mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-26 08:36:50 +08:00
Revert "Deletes Note.compareTo"
This reverts commit 6cf5454f7940c9aee65279c4635f84b04f9ec700. Having this compareTo makes testing easier.
This commit is contained in:
@ -16,7 +16,7 @@ enum NoteLoadState {
|
||||
NotExists,
|
||||
}
|
||||
|
||||
class Note with ChangeNotifier {
|
||||
class Note with ChangeNotifier implements Comparable<Note> {
|
||||
NotesFolder parent;
|
||||
String _filePath;
|
||||
|
||||
@ -204,4 +204,19 @@ class Note with ChangeNotifier {
|
||||
String toString() {
|
||||
return 'Note{filePath: $_filePath, created: $created, modified: $modified, data: $_data}';
|
||||
}
|
||||
|
||||
@override
|
||||
int compareTo(Note other) {
|
||||
if (other == null) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
var dt = modified ?? created ?? _fileLastModified;
|
||||
var otherDt = other.modified ?? other.created ?? other._fileLastModified;
|
||||
if (dt == null || otherDt == null) {
|
||||
return _filePath.compareTo(other._filePath);
|
||||
}
|
||||
|
||||
return dt.compareTo(otherDt);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user