diff --git a/lib/screens/onboarding_screens.dart b/lib/screens/onboarding_screens.dart index 465479c7..fff93fed 100644 --- a/lib/screens/onboarding_screens.dart +++ b/lib/screens/onboarding_screens.dart @@ -135,7 +135,7 @@ class OnBoardingScreenState extends State { ); var appState = StateContainer.of(context).appState; - _startGitClone(appState.gitBaseDirectory); + _startGitClone(context, appState.gitBaseDirectory); getAnalytics().logEvent( name: "onboarding_public_key_copied", @@ -276,7 +276,7 @@ class OnBoardingScreenState extends State { } } - void _startGitClone(String basePath) async { + void _startGitClone(BuildContext context, String basePath) async { // Just in case it was half cloned because of an error await _removeExistingClone(basePath); @@ -296,15 +296,17 @@ class OnBoardingScreenState extends State { name: "onboarding_complete", parameters: {}, ); + Navigator.pop(context); this.widget.onBoardingCompletedFunction(); } } Future _removeExistingClone(String baseDirPath) async { - var baseDir = new Directory(baseDirPath); - var dotGitDir = new Directory(p.join(baseDir.path, "journal", ".git")); + var baseDir = new Directory(p.join(baseDirPath, "journal")); + var dotGitDir = new Directory(p.join(baseDir.path, ".git")); bool exists = await dotGitDir.exists(); if (exists) { + print("Removing " + baseDir.path); await baseDir.delete(recursive: true); await baseDir.create(); } diff --git a/lib/state_container.dart b/lib/state_container.dart index 635e907a..632e97fb 100644 --- a/lib/state_container.dart +++ b/lib/state_container.dart @@ -192,7 +192,7 @@ class StateContainerState extends State { await migrateGitRepo( fromGitBasePath: appState.localGitRepoPath, - toGitBasePath: appState.localGitRepoPath, + toGitBasePath: appState.remoteGitRepoPath, gitBasePath: appState.gitBaseDirectory, ); @@ -201,7 +201,7 @@ class StateContainerState extends State { dirName: appState.remoteGitRepoPath, ); - _persistConfig(); + await _persistConfig(); _loadNotesFromDisk(); _syncNotes(); }); diff --git a/lib/storage/git_storage.dart b/lib/storage/git_storage.dart index a312317e..29e9bdc7 100644 --- a/lib/storage/git_storage.dart +++ b/lib/storage/git_storage.dart @@ -12,7 +12,7 @@ import 'package:journal/storage/notes_repository.dart'; class GitNoteRepository implements NoteRepository { final FileStorage _fileStorage; - final String gitCloneUrl = ""; + //final String gitCloneUrl = ""; final String dirName; bool cloned = false; @@ -85,6 +85,9 @@ class GitNoteRepository implements NoteRepository { @override Future sync() async { + /* + Disable git clone for now - The repo should have already been cloned! + if (gitCloneUrl == null || gitCloneUrl.isEmpty) { print("Cannot sync because of lack of clone url"); return false; @@ -103,6 +106,7 @@ class GitNoteRepository implements NoteRepository { cloned = true; return true; } + */ try { await gitPull(this.dirName);