mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 18:38:36 +08:00
Remove NotesFolderFS::insert
The position of the note in the folder doesn't matter as Virtual folders on top of this sort it according to how to how the user wants them to be sorted.
This commit is contained in:
@ -247,17 +247,6 @@ class NotesFolderFS with NotesFolderNotifier implements NotesFolder {
|
|||||||
notifyNoteAdded(_notes.length - 1, note);
|
notifyNoteAdded(_notes.length - 1, note);
|
||||||
}
|
}
|
||||||
|
|
||||||
void insert(int index, Note note) {
|
|
||||||
assert(note.parent == this);
|
|
||||||
assert(index >= 0);
|
|
||||||
note.addModifiedListener(_noteModified);
|
|
||||||
|
|
||||||
_notes.insert(index, note);
|
|
||||||
_entityMap[note.filePath] = note;
|
|
||||||
|
|
||||||
notifyNoteAdded(index, note);
|
|
||||||
}
|
|
||||||
|
|
||||||
void remove(Note note) {
|
void remove(Note note) {
|
||||||
assert(note.parent == this);
|
assert(note.parent == this);
|
||||||
note.removeModifiedListener(_noteModified);
|
note.removeModifiedListener(_noteModified);
|
||||||
|
@ -200,7 +200,7 @@ class StateContainer with ChangeNotifier {
|
|||||||
void addNote(Note note) async {
|
void addNote(Note note) async {
|
||||||
return _opLock.synchronized(() async {
|
return _opLock.synchronized(() async {
|
||||||
Log.d("State Container addNote");
|
Log.d("State Container addNote");
|
||||||
note.parent.insert(0, note);
|
note.parent.add(note);
|
||||||
note.updateModified();
|
note.updateModified();
|
||||||
_gitRepo.addNote(note).then((NoteRepoResult _) {
|
_gitRepo.addNote(note).then((NoteRepoResult _) {
|
||||||
_syncNotes();
|
_syncNotes();
|
||||||
@ -225,7 +225,7 @@ class StateContainer with ChangeNotifier {
|
|||||||
|
|
||||||
void undoRemoveNote(Note note) async {
|
void undoRemoveNote(Note note) async {
|
||||||
return _opLock.synchronized(() async {
|
return _opLock.synchronized(() async {
|
||||||
note.parent.insert(0, note);
|
note.parent.add(note);
|
||||||
_gitRepo.resetLastCommit().then((NoteRepoResult _) {
|
_gitRepo.resetLastCommit().then((NoteRepoResult _) {
|
||||||
_syncNotes();
|
_syncNotes();
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user