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:
Moxie Marlinspike
2013-07-11 14:58:40 -07:00
parent 52e5274a2f
commit d7070e7ecf
22 changed files with 427 additions and 141 deletions

View File

@@ -48,6 +48,7 @@ import org.thoughtcrime.securesms.database.MmsSmsDatabase;
import org.thoughtcrime.securesms.database.model.MessageRecord;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.recipients.Recipients;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import java.io.IOException;
import java.util.List;
@@ -97,9 +98,7 @@ public class MessageNotifier {
public static void updateNotification(Context context, MasterSecret masterSecret) {
if (!PreferenceManager.getDefaultSharedPreferences(context)
.getBoolean(ApplicationPreferencesActivity.NOTIFICATION_PREF, true))
{
if (!TextSecurePreferences.isNotificationsEnabled(context)) {
return;
}
@@ -107,9 +106,7 @@ public class MessageNotifier {
}
public static void updateNotification(Context context, MasterSecret masterSecret, long threadId) {
if (!PreferenceManager.getDefaultSharedPreferences(context)
.getBoolean(ApplicationPreferencesActivity.NOTIFICATION_PREF, true))
{
if (!TextSecurePreferences.isNotificationsEnabled(context)) {
return;
}
@@ -236,7 +233,7 @@ public class MessageNotifier {
return;
}
String ringtone = sp.getString(ApplicationPreferencesActivity.RINGTONE_PREF, null);
String ringtone = TextSecurePreferences.getNotificationRingtone(context);
if (ringtone == null)
return;
@@ -302,13 +299,11 @@ public class MessageNotifier {
NotificationCompat.Builder builder,
boolean signal)
{
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
String ringtone = sp.getString(ApplicationPreferencesActivity.RINGTONE_PREF, null);
boolean vibrate = sp.getBoolean(ApplicationPreferencesActivity.VIBRATE_PREF, true);
String ledColor = sp.getString(ApplicationPreferencesActivity.LED_COLOR_PREF, "green");
String ledBlinkPattern = sp.getString(ApplicationPreferencesActivity.LED_BLINK_PREF, "500,2000");
String ledBlinkPatternCustom = sp.getString(ApplicationPreferencesActivity.LED_BLINK_PREF_CUSTOM, "500,2000");
String ringtone = TextSecurePreferences.getNotificationRingtone(context);
boolean vibrate = TextSecurePreferences.isNotificationVibrateEnabled(context);
String ledColor = TextSecurePreferences.getNotificationLedColor(context);
String ledBlinkPattern = TextSecurePreferences.getNotificationLedPattern(context);
String ledBlinkPatternCustom = TextSecurePreferences.getNotificationLedPatternCustom(context);
String[] blinkPatternArray = parseBlinkPattern(ledBlinkPattern, ledBlinkPatternCustom);
builder.setSound(TextUtils.isEmpty(ringtone) || !signal ? null : Uri.parse(ringtone));