mirror of
https://github.com/mihonapp/mihon.git
synced 2025-02-08 16:18:51 +01:00
UI Changes for Analytics and Crashlytics
This commit is contained in:
parent
380787a310
commit
faff22c9e9
@ -34,15 +34,21 @@ import androidx.lifecycle.DefaultLifecycleObserver
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.compose.LocalLifecycleOwner
|
||||
import eu.kanade.presentation.util.rememberRequestPackageInstallsPermissionState
|
||||
import eu.kanade.tachiyomi.core.security.SecurityPreferences
|
||||
import eu.kanade.tachiyomi.util.system.launchRequestPackageInstallsPermission
|
||||
import tachiyomi.i18n.MR
|
||||
import tachiyomi.presentation.core.i18n.stringResource
|
||||
import tachiyomi.presentation.core.util.secondaryItemAlpha
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
internal class PermissionStep : OnboardingStep {
|
||||
|
||||
private val securityPreferences: SecurityPreferences by injectLazy()
|
||||
|
||||
private var notificationGranted by mutableStateOf(false)
|
||||
private var batteryGranted by mutableStateOf(false)
|
||||
private var allowCrashLogs by mutableStateOf(false)
|
||||
private var allowAnalytics by mutableStateOf(false)
|
||||
|
||||
override val isComplete: Boolean = true
|
||||
|
||||
@ -109,6 +115,28 @@ internal class PermissionStep : OnboardingStep {
|
||||
context.startActivity(intent)
|
||||
},
|
||||
)
|
||||
|
||||
PermissionItem(
|
||||
title = "Send crash logs",//i18n later
|
||||
subtitle = "Send anonymised crash logs to the developers",
|
||||
granted = allowCrashLogs,
|
||||
onButtonClick = {
|
||||
// Toggle the granted state
|
||||
allowCrashLogs = !allowCrashLogs
|
||||
securityPreferences.crashlytics().set(allowCrashLogs)
|
||||
}
|
||||
)
|
||||
|
||||
PermissionItem(
|
||||
title = "Allow analytics",//i18n later
|
||||
subtitle = "Send anonymized usage data to improve app features.",
|
||||
granted = allowAnalytics,
|
||||
onButtonClick = {
|
||||
// Toggle the granted state
|
||||
allowAnalytics = !allowAnalytics
|
||||
securityPreferences.analytics().set(allowAnalytics)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,7 +168,6 @@ internal class PermissionStep : OnboardingStep {
|
||||
supportingContent = { Text(text = subtitle) },
|
||||
trailingContent = {
|
||||
OutlinedButton(
|
||||
enabled = !granted,
|
||||
onClick = onButtonClick,
|
||||
) {
|
||||
if (granted) {
|
||||
|
@ -65,6 +65,14 @@ object SettingsSecurityScreen : SearchableSettings {
|
||||
)
|
||||
},
|
||||
),
|
||||
Preference.PreferenceItem.SwitchPreference(
|
||||
pref = securityPreferences.crashlytics(),
|
||||
title = "Allow sharing crash logs with devs",
|
||||
),
|
||||
Preference.PreferenceItem.SwitchPreference(
|
||||
pref = securityPreferences.analytics(),
|
||||
title = "Allow sharing analytics data",
|
||||
),
|
||||
Preference.PreferenceItem.SwitchPreference(
|
||||
pref = securityPreferences.hideNotificationContent(),
|
||||
title = stringResource(MR.strings.hide_notification_content),
|
||||
|
@ -21,11 +21,13 @@ import coil3.network.okhttp.OkHttpNetworkFetcherFactory
|
||||
import coil3.request.allowRgb565
|
||||
import coil3.request.crossfade
|
||||
import coil3.util.DebugLogger
|
||||
//import com.google.firebase.crashlytics.FirebaseCrashlytics
|
||||
import dev.mihon.injekt.patchInjekt
|
||||
import eu.kanade.domain.DomainModule
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.domain.ui.model.setAppCompatDelegateThemeMode
|
||||
import eu.kanade.tachiyomi.core.security.SecurityPreferences
|
||||
import eu.kanade.tachiyomi.crash.CrashActivity
|
||||
import eu.kanade.tachiyomi.crash.GlobalExceptionHandler
|
||||
import eu.kanade.tachiyomi.data.coil.BufferedSourceFetcher
|
||||
@ -67,6 +69,7 @@ import java.security.Security
|
||||
class App : Application(), DefaultLifecycleObserver, SingletonImageLoader.Factory {
|
||||
|
||||
private val basePreferences: BasePreferences by injectLazy()
|
||||
private val securityPreferences: SecurityPreferences by injectLazy()
|
||||
private val networkPreferences: NetworkPreferences by injectLazy()
|
||||
|
||||
private val disableIncognitoReceiver = DisableIncognitoReceiver()
|
||||
@ -75,6 +78,7 @@ class App : Application(), DefaultLifecycleObserver, SingletonImageLoader.Factor
|
||||
override fun onCreate() {
|
||||
super<Application>.onCreate()
|
||||
patchInjekt()
|
||||
//FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(securityPreferences.crashlytics().get())
|
||||
|
||||
GlobalExceptionHandler.initialize(applicationContext, CrashActivity::class.java)
|
||||
|
||||
|
@ -18,6 +18,10 @@ class SecurityPreferences(
|
||||
|
||||
fun hideNotificationContent() = preferenceStore.getBoolean("hide_notification_content", false)
|
||||
|
||||
fun crashlytics() = preferenceStore.getBoolean("crashlytics", false)
|
||||
|
||||
fun analytics() = preferenceStore.getBoolean("analytics", false)
|
||||
|
||||
/**
|
||||
* For app lock. Will be set when there is a pending timed lock.
|
||||
* Otherwise this pref should be deleted.
|
||||
|
Loading…
x
Reference in New Issue
Block a user