Add support for moving a Note to another folder

The Folder selection dialog needs a lot of work, but it's a start.
This commit is contained in:
Vishesh Handa
2020-01-29 16:51:57 +01:00
parent d48461a4cc
commit 43281bd2bb
8 changed files with 128 additions and 12 deletions

View File

@ -81,6 +81,19 @@ class GitNoteRepository {
return NoteRepoResult(noteFilePath: newFullPath, error: false);
}
Future<NoteRepoResult> moveNote(
String oldFullPath,
String newFullPath,
) async {
// FIXME: This is a hacky way of adding the changes, ideally we should be calling rm + add or something
await _gitRepo.add(".");
await _gitRepo.commit(
message: "Note Moved",
);
return NoteRepoResult(noteFilePath: newFullPath, error: false);
}
Future<NoteRepoResult> removeNote(String noteFilePath) async {
var pathSpec = noteFilePath.replaceFirst(gitDirPath, "").substring(1);