Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sadespresso/polishes-0-12-20250216 #358

Merged
merged 2 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,23 @@ void main() async {
WidgetsFlutterBinding.ensureInitialized();

if (Platform.isWindows || Platform.isMacOS || Platform.isLinux) {
startupLog.fine("Initializing window manager");
await windowManager.ensureInitialized();
}

const String debugBuildSuffix = debugBuild ? " (dev)" : "";

unawaited(
PackageInfo.fromPlatform()
.then(
(value) =>
appVersion =
"${value.version}+${value.buildNumber}$debugBuildSuffix",
)
.then((value) {
appVersion = "${value.version}+${value.buildNumber}$debugBuildSuffix";

startupLog.fine("Loaded package info");
startupLog.fine("App version: $appVersion");
startupLog.fine("Store: ${value.installerStore}");

return appVersion;
})
.catchError((e) {
startupLog.warning(
"An error was occured while fetching app version",
Expand All @@ -101,13 +106,17 @@ void main() async {
FlowLocalizations.printMissingKeys();
}

startupLog.fine("Initializing ObjectBox database");

/// [ObjectBox] MUST initialize before [LocalPreferences] because prefs
/// access [ObjectBox] upon initialization.
await ObjectBox.initialize();
startupLog.fine("Initializing local preferences (shared prefs)");
await LocalPreferences.initialize();

/// Set `sortOrder` values if there are any unset (-1) values
await ObjectBox().updateAccountOrderList(ignoreIfNoUnsetValue: true);
startupLog.fine("Updating account order list");

unawaited(
NotificationsService().initialize().then((_) {
Expand All @@ -118,26 +127,33 @@ void main() async {
);
if (UserPreferencesService().remindDailyAt
case Duration requireRemindAt) {
startupLog.info(
"Scheduling daily reminder notifications at ${requireRemindAt.inMinutes} minutes past midnight",
);
unawaited(
NotificationsService()
.scheduleDailyReminder(requireRemindAt)
.catchError((error) {
startupLog.severe(
"Failed to schedule reminder notifications",
"Failed to schedule daily reminder notifications",
error,
);
}),
);
} else {
startupLog.fine("No daily reminder set, skipping scheduling");
}
}),
);

startupLog.fine("Clearing stale transactions from trash bin");
unawaited(
TransactionsService().clearStaleTrashBinEntries().catchError((error) {
startupLog.severe("Failed to clear stale trash bin entries", error);
}),
);

startupLog.fine("Initializing exchange rates service");
ExchangeRatesService().init();

try {
Expand All @@ -153,11 +169,13 @@ void main() async {
}

try {
startupLog.fine("Initializing user preferences service");
UserPreferencesService().initialize();
} catch (e) {
startupLog.severe("Failed to initialize UserPreferencesService", e);
}

startupLog.fine("Finally telling Flutter to run the app widget");
runApp(const Flow());
}

Expand Down
32 changes: 6 additions & 26 deletions lib/routes/export/export_history_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import "package:flow/objectbox.dart";
import "package:flow/objectbox/objectbox.g.dart";
import "package:flow/widgets/export/export_history/backup_entry_card.dart";
import "package:flow/widgets/export/export_history/no_backups.dart";
import "package:flow/widgets/general/frame.dart";
import "package:flow/widgets/general/spinner.dart";
import "package:flutter/material.dart";
import "package:flutter_slidable/flutter_slidable.dart";
import "package:go_router/go_router.dart";

class ExportHistoryPage extends StatefulWidget {
const ExportHistoryPage({super.key});
Expand Down Expand Up @@ -42,31 +40,13 @@ class _ExportHistoryPageState extends State<ExportHistoryPage> {
(0, true) => const NoBackups(),
(_, true) => SlidableAutoCloseBehavior(
child: ListView.separated(
itemBuilder: (context, index) {
if (index == backupEntires.length) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 16.0),
Frame(
child: Align(
alignment: Alignment.topRight,
child: TextButton(
onPressed: () => context.push("/_debug/logs"),
child: Text("View debug logs"),
),
),
),
],
);
}
return BackupEntryCard(
entry: backupEntires[index],
dismissibleKey: ValueKey(backupEntires[index].id),
);
},
itemBuilder:
(context, index) => BackupEntryCard(
entry: backupEntires[index],
dismissibleKey: ValueKey(backupEntires[index].id),
),
separatorBuilder: (context, index) => separator,
itemCount: backupEntires!.length + 1,
itemCount: backupEntires!.length,
),
),
(_, false) => const Spinner.center(),
Expand Down
11 changes: 11 additions & 0 deletions lib/routes/preferences_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import "package:flow/services/notifications.dart";
import "package:flow/theme/color_themes/registry.dart";
import "package:flow/theme/flow_color_scheme.dart";
import "package:flow/theme/names.dart";
import "package:flow/widgets/general/frame.dart";
import "package:flow/widgets/general/list_header.dart";
import "package:flow/widgets/select_currency_sheet.dart";
import "package:flutter/material.dart" hide Flow;
Expand Down Expand Up @@ -174,6 +175,16 @@ class PreferencesPageState extends State<PreferencesPage> {
const SizedBox(height: 8.0),
const Haptics(),
const SizedBox(height: 16.0),
Frame(
child: Align(
alignment: Alignment.topRight,
child: TextButton(
onPressed: () => context.push("/_debug/logs"),
child: Text("View debug logs"),
),
),
),
const SizedBox(height: 16.0),
],
),
),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: A personal finance managing app

publish_to: "none" # Remove this line if you wish to publish to pub.dev

version: "0.12.1+144"
version: "0.12.1+145"

environment:
sdk: ">=3.7.0 <4.0.0"
Expand Down