mirror of
https://github.com/AllanWang/Frost-for-Facebook.git
synced 2024-09-20 23:51:40 +02:00
Disable verbose logging on restart
This commit is contained in:
parent
cf2a648e61
commit
fb4f71ef83
@ -13,7 +13,6 @@ import com.mikepenz.materialdrawer.util.DrawerImageLoader
|
||||
import com.pitchedapps.frost.facebook.FbCookie
|
||||
import com.pitchedapps.frost.utils.CrashReportingTree
|
||||
import com.pitchedapps.frost.utils.Prefs
|
||||
import com.pitchedapps.frost.utils.iab.IAB
|
||||
import com.raizlabs.android.dbflow.config.FlowConfig
|
||||
import com.raizlabs.android.dbflow.config.FlowManager
|
||||
import io.fabric.sdk.android.Fabric
|
||||
@ -46,6 +45,7 @@ class FrostApp : Application() {
|
||||
Crashlytics.setUserIdentifier(Prefs.frostId)
|
||||
Timber.plant(CrashReportingTree())
|
||||
}
|
||||
Prefs.verboseLogging = false
|
||||
FbCookie()
|
||||
if (Prefs.installDate == -1L) Prefs.installDate = System.currentTimeMillis()
|
||||
if (Prefs.identifier == -1) Prefs.identifier = Random().nextInt(Int.MAX_VALUE)
|
||||
|
@ -15,13 +15,17 @@ import com.mikepenz.google_material_typeface_library.GoogleMaterial
|
||||
import com.pitchedapps.frost.settings.*
|
||||
import com.pitchedapps.frost.utils.*
|
||||
import com.pitchedapps.frost.utils.iab.IS_FROST_PRO
|
||||
import com.pitchedapps.frost.utils.iab.IabBroadcastReceiver
|
||||
import com.pitchedapps.frost.utils.iab.openPlayProPurchase
|
||||
|
||||
|
||||
/**
|
||||
* Created by Allan Wang on 2017-06-06.
|
||||
*/
|
||||
class SettingsActivity : KPrefActivity() {
|
||||
class SettingsActivity : KPrefActivity(), IabBroadcastReceiver.IabBroadcastListener {
|
||||
override fun receivedBroadcast() {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
override fun kPrefCoreAttributes(): CoreAttributeContract.() -> Unit = {
|
||||
textColor = { Prefs.textColor }
|
||||
|
@ -22,6 +22,7 @@ object IAB {
|
||||
if (!activity.isFromGooglePlay && !BuildConfig.DEBUG) return L.d("IAB not from google play")
|
||||
try {
|
||||
helper = IabHelper(activity.applicationContext, PUBLIC_BILLING_KEY)
|
||||
helper!!.enableDebugLogging(BuildConfig.DEBUG, "Frost:")
|
||||
helper!!.startSetup {
|
||||
result ->
|
||||
L.d("IAB result ${result.message}")
|
||||
@ -63,24 +64,28 @@ fun Activity.openPlayPurchase(key: String, code: Int) {
|
||||
L.d("IAB flag end async")
|
||||
IAB.helper?.flagEndAsync() ?: return playStoreGenericError("Null flag end async")
|
||||
L.d("IAB query inv async")
|
||||
IAB.helper!!.queryInventoryAsync {
|
||||
res, inv ->
|
||||
if (res.isFailure) return@queryInventoryAsync playStoreGenericError("Query res error")
|
||||
if (inv == null) return@queryInventoryAsync playStoreGenericError("Empty inventory")
|
||||
L.d("IAB: inventory ${inv.allOwnedSkus}")
|
||||
val donation = inv.getSkuDetails(key) ?: return@queryInventoryAsync playStoreGenericError("Donation null")
|
||||
IAB.helper!!.launchPurchaseFlow(this@openPlayPurchase, donation.sku, code) {
|
||||
result, _ ->
|
||||
if (result.isSuccess) materialDialogThemed {
|
||||
title(R.string.play_thank_you)
|
||||
content(R.string.play_purchased_pro)
|
||||
positiveText(R.string.kau_ok)
|
||||
} else playStoreGenericError("Result: ${result.message}")
|
||||
frostAnswers {
|
||||
logPurchase(PurchaseEvent()
|
||||
.putItemId(key)
|
||||
.putSuccess(result.isSuccess))
|
||||
try {
|
||||
IAB.helper!!.queryInventoryAsync {
|
||||
res, inv ->
|
||||
if (res.isFailure) return@queryInventoryAsync playStoreGenericError("Query res error")
|
||||
if (inv == null) return@queryInventoryAsync playStoreGenericError("Empty inventory")
|
||||
L.d("IAB: inventory ${inv.allOwnedSkus}")
|
||||
val donation = inv.getSkuDetails(key) ?: return@queryInventoryAsync playStoreGenericError("Donation null")
|
||||
IAB.helper!!.launchPurchaseFlow(this@openPlayPurchase, donation.sku, code) {
|
||||
result, _ ->
|
||||
if (result.isSuccess) materialDialogThemed {
|
||||
title(R.string.play_thank_you)
|
||||
content(R.string.play_purchased_pro)
|
||||
positiveText(R.string.kau_ok)
|
||||
} else playStoreGenericError("Result: ${result.message}")
|
||||
frostAnswers {
|
||||
logPurchase(PurchaseEvent()
|
||||
.putItemId(key)
|
||||
.putSuccess(result.isSuccess))
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch(e: IabHelper.IabAsyncInProgressException) {
|
||||
L.e(e, "IAB query dup")
|
||||
}
|
||||
}
|
@ -53,7 +53,7 @@
|
||||
<string name="search">Search Type</string>
|
||||
<string name="search_desc">Enable the search bar instead of a search overlay</string>
|
||||
<string name="verbose_logging">Verbose Logging</string>
|
||||
<string name="verbose_logging_desc">Enable verbose logging to help with crash reports. Logging will only be sent once an error is encountered, so repeat the issue to notify the dev.</string>
|
||||
<string name="verbose_logging_desc">Enable verbose logging to help with crash reports. Logging will only be sent once an error is encountered, so repeat the issue to notify the dev. This will automatically be disabled if the app restarts.</string>
|
||||
<string name="restart_frost">Restart Frost</string>
|
||||
<string name="restart_frost_desc">Crashlytics will only submit logs when a crash occurs or if errors are found and the app is restarted. Clicking here will restart the app and flush whatever issues are currently found.</string>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user