mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-20 14:54:09 +00:00
Inserted the Registration activity into initial setup flow.
1) Added push messaging toggle to preferences. 2) Added push messaging registration screen to setup flow. 3) Migrated rest of SharedPreferences accessors to TextSecurePreferences.
This commit is contained in:
@@ -174,11 +174,10 @@ public class KeyCachingService extends Service {
|
||||
}
|
||||
|
||||
private void startTimeoutIfAppropriate() {
|
||||
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
boolean timeoutEnabled = sharedPreferences.getBoolean(ApplicationPreferencesActivity.PASSPHRASE_TIMEOUT_PREF, false);
|
||||
boolean timeoutEnabled = TextSecurePreferences.isPassphraseTimeoutEnabled(this);
|
||||
|
||||
if ((activitiesRunning == 0) && (this.masterSecret != null) && timeoutEnabled && !TextSecurePreferences.isPasswordDisabled(this)) {
|
||||
long timeoutMinutes = sharedPreferences.getInt(ApplicationPreferencesActivity.PASSPHRASE_TIMEOUT_INTERVAL_PREF, 60 * 5);
|
||||
long timeoutMinutes = TextSecurePreferences.getPassphraseTimeoutInterval(this);
|
||||
long timeoutMillis = timeoutMinutes * 60 * 1000;
|
||||
|
||||
Log.w("KeyCachingService", "Starting timeout: " + timeoutMillis);
|
||||
|
@@ -27,6 +27,7 @@ import android.util.Log;
|
||||
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
|
||||
import org.thoughtcrime.securesms.protocol.WirePrefix;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
|
||||
import ws.com.google.android.mms.pdu.GenericPdu;
|
||||
import ws.com.google.android.mms.pdu.NotificationInd;
|
||||
@@ -52,8 +53,7 @@ public class MmsListener extends BroadcastReceiver {
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT ||
|
||||
PreferenceManager.getDefaultSharedPreferences(context)
|
||||
.getBoolean(ApplicationPreferencesActivity.ALL_MMS_PERF, true))
|
||||
TextSecurePreferences.isInterceptAllMmsEnabled(context))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.gcm.GcmIntentService;
|
||||
import org.thoughtcrime.securesms.gcm.GcmRegistrationTimeoutException;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.whispersystems.textsecure.push.PushServiceSocket;
|
||||
import org.whispersystems.textsecure.push.RateLimitException;
|
||||
import org.whispersystems.textsecure.util.Util;
|
||||
@@ -296,23 +297,18 @@ public class RegistrationService extends Service {
|
||||
}
|
||||
|
||||
private void markAsVerifying(boolean verifying) {
|
||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
Editor editor = preferences.edit();
|
||||
TextSecurePreferences.setVerifying(this, verifying);
|
||||
|
||||
editor.putBoolean(ApplicationPreferencesActivity.VERIFYING_STATE_PREF, verifying);
|
||||
editor.putBoolean(ApplicationPreferencesActivity.REGISTERED_GCM_PREF, false);
|
||||
editor.commit();
|
||||
if (verifying) {
|
||||
TextSecurePreferences.setPushRegistered(this, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void markAsVerified(String number, String password) {
|
||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
Editor editor = preferences.edit();
|
||||
|
||||
editor.putBoolean(ApplicationPreferencesActivity.VERIFYING_STATE_PREF, false);
|
||||
editor.putBoolean(ApplicationPreferencesActivity.REGISTERED_GCM_PREF, true);
|
||||
editor.putString(ApplicationPreferencesActivity.LOCAL_NUMBER_PREF, number);
|
||||
editor.putString(ApplicationPreferencesActivity.GCM_PASSWORD_PREF, password);
|
||||
editor.commit();
|
||||
TextSecurePreferences.setVerifying(this, false);
|
||||
TextSecurePreferences.setPushRegistered(this, true);
|
||||
TextSecurePreferences.setLocalNumber(this, number);
|
||||
TextSecurePreferences.setPushServerPassword(this, password);
|
||||
}
|
||||
|
||||
private void setState(RegistrationState state) {
|
||||
|
@@ -30,6 +30,7 @@ import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
|
||||
import org.thoughtcrime.securesms.protocol.WirePrefix;
|
||||
import org.thoughtcrime.securesms.sms.IncomingTextMessage;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -127,7 +128,7 @@ public class SmsListener extends BroadcastReceiver {
|
||||
return false;
|
||||
|
||||
if (messageBody.matches("Your TextSecure verification code: [0-9]{3,4}-[0-9]{3,4}") &&
|
||||
preferences.getBoolean(ApplicationPreferencesActivity.VERIFYING_STATE_PREF, false))
|
||||
TextSecurePreferences.isVerifying(context))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@@ -39,6 +39,7 @@ import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.sms.IncomingKeyExchangeMessage;
|
||||
import org.thoughtcrime.securesms.sms.IncomingTextMessage;
|
||||
import org.thoughtcrime.securesms.sms.MultipartSmsMessageHandler;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -95,10 +96,7 @@ public class SmsReceiver {
|
||||
private Pair<Long, Long> storeKeyExchangeMessage(MasterSecret masterSecret,
|
||||
IncomingKeyExchangeMessage message)
|
||||
{
|
||||
if (masterSecret != null &&
|
||||
PreferenceManager.getDefaultSharedPreferences(context)
|
||||
.getBoolean(ApplicationPreferencesActivity.AUTO_KEY_EXCHANGE_PREF, true))
|
||||
{
|
||||
if (masterSecret != null && TextSecurePreferences.isAutoRespondKeyExchangeEnabled(context)) {
|
||||
try {
|
||||
Recipient recipient = new Recipient(null, message.getSender(), null, null);
|
||||
KeyExchangeMessage keyExchangeMessage = new KeyExchangeMessage(message.getMessageBody());
|
||||
|
Reference in New Issue
Block a user