mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-03 17:59:39 +02:00
disable push notifications setting if apk was built without support
This commit is contained in:
parent
1b80bc32dd
commit
178331ce2a
4 changed files with 12 additions and 6 deletions
|
@ -111,11 +111,13 @@ android {
|
|||
productFlavors {
|
||||
fat {
|
||||
dimension "none"
|
||||
buildConfigField "boolean", "USE_PLAY_SERVICES", "false"
|
||||
}
|
||||
gplay {
|
||||
dimension "none"
|
||||
applicationId "chat.delta"
|
||||
apply plugin: "com.google.gms.google-services"
|
||||
buildConfigField "boolean", "USE_PLAY_SERVICES", "true"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -227,11 +227,15 @@ public class ApplicationContext extends MultiDexApplication {
|
|||
fetchWorkRequest);
|
||||
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
|
||||
|
||||
if(Prefs.isPushEnabled(this)) {
|
||||
if (BuildConfig.USE_PLAY_SERVICES) {
|
||||
if (Prefs.isPushEnabled(this)) {
|
||||
FcmReceiveService.register(this);
|
||||
} else {
|
||||
Log.i(TAG, "FCM disabled in user settings");
|
||||
}
|
||||
} else {
|
||||
Log.i(TAG, "FCM disabled at build time");
|
||||
}
|
||||
}
|
||||
|
||||
public JobManager getJobManager() {
|
||||
|
|
|
@ -21,6 +21,7 @@ import androidx.preference.Preference;
|
|||
import android.text.TextUtils;
|
||||
|
||||
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
|
||||
import org.thoughtcrime.securesms.BuildConfig;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.connect.DcHelper;
|
||||
import org.thoughtcrime.securesms.connect.KeepAliveService;
|
||||
|
@ -74,6 +75,7 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
|
|||
|
||||
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) {
|
||||
|
|
|
@ -173,9 +173,7 @@ public class Prefs {
|
|||
}
|
||||
|
||||
public static boolean isPushEnabled(Context context) {
|
||||
// Do not use PUSH for the the default application ID "com.b44t.messenger" which is used eg. used by F-Droid
|
||||
boolean defaultPush = !BuildConfig.APPLICATION_ID.equals("com.b44t.messenger");
|
||||
return getBooleanPreference(context, "pref_push_enabled", defaultPush);
|
||||
return BuildConfig.USE_PLAY_SERVICES && getBooleanPreference(context, "pref_push_enabled", true);
|
||||
}
|
||||
|
||||
public static boolean isHardCompressionEnabled(Context context) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue