mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
disable push notifications setting if apk was built without support
This commit is contained in:
@@ -227,10 +227,14 @@ public class ApplicationContext extends MultiDexApplication {
|
||||
fetchWorkRequest);
|
||||
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
|
||||
|
||||
if(Prefs.isPushEnabled(this)) {
|
||||
FcmReceiveService.register(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 in user settings");
|
||||
Log.i(TAG, "FCM disabled at build time");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user