mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 10:17:16 +08:00
Fix Clone screen not disappearing
and other misc changes
This commit is contained in:
@ -135,7 +135,7 @@ class OnBoardingScreenState extends State<OnBoardingScreen> {
|
||||
);
|
||||
|
||||
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<OnBoardingScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
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<OnBoardingScreen> {
|
||||
name: "onboarding_complete",
|
||||
parameters: <String, dynamic>{},
|
||||
);
|
||||
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();
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ class StateContainerState extends State<StateContainer> {
|
||||
|
||||
await migrateGitRepo(
|
||||
fromGitBasePath: appState.localGitRepoPath,
|
||||
toGitBasePath: appState.localGitRepoPath,
|
||||
toGitBasePath: appState.remoteGitRepoPath,
|
||||
gitBasePath: appState.gitBaseDirectory,
|
||||
);
|
||||
|
||||
@ -201,7 +201,7 @@ class StateContainerState extends State<StateContainer> {
|
||||
dirName: appState.remoteGitRepoPath,
|
||||
);
|
||||
|
||||
_persistConfig();
|
||||
await _persistConfig();
|
||||
_loadNotesFromDisk();
|
||||
_syncNotes();
|
||||
});
|
||||
|
@ -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<bool> 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);
|
||||
|
Reference in New Issue
Block a user