Workspace selector feature

This commit is contained in:
Ashita Prasad
2024-09-09 04:03:52 +05:30
parent 802d9e4607
commit 59fdbae41d
8 changed files with 273 additions and 81 deletions

View File

@ -10,11 +10,14 @@ import 'app.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
final settingsModel = await getSettingsFromSharedPrefs();
await initApp(settingsModel: settingsModel);
var settingsModel = await getSettingsFromSharedPrefs();
final initStatus = await initApp(settingsModel: settingsModel);
if (kIsDesktop) {
await initWindow(settingsModel: settingsModel);
}
if (!initStatus) {
settingsModel = settingsModel?.copyWithPath(workspaceFolderPath: null);
}
runApp(
ProviderScope(
@ -28,13 +31,22 @@ void main() async {
);
}
Future<void> initApp({SettingsModel? settingsModel}) async {
Future<bool> initApp({SettingsModel? settingsModel}) async {
GoogleFonts.config.allowRuntimeFetching = false;
await openBoxes(
kIsDesktop,
settingsModel?.workspaceFolderPath,
);
await autoClearHistory(settingsModel: settingsModel);
try {
final openBoxesStatus = await openBoxes(
kIsDesktop,
settingsModel?.workspaceFolderPath,
);
debugPrint("openBoxesStatus: $openBoxesStatus");
if (openBoxesStatus) {
await autoClearHistory(settingsModel: settingsModel);
}
return openBoxesStatus;
} catch (e) {
debugPrint("initApp failed due to $e");
return false;
}
}
Future<void> initWindow({