fix: comments were kinda ass

This commit is contained in:
2026-09-16 22:33:14 +02:00
parent f6d7c21691
commit 33d9ae11d8
9 changed files with 33 additions and 49 deletions
-1
View File
@@ -33,7 +33,6 @@ class _AppBootstrapState extends State<AppBootstrap> {
DefaultExportService(database: database).uploadToServer();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
});
}
+29 -27
View File
@@ -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(
-2
View File
@@ -53,5 +53,3 @@ class BarTab {
Object.hashAll(items),
);
}
// _listEquals moved to utils/collection_utils.dart
-2
View File
@@ -53,5 +53,3 @@ class ClosedTab {
Object.hashAll(items),
);
}
// _listEquals moved to utils/collection_utils.dart
+2 -2
View File
@@ -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
}
}
+1 -1
View File
@@ -1,2 +1,2 @@
const kUpdateServerUrl = 'https://updater.brammie15.dev';
const kExportServerUrl = 'https://your-server.com/api/backup';
const kExportServerUrl = 'https://kooltab.brammie15.dev/api/backup';
-2
View File
@@ -54,14 +54,12 @@ class AppUpdateUtil {
AppUpdateUtil({required this.serverUrl});
/// Gets the installed app version
Future<String> currentVersion() async {
final info = await PackageInfo.fromPlatform();
debugPrint("Current app version: ${info.version}");
return info.version;
}
/// Checks the update server
Future<UpdateInfo?> checkForUpdate() async {
final version = await currentVersion();
+1 -10
View File
@@ -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<void> 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<bool> 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<bool> 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<bool> 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<bool> 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;
-2
View File
@@ -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<void> updatePinRequired(bool value) =>
_save(_settings.copyWith(pinRequired: value));