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

docs: fix app_model.dart documentation #345

Merged
merged 1 commit into from
Nov 25, 2024
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
2 changes: 0 additions & 2 deletions lib/data/data_providers/cache_provider.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:hive/hive.dart';
import 'package:flutter_settings_screens/flutter_settings_screens.dart';
import 'package:path_provider/path_provider.dart';
Expand All @@ -11,7 +10,6 @@ class HiveCache extends CacheProvider {

@override
Future<void> init() async {
WidgetsFlutterBinding.ensureInitialized();
if (!kIsWeb) {
final defaultDirectory = await getApplicationSupportDirectory();
_preferences = Hive.box(name: keyName, directory: defaultDirectory.path);
Expand Down
5 changes: 1 addition & 4 deletions lib/data/data_providers/file_system_data_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,7 @@ class FileSystemData {
/// file system paths, excluding PDF files.
Future<Map<String, String>> _getTitleToPath() async {
Map<String, String> titleToPath = {};
if (!Settings.isInitialized) {
await Settings.init(cacheProvider: HiveCache());
}
final libraryPath = Settings.getValue('key-library-path');
final libraryPath = Settings.getValue('key-library-path') ?? 'C:\\אוצריא';
List<String> paths = await getAllBooksPathsFromDirecctory(libraryPath);
for (var path in paths) {
if (path.toLowerCase().endsWith('.pdf')) continue;
Expand Down
3 changes: 3 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ Future<void> createDirs() async {
/// For Windows, defaults to 'C:/אוצריא' if not previously set.
/// For other platforms, uses the existing settings value.
Future<void> initLibraryPath() async {
if (!Settings.isInitialized) {
await Settings.init(cacheProvider: HiveCache());
}
if (Platform.isAndroid || Platform.isIOS) {
// Mobile platforms use the app's documents directory
await Settings.setValue(
Expand Down
Loading