aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-06-29 23:43:36 -0700
committerAllan Wang <me@allanwang.ca>2017-06-29 23:43:36 -0700
commita42519030892ede729fc37ce6cbc93bb1d80989c (patch)
treef2898b8825ea346bdf0fb8605b355237ce3da669
parent213a6b8a9213240801a84cfcfb9925d4709cdbe4 (diff)
downloadfrost-a42519030892ede729fc37ce6cbc93bb1d80989c.tar.gz
frost-a42519030892ede729fc37ce6cbc93bb1d80989c.tar.bz2
frost-a42519030892ede729fc37ce6cbc93bb1d80989c.zip
Add log throws
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/LoginActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt1
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/facebook/UsernameFetcher.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt31
-rw-r--r--gradle.properties6
6 files changed, 22 insertions, 22 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/LoginActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/LoginActivity.kt
index fdb918cc..cd6c2255 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/LoginActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/LoginActivity.kt
@@ -86,7 +86,7 @@ class LoginActivity : BaseActivity() {
.observeOn(AndroidSchedulers.mainThread()).subscribe {
(foundImage, name) ->
refresh = false
- if (!foundImage) L.e("Could not get profile photo; Invalid userId?\n\t$cookie")
+ if (!foundImage) L.eThrow("Could not get profile photo; Invalid userId?\n\t$cookie")
textview.text = String.format(getString(R.string.welcome), name)
textview.fadeIn()
frostAnswers {
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
index 02191730..d8230159 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
@@ -346,7 +346,6 @@ class MainActivity : BaseActivity(), FrostWebViewSearch.SearchContract {
searchOverlayDispose()
menu.findItem(R.id.action_search).setOnMenuItemClickListener { _ -> launchWebOverlay(FbTab.SEARCH.url); true }
}
- KL.e("SearchView ${searchView == null} HID ${hiddenSearchView == null}")
return true
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/UsernameFetcher.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/UsernameFetcher.kt
index 5bc58fa9..cbb6222a 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/UsernameFetcher.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/UsernameFetcher.kt
@@ -21,7 +21,7 @@ object UsernameFetcher {
.get().title()
L.d("User name found: $name")
} catch (e: Exception) {
- L.e("User name fetching failed: ${e.message}")
+ L.e(e, "User name fetching failed")
} finally {
data.name = name
saveFbCookie(data)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
index 986f9565..eb346140 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
@@ -133,7 +133,7 @@ fun Context.scheduleNotifications(minutes: Long): Boolean {
.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY) //TODO add options
val result = scheduler.schedule(builder.build())
if (result <= 0) {
- L.e("Notification scheduler failed")
+ L.eThrow("Notification scheduler failed")
return false
}
return true
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt
index 11fa1c4b..5d0cdfa2 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt
@@ -8,7 +8,6 @@ import com.crashlytics.android.answers.PurchaseEvent
import com.pitchedapps.frost.BuildConfig
import com.pitchedapps.frost.R
import com.pitchedapps.frost.utils.*
-import org.jetbrains.anko.doAsync
/**
* Created by Allan Wang on 2017-06-23.
@@ -19,17 +18,15 @@ object IAB {
fun setupAsync(context: Context) {
if (!context.isFromGooglePlay) return
- doAsync {
- if (helper == null) {
- try {
- helper = IabHelper(context.applicationContext, PUBLIC_BILLING_KEY)
- helper!!.startSetup {
- result ->
- if (!result.isSuccess) L.e("IAB Setup error: $result")
- }
- } catch (e: Exception) {
- L.e("IAB error: ${e.message}")
+ if (helper == null) {
+ try {
+ helper = IabHelper(context.applicationContext, PUBLIC_BILLING_KEY)
+ helper!!.startSetup {
+ result ->
+ if (!result.isSuccess) L.eThrow("IAB Setup error: $result")
}
+ } catch (e: Exception) {
+ L.e(e, "IAB error")
}
}
}
@@ -59,10 +56,13 @@ fun Activity.openPlayPurchase(key: String, code: Int) {
frostAnswersCustom("PLAY_PURCHASE") {
putCustomAttribute("Key", key)
}
- IAB.helper?.flagEndAsync()
+ IAB.helper?.flagEndAsync() ?: playStoreErrorDialog()
IAB.helper?.queryInventoryAsync {
- _, inv ->
- if (inv == null) {
+ res, inv ->
+ if (res.isFailure) {
+ L.e("IAB error: ${res.message}")
+ playStoreErrorDialog()
+ } else if (inv == null) {
playStoreErrorDialog()
} else {
val donation = inv.getSkuDetails(key)
@@ -79,7 +79,7 @@ fun Activity.openPlayPurchase(key: String, code: Int) {
.putItemId(key)
.putSuccess(result.isSuccess))
}
- }
+ } ?: playStoreErrorDialog()
}
}
}
@@ -91,4 +91,5 @@ private fun Context.playStoreErrorDialog() {
content(R.string.play_store_billing_error)
positiveText(R.string.kau_ok)
}
+ L.eThrow("Play Store Error")
} \ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
index 7c057657..868f1e95 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -16,10 +16,10 @@ APP_GROUP=com.pitchedapps
MIN_SDK=21
TARGET_SDK=26
BUILD_TOOLS=26.0.0
-VERSION_CODE=5
-VERSION_NAME=0.5
+VERSION_CODE=6
+VERSION_NAME=0.6
-KAU=fc7e19ef72
+KAU=e1e3b37000
KOTLIN=1.1.3
MATERIAL_DRAWER=5.9.3
MATERIAL_DRAWER_KT=1.0.4