Search in sources :

Example 1 with Event

use of com.waz.zclient.core.controllers.tracking.events.Event in project wire-android by wireapp.

the class MainActivity method onNewIntent.

@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    if (IntentUtils.isPasswordResetIntent(intent)) {
        onPasswordWasReset();
    }
    injectJava(GlobalTrackingController.class).appLaunched(intent);
    String appCrash = getControllerFactory().getUserPreferencesController().getCrashException();
    String appCrashDetails = getControllerFactory().getUserPreferencesController().getCrashDetails();
    if (appCrash != null) {
        Event exceptionEvent = ExceptionEvent.exception(appCrash, appCrashDetails);
        injectJava(GlobalTrackingController.class).tagEvent(exceptionEvent);
    }
    setIntent(intent);
    String page = intent.getStringExtra(LaunchActivity.APP_PAGE);
    if (page == null || TextUtils.isEmpty(page)) {
        return;
    }
    setIntent(IntentUtils.resetAppPage(intent));
    switch(page) {
        case IntentUtils.LOCALYTICS_DEEPLINK_SEARCH:
        case IntentUtils.LOCALYTICS_DEEPLINK_PROFILE:
            restartAppWithPage(page);
            break;
        case IntentUtils.LOCALYTICS_DEEPLINK_SETTINGS:
            startActivity(ZetaPreferencesActivity.getDefaultIntent(this));
            break;
    }
}
Also used : GlobalTrackingController(com.waz.zclient.tracking.GlobalTrackingController) LoggedOutEvent(com.waz.zclient.core.controllers.tracking.events.session.LoggedOutEvent) Event(com.waz.zclient.core.controllers.tracking.events.Event) AcceptedGenericInviteEvent(com.waz.zclient.controllers.tracking.events.connect.AcceptedGenericInviteEvent) VerifiedConversationEvent(com.waz.zclient.controllers.tracking.events.otr.VerifiedConversationEvent) OpenedMediaActionEvent(com.waz.zclient.core.controllers.tracking.events.media.OpenedMediaActionEvent) ExceptionEvent(com.waz.zclient.controllers.tracking.events.exception.ExceptionEvent)

Example 2 with Event

use of com.waz.zclient.core.controllers.tracking.events.Event in project wire-android by wireapp.

the class MainActivity method onCreate.

@Override
@SuppressWarnings("PMD")
public void onCreate(final Bundle savedInstanceState) {
    Timber.i("onCreate");
    if (getActionBar() != null) {
        getActionBar().hide();
    }
    super.onCreate(savedInstanceState);
    injectJava(UiTrackingController.class);
    //Prevent drawing the default background to reduce overdraw
    getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    setContentView(R.layout.main);
    if (LayoutSpec.isPhone(this)) {
        ViewUtils.lockScreenOrientation(Configuration.ORIENTATION_PORTRAIT, this);
    }
    FragmentManager fragmentManager = getSupportFragmentManager();
    initializeControllers();
    if (savedInstanceState == null) {
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.add(R.id.fl__offline__container, ConnectivityFragment.newInstance(), ConnectivityFragment.TAG);
        if (BuildConfig.SHOW_GRIDOVERLAY) {
            fragmentTransaction.add(R.id.fl_main_grid, GridFragment.newInstance(), GridFragment.TAG);
        }
        fragmentTransaction.commit();
    } else {
        getControllerFactory().getNavigationController().onActivityCreated(savedInstanceState);
    }
    if (BuildConfigUtils.isHockeyUpdateEnabled() && !BuildConfigUtils.isLocalBuild(this)) {
        HockeyCrashReporting.checkForUpdates(this);
    }
    injectJava(GlobalTrackingController.class).appLaunched(getIntent());
    String appCrash = getControllerFactory().getUserPreferencesController().getCrashException();
    String appCrashDetails = getControllerFactory().getUserPreferencesController().getCrashDetails();
    if (appCrash != null) {
        Event exceptionEvent = ExceptionEvent.exception(appCrash, appCrashDetails);
        injectJava(GlobalTrackingController.class).tagEvent(exceptionEvent);
    }
    getControllerFactory().getLoadTimeLoggerController().appStart();
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) FragmentTransaction(android.support.v4.app.FragmentTransaction) GlobalTrackingController(com.waz.zclient.tracking.GlobalTrackingController) ColorDrawable(android.graphics.drawable.ColorDrawable) LoggedOutEvent(com.waz.zclient.core.controllers.tracking.events.session.LoggedOutEvent) Event(com.waz.zclient.core.controllers.tracking.events.Event) AcceptedGenericInviteEvent(com.waz.zclient.controllers.tracking.events.connect.AcceptedGenericInviteEvent) VerifiedConversationEvent(com.waz.zclient.controllers.tracking.events.otr.VerifiedConversationEvent) OpenedMediaActionEvent(com.waz.zclient.core.controllers.tracking.events.media.OpenedMediaActionEvent) ExceptionEvent(com.waz.zclient.controllers.tracking.events.exception.ExceptionEvent)

Example 3 with Event

