mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-07-15 07:56:11 +08:00
Hookup onBoarding screen to app
* I should probably stop calling in an onboarding screen, since it's now just a way to setup sync. * It overall feels quite ugly, and unpolished.
This commit is contained in:
@ -10,9 +10,10 @@ import 'package:journal/appstate.dart';
|
||||
import 'package:journal/note.dart';
|
||||
import 'package:journal/storage/notes_repository.dart';
|
||||
import 'package:journal/storage/git_storage.dart';
|
||||
import 'package:journal/apis/git.dart';
|
||||
import 'package:journal/datetime_utils.dart';
|
||||
|
||||
import 'package:journal/apis/git_migration.dart';
|
||||
|
||||
class StateContainer extends StatefulWidget {
|
||||
final Widget child;
|
||||
final bool localGitRepoConfigured;
|
||||
@ -185,20 +186,27 @@ class StateContainerState extends State<StateContainer> {
|
||||
}
|
||||
|
||||
void completeOnBoarding() {
|
||||
setState(() {
|
||||
//this.appState.onBoardingCompleted = true;
|
||||
setState(() async {
|
||||
this.appState.remoteGitRepoConfigured = true;
|
||||
this.appState.remoteGitRepoPath = "journal";
|
||||
|
||||
_persistOnBoardingCompleted();
|
||||
await migrateGitRepo(
|
||||
fromGitBasePath: appState.localGitRepoPath,
|
||||
toGitBasePath: appState.localGitRepoPath,
|
||||
gitBasePath: appState.gitBaseDirectory,
|
||||
);
|
||||
|
||||
noteRepo = new GitNoteRepository(
|
||||
baseDirectory: appState.gitBaseDirectory,
|
||||
dirName: appState.remoteGitRepoPath,
|
||||
);
|
||||
|
||||
_persistConfig();
|
||||
_loadNotesFromDisk();
|
||||
_syncNotes();
|
||||
});
|
||||
}
|
||||
|
||||
void _persistOnBoardingCompleted() async {
|
||||
var pref = await SharedPreferences.getInstance();
|
||||
pref.setBool("onBoardingCompleted", true);
|
||||
}
|
||||
|
||||
Future _persistConfig() async {
|
||||
var pref = await SharedPreferences.getInstance();
|
||||
await pref.setBool(
|
||||
|
Reference in New Issue
Block a user