0
0
Fork 0
mirror of https://github.com/YTVanced/VancedMicroG synced 2024-11-16 16:25:12 +00:00

updated checkin

This commit is contained in:
X1nto 2020-07-27 21:10:05 +04:00
parent 75a93f052e
commit 9b7680f915
6 changed files with 2 additions and 6 deletions

View file

@ -33,8 +33,6 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import static org.microg.gms.checkin.TriggerReceiver.PREF_ENABLE_CHECKIN;
public class CheckinManager { public class CheckinManager {
private static final long MIN_CHECKIN_INTERVAL = 3 * 60 * 60 * 1000; // 3 hours private static final long MIN_CHECKIN_INTERVAL = 3 * 60 * 60 * 1000; // 3 hours
@ -43,7 +41,7 @@ public class CheckinManager {
LastCheckinInfo info = LastCheckinInfo.read(context); LastCheckinInfo info = LastCheckinInfo.read(context);
if (!force && info.lastCheckin > System.currentTimeMillis() - MIN_CHECKIN_INTERVAL) if (!force && info.lastCheckin > System.currentTimeMillis() - MIN_CHECKIN_INTERVAL)
return null; return null;
if (!PreferenceManager.getDefaultSharedPreferences(context).getBoolean(PREF_ENABLE_CHECKIN, true)) if (!CheckinPrefs.get(context).isEnabled())
return null; return null;
List<CheckinClient.Account> accounts = new ArrayList<CheckinClient.Account>(); List<CheckinClient.Account> accounts = new ArrayList<CheckinClient.Account>();
AccountManager accountManager = AccountManager.get(context); AccountManager accountManager = AccountManager.get(context);

View file

@ -34,8 +34,6 @@ import org.microg.gms.common.ForegroundServiceContext;
import org.microg.gms.gcm.McsService; import org.microg.gms.gcm.McsService;
import org.microg.gms.people.PeopleManager; import org.microg.gms.people.PeopleManager;
import static org.microg.gms.checkin.TriggerReceiver.PREF_ENABLE_CHECKIN;
public class CheckinService extends IntentService { public class CheckinService extends IntentService {
private static final String TAG = "GmsCheckinSvc"; private static final String TAG = "GmsCheckinSvc";
public static final String BIND_ACTION = "com.google.android.gms.checkin.BIND_TO_SERVICE"; public static final String BIND_ACTION = "com.google.android.gms.checkin.BIND_TO_SERVICE";
@ -58,7 +56,7 @@ public class CheckinService extends IntentService {
protected void onHandleIntent(Intent intent) { protected void onHandleIntent(Intent intent) {
try { try {
ForegroundServiceContext.completeForegroundService(this, intent, TAG); ForegroundServiceContext.completeForegroundService(this, intent, TAG);
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(PREF_ENABLE_CHECKIN, true)) { if (CheckinPrefs.get(this).isEnabled()) {
LastCheckinInfo info = CheckinManager.checkin(this, intent.getBooleanExtra(EXTRA_FORCE_CHECKIN, false)); LastCheckinInfo info = CheckinManager.checkin(this, intent.getBooleanExtra(EXTRA_FORCE_CHECKIN, false));
if (info != null) { if (info != null) {
Log.d(TAG, "Checked in as " + Long.toHexString(info.androidId)); Log.d(TAG, "Checked in as " + Long.toHexString(info.androidId));