Browse Source

Data collection hotfix

pull/61/merge
Ezerous 6 years ago
parent
commit
910d8a9ff8
No known key found for this signature in database GPG Key ID: 262B2954BBA319E3
  1. 10
      app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java

10
app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java

@ -750,10 +750,12 @@ public abstract class BaseActivity extends AppCompatActivity {
FirebaseMessaging.getInstance().setAutoInitEnabled(true); FirebaseMessaging.getInstance().setAutoInitEnabled(true);
BaseApplication.getInstance().startFirebaseCrashlyticsCollection(); BaseApplication.getInstance().startFirebaseCrashlyticsCollection();
BaseApplication.getInstance().setFirebaseAnalyticsCollection(true); BaseApplication.getInstance().setFirebaseAnalyticsCollection(true);
setUserDataShareEnabled(true);
}); });
builder.setNegativeButton("Nope, leave me alone", (dialogInterface, i) -> { builder.setNegativeButton("Nope, leave me alone", (dialogInterface, i) -> {
addUserConsent(); addUserConsent();
FirebaseMessaging.getInstance().setAutoInitEnabled(true); FirebaseMessaging.getInstance().setAutoInitEnabled(true);
setUserDataShareEnabled(false);
}); });
builder.setNeutralButton("Privacy Policy", (dialog, which) -> {/*Will be overridden below*/}); builder.setNeutralButton("Privacy Policy", (dialog, which) -> {/*Will be overridden below*/});
builder.setCancelable(false); builder.setCancelable(false);
@ -799,11 +801,17 @@ public abstract class BaseActivity extends AppCompatActivity {
} }
} }
private void addUserConsent (){ private void addUserConsent(){
SharedPreferences.Editor editor = sharedPreferences.edit(); SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean(getString(R.string.user_consent_shared_preference_key), true).apply(); editor.putBoolean(getString(R.string.user_consent_shared_preference_key), true).apply();
} }
private void setUserDataShareEnabled(boolean enabled){
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean(getString(R.string.pref_privacy_crashlytics_enable_key), enabled).apply();
editor.putBoolean(getString(R.string.pref_privacy_analytics_enable_key), enabled).apply();
}
//----------------------------------MISC---------------------- //----------------------------------MISC----------------------
protected void setMainActivity(MainActivity mainActivity) { protected void setMainActivity(MainActivity mainActivity) {
this.mainActivity = mainActivity; this.mainActivity = mainActivity;

Loading…
Cancel
Save