mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 18:03:14 +08:00
Decrease app boot time
We don't need to wait for all the futures, and some can be re-used.
This commit is contained in:
@ -45,13 +45,13 @@ class JournalApp extends StatelessWidget {
|
|||||||
|
|
||||||
localGitRepoConfigured = true;
|
localGitRepoConfigured = true;
|
||||||
|
|
||||||
await pref.setBool("localGitRepoConfigured", localGitRepoConfigured);
|
pref.setBool("localGitRepoConfigured", localGitRepoConfigured);
|
||||||
await pref.setString("localGitRepoPath", localGitRepoPath);
|
pref.setString("localGitRepoPath", localGitRepoPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
var dir = await getGitBaseDirectory();
|
var dir = await getGitBaseDirectory();
|
||||||
|
|
||||||
await Settings.instance.load();
|
Settings.instance.load(pref);
|
||||||
|
|
||||||
runApp(StateContainer(
|
runApp(StateContainer(
|
||||||
localGitRepoConfigured: localGitRepoConfigured,
|
localGitRepoConfigured: localGitRepoConfigured,
|
||||||
|
@ -7,8 +7,7 @@ class Settings {
|
|||||||
Settings._internal();
|
Settings._internal();
|
||||||
static Settings get instance => _singleton;
|
static Settings get instance => _singleton;
|
||||||
|
|
||||||
Future load() async {
|
void load(SharedPreferences pref) {
|
||||||
var pref = await SharedPreferences.getInstance();
|
|
||||||
gitAuthor = pref.getString("gitAuthor") ?? gitAuthor;
|
gitAuthor = pref.getString("gitAuthor") ?? gitAuthor;
|
||||||
gitAuthorEmail = pref.getString("gitAuthorEmail") ?? gitAuthorEmail;
|
gitAuthorEmail = pref.getString("gitAuthorEmail") ?? gitAuthorEmail;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user