Merge pull request #793 from mpretty-cyro/fix/early-push-registration

Fixed an incorrect push registration
This commit is contained in:
RyanZhao 2023-02-21 16:07:55 +11:00 committed by GitHub
commit 4404dda331
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,8 +20,11 @@ public enum SyncPushTokensJob: JobExecutor {
failure: @escaping (Job, Error?, Bool) -> (),
deferred: @escaping (Job) -> ()
) {
// Don't run when inactive or not in main app
guard (UserDefaults.sharedLokiProject?[.isMainAppActive]).defaulting(to: false) else {
// Don't run when inactive or not in main app or if the user doesn't exist yet
guard
(UserDefaults.sharedLokiProject?[.isMainAppActive]).defaulting(to: false),
Identity.userExists()
else {
deferred(job) // Don't need to do anything if it's not the main app
return
}