Commit 5dad3f4a authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Centralized logic

parent 28b02241
......@@ -12,6 +12,7 @@ import com.frostnerd.smokescreen.activity.PinActivity
import com.frostnerd.smokescreen.database.AppDatabase
import com.frostnerd.smokescreen.util.crashhelpers.DatasavingSentryEventHelper
import com.frostnerd.smokescreen.util.Notifications
import com.frostnerd.smokescreen.util.preferences.AppSettings
import com.frostnerd.smokescreen.util.preferences.Crashreporting
import io.sentry.Sentry
import io.sentry.android.AndroidSentryClientFactory
......@@ -166,11 +167,7 @@ class SmokeScreen : Application() {
e.printStackTrace()
log(e, extras)
extras.clear()
val isPrerelease =
BuildConfig.VERSION_NAME.contains(
"alpha",
true
) || BuildConfig.VERSION_NAME.contains("beta", true)
val isPrerelease = !AppSettings.isReleaseVersion
if (isPrerelease && getPreferences().loggingEnabled && getPreferences().crashreportingType == Crashreporting.OFF) {
startActivity(
Intent(
......
......@@ -8,6 +8,7 @@ import android.view.ViewGroup
import android.widget.BaseExpandableListAdapter
import com.frostnerd.lifecyclemanagement.BaseDialog
import com.frostnerd.smokescreen.*
import com.frostnerd.smokescreen.util.preferences.AppSettings
import com.frostnerd.smokescreen.util.preferences.Crashreporting
import io.sentry.Sentry
import kotlinx.android.synthetic.main.dialog_crashreportingusages.view.*
......@@ -32,9 +33,7 @@ import kotlinx.android.synthetic.main.dialog_crashreportingusages_listgroup.view
* You can contact the developer at daniel.wolf@frostnerd.com.
*/
class CrashReportingEnableDialog(
context: Context, showTesterText: Boolean = BuildConfig.VERSION_NAME.let {
it.contains("alpha", true) || it.contains("beta", true)
},
context: Context, showTesterText: Boolean = !AppSettings.isReleaseVersion,
onConsentGiven: (() -> Unit)? = null
) : BaseDialog(context, context.getPreferences().theme.dialogStyle) {
......
......@@ -147,9 +147,7 @@ interface AppSettings {
}
fun shouldShowCrashReportingConsentDialog(): Boolean {
return BuildConfig.VERSION_NAME.let {
it.contains("alpha", true) || it.contains("beta", true)
} && !crashReportingConsent && !crashReportingConsentAsked && !BuildConfig.DEBUG
return !isReleaseVersion && !crashReportingConsent && !crashReportingConsentAsked && !BuildConfig.DEBUG
}
}
......@@ -196,7 +194,7 @@ class AppSettingsSharedPreferences(context: Context) : AppSettings, SimpleTypedP
override var nxDomainCacheTime: Int by stringBasedIntPref("dnscache_nxdomain_cachetime", 1800)
override var loggingEnabled: Boolean by booleanPref(
"logging_enabled",
BuildConfig.VERSION_NAME.contains("alpha", true) || BuildConfig.VERSION_NAME.contains("beta", true)
!AppSettings.isReleaseVersion
)
fun shouldLogDnsQueriesToConsole():Boolean = loggingEnabled && (!AppSettings.isReleaseVersion || advancedLogging)
var advancedLogging:Boolean by booleanPref(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment