mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-06 03:49:58 +02:00
remove push notifications toggle
This commit is contained in:
parent
8e802e1062
commit
3e72837688
4 changed files with 3 additions and 46 deletions
|
@ -228,12 +228,8 @@ public class ApplicationContext extends MultiDexApplication {
|
|||
fetchWorkRequest);
|
||||
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
|
||||
|
||||
if (BuildConfig.USE_PLAY_SERVICES) {
|
||||
if (Prefs.isPushEnabled(this)) {
|
||||
FcmReceiveService.register(this);
|
||||
} else {
|
||||
Log.i(TAG, "FCM disabled in user settings");
|
||||
}
|
||||
if (Prefs.isPushEnabled(this)) {
|
||||
FcmReceiveService.register(this);
|
||||
} else {
|
||||
Log.i(TAG, "FCM disabled at build time");
|
||||
}
|
||||
|
|
|
@ -73,27 +73,6 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
|
|||
|
||||
initializeRingtoneSummary(findPreference(Prefs.RINGTONE_PREF));
|
||||
|
||||
CheckBoxPreference usePushService = this.findPreference("pref_push_enabled");
|
||||
usePushService.setChecked(Prefs.isPushEnabled(getContext()));
|
||||
usePushService.setEnabled(BuildConfig.USE_PLAY_SERVICES);
|
||||
usePushService.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
final boolean enabled = (Boolean) newValue;
|
||||
if (!enabled) {
|
||||
new AlertDialog.Builder(getContext())
|
||||
.setMessage(R.string.pref_push_ask_disable)
|
||||
.setPositiveButton(R.string.ok, (dialogInterface, i) -> {
|
||||
((CheckBoxPreference)preference).setChecked(false);
|
||||
})
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.setNeutralButton(R.string.learn_more, (dialogInterface, i) -> {
|
||||
DcHelper.openHelp(getActivity(), "#instant-delivery");
|
||||
})
|
||||
.show();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
ignoreBattery = this.findPreference("pref_ignore_battery_optimizations");
|
||||
ignoreBattery.setVisible(needsIgnoreBatteryOptimizations());
|
||||
ignoreBattery.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
|
@ -137,18 +116,6 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
|
|||
notificationsEnabled.setChecked(!dcContext.isMuted());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
|
||||
// we delay applying token changes to avoid changes and races if the user is just playing around
|
||||
if (Prefs.isPushEnabled(getContext()) && FcmReceiveService.getToken() == null) {
|
||||
FcmReceiveService.register(getContext());
|
||||
} else if(!Prefs.isPushEnabled(getContext()) && FcmReceiveService.getToken() != null) {
|
||||
FcmReceiveService.deleteToken();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
|
|
@ -168,7 +168,7 @@ public class Prefs {
|
|||
}
|
||||
|
||||
public static boolean isPushEnabled(Context context) {
|
||||
return BuildConfig.USE_PLAY_SERVICES && getBooleanPreference(context, "pref_push_enabled", true);
|
||||
return BuildConfig.USE_PLAY_SERVICES;
|
||||
}
|
||||
|
||||
public static boolean isHardCompressionEnabled(Context context) {
|
||||
|
|
|
@ -50,12 +50,6 @@
|
|||
android:defaultValue="true" />
|
||||
|
||||
<PreferenceCategory android:title="@string/pref_instant_delivery">
|
||||
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
|
||||
android:key="pref_push_enabled"
|
||||
android:defaultValue="true"
|
||||
android:title="@string/pref_push_notifications"
|
||||
android:summary="@string/pref_push_notifications_explain"/>
|
||||
|
||||
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
|
||||
android:key="pref_ignore_battery_optimizations"
|
||||
android:defaultValue="false"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue