diff --git a/lib/repository.dart b/lib/repository.dart index 083f57ed..805c3be6 100644 --- a/lib/repository.dart +++ b/lib/repository.dart @@ -45,6 +45,7 @@ class Repository with ChangeNotifier { String repoPath; SyncStatus syncStatus = SyncStatus.Unknown; + String syncStatusError = ""; int numChanges = 0; bool get hasJournalEntries { @@ -184,6 +185,7 @@ class Repository with ChangeNotifier { } catch (e, stacktrace) { Log.e("Failed to Sync", ex: e, stacktrace: stacktrace); syncStatus = SyncStatus.Error; + syncStatusError = e.toString(); notifyListeners(); if (shouldLogGitException(e)) { await logException(e, stacktrace); diff --git a/lib/widgets/sync_button.dart b/lib/widgets/sync_button.dart index a19e702c..61137d47 100644 --- a/lib/widgets/sync_button.dart +++ b/lib/widgets/sync_button.dart @@ -74,6 +74,17 @@ class _SyncButtonState extends State { ); } + if (repo.syncStatus == SyncStatus.Error) { + return GitPendingChangesBadge( + child: IconButton( + icon: const Icon(Icons.cloud_off), + onPressed: () async { + _syncRepo(); + }, + ), + ); + } + return GitPendingChangesBadge( child: IconButton( icon: Icon(_syncStatusIcon()),