RemoveExistingClone if onboarding is not completed

This only happens when I manually delete the shared_prefs. It's
basically a way to make working on the onboarding much easier.
This commit is contained in:
Vishesh Handa
2019-01-10 13:31:23 +01:00
parent 290ca293ae
commit fe84aab6b7

View File

@ -62,6 +62,18 @@ class StateContainerState extends State<StateContainer> {
if (appState.onBoardingCompleted) {
_loadNotesFromDisk();
_syncNotes();
} else {
_removeExistingClone();
}
}
void _removeExistingClone() async {
var baseDir = await getNotesDir();
var dotGitDir = new Directory(p.join(baseDir.path, ".git"));
bool exists = await dotGitDir.exists();
if (exists) {
await baseDir.delete(recursive: true);
await baseDir.create();
}
}