diff --git a/src/org/thoughtcrime/securesms/ApplicationPreferencesActivity.java b/src/org/thoughtcrime/securesms/ApplicationPreferencesActivity.java index ba8534fe4f..657b3f42a7 100644 --- a/src/org/thoughtcrime/securesms/ApplicationPreferencesActivity.java +++ b/src/org/thoughtcrime/securesms/ApplicationPreferencesActivity.java @@ -76,48 +76,9 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredSherlockPr private static final int PICK_IDENTITY_CONTACT = 1; private static final int ENABLE_PASSPHRASE_ACTIVITY = 2; -<<<<<<< HEAD - public static final String RINGTONE_PREF = "pref_key_ringtone"; - public static final String IN_THREAD_NOTIFICATION_PREF = "pref_key_inthread_notifications"; - public static final String VIBRATE_PREF = "pref_key_vibrate"; - public static final String NOTIFICATION_PREF = "pref_key_enable_notifications"; - public static final String LED_COLOR_PREF = "pref_led_color"; - public static final String LED_BLINK_PREF = "pref_led_blink"; - public static final String LED_BLINK_PREF_CUSTOM = "pref_led_blink_custom"; - public static final String IDENTITY_PREF = "pref_choose_identity"; - public static final String ALL_SMS_PREF = "pref_all_sms"; - public static final String ALL_MMS_PERF = "pref_all_mms"; - public static final String KITKAT_DEFAULT_PREF = "pref_set_default"; - public static final String PASSPHRASE_TIMEOUT_INTERVAL_PREF = "pref_timeout_interval"; - public static final String PASSPHRASE_TIMEOUT_PREF = "pref_timeout_passphrase"; - public static final String AUTO_KEY_EXCHANGE_PREF = "pref_auto_complete_key_exchange"; - public static final String THEME_PREF = "pref_theme"; - public static final String LANGUAGE_PREF = "pref_language"; - public static final String ENTER_SENDS_PREF = "pref_enter_sends"; - public static final String ENTER_PRESENT_PREF = "pref_enter_key"; - - private static final String DISPLAY_CATEGORY_PREF = "pref_display_category"; - private static final String PUSH_MESSAGING_PREF = "pref_toggle_push_messaging"; - - private static final String CHANGE_PASSPHRASE_PREF = "pref_change_passphrase"; - public static final String DISABLE_PASSPHRASE_PREF = "pref_disable_passphrase"; - - public static final String MMS_PREF = "pref_mms_preferences"; - public static final String ENABLE_MANUAL_MMS_PREF = "pref_enable_manual_mms"; - public static final String MMSC_HOST_PREF = "pref_apn_mmsc_host"; - public static final String MMSC_PROXY_HOST_PREF = "pref_apn_mms_proxy"; - public static final String MMSC_PROXY_PORT_PREF = "pref_apn_mms_proxy_port"; - - public static final String SMS_DELIVERY_REPORT_PREF = "pref_delivery_report_sms"; - - public static final String THREAD_TRIM_ENABLED = "pref_trim_threads"; - public static final String THREAD_TRIM_LENGTH = "pref_trim_length"; - public static final String THREAD_TRIM_NOW = "pref_trim_now"; - - public static final String LOCAL_NUMBER_PREF = "pref_local_number"; - public static final String VERIFYING_STATE_PREF = "pref_verifying"; - public static final String REGISTERED_GCM_PREF = "pref_gcm_registered"; - public static final String GCM_PASSWORD_PREF = "pref_gcm_password"; + private static final String DISPLAY_CATEGORY_PREF = "pref_display_category"; + private static final String PUSH_MESSAGING_PREF = "pref_toggle_push_messaging"; + private static final String MMS_PREF = "pref_mms_preferences"; private final DynamicTheme dynamicTheme = new DynamicTheme(); private final DynamicLanguage dynamicLanguage = new DynamicLanguage(); diff --git a/src/org/thoughtcrime/securesms/MmsPreferencesActivity.java b/src/org/thoughtcrime/securesms/MmsPreferencesActivity.java index 59d91c33af..db6dc555a2 100644 --- a/src/org/thoughtcrime/securesms/MmsPreferencesActivity.java +++ b/src/org/thoughtcrime/securesms/MmsPreferencesActivity.java @@ -24,12 +24,13 @@ import android.preference.PreferenceManager; import android.widget.Toast; import com.actionbarsherlock.view.MenuItem; -import org.thoughtcrime.securesms.crypto.MasterSecret; import org.thoughtcrime.securesms.mms.MmsDownloadHelper; import org.thoughtcrime.securesms.service.SendReceiveService; import org.thoughtcrime.securesms.util.DynamicLanguage; import org.thoughtcrime.securesms.util.DynamicTheme; import org.thoughtcrime.securesms.util.MemoryCleaner; +import org.thoughtcrime.securesms.util.TextSecurePreferences; +import org.whispersystems.textsecure.crypto.MasterSecret; public class MmsPreferencesActivity extends PassphraseRequiredSherlockPreferenceActivity { @@ -87,9 +88,9 @@ public class MmsPreferencesActivity extends PassphraseRequiredSherlockPreference private void initializePreferences() { if (!MmsDownloadHelper.isMmsConnectionParametersAvailable(this, null, false)) { PreferenceManager.getDefaultSharedPreferences(this).edit() - .putBoolean(ApplicationPreferencesActivity.ENABLE_MANUAL_MMS_PREF, true).commit(); + .putBoolean(TextSecurePreferences.ENABLE_MANUAL_MMS_PREF, true).commit(); addPreferencesFromResource(R.xml.mms_preferences); - this.findPreference(ApplicationPreferencesActivity.ENABLE_MANUAL_MMS_PREF).setOnPreferenceChangeListener(new OverrideMmsChangeListener()); + this.findPreference(TextSecurePreferences.ENABLE_MANUAL_MMS_PREF).setOnPreferenceChangeListener(new OverrideMmsChangeListener()); } else { addPreferencesFromResource(R.xml.mms_preferences); } @@ -112,9 +113,9 @@ public class MmsPreferencesActivity extends PassphraseRequiredSherlockPreference } private void initializeEditTextSummaries() { - initializeEditTextSummary((EditTextPreference)this.findPreference(ApplicationPreferencesActivity.MMSC_HOST_PREF)); - initializeEditTextSummary((EditTextPreference)this.findPreference(ApplicationPreferencesActivity.MMSC_PROXY_HOST_PREF)); - initializeEditTextSummary((EditTextPreference)this.findPreference(ApplicationPreferencesActivity.MMSC_PROXY_PORT_PREF)); + initializeEditTextSummary((EditTextPreference)this.findPreference(TextSecurePreferences.MMSC_HOST_PREF)); + initializeEditTextSummary((EditTextPreference)this.findPreference(TextSecurePreferences.MMSC_PROXY_HOST_PREF)); + initializeEditTextSummary((EditTextPreference)this.findPreference(TextSecurePreferences.MMSC_PROXY_PORT_PREF)); } private void handleDownloadMmsPendingApn() { @@ -127,7 +128,7 @@ public class MmsPreferencesActivity extends PassphraseRequiredSherlockPreference @Override public boolean onPreferenceChange(Preference preference, Object o) { PreferenceManager.getDefaultSharedPreferences(MmsPreferencesActivity.this).edit() - .putBoolean(ApplicationPreferencesActivity.ENABLE_MANUAL_MMS_PREF, true).commit(); + .putBoolean(TextSecurePreferences.ENABLE_MANUAL_MMS_PREF, true).commit(); Toast.makeText(MmsPreferencesActivity.this, R.string.mms_preferences_activity__manual_mms_settings_are_required, Toast.LENGTH_SHORT).show(); return false; } diff --git a/src/org/thoughtcrime/securesms/database/MmsDatabase.java b/src/org/thoughtcrime/securesms/database/MmsDatabase.java index 4e7cc18ae1..5a16dc8572 100644 --- a/src/org/thoughtcrime/securesms/database/MmsDatabase.java +++ b/src/org/thoughtcrime/securesms/database/MmsDatabase.java @@ -237,11 +237,6 @@ public class MmsDatabase extends Database implements MmsSmsColumns { notifyConversationListeners(getThreadIdForMessage(messageId)); } - public void markAsSending(long messageId) { - updateMailboxBitmask(messageId, Types.BASE_TYPE_MASK, Types.BASE_SENDING_TYPE); - notifyConversationListeners(getThreadIdForMessage(messageId)); - } - public void markAsSent(long messageId, byte[] mmsId, long status) { SQLiteDatabase database = databaseHelper.getWritableDatabase(); ContentValues contentValues = new ContentValues(); diff --git a/src/org/thoughtcrime/securesms/notifications/MessageNotifier.java b/src/org/thoughtcrime/securesms/notifications/MessageNotifier.java index 7b060ee99d..cc4fa6786e 100644 --- a/src/org/thoughtcrime/securesms/notifications/MessageNotifier.java +++ b/src/org/thoughtcrime/securesms/notifications/MessageNotifier.java @@ -241,12 +241,10 @@ public class MessageNotifier { private static void sendInThreadNotification(Context context) { try { - SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); - - if (!sp.getBoolean(ApplicationPreferencesActivity.IN_THREAD_NOTIFICATION_PREF, true)) { - return; + if (!TextSecurePreferences.isInThreadNotifications(context)) { + return; } - + String ringtone = TextSecurePreferences.getNotificationRingtone(context); if (ringtone == null) diff --git a/src/org/thoughtcrime/securesms/service/KeyCachingService.java b/src/org/thoughtcrime/securesms/service/KeyCachingService.java index 2d4d7e9a71..4baf2fb998 100644 --- a/src/org/thoughtcrime/securesms/service/KeyCachingService.java +++ b/src/org/thoughtcrime/securesms/service/KeyCachingService.java @@ -27,6 +27,7 @@ import android.os.Binder; import android.os.Build; import android.os.IBinder; import android.os.SystemClock; +import android.support.v4.app.NotificationCompat; import android.util.Log; import android.widget.RemoteViews; diff --git a/src/org/thoughtcrime/securesms/service/MmsDownloader.java b/src/org/thoughtcrime/securesms/service/MmsDownloader.java index 2921716601..a1befd2a24 100644 --- a/src/org/thoughtcrime/securesms/service/MmsDownloader.java +++ b/src/org/thoughtcrime/securesms/service/MmsDownloader.java @@ -164,7 +164,7 @@ public class MmsDownloader { private void retrieveAndStore(MasterSecret masterSecret, long messageId, long threadId, String contentLocation, byte[] transactionId, boolean radioEnabled, boolean useProxy) - throws IOException, MmsException + throws IOException, MmsException, ApnUnavailableException { RetrieveConf retrieved = MmsDownloadHelper.retrieveMms(context, contentLocation, radio.getApnInformation(), diff --git a/src/org/thoughtcrime/securesms/util/TextSecurePreferences.java b/src/org/thoughtcrime/securesms/util/TextSecurePreferences.java index 2e54f6af2c..18bf084bce 100644 --- a/src/org/thoughtcrime/securesms/util/TextSecurePreferences.java +++ b/src/org/thoughtcrime/securesms/util/TextSecurePreferences.java @@ -16,7 +16,7 @@ public class TextSecurePreferences { public static final String MMSC_PROXY_PORT_PREF = "pref_apn_mms_proxy_port"; public static final String THREAD_TRIM_LENGTH = "pref_trim_length"; public static final String THREAD_TRIM_NOW = "pref_trim_now"; - public static final String USE_LOCAL_MMS_APNS_PREF = "pref_use_local_apns"; + public static final String ENABLE_MANUAL_MMS_PREF = "pref_enable_manual_mms"; private static final String RINGTONE_PREF = "pref_key_ringtone"; private static final String VIBRATE_PREF = "pref_key_vibrate"; @@ -39,6 +39,11 @@ public class TextSecurePreferences { private static final String PROMPTED_PUSH_REGISTRATION_PREF = "pref_prompted_push_registration"; private static final String SIGNALING_KEY_PREF = "pref_signaling_key"; private static final String DIRECTORY_FRESH_TIME_PREF = "pref_directory_refresh_time"; + private static final String IN_THREAD_NOTIFICATION_PREF = "pref_key_inthread_notifications"; + + public static boolean isInThreadNotifications(Context context) { + return getBooleanPreference(context, IN_THREAD_NOTIFICATION_PREF, true); + } public static long getDirectoryRefreshTime(Context context) { return getLongPreference(context, DIRECTORY_FRESH_TIME_PREF, 0L); @@ -113,7 +118,7 @@ public class TextSecurePreferences { } public static boolean isUseLocalApnsEnabled(Context context) { - return getBooleanPreference(context, USE_LOCAL_MMS_APNS_PREF, false); + return getBooleanPreference(context, ENABLE_MANUAL_MMS_PREF, false); } public static String getTheme(Context context) {