Check to see if FCM is available at app launch.
This commit is contained in:
parent
3f7d0688fc
commit
eea7174f1d
1 changed files with 18 additions and 0 deletions
|
@ -44,6 +44,7 @@ import org.thoughtcrime.securesms.jobs.CreateSignedPreKeyJob;
|
|||
import org.thoughtcrime.securesms.jobs.FcmRefreshJob;
|
||||
import org.thoughtcrime.securesms.jobs.MultiDeviceContactUpdateJob;
|
||||
import org.thoughtcrime.securesms.jobs.PushNotificationReceiveJob;
|
||||
import org.thoughtcrime.securesms.jobs.RefreshAttributesJob;
|
||||
import org.thoughtcrime.securesms.jobs.RefreshPreKeysJob;
|
||||
import org.thoughtcrime.securesms.logging.AndroidLogger;
|
||||
import org.thoughtcrime.securesms.logging.CustomSignalProtocolLogger;
|
||||
|
@ -67,6 +68,7 @@ import org.thoughtcrime.securesms.service.RotateSignedPreKeyListener;
|
|||
import org.thoughtcrime.securesms.service.UpdateApkRefreshListener;
|
||||
import org.thoughtcrime.securesms.storage.StorageSyncHelper;
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags;
|
||||
import org.thoughtcrime.securesms.util.PlayServicesUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.thoughtcrime.securesms.util.concurrent.SignalExecutors;
|
||||
import org.thoughtcrime.securesms.util.dynamiclanguage.DynamicLanguageContextWrapper;
|
||||
|
@ -127,6 +129,7 @@ public class ApplicationContext extends MultiDexApplication implements DefaultLi
|
|||
initializePendingMessages();
|
||||
initializeBlobProvider();
|
||||
initializeCleanup();
|
||||
initializePlayServicesCheck();
|
||||
|
||||
FeatureFlags.init();
|
||||
NotificationChannels.create(this);
|
||||
|
@ -375,6 +378,21 @@ public class ApplicationContext extends MultiDexApplication implements DefaultLi
|
|||
});
|
||||
}
|
||||
|
||||
private void initializePlayServicesCheck() {
|
||||
if (TextSecurePreferences.isFcmDisabled(this)) {
|
||||
PlayServicesUtil.PlayServicesStatus status = PlayServicesUtil.getPlayServicesStatus(this);
|
||||
|
||||
if (status == PlayServicesUtil.PlayServicesStatus.SUCCESS) {
|
||||
Log.i(TAG, "Play Services are newly-available. Updating to use FCM.");
|
||||
|
||||
TextSecurePreferences.setFcmDisabled(this, false);
|
||||
ApplicationDependencies.getJobManager().startChain(new FcmRefreshJob())
|
||||
.then(new RefreshAttributesJob())
|
||||
.enqueue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(DynamicLanguageContextWrapper.updateContext(base, TextSecurePreferences.getLanguage(base)));
|
||||
|
|
Loading…
Add table
Reference in a new issue