mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2024-12-24 03:35:50 +01:00
Attempt to fix registration service...again
This commit is contained in:
parent
a511289a6d
commit
4daa2a0e38
@ -18,6 +18,7 @@ import java.io.File;
|
||||
|
||||
public class CheckinPrefs implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
public static final String PREF_ENABLE_CHECKIN = "checkin_enable_service";
|
||||
public static final String START_PREF_ENABLE_CHECKIN = "start_checkin_enable_service";
|
||||
private static CheckinPrefs INSTANCE;
|
||||
|
||||
public static CheckinPrefs get(Context context) {
|
||||
@ -33,7 +34,7 @@ public class CheckinPrefs implements SharedPreferences.OnSharedPreferenceChangeL
|
||||
|
||||
private SharedPreferences preferences;
|
||||
private SharedPreferences systemDefaultPreferences;
|
||||
private boolean checkinEnabled = true;
|
||||
private boolean checkinEnabled = false;
|
||||
|
||||
private CheckinPrefs(Context context) {
|
||||
if (context != null) {
|
||||
@ -68,8 +69,17 @@ public class CheckinPrefs implements SharedPreferences.OnSharedPreferenceChangeL
|
||||
}
|
||||
|
||||
public static void setEnabled(Context context, boolean newStatus) {
|
||||
boolean changed = CheckinPrefs.get(context).isEnabled() != newStatus;
|
||||
PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean(PREF_ENABLE_CHECKIN, newStatus).commit();
|
||||
boolean changed = false;
|
||||
if (!PreferenceManager.getDefaultSharedPreferences(context).getBoolean(START_PREF_ENABLE_CHECKIN, true)) {
|
||||
changed = CheckinPrefs.get(context).isEnabled() != newStatus;
|
||||
} else {
|
||||
if (CheckinPrefs.get(context).isEnabled()) {
|
||||
changed = true;
|
||||
}
|
||||
PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean(START_PREF_ENABLE_CHECKIN, false).apply();
|
||||
}
|
||||
PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean(PREF_ENABLE_CHECKIN, newStatus).apply();
|
||||
|
||||
if (!changed) return;
|
||||
if (newStatus) {
|
||||
context.sendOrderedBroadcast(new Intent(context, TriggerReceiver.class), null);
|
||||
|
@ -65,7 +65,7 @@ public class GcmPrefs implements SharedPreferences.OnSharedPreferenceChangeListe
|
||||
private boolean gcmLogEnabled = true;
|
||||
private String lastPersistedId = "";
|
||||
private boolean confirmNewApps = false;
|
||||
private boolean gcmEnabled = true;
|
||||
private boolean gcmEnabled = false;
|
||||
|
||||
private int networkMobile = 0;
|
||||
private int networkWifi = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user