Add basic events

This commit is contained in:
Niels Andriesse 2019-09-05 09:38:36 +10:00
parent e346a45d99
commit 6341ca0101
3 changed files with 19 additions and 0 deletions

View File

@ -226,6 +226,7 @@ import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;
import org.whispersystems.signalservice.api.push.SignalServiceAddress; import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import org.whispersystems.signalservice.loki.messaging.LokiMessageFriendRequestStatus; import org.whispersystems.signalservice.loki.messaging.LokiMessageFriendRequestStatus;
import org.whispersystems.signalservice.loki.messaging.LokiThreadFriendRequestStatus; import org.whispersystems.signalservice.loki.messaging.LokiThreadFriendRequestStatus;
import org.whispersystems.signalservice.loki.utilities.Analytics;
import java.io.IOException; import java.io.IOException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -392,6 +393,16 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
}); });
} }
}); });
if (this.recipient.isGroupRecipient()) {
if (this.recipient.getName().equals("Loki Public Chat")) {
Analytics.Companion.getShared().track("Loki Public Chat Opened");
} else {
Analytics.Companion.getShared().track("RSS Feed Opened");
}
} else {
Analytics.Companion.getShared().track("Conversation Opened");
}
} }
@Override @Override

View File

@ -16,6 +16,7 @@ import org.thoughtcrime.securesms.qr.ScanListener
import org.thoughtcrime.securesms.recipients.Recipient import org.thoughtcrime.securesms.recipients.Recipient
import org.thoughtcrime.securesms.util.DynamicTheme import org.thoughtcrime.securesms.util.DynamicTheme
import org.thoughtcrime.securesms.util.TextSecurePreferences import org.thoughtcrime.securesms.util.TextSecurePreferences
import org.whispersystems.signalservice.loki.utilities.Analytics
import org.whispersystems.signalservice.loki.utilities.PublicKeyValidation import org.whispersystems.signalservice.loki.utilities.PublicKeyValidation
class NewConversationActivity : PassphraseRequiredActionBarActivity(), ScanListener { class NewConversationActivity : PassphraseRequiredActionBarActivity(), ScanListener {
@ -60,6 +61,7 @@ class NewConversationActivity : PassphraseRequiredActionBarActivity(), ScanListe
} }
override fun onQrDataFound(hexEncodedPublicKey: String) { override fun onQrDataFound(hexEncodedPublicKey: String) {
Analytics.shared.track("QR Code Scanned")
startNewConversationIfPossible(hexEncodedPublicKey) startNewConversationIfPossible(hexEncodedPublicKey)
} }
@ -75,6 +77,7 @@ class NewConversationActivity : PassphraseRequiredActionBarActivity(), ScanListe
val existingThread = DatabaseFactory.getThreadDatabase(this).getThreadIdIfExistsFor(contact) val existingThread = DatabaseFactory.getThreadDatabase(this).getThreadIdIfExistsFor(contact)
intent.putExtra(ConversationActivity.THREAD_ID_EXTRA, existingThread) intent.putExtra(ConversationActivity.THREAD_ID_EXTRA, existingThread)
intent.putExtra(ConversationActivity.DISTRIBUTION_TYPE_EXTRA, ThreadDatabase.DistributionTypes.DEFAULT) intent.putExtra(ConversationActivity.DISTRIBUTION_TYPE_EXTRA, ThreadDatabase.DistributionTypes.DEFAULT)
Analytics.shared.track("New Conversation Started")
startActivity(intent) startActivity(intent)
finish() finish()
} }

View File

@ -22,6 +22,7 @@ import org.thoughtcrime.securesms.util.TextSecurePreferences
import org.whispersystems.curve25519.Curve25519 import org.whispersystems.curve25519.Curve25519
import org.whispersystems.libsignal.util.KeyHelper import org.whispersystems.libsignal.util.KeyHelper
import org.whispersystems.signalservice.loki.crypto.MnemonicCodec import org.whispersystems.signalservice.loki.crypto.MnemonicCodec
import org.whispersystems.signalservice.loki.utilities.Analytics
import org.whispersystems.signalservice.loki.utilities.hexEncodedPublicKey import org.whispersystems.signalservice.loki.utilities.hexEncodedPublicKey
import java.io.File import java.io.File
import java.io.FileOutputStream import java.io.FileOutputStream
@ -162,6 +163,10 @@ class SeedActivity : BaseActionBarActivity() {
val application = ApplicationContext.getInstance(this) val application = ApplicationContext.getInstance(this)
application.setUpP2PAPI() application.setUpP2PAPI()
application.startLongPollingIfNeeded() application.startLongPollingIfNeeded()
when (mode) {
Mode.Register -> Analytics.shared.track("Seed Created")
Mode.Restore -> Analytics.shared.track("Seed Restored")
}
startActivity(Intent(this, ConversationListActivity::class.java)) startActivity(Intent(this, ConversationListActivity::class.java))
finish() finish()
} }