diff --git a/app/src/main/java/com/hippo/ehviewer/Analytics.java b/app/src/main/java/com/hippo/ehviewer/Analytics.java index e9bb5b131..ed881a47b 100644 --- a/app/src/main/java/com/hippo/ehviewer/Analytics.java +++ b/app/src/main/java/com/hippo/ehviewer/Analytics.java @@ -31,6 +31,7 @@ public final class Analytics { public static void start(Application application) { AppCenter.start(application, "1aa06805-037c-4f3c-8aaa-e23d1433986d", com.microsoft.appcenter.analytics.Analytics.class, Crashes.class, Distribute.class); AppCenter.setUserId(Settings.getUserID()); + com.microsoft.appcenter.analytics.Analytics.setEnabled(Settings.getEnableAnalytics()); Crashes.setEnabled(!BuildConfig.DEBUG); Distribute.setEnabledForDebuggableBuild(false); } @@ -39,6 +40,10 @@ public final class Analytics { return AppCenter.isConfigured() && Settings.getEnableAnalytics(); } + public static void setEnabled(boolean enabled) { + com.microsoft.appcenter.analytics.Analytics.setEnabled(enabled); + } + public static void onSceneView(SceneFragment scene) { if (isEnabled()) { Map properties = new HashMap<>(); diff --git a/app/src/main/java/com/hippo/ehviewer/EhApplication.java b/app/src/main/java/com/hippo/ehviewer/EhApplication.java index 63be24155..fd174adb4 100644 --- a/app/src/main/java/com/hippo/ehviewer/EhApplication.java +++ b/app/src/main/java/com/hippo/ehviewer/EhApplication.java @@ -334,9 +334,7 @@ public class EhApplication extends RecordingApplication { EhDB.mergeOldDB(this); } - if (Settings.getEnableAnalytics()) { - Analytics.start(this); - } + Analytics.start(this); AppCompatDelegate.setDefaultNightMode(Settings.getTheme()); diff --git a/app/src/main/java/com/hippo/ehviewer/ui/scene/AnalyticsScene.java b/app/src/main/java/com/hippo/ehviewer/ui/scene/AnalyticsScene.java index 363c6ad53..eb427af38 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/scene/AnalyticsScene.java +++ b/app/src/main/java/com/hippo/ehviewer/ui/scene/AnalyticsScene.java @@ -85,9 +85,8 @@ public class AnalyticsScene extends SolidScene implements View.OnClickListener { Settings.putEnableAnalytics(false); } else if (mAccept == v) { Settings.putEnableAnalytics(true); - // Start Analytics - Analytics.start(activity.getApplication()); } + Analytics.setEnabled(Settings.getEnableAnalytics()); Settings.putAskAnalytics(false); // Start new scene and finish it self diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index dc0d606d2..7f735c776 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -148,7 +148,7 @@ Tap to retry EhViewer will request WRITE_EXTERNAL_STORAGE permission for downloading gallery. Do you want to grant the permission? It hurts - Would you mind if the developer collected your device information and your usage? It will help the developer a lot and it will also enable the in app updates for you.<br><br>Data analysis service is provided by Microsoft AppCenter. Its privacy policy can be found at <a href="https://privacy.microsoft.com/zh-cn/privacystatement">https://privacy.microsoft.com/zh-cn/privacystatement</a>.<br><br>If you agree to join data analysis, your device information and your usage will be collected, including but not limited to Android API version, equipment model, language residence, the application version, conversion time, function times. The developer promise that these information will NOT be collected, including phone number, e-mail address, IMEI.<br><br>Your information will not be collected until you agree to join data analysis.<br><br>The collected information will be analyzed by Microsoft AppCenter. The analysis report can only be viewed by the developer of this application. + Would you mind if the developer collected your device information and your usage? It will help the developer a lot.<br><br>Data analysis service is provided by Microsoft AppCenter. Its privacy policy can be found at <a href="https://privacy.microsoft.com/zh-cn/privacystatement">https://privacy.microsoft.com/zh-cn/privacystatement</a>.<br><br>If you agree to join data analysis, your device information and your usage will be collected, including but not limited to Android API version, equipment model, language residence, the application version, conversion time, function times. The developer promise that these information will NOT be collected, including phone number, e-mail address, IMEI.<br><br>Your information will not be collected until you agree to join data analysis.<br><br>The collected information will be analyzed by Microsoft AppCenter. The analysis report can only be viewed by the developer of this application. Got it Accept Reject