use of com.waz.zclient.core.controllers.tracking.events.Event 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)

Example 4 with Event

use of com.waz.zclient.core.controllers.tracking.events.Event in project wire-android by wireapp.

the class OptionsPreferences method handlePreferenceChanged.

@Override
public Event handlePreferenceChanged(SharedPreferences sharedPreferences, String key) {
    Event event = null;
    if (key.equals(getString(R.string.pref_options_sounds_key))) {
        String stringValue = sharedPreferences.getString(key, "");
        TrackingUtils.tagChangedSoundNotificationLevelEvent(((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class), stringValue, getContext());
    } else if (key.equals(ringtonePreference.getKey()) || key.equals(textTonePreference.getKey()) || key.equals(pingPreference.getKey())) {
        SoundController ctrl = inject(SoundController.class);
        if (ctrl != null) {
            ctrl.setCustomSoundUrisFromPreferences(sharedPreferences);
        }
    } else 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_options_contacts_key))) {
        boolean shareContacts = sharedPreferences.getBoolean(key, false);
        event = new ChangedContactsPermissionEvent(shareContacts, true);
        boolean hasContactsReadPermission = PermissionUtils.hasSelfPermissions(getContext(), Manifest.permission.READ_CONTACTS);
        if (shareContacts && !hasContactsReadPermission) {
            ActivityCompat.requestPermissions(getActivity(), new String[] { Manifest.permission.READ_CONTACTS }, PermissionUtils.REQUEST_READ_CONTACTS);
        }
    } else if (key.equals(getString(R.string.pref_options_theme_switch_key))) {
        getControllerFactory().getThemeController().toggleThemePending(true);
        event = new ChangedThemeEvent(getControllerFactory().getThemeController().isDarkTheme());
    } else if (key.equals(getString(R.string.pref_options_cursor_send_button_key))) {
        boolean sendButtonIsOn = sharedPreferences.getBoolean(key, false);
        event = new ChangedSendButtonSettingEvent(sendButtonIsOn);
    }
    return event;
}
Also used : SoundController(com.waz.zclient.media.SoundController) ChangedContactsPermissionEvent(com.waz.zclient.core.controllers.tracking.events.settings.ChangedContactsPermissionEvent) GlobalTrackingController(com.waz.zclient.tracking.GlobalTrackingController) ChangedSendButtonSettingEvent(com.waz.zclient.core.controllers.tracking.events.settings.ChangedSendButtonSettingEvent) ChangedImageDownloadPreferenceEvent(com.waz.zclient.core.controllers.tracking.events.settings.ChangedImageDownloadPreferenceEvent) ChangedThemeEvent(com.waz.zclient.core.controllers.tracking.events.settings.ChangedThemeEvent) Event(com.waz.zclient.core.controllers.tracking.events.Event) ChangedSendButtonSettingEvent(com.waz.zclient.core.controllers.tracking.events.settings.ChangedSendButtonSettingEvent) ChangedImageDownloadPreferenceEvent(com.waz.zclient.core.controllers.tracking.events.settings.ChangedImageDownloadPreferenceEvent) ChangedContactsPermissionEvent(com.waz.zclient.core.controllers.tracking.events.settings.ChangedContactsPermissionEvent) ChangedThemeEvent(com.waz.zclient.core.controllers.tracking.events.settings.ChangedThemeEvent)

Aggregations

Event (com.waz.zclient.core.controllers.tracking.events.Event)4 GlobalTrackingController (com.waz.zclient.tracking.GlobalTrackingController)4 AcceptedGenericInviteEvent (com.waz.zclient.controllers.tracking.events.connect.AcceptedGenericInviteEvent)2 ExceptionEvent (com.waz.zclient.controllers.tracking.events.exception.ExceptionEvent)2 VerifiedConversationEvent (com.waz.zclient.controllers.tracking.events.otr.VerifiedConversationEvent)2 OpenedMediaActionEvent (com.waz.zclient.core.controllers.tracking.events.media.OpenedMediaActionEvent)2 LoggedOutEvent (com.waz.zclient.core.controllers.tracking.events.session.LoggedOutEvent)2 ChangedImageDownloadPreferenceEvent (com.waz.zclient.core.controllers.tracking.events.settings.ChangedImageDownloadPreferenceEvent)2 ColorDrawable (android.graphics.drawable.ColorDrawable)1 FragmentManager (android.support.v4.app.FragmentManager)1 FragmentTransaction (android.support.v4.app.FragmentTransaction)1 OptIn (com.waz.zclient.controllers.tracking.events.tracking.OptIn)1 OptOut (com.waz.zclient.controllers.tracking.events.tracking.OptOut)1 ChangedContactsPermissionEvent (com.waz.zclient.core.controllers.tracking.events.settings.ChangedContactsPermissionEvent)1 ChangedSendButtonSettingEvent (com.waz.zclient.core.controllers.tracking.events.settings.ChangedSendButtonSettingEvent)1 ChangedThemeEvent (com.waz.zclient.core.controllers.tracking.events.settings.ChangedThemeEvent)1 SoundController (com.waz.zclient.media.SoundController)1