mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 01:45:55 +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;
|
||||
|
||||
await pref.setBool("localGitRepoConfigured", localGitRepoConfigured);
|
||||
await pref.setString("localGitRepoPath", localGitRepoPath);
|
||||
pref.setBool("localGitRepoConfigured", localGitRepoConfigured);
|
||||
pref.setString("localGitRepoPath", localGitRepoPath);
|
||||
}
|
||||
|
||||
var dir = await getGitBaseDirectory();
|
||||
|
||||
await Settings.instance.load();
|
||||
Settings.instance.load(pref);
|
||||
|
||||
runApp(StateContainer(
|
||||
localGitRepoConfigured: localGitRepoConfigured,
|
||||
|
@ -7,8 +7,7 @@ class Settings {
|
||||
Settings._internal();
|
||||
static Settings get instance => _singleton;
|
||||
|
||||
Future load() async {
|
||||
var pref = await SharedPreferences.getInstance();
|
||||
void load(SharedPreferences pref) {
|
||||
gitAuthor = pref.getString("gitAuthor") ?? gitAuthor;
|
||||
gitAuthorEmail = pref.getString("gitAuthorEmail") ?? gitAuthorEmail;
|
||||
}
|
||||
|
Reference in New Issue
Block a user