mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-03 01:39:18 +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 {
|
productFlavors {
|
||||||
fat {
|
fat {
|
||||||
dimension "none"
|
dimension "none"
|
||||||
|
buildConfigField "boolean", "USE_PLAY_SERVICES", "false"
|
||||||
}
|
}
|
||||||
gplay {
|
gplay {
|
||||||
dimension "none"
|
dimension "none"
|
||||||
applicationId "chat.delta"
|
applicationId "chat.delta"
|
||||||
apply plugin: "com.google.gms.google-services"
|
apply plugin: "com.google.gms.google-services"
|
||||||
|
buildConfigField "boolean", "USE_PLAY_SERVICES", "true"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -227,10 +227,14 @@ public class ApplicationContext extends MultiDexApplication {
|
||||||
fetchWorkRequest);
|
fetchWorkRequest);
|
||||||
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
|
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
|
||||||
|
|
||||||
if(Prefs.isPushEnabled(this)) {
|
if (BuildConfig.USE_PLAY_SERVICES) {
|
||||||
FcmReceiveService.register(this);
|
if (Prefs.isPushEnabled(this)) {
|
||||||
|
FcmReceiveService.register(this);
|
||||||
|
} else {
|
||||||
|
Log.i(TAG, "FCM disabled in user settings");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.i(TAG, "FCM disabled in user settings");
|
Log.i(TAG, "FCM disabled at build time");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ import androidx.preference.Preference;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
|
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
|
||||||
|
import org.thoughtcrime.securesms.BuildConfig;
|
||||||
import org.thoughtcrime.securesms.R;
|
import org.thoughtcrime.securesms.R;
|
||||||
import org.thoughtcrime.securesms.connect.DcHelper;
|
import org.thoughtcrime.securesms.connect.DcHelper;
|
||||||
import org.thoughtcrime.securesms.connect.KeepAliveService;
|
import org.thoughtcrime.securesms.connect.KeepAliveService;
|
||||||
|
@ -74,6 +75,7 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
|
||||||
|
|
||||||
CheckBoxPreference usePushService = this.findPreference("pref_push_enabled");
|
CheckBoxPreference usePushService = this.findPreference("pref_push_enabled");
|
||||||
usePushService.setChecked(Prefs.isPushEnabled(getContext()));
|
usePushService.setChecked(Prefs.isPushEnabled(getContext()));
|
||||||
|
usePushService.setEnabled(BuildConfig.USE_PLAY_SERVICES);
|
||||||
usePushService.setOnPreferenceChangeListener((preference, newValue) -> {
|
usePushService.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
final boolean enabled = (Boolean) newValue;
|
final boolean enabled = (Boolean) newValue;
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
|
|
|
@ -173,9 +173,7 @@ public class Prefs {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPushEnabled(Context context) {
|
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
|
return BuildConfig.USE_PLAY_SERVICES && getBooleanPreference(context, "pref_push_enabled", true);
|
||||||
boolean defaultPush = !BuildConfig.APPLICATION_ID.equals("com.b44t.messenger");
|
|
||||||
return getBooleanPreference(context, "pref_push_enabled", defaultPush);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isHardCompressionEnabled(Context context) {
|
public static boolean isHardCompressionEnabled(Context context) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue