Match iOS analytics

This commit is contained in:
Niels Andriesse 2019-10-07 10:52:59 +11:00
parent 4f58bc11a1
commit 33798c6a17
8 changed files with 50 additions and 2 deletions

View File

@ -53,6 +53,7 @@ import org.thoughtcrime.securesms.util.DynamicLanguage;
import org.thoughtcrime.securesms.util.DynamicTheme;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.whispersystems.signalservice.loki.crypto.MnemonicCodec;
import org.whispersystems.signalservice.loki.utilities.Analytics;
import org.whispersystems.signalservice.loki.utilities.SerializationKt;
import java.io.File;
@ -102,6 +103,7 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
if (getIntent() != null && getIntent().getCategories() != null && getIntent().getCategories().contains("android.intent.category.NOTIFICATION_PREFERENCES")) {
initFragment(android.R.id.content, new NotificationsPreferenceFragment());
} else if (icicle == null) {
Analytics.Companion.getShared().track("Settings Opened");
initFragment(android.R.id.content, new ApplicationPreferenceFragment());
}
}
@ -317,6 +319,7 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
break;
*/
case PREFERENCE_CATEGORY_PUBLIC_KEY:
Analytics.Companion.getShared().track("Public Key Shared");
String hexEncodedPublicKey = TextSecurePreferences.getLocalNumber(getContext());
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
@ -331,6 +334,7 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
DeviceLinkingDialog.INSTANCE.show(getContext(), DeviceLinkingView.Mode.Master);
break;
case PREFERENCE_CATEGORY_SEED:
Analytics.Companion.getShared().track("Seed Modal Shown");
File languageFileDirectory = new File(getContext().getApplicationInfo().dataDir);
try {
String hexEncodedSeed = IdentityKeyUtil.retrieve(getContext(), IdentityKeyUtil.lokiSeedKey);

View File

@ -62,6 +62,7 @@ import org.whispersystems.signalservice.api.SignalServiceAccountManager;
import org.whispersystems.signalservice.api.crypto.ProfileCipher;
import org.whispersystems.signalservice.api.util.StreamDetails;
import org.whispersystems.signalservice.loki.api.LokiGroupChatAPI;
import org.whispersystems.signalservice.loki.utilities.Analytics;
import java.io.ByteArrayInputStream;
import java.io.File;
@ -115,6 +116,8 @@ public class CreateProfileActivity extends BaseActionBarActivity implements Inje
initializeProfileAvatar(getIntent().getBooleanExtra(EXCLUDE_SYSTEM, false));
ApplicationContext.getInstance(this).injectDependencies(this);
Analytics.Companion.getShared().track("Display Name Screen Viewed");
}
@Override
@ -371,6 +374,8 @@ public class CreateProfileActivity extends BaseActionBarActivity implements Inje
Context context = CreateProfileActivity.this;
byte[] profileKey = ProfileKeyUtil.getProfileKey(CreateProfileActivity.this);
Analytics.Companion.getShared().track("Display Name Updated");
TextSecurePreferences.setProfileName(context, name);
String userHexEncodedPublicKey = TextSecurePreferences.getLocalNumber(context);

View File

