From 67cc92d98357bc09911bc645159575e03f284a2b Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Fri, 31 Jan 2020 16:18:03 +1100 Subject: [PATCH] Remove Mixpanel --- build.gradle | 2 -- .../securesms/ApplicationContext.java | 17 ++--------------- .../ApplicationPreferencesActivity.java | 4 ---- .../securesms/CreateProfileActivity.java | 5 ----- .../securesms/loki/MultiDeviceUtilities.kt | 6 ------ .../messaging/BackgroundPollWorker.kt | 2 -- .../AppProtectionPreferenceFragment.java | 19 ------------------- .../registration/WelcomeActivity.java | 2 -- 8 files changed, 2 insertions(+), 55 deletions(-) diff --git a/build.gradle b/build.gradle index 475c1cbe6e..bd283e0016 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,6 @@ buildscript { ext.kovenant_version = "3.3.0" ext.identicon_version = "v11" ext.rss_parser_version = "2.0.4" - ext.mixpanel_version = "5.+" ext.crashlytics_version = "2.10.1" repositories { @@ -196,7 +195,6 @@ dependencies { implementation "nl.komponents.kovenant:kovenant-android:$kovenant_version" implementation "com.github.lelloman:android-identicons:$identicon_version" implementation "com.prof.rssparser:rssparser:$rss_parser_version" - implementation "com.mixpanel.android:mixpanel-android:$mixpanel_version" implementation("com.crashlytics.sdk.android:crashlytics:$crashlytics_version@aar") { transitive = true } diff --git a/src/org/thoughtcrime/securesms/ApplicationContext.java b/src/org/thoughtcrime/securesms/ApplicationContext.java index 659b58cf1b..f64b972e2f 100644 --- a/src/org/thoughtcrime/securesms/ApplicationContext.java +++ b/src/org/thoughtcrime/securesms/ApplicationContext.java @@ -33,7 +33,6 @@ import android.support.multidex.MultiDexApplication; import com.crashlytics.android.Crashlytics; import com.google.android.gms.security.ProviderInstaller; -import com.mixpanel.android.mpmetrics.MixpanelAPI; import org.conscrypt.Conscrypt; import org.jetbrains.annotations.NotNull; @@ -66,14 +65,14 @@ import org.thoughtcrime.securesms.logging.CustomSignalProtocolLogger; import org.thoughtcrime.securesms.logging.Log; import org.thoughtcrime.securesms.logging.PersistentLogger; import org.thoughtcrime.securesms.logging.UncaughtExceptionLogger; -import org.thoughtcrime.securesms.loki.redesign.messaging.BackgroundPollWorker; -import org.thoughtcrime.securesms.loki.redesign.messaging.BackgroundPublicChatPollWorker; import org.thoughtcrime.securesms.loki.LokiAPIDatabase; import org.thoughtcrime.securesms.loki.LokiPublicChatManager; import org.thoughtcrime.securesms.loki.LokiRSSFeedPoller; import org.thoughtcrime.securesms.loki.LokiUserDatabase; import org.thoughtcrime.securesms.loki.MultiDeviceUtilities; import org.thoughtcrime.securesms.loki.redesign.activities.HomeActivity; +import org.thoughtcrime.securesms.loki.redesign.messaging.BackgroundPollWorker; +import org.thoughtcrime.securesms.loki.redesign.messaging.BackgroundPublicChatPollWorker; import org.thoughtcrime.securesms.loki.redesign.utilities.Broadcaster; import org.thoughtcrime.securesms.notifications.MessageNotifier; import org.thoughtcrime.securesms.notifications.NotificationChannels; @@ -106,11 +105,9 @@ import org.whispersystems.signalservice.loki.api.LokiPublicChat; import org.whispersystems.signalservice.loki.api.LokiPublicChatAPI; import org.whispersystems.signalservice.loki.api.LokiRSSFeed; import org.whispersystems.signalservice.loki.api.LokiStorageAPI; -import org.whispersystems.signalservice.loki.utilities.Analytics; import java.security.Security; import java.util.ArrayList; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -119,7 +116,6 @@ import java.util.concurrent.TimeUnit; import dagger.ObjectGraph; import io.fabric.sdk.android.Fabric; import kotlin.Unit; -import kotlin.jvm.functions.Function1; import network.loki.messenger.BuildConfig; import okhttp3.Cache; @@ -155,7 +151,6 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc private LokiPublicChatAPI lokiPublicChatAPI = null; public Broadcaster broadcaster = null; public SignalCommunicationModule communicationModule; - public MixpanelAPI mixpanel; private volatile boolean isAppVisible; @@ -195,14 +190,6 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc if (!BuildConfig.DEBUG) { Fabric.with(this, new Crashlytics()); } - mixpanel = MixpanelAPI.getInstance(this, "59040b6707e5a1725f3fb6730fefca92"); - Analytics.Companion.getShared().trackImplementation = (Function1) event -> { - HashMap properties = new HashMap(); - String configuration = BuildConfig.DEBUG ? "debug" : "production"; - properties.put("configuration", configuration); - mixpanel.trackMap(event, properties); - return Unit.INSTANCE; - }; // Loki - Set the cache LokiDotNetAPI.setCache(new Cache(this.getCacheDir(), OK_HTTP_CACHE_SIZE)); // Loki - Update device mappings diff --git a/src/org/thoughtcrime/securesms/ApplicationPreferencesActivity.java b/src/org/thoughtcrime/securesms/ApplicationPreferencesActivity.java index 345481ce0a..5b464e2771 100644 --- a/src/org/thoughtcrime/securesms/ApplicationPreferencesActivity.java +++ b/src/org/thoughtcrime/securesms/ApplicationPreferencesActivity.java @@ -51,7 +51,6 @@ 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; @@ -101,7 +100,6 @@ 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()); } } @@ -325,7 +323,6 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA break; */ case PREFERENCE_CATEGORY_PUBLIC_KEY: - Analytics.Companion.getShared().track("Public Key Shared"); String hexEncodedPublicKey = TextSecurePreferences.getMasterHexEncodedPublicKey(getContext()); if (hexEncodedPublicKey == null) { hexEncodedPublicKey = TextSecurePreferences.getLocalNumber(getContext()); @@ -339,7 +336,6 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA case PREFERENCE_CATEGORY_QR_CODE: break; case PREFERENCE_CATEGORY_LINKED_DEVICES: 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); diff --git a/src/org/thoughtcrime/securesms/CreateProfileActivity.java b/src/org/thoughtcrime/securesms/CreateProfileActivity.java index 14347fbb8f..b2eb3f32e8 100644 --- a/src/org/thoughtcrime/securesms/CreateProfileActivity.java +++ b/src/org/thoughtcrime/securesms/CreateProfileActivity.java @@ -60,7 +60,6 @@ import org.whispersystems.signalservice.api.util.StreamDetails; import org.whispersystems.signalservice.loki.api.LokiDotNetAPI; import org.whispersystems.signalservice.loki.api.LokiPublicChatAPI; import org.whispersystems.signalservice.loki.api.LokiStorageAPI; -import org.whispersystems.signalservice.loki.utilities.Analytics; import java.io.ByteArrayInputStream; import java.io.File; @@ -119,8 +118,6 @@ 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 @@ -386,8 +383,6 @@ public class CreateProfileActivity extends BaseActionBarActivity implements Inje protected Boolean doInBackground(Void... params) { Context context = CreateProfileActivity.this; - Analytics.Companion.getShared().track("Display Name Updated"); - TextSecurePreferences.setProfileName(context, name); LokiPublicChatAPI publicChatAPI = ApplicationContext.getInstance(context).getLokiPublicChatAPI(); if (publicChatAPI != null) { diff --git a/src/org/thoughtcrime/securesms/loki/MultiDeviceUtilities.kt b/src/org/thoughtcrime/securesms/loki/MultiDeviceUtilities.kt index 89f54bddee..125fcdd226 100644 --- a/src/org/thoughtcrime/securesms/loki/MultiDeviceUtilities.kt +++ b/src/org/thoughtcrime/securesms/loki/MultiDeviceUtilities.kt @@ -6,12 +6,10 @@ import nl.komponents.kovenant.Promise import nl.komponents.kovenant.all import nl.komponents.kovenant.functional.bind import nl.komponents.kovenant.functional.map -import nl.komponents.kovenant.then import nl.komponents.kovenant.toFailVoid import nl.komponents.kovenant.ui.successUi import org.thoughtcrime.securesms.ApplicationContext import org.thoughtcrime.securesms.crypto.IdentityKeyUtil -import org.thoughtcrime.securesms.crypto.PreKeyUtil import org.thoughtcrime.securesms.crypto.ProfileKeyUtil import org.thoughtcrime.securesms.crypto.UnidentifiedAccessUtil import org.thoughtcrime.securesms.database.Address @@ -20,14 +18,11 @@ import org.thoughtcrime.securesms.logging.Log import org.thoughtcrime.securesms.recipients.Recipient import org.thoughtcrime.securesms.sms.MessageSender import org.thoughtcrime.securesms.util.TextSecurePreferences -import org.whispersystems.libsignal.util.guava.Optional -import org.whispersystems.signalservice.api.crypto.UnidentifiedAccessPair import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage import org.whispersystems.signalservice.api.push.SignalServiceAddress import org.whispersystems.signalservice.loki.api.LokiStorageAPI import org.whispersystems.signalservice.loki.api.PairingAuthorisation import org.whispersystems.signalservice.loki.messaging.LokiThreadFriendRequestStatus -import org.whispersystems.signalservice.loki.utilities.Analytics import org.whispersystems.signalservice.loki.utilities.recover import org.whispersystems.signalservice.loki.utilities.retryIfNeeded import java.util.* @@ -44,7 +39,6 @@ fun checkForRevocation(context: Context) { DatabaseFactory.getLokiAPIDatabase(context).removePairingAuthorisations(ourDevice) LokiStorageAPI.shared.updateUserDeviceMappings() }.successUi { - Analytics.shared.track("Secondary Device Unlinked") TextSecurePreferences.setNeedsRevocationCheck(context, false) ApplicationContext.getInstance(context).clearData() }.fail { error -> diff --git a/src/org/thoughtcrime/securesms/loki/redesign/messaging/BackgroundPollWorker.kt b/src/org/thoughtcrime/securesms/loki/redesign/messaging/BackgroundPollWorker.kt index 7d716345e9..184e11d585 100644 --- a/src/org/thoughtcrime/securesms/loki/redesign/messaging/BackgroundPollWorker.kt +++ b/src/org/thoughtcrime/securesms/loki/redesign/messaging/BackgroundPollWorker.kt @@ -10,7 +10,6 @@ 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() { @@ -30,7 +29,6 @@ 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 { diff --git a/src/org/thoughtcrime/securesms/preferences/AppProtectionPreferenceFragment.java b/src/org/thoughtcrime/securesms/preferences/AppProtectionPreferenceFragment.java index e511b230e6..7f4e4e6af3 100644 --- a/src/org/thoughtcrime/securesms/preferences/AppProtectionPreferenceFragment.java +++ b/src/org/thoughtcrime/securesms/preferences/AppProtectionPreferenceFragment.java @@ -24,7 +24,6 @@ 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; @@ -127,12 +126,6 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment 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); @@ -203,12 +196,6 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment 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()), @@ -229,12 +216,6 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment 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()), diff --git a/src/org/thoughtcrime/securesms/registration/WelcomeActivity.java b/src/org/thoughtcrime/securesms/registration/WelcomeActivity.java index 83247f5371..2cb3f9a81d 100644 --- a/src/org/thoughtcrime/securesms/registration/WelcomeActivity.java +++ b/src/org/thoughtcrime/securesms/registration/WelcomeActivity.java @@ -11,7 +11,6 @@ import org.thoughtcrime.securesms.BaseActionBarActivity; import org.thoughtcrime.securesms.permissions.Permissions; import org.thoughtcrime.securesms.util.CommunicationActions; import org.thoughtcrime.securesms.util.TextSecurePreferences; -import org.whispersystems.signalservice.loki.utilities.Analytics; import network.loki.messenger.R; @@ -23,7 +22,6 @@ 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