diff --git a/lib/app/app_bootstrap.dart b/lib/app/app_bootstrap.dart index 71e0653..ddf4ece 100644 --- a/lib/app/app_bootstrap.dart +++ b/lib/app/app_bootstrap.dart @@ -33,7 +33,6 @@ class _AppBootstrapState extends State { DefaultExportService(database: database).uploadToServer(); - SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky); }); } diff --git a/lib/app/router.dart b/lib/app/router.dart index 4564d31..eef9bec 100644 --- a/lib/app/router.dart +++ b/lib/app/router.dart @@ -57,8 +57,8 @@ bool _mustBeOnLock(PinLockViewModel pinLockViewModel) { !pinLockViewModel.isPinSet && pinLockViewModel.pinRequired; final isLocked = pinLockViewModel.isPinSet && - !pinLockViewModel.isUnlocked && - pinLockViewModel.pinRequired; + !pinLockViewModel.isUnlocked && + pinLockViewModel.pinRequired; return needsPinSetup || isLocked; } @@ -81,47 +81,49 @@ bool _isDebugShortcutArea(String location) { location.startsWith('/history/'); } -GoRouter createAppRouter( - PinLockViewModel pinLockViewModel, { +GoRouter createAppRouter(PinLockViewModel pinLockViewModel, { required AdminPinViewModel adminPinViewModel, }) { return GoRouter( initialLocation: '/bar', observers: [routeObserver, SentryNavigatorObserver()], refreshListenable: Listenable.merge([pinLockViewModel, adminPinViewModel]), - redirect: (_, state) => _redirectApp( - pinLockViewModel: pinLockViewModel, - adminPinViewModel: adminPinViewModel, - state: state, - ), + redirect: (_, state) => + _redirectApp( + pinLockViewModel: pinLockViewModel, + adminPinViewModel: adminPinViewModel, + state: state, + ), routes: [ GoRoute(path: '/', redirect: (context, state) => '/bar'), GoRoute( path: '/lock', - builder: (context, state) => PinEntryView( - mode: pinLockViewModel.isPinSet - ? PinEntryMode.unlock - : PinEntryMode.create, - onSuccess: () { - context.go("/bar"); - }, - ), + builder: (context, state) => + PinEntryView( + mode: pinLockViewModel.isPinSet + ? PinEntryMode.unlock + : PinEntryMode.create, + onSuccess: () { + context.go("/bar"); + }, + ), ), GoRoute(path: '/bar', builder: (context, state) => const BarScreenView()), GoRoute( path: '/admin/lock', - builder: (context, state) => PinEntryView( - mode: adminPinViewModel.isPinSet - ? PinEntryMode.unlock - : PinEntryMode.create, - isAdmin: true, - onVerify: adminPinViewModel.verify, - onSet: adminPinViewModel.setPin, - errorMessage: () => adminPinViewModel.errorMessage, - onSuccess: () => context.go('/admin'), - ), + builder: (context, state) => + PinEntryView( + mode: adminPinViewModel.isPinSet + ? PinEntryMode.unlock + : PinEntryMode.create, + isAdmin: true, + onVerify: adminPinViewModel.verify, + onSet: adminPinViewModel.setPin, + errorMessage: () => adminPinViewModel.errorMessage, + onSuccess: () => context.go('/admin'), + ), ), GoRoute( diff --git a/lib/models/bar_tab.dart b/lib/models/bar_tab.dart index 4e5344b..7350b62 100644 --- a/lib/models/bar_tab.dart +++ b/lib/models/bar_tab.dart @@ -53,5 +53,3 @@ class BarTab { Object.hashAll(items), ); } - -// _listEquals moved to utils/collection_utils.dart diff --git a/lib/models/closed_tab.dart b/lib/models/closed_tab.dart index e7b101a..36718dd 100644 --- a/lib/models/closed_tab.dart +++ b/lib/models/closed_tab.dart @@ -53,5 +53,3 @@ class ClosedTab { Object.hashAll(items), ); } - -// _listEquals moved to utils/collection_utils.dart diff --git a/lib/services/export_service.dart b/lib/services/export_service.dart index 2df9b62..e7b77e9 100644 --- a/lib/services/export_service.dart +++ b/lib/services/export_service.dart @@ -28,10 +28,10 @@ class DefaultExportService implements ExportService { ); if (response.statusCode != 200 && response.statusCode != 201) { - // Silently fail - this is a non-critical background operation + // Should prob log this one tho } } catch (_) { - // Silently fail - this is a non-critical background operation + // if this fails who cares } } diff --git a/lib/utils/app_config.dart b/lib/utils/app_config.dart index 4e881b4..4f4d80b 100644 --- a/lib/utils/app_config.dart +++ b/lib/utils/app_config.dart @@ -1,2 +1,2 @@ const kUpdateServerUrl = 'https://updater.brammie15.dev'; -const kExportServerUrl = 'https://your-server.com/api/backup'; \ No newline at end of file +const kExportServerUrl = 'https://kooltab.brammie15.dev/api/backup'; \ No newline at end of file diff --git a/lib/utils/app_update_util.dart b/lib/utils/app_update_util.dart index 3e6b0f6..be1ae1c 100644 --- a/lib/utils/app_update_util.dart +++ b/lib/utils/app_update_util.dart @@ -54,14 +54,12 @@ class AppUpdateUtil { AppUpdateUtil({required this.serverUrl}); - /// Gets the installed app version Future currentVersion() async { final info = await PackageInfo.fromPlatform(); debugPrint("Current app version: ${info.version}"); return info.version; } - /// Checks the update server Future checkForUpdate() async { final version = await currentVersion(); diff --git a/lib/viewmodels/pin_lock_view_model.dart b/lib/viewmodels/pin_lock_view_model.dart index a23d8f7..4badc40 100644 --- a/lib/viewmodels/pin_lock_view_model.dart +++ b/lib/viewmodels/pin_lock_view_model.dart @@ -40,7 +40,7 @@ class PinLockViewModel extends ChangeNotifier { await load(); } - /// Checks whether a PIN has already been configured on this device. + // Checks whether a pin has already been configured on this device. Future load() async { if (_isLoading) return; @@ -66,9 +66,6 @@ class PinLockViewModel extends ChangeNotifier { } } - /// Creates a new PIN (first-time setup, or after disabling an old one). - /// Unlocks the app immediately on success, since the person just proved - /// they know it by typing it. Future setPin(String pin) async { _errorMessage = null; @@ -94,7 +91,6 @@ class PinLockViewModel extends ChangeNotifier { } } - /// Checks an entered PIN against the stored one, unlocking on match. Future verify(String pin) async { _errorMessage = null; @@ -118,7 +114,6 @@ class PinLockViewModel extends ChangeNotifier { } } - /// Replaces the current PIN. Requires the current PIN to match first. Future changePin({ required String currentPin, required String newPin, @@ -134,7 +129,6 @@ class PinLockViewModel extends ChangeNotifier { return setPin(newPin); } - /// Removes the PIN entirely. Requires the current PIN to confirm. Future disablePin(String currentPin) async { final matches = await pinLockService.verifyPin(currentPin); @@ -158,9 +152,6 @@ class PinLockViewModel extends ChangeNotifier { return true; } - /// Re-locks the app. Call this on app backgrounding (e.g. from a - /// WidgetsBindingObserver on AppLifecycleState.paused) if you want the - /// PIN required again after the app is put away, not just on cold start. void lock() { if (!_isUnlocked) return; diff --git a/lib/viewmodels/settings_view_model.dart b/lib/viewmodels/settings_view_model.dart index d33d484..6b3ecec 100644 --- a/lib/viewmodels/settings_view_model.dart +++ b/lib/viewmodels/settings_view_model.dart @@ -103,8 +103,6 @@ class SettingsViewModel extends ChangeNotifier { } } - /// Just flips the preference flag. Caller is responsible for having - /// already set/verified the actual PIN via PinLockViewModel first. Future updatePinRequired(bool value) => _save(_settings.copyWith(pinRequired: value));