@ -9,6 +9,7 @@ import org.thoughtcrime.securesms.service.PersistentAlarmManagerListener
import org.thoughtcrime.securesms.util.TextSecurePreferences
import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope
import org.whispersystems.signalservice.loki.api.LokiAPI
import org.whispersystems.signalservice.loki.utilities.Analytics
import java.util.concurrent.TimeUnit
class BackgroundPollWorker : PersistentAlarmManagerListener() {
@ -28,6 +29,7 @@ class BackgroundPollWorker : PersistentAlarmManagerListener() {
override fun onAlarm(context: Context, scheduledTime: Long): Long {
if (scheduledTime != 0L) {
Analytics.shared.track("Performed Background Fetch")
val userHexEncodedPublicKey = TextSecurePreferences.getLocalNumber(context)
val lokiAPIDatabase = DatabaseFactory.getLokiAPIDatabase(context)
try {

View File

@ -13,6 +13,7 @@ import org.thoughtcrime.securesms.database.DatabaseFactory
import org.thoughtcrime.securesms.util.TextSecurePreferences
import org.whispersystems.signalservice.api.crypto.ProfileCipher
import org.whispersystems.signalservice.loki.api.LokiGroupChatAPI
import org.whispersystems.signalservice.loki.utilities.Analytics
class DisplayNameActivity : BaseActionBarActivity() {
@ -29,6 +30,7 @@ class DisplayNameActivity : BaseActionBarActivity() {
if (name.toByteArray().size > ProfileCipher.NAME_PADDED_LENGTH) {
return nameEditText.input.setError("Too Long")
} else {
Analytics.shared.track("Display Name Updated")
TextSecurePreferences.setProfileName(this, name)
}
}

View File

@ -47,6 +47,7 @@ class SeedActivity : BaseActionBarActivity() {
copyButton.setOnClickListener { copy() }
toggleModeButton.setOnClickListener { toggleMode() }
registerOrRestoreButton.setOnClickListener { registerOrRestore() }
Analytics.shared.track("Seed Screen Viewed")
}
// endregion
@ -160,9 +161,13 @@ class SeedActivity : BaseActionBarActivity() {
when (mode) {
Mode.Register -> Analytics.shared.track("Seed Created")
Mode.Restore -> Analytics.shared.track("Seed Restored")
// TODO: Mode.Link -> Analytics.shared.track("Device Linking Attempted")
}
startActivity(Intent(this, DisplayNameActivity::class.java))
finish()
}
// TODO: Analytics.shared.track("Device Linked Successfully")
// endregion
}

View File

@ -15,7 +15,6 @@ import org.thoughtcrime.securesms.ApplicationContext;
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
import org.thoughtcrime.securesms.BlockedContactsActivity;
import org.thoughtcrime.securesms.PassphraseChangeActivity;
import network.loki.messenger.R;
import org.thoughtcrime.securesms.components.SwitchPreferenceCompat;
import org.thoughtcrime.securesms.crypto.MasterSecretUtil;
import org.thoughtcrime.securesms.dependencies.InjectableType;
@ -26,12 +25,14 @@ import org.thoughtcrime.securesms.service.KeyCachingService;
import org.thoughtcrime.securesms.util.CommunicationActions;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
import org.whispersystems.signalservice.loki.utilities.Analytics;
import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
import mobi.upod.timedurationpicker.TimeDurationPickerDialog;
import network.loki.messenger.R;
public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment implements InjectableType {
@ -71,6 +72,8 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment
disablePassphrase.setOnPreferenceChangeListener(new DisablePassphraseClickListener());
initializeVisibility();
Analytics.Companion.getShared().track("Privacy Settings Opened");
}
@Override
@ -128,6 +131,13 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
boolean enabled = (Boolean)newValue;
if (enabled) {
Analytics.Companion.getShared().track("Screen Lock Enabled");
} else {
Analytics.Companion.getShared().track("Screen Lock Disabled");
}
TextSecurePreferences.setScreenLockEnabled(getContext(), enabled);
Intent intent = new Intent(getContext(), KeyCachingService.class);
@ -197,6 +207,13 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
boolean enabled = (boolean)newValue;
if (enabled) {
Analytics.Companion.getShared().track("Typing Indicators Enabled");
} else {
Analytics.Companion.getShared().track("Typing Indicators Disabled");
}
ApplicationContext.getInstance(getContext())
.getJobManager()
.add(new MultiDeviceConfigurationUpdateJob(TextSecurePreferences.isReadReceiptsEnabled(requireContext()),
@ -216,6 +233,13 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
boolean enabled = (boolean)newValue;
if (enabled) {
Analytics.Companion.getShared().track("Link Previews Enabled");
} else {
Analytics.Companion.getShared().track("Link Previews Disabled");
}
ApplicationContext.getInstance(requireContext())
.getJobManager()
.add(new MultiDeviceConfigurationUpdateJob(TextSecurePreferences.isReadReceiptsEnabled(requireContext()),

View File

@ -15,11 +15,13 @@ import android.support.v7.preference.Preference;
import android.text.TextUtils;
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
import network.loki.messenger.R;
import org.thoughtcrime.securesms.components.SwitchPreferenceCompat;
import org.thoughtcrime.securesms.notifications.MessageNotifier;
import org.thoughtcrime.securesms.notifications.NotificationChannels;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.whispersystems.signalservice.loki.utilities.Analytics;
import network.loki.messenger.R;
import static android.app.Activity.RESULT_OK;
@ -119,6 +121,8 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
// initializeCallRingtoneSummary(findPreference(TextSecurePreferences.CALL_RINGTONE_PREF));
initializeMessageVibrateSummary((SwitchPreferenceCompat)findPreference(TextSecurePreferences.VIBRATE_PREF));
// initializeCallVibrateSummary((SwitchPreferenceCompat)findPreference(TextSecurePreferences.CALL_VIBRATE_PREF));
Analytics.Companion.getShared().track("Notification Settings Opened");
}
@Override

View File

@ -8,6 +8,7 @@ import android.support.annotation.NonNull;
import org.thoughtcrime.securesms.BaseActionBarActivity;
import org.thoughtcrime.securesms.permissions.Permissions;
import org.thoughtcrime.securesms.util.CommunicationActions;
import org.whispersystems.signalservice.loki.utilities.Analytics;
import network.loki.messenger.R;
@ -19,6 +20,7 @@ public class WelcomeActivity extends BaseActionBarActivity {
setContentView(R.layout.registration_welcome_activity);
findViewById(R.id.welcome_terms_button).setOnClickListener(v -> onTermsClicked());
findViewById(R.id.welcome_continue_button).setOnClickListener(v -> onContinueClicked());
Analytics.Companion.getShared().track("Landing Screen Viewed");
}
@Override