use of com.waz.zclient.controllers.tracking.events.tracking.OptOut in project wire-android by wireapp.
the class AdvancedPreferences method handlePreferenceChanged.
@Override
public Event handlePreferenceChanged(SharedPreferences sharedPreferences, String key) {
Event event = null;
if (key.equals(getString(R.string.pref_options_image_download_key))) {
String stringValue = sharedPreferences.getString(key, "");
boolean wifiOnly = stringValue.equals(getContext().getString(R.string.zms_image_download_value_wifi));
event = new ChangedImageDownloadPreferenceEvent(wifiOnly);
} else if (key.equals(getString(R.string.pref_advanced_analytics_enabled_key))) {
boolean enableTracking = sharedPreferences.getBoolean(key, false);
if (enableTracking) {
event = new OptIn();
Localytics.setOptedOut(false);
} else {
try {
(((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class)).tagEvent(new OptOut());
} catch (Exception e) {
Timber.e("Unable to tag event OptOut");
e.printStackTrace();
}
Localytics.setOptedOut(true);
}
}
return event;
}
Aggregations