mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-23 20:48:43 +00:00
Improve FCM check clock skew handling.
This commit is contained in:
@@ -386,9 +386,11 @@ public class ApplicationContext extends MultiDexApplication implements AppForegr
|
|||||||
|
|
||||||
private void initializeFcmCheck() {
|
private void initializeFcmCheck() {
|
||||||
if (SignalStore.account().isRegistered()) {
|
if (SignalStore.account().isRegistered()) {
|
||||||
long nextSetTime = SignalStore.account().getFcmTokenLastSetTime() + TimeUnit.HOURS.toMillis(6);
|
long lastSetTime = SignalStore.account().getFcmTokenLastSetTime();
|
||||||
|
long nextSetTime = lastSetTime + TimeUnit.HOURS.toMillis(6);
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
|
|
||||||
if (SignalStore.account().getFcmToken() == null || nextSetTime <= System.currentTimeMillis()) {
|
if (SignalStore.account().getFcmToken() == null || nextSetTime <= now || lastSetTime > now) {
|
||||||
AppDependencies.getJobManager().add(new FcmRefreshJob());
|
AppDependencies.getJobManager().add(new FcmRefreshJob());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user