Search in sources :

Example 1 with OptIn

use of com.waz.zclient.controllers.tracking.events.tracking.OptIn 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;
}
Also used : GlobalTrackingController(com.waz.zclient.tracking.GlobalTrackingController) OptOut(com.waz.zclient.controllers.tracking.events.tracking.OptOut) OptIn(com.waz.zclient.controllers.tracking.events.tracking.OptIn) ChangedImageDownloadPreferenceEvent(com.waz.zclient.core.controllers.tracking.events.settings.ChangedImageDownloadPreferenceEvent) Event(com.waz.zclient.core.controllers.tracking.events.Event) ChangedImageDownloadPreferenceEvent(com.waz.zclient.core.controllers.tracking.events.settings.ChangedImageDownloadPreferenceEvent)

Aggregations

OptIn (com.waz.zclient.controllers.tracking.events.tracking.OptIn)1 OptOut (com.waz.zclient.controllers.tracking.events.tracking.OptOut)1 Event (com.waz.zclient.core.controllers.tracking.events.Event)1 ChangedImageDownloadPreferenceEvent (com.waz.zclient.core.controllers.tracking.events.settings.ChangedImageDownloadPreferenceEvent)1 GlobalTrackingController (com.waz.zclient.tracking.GlobalTrackingController)1