diff --git a/lib/app.dart b/lib/app.dart index b1d2ed9b..4ab946a0 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -329,7 +329,10 @@ class _JournalAppState extends State { case '/settings': return SettingsScreen(); case '/setupRemoteGit': - return GitHostSetupScreen(stateContainer.completeGitHostSetup); + return GitHostSetupScreen( + "journal", + stateContainer.completeGitHostSetup, + ); case '/onBoarding': return OnBoardingScreen(stateContainer.completeOnBoarding); case '/purchase': diff --git a/lib/setup/screens.dart b/lib/setup/screens.dart index d87d750e..5a18d489 100644 --- a/lib/setup/screens.dart +++ b/lib/setup/screens.dart @@ -27,9 +27,10 @@ import 'loading_error.dart'; import 'sshkey.dart'; class GitHostSetupScreen extends StatefulWidget { - final Func0 onCompletedFunction; + final String repoFolderName; + final Func1 onCompletedFunction; - GitHostSetupScreen(this.onCompletedFunction); + GitHostSetupScreen(this.repoFolderName, this.onCompletedFunction); @override GitHostSetupScreenState createState() { @@ -469,9 +470,9 @@ class GitHostSetupScreenState extends State { var basePath = appState.gitBaseDirectory; // Just in case it was half cloned because of an error - await _removeExistingClone(basePath); + String repoPath = p.join(basePath, widget.repoFolderName); + await _removeExistingClone(repoPath); - String repoPath = p.join(basePath, "journal"); String error; try { Log.d("Cloning " + _gitCloneUrl); @@ -523,7 +524,7 @@ class GitHostSetupScreenState extends State { parameters: _buildOnboardingAnalytics(), ); Navigator.pop(context); - widget.onCompletedFunction(); + widget.onCompletedFunction(widget.repoFolderName); } Future _completeAutoConfigure() async { @@ -594,7 +595,7 @@ class GitHostSetupScreenState extends State { } Future _removeExistingClone(String baseDirPath) async { - var baseDir = Directory(p.join(baseDirPath, "journal")); + var baseDir = Directory(baseDirPath); var dotGitDir = Directory(p.join(baseDir.path, ".git")); bool exists = dotGitDir.existsSync(); if (exists) { diff --git a/lib/state_container.dart b/lib/state_container.dart index cb0d39a2..2512d72b 100644 --- a/lib/state_container.dart +++ b/lib/state_container.dart @@ -323,10 +323,10 @@ class StateContainer with ChangeNotifier { }); } - void completeGitHostSetup() { + void completeGitHostSetup(String repoFolderName) { () async { appState.remoteGitRepoConfigured = true; - appState.remoteGitRepoFolderName = "journal"; + appState.remoteGitRepoFolderName = repoFolderName; await migrateGitRepo( fromGitBasePath: appState.localGitRepoFolderName,