mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-26 08:26:58 +00:00
Add preference to disable the SMS channel all together.
1) If the SMS fallback preference is disabled, no outgoing messages will succeed via the SMS transport. 2) If the SMS fallback preference is disabled, "mirroring" the SMS db state when not the default system SMS app is disabled.
This commit is contained in:
@@ -100,6 +100,7 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredSherlockPr
|
||||
|
||||
initializeIdentitySelection();
|
||||
initializePlatformSpecificOptions();
|
||||
initializeSmsFallbackOption();
|
||||
initializePushMessagingToggle();
|
||||
|
||||
this.findPreference(TextSecurePreferences.CHANGE_PASSPHRASE_PREF)
|
||||
@@ -178,8 +179,8 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredSherlockPr
|
||||
}
|
||||
|
||||
private void initializePlatformSpecificOptions() {
|
||||
PreferenceGroup generalCategory = (PreferenceGroup)findPreference("general_category");
|
||||
Preference defaultPreference = findPreference(KITKAT_DEFAULT_PREF);
|
||||
PreferenceGroup generalCategory = (PreferenceGroup) findPreference("general_category");
|
||||
Preference defaultPreference = findPreference(KITKAT_DEFAULT_PREF);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
generalCategory.removePreference(findPreference(TextSecurePreferences.ALL_SMS_PREF));
|
||||
@@ -198,6 +199,29 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredSherlockPr
|
||||
}
|
||||
}
|
||||
|
||||
private void initializeSmsFallbackOption() {
|
||||
CheckBoxPreference allowSmsPreference =
|
||||
(CheckBoxPreference) findPreference(TextSecurePreferences.ALLOW_SMS_FALLBACK_PREF);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
if (Util.isDefaultSmsProvider(this) || !TextSecurePreferences.isPushRegistered(this)) {
|
||||
allowSmsPreference.setEnabled(false);
|
||||
allowSmsPreference.setChecked(true);
|
||||
} else {
|
||||
allowSmsPreference.setEnabled(true);
|
||||
}
|
||||
} else {
|
||||
if (TextSecurePreferences.isInterceptAllMmsEnabled(this) ||
|
||||
TextSecurePreferences.isInterceptAllSmsEnabled(this))
|
||||
{
|
||||
allowSmsPreference.setEnabled(false);
|
||||
allowSmsPreference.setChecked(true);
|
||||
} else {
|
||||
allowSmsPreference.setEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void initializeEditTextSummary(final EditTextPreference preference) {
|
||||
if (preference.getText() == null) {
|
||||
preference.setSummary("Not set");
|
||||
@@ -268,6 +292,10 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredSherlockPr
|
||||
dynamicTheme.onResume(this);
|
||||
} else if (key.equals(TextSecurePreferences.LANGUAGE_PREF)) {
|
||||
dynamicLanguage.onResume(this);
|
||||
} else if (key.equals(TextSecurePreferences.ALL_MMS_PREF) ||
|
||||
key.equals(TextSecurePreferences.ALL_SMS_PREF))
|
||||
{
|
||||
initializeSmsFallbackOption();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user