mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 20:15:21 +00:00
Merge branch 'dev' into multi-device-integration
# Conflicts: # src/org/thoughtcrime/securesms/loki/SeedActivity.kt
This commit is contained in:
commit
dbd8133926
@ -464,7 +464,7 @@
|
||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||
|
||||
<!-- Loki -->
|
||||
<activity android:name="org.thoughtcrime.securesms.loki.AccountDetailsActivity"
|
||||
<activity android:name="org.thoughtcrime.securesms.loki.DisplayNameActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/TextSecure.DarkRegistrationTheme"
|
||||
android:windowSoftInputMode="stateUnchanged"
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
@ -321,6 +323,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);
|
||||
@ -335,6 +338,7 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
|
||||
DeviceLinkingDialog.Companion.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);
|
||||
|
@ -35,11 +35,15 @@ import org.thoughtcrime.securesms.components.emoji.EmojiKeyboardProvider;
|
||||
import org.thoughtcrime.securesms.components.emoji.EmojiToggle;
|
||||
import org.thoughtcrime.securesms.components.emoji.MediaKeyboard;
|
||||
import org.thoughtcrime.securesms.contacts.avatars.ResourceContactPhoto;
|
||||
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil;
|
||||
import org.thoughtcrime.securesms.crypto.ProfileKeyUtil;
|
||||
import org.thoughtcrime.securesms.database.Address;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.dependencies.InjectableType;
|
||||
import org.thoughtcrime.securesms.jobs.MultiDeviceProfileKeyUpdateJob;
|
||||
import org.thoughtcrime.securesms.logging.Log;
|
||||
import org.thoughtcrime.securesms.loki.LokiAPIDatabase;
|
||||
import org.thoughtcrime.securesms.loki.LokiUserDatabase;
|
||||
import org.thoughtcrime.securesms.mms.GlideApp;
|
||||
import org.thoughtcrime.securesms.permissions.Permissions;
|
||||
import org.thoughtcrime.securesms.profiles.AvatarHelper;
|
||||
@ -57,6 +61,8 @@ import org.thoughtcrime.securesms.util.concurrent.ListenableFuture;
|
||||
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;
|
||||
@ -110,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
|
||||
@ -366,8 +374,16 @@ 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);
|
||||
byte[] userPrivateKey = IdentityKeyUtil.getIdentityKeyPair(context).getPrivateKey().serialize();
|
||||
LokiAPIDatabase apiDatabase = DatabaseFactory.getLokiAPIDatabase(context);
|
||||
LokiUserDatabase userDatabase = DatabaseFactory.getLokiUserDatabase(context);
|
||||
new LokiGroupChatAPI(userHexEncodedPublicKey, userPrivateKey, apiDatabase, userDatabase).setDisplayName(name, LokiGroupChatAPI.getPublicChatServer());
|
||||
|
||||
// Loki - Original code
|
||||
// ========
|
||||
// try {
|
||||
|
@ -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 {
|
||||
|
@ -8,15 +8,20 @@ import network.loki.messenger.R
|
||||
import org.thoughtcrime.securesms.ApplicationContext
|
||||
import org.thoughtcrime.securesms.BaseActionBarActivity
|
||||
import org.thoughtcrime.securesms.ConversationListActivity
|
||||
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil
|
||||
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 AccountDetailsActivity : BaseActionBarActivity() {
|
||||
class DisplayNameActivity : BaseActionBarActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_account_details)
|
||||
nextButton.setOnClickListener { continueIfPossible() }
|
||||
Analytics.shared.track("Display Name Screen Viewed")
|
||||
}
|
||||
|
||||
private fun continueIfPossible() {
|
||||
@ -26,6 +31,7 @@ class AccountDetailsActivity : 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)
|
||||
}
|
||||
}
|
||||
@ -39,5 +45,12 @@ class AccountDetailsActivity : BaseActionBarActivity() {
|
||||
application.setUpStorageAPIIfNeeded()
|
||||
startActivity(Intent(this, ConversationListActivity::class.java))
|
||||
finish()
|
||||
val userHexEncodedPublicKey = TextSecurePreferences.getLocalNumber(this)
|
||||
val userPrivateKey = IdentityKeyUtil.getIdentityKeyPair(this).privateKey.serialize()
|
||||
val apiDatabase = DatabaseFactory.getLokiAPIDatabase(this)
|
||||
val userDatabase = DatabaseFactory.getLokiUserDatabase(this)
|
||||
if (name != null) {
|
||||
LokiGroupChatAPI(userHexEncodedPublicKey, userPrivateKey, apiDatabase, userDatabase).setDisplayName(name, LokiGroupChatAPI.publicChatServer)
|
||||
}
|
||||
}
|
||||
}
|
@ -34,9 +34,9 @@ class LokiGroupChatPoller(private val context: Context, private val group: LokiG
|
||||
|
||||
private val api: LokiGroupChatAPI
|
||||
get() = {
|
||||
val userPrivateKey = IdentityKeyUtil.getIdentityKeyPair(context).privateKey.serialize()
|
||||
val lokiAPIDatabase = DatabaseFactory.getLokiAPIDatabase(context)
|
||||
val lokiUserDatabase = DatabaseFactory.getLokiUserDatabase(context)
|
||||
val userPrivateKey = IdentityKeyUtil.getIdentityKeyPair(context).privateKey.serialize()
|
||||
LokiGroupChatAPI(userHexEncodedPublicKey, userPrivateKey, lokiAPIDatabase, lokiUserDatabase)
|
||||
}()
|
||||
// endregion
|
||||
|
@ -59,6 +59,7 @@ class SeedActivity : BaseActionBarActivity() {
|
||||
toggleRegisterModeButton.setOnClickListener { mode = Mode.Register }
|
||||
toggleLinkModeButton.setOnClickListener { mode = Mode.Link }
|
||||
registerOrRestoreButton.setOnClickListener { registerOrRestore() }
|
||||
Analytics.shared.track("Seed Screen Viewed")
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
@ -245,7 +246,7 @@ class SeedActivity : BaseActionBarActivity() {
|
||||
}
|
||||
|
||||
private fun showAccountDetailsView() {
|
||||
startActivity(Intent(this, AccountDetailsActivity::class.java))
|
||||
startActivity(Intent(this, DisplayNameActivity::class.java))
|
||||
finish()
|
||||
}
|
||||
|
||||
|
@ -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()),
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user