-
Notifications
You must be signed in to change notification settings - Fork 534
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to opt out of Analytics and Crashlytics (#1237)
- Loading branch information
1 parent
c8bb78d
commit 7c7af72
Showing
9 changed files
with
200 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package mihon.core.firebase | ||
|
||
import android.content.Context | ||
import eu.kanade.tachiyomi.core.security.PrivacyPreferences | ||
import kotlinx.coroutines.CoroutineScope | ||
|
||
object Firebase { | ||
fun setup(context: Context, preference: PrivacyPreferences, scope: CoroutineScope) = Unit | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package mihon.core.firebase | ||
|
||
import android.content.Context | ||
import com.google.firebase.analytics.FirebaseAnalytics | ||
import com.google.firebase.crashlytics.FirebaseCrashlytics | ||
import eu.kanade.tachiyomi.core.security.PrivacyPreferences | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.flow.launchIn | ||
import kotlinx.coroutines.flow.onEach | ||
|
||
object Firebase { | ||
fun setup(context: Context, preference: PrivacyPreferences, scope: CoroutineScope) { | ||
preference.analytics().changes().onEach { enabled -> | ||
FirebaseAnalytics.getInstance(context).setAnalyticsCollectionEnabled(enabled) | ||
}.launchIn(scope) | ||
preference.crashlytics().changes().onEach { enabled -> | ||
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(enabled) | ||
}.launchIn(scope) | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
core/common/src/main/kotlin/eu/kanade/tachiyomi/core/security/PrivacyPreferences.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package eu.kanade.tachiyomi.core.security | ||
|
||
import tachiyomi.core.common.preference.PreferenceStore | ||
|
||
class PrivacyPreferences( | ||
private val preferenceStore: PreferenceStore, | ||
) { | ||
fun crashlytics() = preferenceStore.getBoolean("crashlytics", true) | ||
|
||
fun analytics() = preferenceStore.getBoolean("analytics", true) | ||
} |
Oops, something went wrong.