mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-27 01:02:14 +08:00
Avoid saving hasJournalEntries
It can be a simple getter
This commit is contained in:
@ -22,7 +22,10 @@ class AppState {
|
||||
//
|
||||
/// This is the directory where all the git repos are stored
|
||||
String gitBaseDirectory = "";
|
||||
bool hasJournalEntries = false;
|
||||
|
||||
bool get hasJournalEntries {
|
||||
return notes.isNotEmpty;
|
||||
}
|
||||
|
||||
bool isLoadingFromDisk = false;
|
||||
List<Note> notes = [];
|
||||
|
@ -86,7 +86,6 @@ class StateContainerState extends State<StateContainer> {
|
||||
setState(() {
|
||||
appState.isLoadingFromDisk = false;
|
||||
appState.notes = loadedNotes;
|
||||
appState.hasJournalEntries = loadedNotes.isNotEmpty;
|
||||
|
||||
getAnalytics().logEvent(
|
||||
name: "notes_loaded",
|
||||
@ -125,7 +124,6 @@ class StateContainerState extends State<StateContainer> {
|
||||
setState(() {
|
||||
appState.isLoadingFromDisk = false;
|
||||
appState.notes = loadedNotes;
|
||||
appState.hasJournalEntries = loadedNotes.isNotEmpty;
|
||||
});
|
||||
} catch (err, stack) {
|
||||
setState(() {
|
||||
@ -198,7 +196,6 @@ class StateContainerState extends State<StateContainer> {
|
||||
note.filePath = p.join(noteRepo.notesBasePath, getFileName(note));
|
||||
}
|
||||
appState.notes.insert(index, note);
|
||||
appState.hasJournalEntries = true;
|
||||
noteRepo.addNote(note).then((NoteRepoResult _) {
|
||||
_syncNotes();
|
||||
});
|
||||
|
Reference in New Issue
Block a user