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:
Vishesh Handa
2020-04-20 01:56:32 +02:00
parent 3c3c49e099
commit 5784399ac6
2 changed files with 2 additions and 13 deletions

View File

@ -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);

View File

@ -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();
}); });