Check backups state whenever the app is brought to foreground.

This commit is contained in:
Alex Hart
2024-10-04 14:11:22 -03:00
committed by Greyson Parrelli
parent 5bc8435d25
commit 8c63977775
2 changed files with 6 additions and 0 deletions

View File

@@ -53,6 +53,7 @@ import org.thoughtcrime.securesms.emoji.EmojiSource;
import org.thoughtcrime.securesms.emoji.JumboEmoji;
import org.thoughtcrime.securesms.gcm.FcmFetchManager;
import org.thoughtcrime.securesms.jobs.AccountConsistencyWorkerJob;
import org.thoughtcrime.securesms.jobs.BackupSubscriptionCheckJob;
import org.thoughtcrime.securesms.jobs.BuildExpirationConfirmationJob;
import org.thoughtcrime.securesms.jobs.CheckServiceReachabilityJob;
import org.thoughtcrime.securesms.jobs.DownloadLatestEmojiDataJob;
@@ -254,6 +255,10 @@ public class ApplicationContext extends Application implements AppForegroundObse
checkBuildExpiration();
MemoryTracker.start();
if (RemoteConfig.messageBackups()) {
AppDependencies.getJobManager().add(BackupSubscriptionCheckJob.create());
}
long lastForegroundTime = SignalStore.misc().getLastForegroundTime();
long currentTime = System.currentTimeMillis();
long timeDiff = currentTime - lastForegroundTime;

View File

@@ -29,6 +29,7 @@ class BackupSubscriptionCheckJob private constructor(parameters: Parameters) : C
const val KEY = "BackupSubscriptionCheckJob"
@JvmStatic
fun create(): BackupSubscriptionCheckJob {
return BackupSubscriptionCheckJob(
Parameters.Builder()