Resume account-scoped pending sync after auth restoration
This commit is contained in:
parent
f828253695
commit
24a7967125
|
|
@ -51,6 +51,14 @@ final syncManagerProvider = ChangeNotifierProvider<SyncManager>((ref) {
|
|||
defaultProviderId: 'firebase',
|
||||
);
|
||||
final accountSync = ref.watch(firebaseAccountSyncServiceProvider);
|
||||
|
||||
// The provider is rebuilt when the account UID changes. If the new account
|
||||
// already has persisted auth-blocked work, resume it immediately rather than
|
||||
// waiting for another auth event that may never arrive.
|
||||
if (ref.read(authNotifierProvider).isAuthenticated) {
|
||||
manager.retryAuthRequired();
|
||||
}
|
||||
|
||||
ref.listen<AuthState>(authNotifierProvider, (previous, next) {
|
||||
if (next.isAuthenticated && previous?.isAuthenticated != true) {
|
||||
manager.retryAuthRequired();
|
||||
|
|
|
|||
Loading…
Reference in New Issue