Просмотр исходного кода

Merge pull request #664 from ente-io/bug_fixes

Minor improvements and fixes
Ashil 2 лет назад
Родитель
Сommit
1417ceac5a

+ 5 - 1
lib/services/remote_sync_service.dart

@@ -279,10 +279,14 @@ class RemoteSyncService {
         localIDsToSync.removeAll(alreadyClaimedLocalIDs);
       }
 
-      if (localIDsToSync.isEmpty || deviceCollection.collectionID == -1) {
+      if (localIDsToSync.isEmpty) {
         continue;
       }
       await _createCollectionForDevicePath(deviceCollection);
+      if (deviceCollection.collectionID == -1) {
+        _logger.finest('DeviceCollection should not be -1 here');
+        continue;
+      }
 
       moreFilesMarkedForBackup = true;
       await _db.setCollectionIDForUnMappedLocalFiles(

+ 7 - 1
lib/services/user_service.dart

@@ -54,7 +54,13 @@ class UserService {
     emailValueNotifier =
         ValueNotifier<String>(Configuration.instance.getEmail());
     _preferences = await SharedPreferences.getInstance();
-    setTwoFactor(fetchTwoFactorStatus: true).ignore();
+    if (Configuration.instance.isLoggedIn()) {
+      // add artificial delay in refreshing 2FA status
+      Future.delayed(
+        const Duration(seconds: 5),
+        () => {setTwoFactor(fetchTwoFactorStatus: true).ignore()},
+      );
+    }
     Bus.instance.on<TwoFactorStatusChangeEvent>().listen((event) {
       setTwoFactor(value: event.status);
     });

+ 3 - 3
lib/ui/components/toggle_switch_widget.dart

@@ -26,7 +26,7 @@ class ToggleSwitchWidget extends StatefulWidget {
 }
 
 class _ToggleSwitchWidgetState extends State<ToggleSwitchWidget> {
-  late bool toggleValue;
+  bool? toggleValue;
   ExecutionState executionState = ExecutionState.idle;
   final _debouncer = Debouncer(const Duration(milliseconds: 300));
 
@@ -60,7 +60,7 @@ class _ToggleSwitchWidgetState extends State<ToggleSwitchWidget> {
               activeColor: enteColorScheme.primary400,
               inactiveTrackColor: enteColorScheme.fillMuted,
               materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
-              value: toggleValue,
+              value: toggleValue ?? false,
               onChanged: (negationOfToggleValue) async {
                 setState(() {
                   toggleValue = negationOfToggleValue;
@@ -96,7 +96,7 @@ class _ToggleSwitchWidgetState extends State<ToggleSwitchWidget> {
                       });
                     }
                   } else {
-                    toggleValue = !toggleValue;
+                    toggleValue = !toggleValue!;
                     executionState = ExecutionState.idle;
                   }
                 });