couple small fixes

This commit is contained in:
julian 2024-06-05 17:56:10 -06:00
parent e9063dbc0f
commit eb13c2dc00
2 changed files with 35 additions and 32 deletions

View file

@ -16,6 +16,8 @@ import 'package:crypto/crypto.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import '../app_config.dart';
import '../db/isar/main_db.dart'; import '../db/isar/main_db.dart';
import '../models/isar/stack_theme.dart'; import '../models/isar/stack_theme.dart';
import '../networking/http.dart'; import '../networking/http.dart';
@ -145,37 +147,38 @@ class ThemeService {
); );
} }
} }
if (AppConfig.hasFeature(AppFeature.themeSelection)) {
if (!(await ThemeService.instance.verifyInstalled(themeId: "dark"))) { if (!(await ThemeService.instance.verifyInstalled(themeId: "dark"))) {
Logging.instance.log( Logging.instance.log(
"Installing default dark theme... ", "Installing default dark theme... ",
level: LogLevel.Info, level: LogLevel.Info,
); );
final darkZip = await rootBundle.load("assets/default_themes/dark.zip"); final darkZip = await rootBundle.load("assets/default_themes/dark.zip");
await ThemeService.instance await ThemeService.instance
.install(themeArchiveData: darkZip.buffer.asUint8List()); .install(themeArchiveData: darkZip.buffer.asUint8List());
Logging.instance.log( Logging.instance.log(
"Installing default dark theme... finished", "Installing default dark theme... finished",
level: LogLevel.Info, level: LogLevel.Info,
); );
} else { } else {
// check installed version // check installed version
// final theme = ThemeService.instance.getTheme(themeId: "dark"); // final theme = ThemeService.instance.getTheme(themeId: "dark");
// Force update theme to add missing icons for now // Force update theme to add missing icons for now
// TODO: uncomment if statement in future when themes are version 4 or above // TODO: uncomment if statement in future when themes are version 4 or above
// if ((theme?.version ?? 1) < _currentDefaultThemeVersion) { // if ((theme?.version ?? 1) < _currentDefaultThemeVersion) {
Logging.instance.log( Logging.instance.log(
"Updating default dark theme...", "Updating default dark theme...",
level: LogLevel.Info, level: LogLevel.Info,
); );
final darkZip = await rootBundle.load("assets/default_themes/dark.zip"); final darkZip = await rootBundle.load("assets/default_themes/dark.zip");
await ThemeService.instance await ThemeService.instance
.install(themeArchiveData: darkZip.buffer.asUint8List()); .install(themeArchiveData: darkZip.buffer.asUint8List());
Logging.instance.log( Logging.instance.log(
"Updating default dark theme... finished", "Updating default dark theme... finished",
level: LogLevel.Info, level: LogLevel.Info,
); );
// } // }
}
} }
} }

View file

@ -123,7 +123,7 @@ abstract class StackFileSystem {
if (Util.isDesktop) { if (Util.isDesktop) {
final dir = Directory("${root.path}/sqlite/firo_cache"); final dir = Directory("${root.path}/sqlite/firo_cache");
if (!dir.existsSync()) { if (!dir.existsSync()) {
await dir.create(); await dir.create(recursive: true);
} }
return dir; return dir;
} else { } else {