fix: comments were kinda ass
This commit is contained in:
@@ -33,7 +33,6 @@ class _AppBootstrapState extends State<AppBootstrap> {
|
|||||||
|
|
||||||
DefaultExportService(database: database).uploadToServer();
|
DefaultExportService(database: database).uploadToServer();
|
||||||
|
|
||||||
|
|
||||||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
|
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-5
@@ -81,15 +81,15 @@ bool _isDebugShortcutArea(String location) {
|
|||||||
location.startsWith('/history/');
|
location.startsWith('/history/');
|
||||||
}
|
}
|
||||||
|
|
||||||
GoRouter createAppRouter(
|
GoRouter createAppRouter(PinLockViewModel pinLockViewModel, {
|
||||||
PinLockViewModel pinLockViewModel, {
|
|
||||||
required AdminPinViewModel adminPinViewModel,
|
required AdminPinViewModel adminPinViewModel,
|
||||||
}) {
|
}) {
|
||||||
return GoRouter(
|
return GoRouter(
|
||||||
initialLocation: '/bar',
|
initialLocation: '/bar',
|
||||||
observers: [routeObserver, SentryNavigatorObserver()],
|
observers: [routeObserver, SentryNavigatorObserver()],
|
||||||
refreshListenable: Listenable.merge([pinLockViewModel, adminPinViewModel]),
|
refreshListenable: Listenable.merge([pinLockViewModel, adminPinViewModel]),
|
||||||
redirect: (_, state) => _redirectApp(
|
redirect: (_, state) =>
|
||||||
|
_redirectApp(
|
||||||
pinLockViewModel: pinLockViewModel,
|
pinLockViewModel: pinLockViewModel,
|
||||||
adminPinViewModel: adminPinViewModel,
|
adminPinViewModel: adminPinViewModel,
|
||||||
state: state,
|
state: state,
|
||||||
@@ -98,7 +98,8 @@ GoRouter createAppRouter(
|
|||||||
GoRoute(path: '/', redirect: (context, state) => '/bar'),
|
GoRoute(path: '/', redirect: (context, state) => '/bar'),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/lock',
|
path: '/lock',
|
||||||
builder: (context, state) => PinEntryView(
|
builder: (context, state) =>
|
||||||
|
PinEntryView(
|
||||||
mode: pinLockViewModel.isPinSet
|
mode: pinLockViewModel.isPinSet
|
||||||
? PinEntryMode.unlock
|
? PinEntryMode.unlock
|
||||||
: PinEntryMode.create,
|
: PinEntryMode.create,
|
||||||
@@ -112,7 +113,8 @@ GoRouter createAppRouter(
|
|||||||
|
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/admin/lock',
|
path: '/admin/lock',
|
||||||
builder: (context, state) => PinEntryView(
|
builder: (context, state) =>
|
||||||
|
PinEntryView(
|
||||||
mode: adminPinViewModel.isPinSet
|
mode: adminPinViewModel.isPinSet
|
||||||
? PinEntryMode.unlock
|
? PinEntryMode.unlock
|
||||||
: PinEntryMode.create,
|
: PinEntryMode.create,
|
||||||
|
|||||||
@@ -53,5 +53,3 @@ class BarTab {
|
|||||||
Object.hashAll(items),
|
Object.hashAll(items),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// _listEquals moved to utils/collection_utils.dart
|
|
||||||
|
|||||||
@@ -53,5 +53,3 @@ class ClosedTab {
|
|||||||
Object.hashAll(items),
|
Object.hashAll(items),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// _listEquals moved to utils/collection_utils.dart
|
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ class DefaultExportService implements ExportService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (response.statusCode != 200 && response.statusCode != 201) {
|
if (response.statusCode != 200 && response.statusCode != 201) {
|
||||||
// Silently fail - this is a non-critical background operation
|
// Should prob log this one tho
|
||||||
}
|
}
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
// Silently fail - this is a non-critical background operation
|
// if this fails who cares
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
const kUpdateServerUrl = 'https://updater.brammie15.dev';
|
const kUpdateServerUrl = 'https://updater.brammie15.dev';
|
||||||
const kExportServerUrl = 'https://your-server.com/api/backup';
|
const kExportServerUrl = 'https://kooltab.brammie15.dev/api/backup';
|
||||||
@@ -54,14 +54,12 @@ class AppUpdateUtil {
|
|||||||
|
|
||||||
AppUpdateUtil({required this.serverUrl});
|
AppUpdateUtil({required this.serverUrl});
|
||||||
|
|
||||||
/// Gets the installed app version
|
|
||||||
Future<String> currentVersion() async {
|
Future<String> currentVersion() async {
|
||||||
final info = await PackageInfo.fromPlatform();
|
final info = await PackageInfo.fromPlatform();
|
||||||
debugPrint("Current app version: ${info.version}");
|
debugPrint("Current app version: ${info.version}");
|
||||||
return info.version;
|
return info.version;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks the update server
|
|
||||||
Future<UpdateInfo?> checkForUpdate() async {
|
Future<UpdateInfo?> checkForUpdate() async {
|
||||||
final version = await currentVersion();
|
final version = await currentVersion();
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class PinLockViewModel extends ChangeNotifier {
|
|||||||
await load();
|
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 {
|
Future<void> load() async {
|
||||||
if (_isLoading) return;
|
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 {
|
Future<bool> setPin(String pin) async {
|
||||||
_errorMessage = null;
|
_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 {
|
Future<bool> verify(String pin) async {
|
||||||
_errorMessage = null;
|
_errorMessage = null;
|
||||||
|
|
||||||
@@ -118,7 +114,6 @@ class PinLockViewModel extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Replaces the current PIN. Requires the current PIN to match first.
|
|
||||||
Future<bool> changePin({
|
Future<bool> changePin({
|
||||||
required String currentPin,
|
required String currentPin,
|
||||||
required String newPin,
|
required String newPin,
|
||||||
@@ -134,7 +129,6 @@ class PinLockViewModel extends ChangeNotifier {
|
|||||||
return setPin(newPin);
|
return setPin(newPin);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Removes the PIN entirely. Requires the current PIN to confirm.
|
|
||||||
Future<bool> disablePin(String currentPin) async {
|
Future<bool> disablePin(String currentPin) async {
|
||||||
final matches = await pinLockService.verifyPin(currentPin);
|
final matches = await pinLockService.verifyPin(currentPin);
|
||||||
|
|
||||||
@@ -158,9 +152,6 @@ class PinLockViewModel extends ChangeNotifier {
|
|||||||
return true;
|
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() {
|
void lock() {
|
||||||
if (!_isUnlocked) return;
|
if (!_isUnlocked) return;
|
||||||
|
|
||||||
|
|||||||
@@ -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) =>
|
Future<void> updatePinRequired(bool value) =>
|
||||||
_save(_settings.copyWith(pinRequired: value));
|
_save(_settings.copyWith(pinRequired: value));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user