mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 20:15:21 +00:00
fix: forcing the registration will cancel and restart the FCM task
This commit is contained in:
parent
1b417362ae
commit
1ecc87da76
@ -447,7 +447,10 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void registerForFCMIfNeeded(final Boolean force) {
|
public void registerForFCMIfNeeded(final Boolean force) {
|
||||||
if (firebaseInstanceIdJob != null && firebaseInstanceIdJob.isActive()) return;
|
if (firebaseInstanceIdJob != null && firebaseInstanceIdJob.isActive() && !force) return;
|
||||||
|
if (force && firebaseInstanceIdJob != null) {
|
||||||
|
firebaseInstanceIdJob.cancel(null);
|
||||||
|
}
|
||||||
firebaseInstanceIdJob = FcmUtils.getFcmInstanceId(task->{
|
firebaseInstanceIdJob = FcmUtils.getFcmInstanceId(task->{
|
||||||
if (!task.isSuccessful()) {
|
if (!task.isSuccessful()) {
|
||||||
Log.w("Loki", "FirebaseInstanceId.getInstance().getInstanceId() failed." + task.getException());
|
Log.w("Loki", "FirebaseInstanceId.getInstance().getInstanceId() failed." + task.getException());
|
||||||
|
Loading…
Reference in New Issue
Block a user