forked from Nexus/nexus
Try to fix error handling on sync
This commit is contained in:
parent
3cfbe7c078
commit
5154e0fc6b
4 changed files with 35 additions and 18 deletions
|
|
@ -1,11 +1,17 @@
|
|||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||
import "package:nexus/main.dart";
|
||||
import "package:nexus/models/sync_status.dart";
|
||||
|
||||
class SyncStatusController extends Notifier<SyncStatus?> {
|
||||
@override
|
||||
Null build() => null;
|
||||
|
||||
void set(SyncStatus newStatus) => state = newStatus;
|
||||
void set(SyncStatus newStatus) {
|
||||
if (newStatus.type == SyncStatusType.permanentlyFailed) {
|
||||
showError(newStatus.error ?? "Syncing failed");
|
||||
}
|
||||
state = newStatus;
|
||||
}
|
||||
|
||||
static final provider = NotifierProvider<SyncStatusController, SyncStatus?>(
|
||||
SyncStatusController.new,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue