mirror of
https://github.com/foss42/apidash.git
synced 2025-05-28 20:27:04 +08:00
Workspace selector feature
This commit is contained in:
@ -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({
|
||||
|
Reference in New Issue
Block a user