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;
}
}
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();
}
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;
}
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;
}
Aggregations