82 Commits

Author SHA1 Message Date
eb7d7dc2e7 Add a lock between all git operations
This way in between a git add + git commit, no other git operation will
run. This rarely occurs but it was a posibility depending on the speed
of the users actions.
2020-03-21 00:44:14 +01:00
b252f037b3 Rename NotesFolder -> NotesFolderFS
And NotesFolderReadOnly to NotesFolder. It just makes more sense this
way as we're now getting more and more different "types" of
NotesFolders.
2020-03-15 02:01:07 +01:00
31262e5f7d Add some debug messages 2020-03-01 14:53:11 +01:00
d50f772468 Only have one SortingMode class
It doesn't make sense to duplicate it.
2020-03-01 13:40:16 +01:00
78d7e6cef0 Integrate the NotesCache
It doesn't make any difference as -

1. The sort order shown our SortedNotesFolder is different
2. Rebuilds of the tree affect everything. Even the elements which
should be in the correct place.
2020-02-28 14:55:52 +01:00
12122be7fe AppState.notesFolder: Avoid changing the object
We're accessing appState.notesFolder directly in the parent. Ideally it
would be nice if we passed it down via the Provider, but that doesn't
seem to be working for me. I've spent over 30 minutes. I now give up.
2020-02-11 19:57:57 +01:00
3a3ec76529 StateContainer: Use Provider
This way we can avoid listening for changes in many places.
2020-02-11 19:10:34 +01:00
e0f03d703e Allow remote sync frequency to be controller
For now the only 2 options are - automaitic and manual.

I rather name it "Automatic" instead of "After each change" as that way
I can choose to do it more frequently, if desired.

Fixes #8
2020-02-09 22:23:39 +01:00
49192026a7 NotesFolder: Do not allow changes in the folderPath
Otherwise the NotesFolder can reach an inconsistent state.
2020-02-09 17:08:31 +01:00
0c0fd17543 syncNotes: Catch the exception outside the StateContainer
The StateContainer doesn't have access to the snackbar.
2020-02-09 16:32:35 +01:00
56fa627de7 moveNote: Do nothing if dest is the current folder 2020-01-29 17:05:21 +01:00
43281bd2bb Add support for moving a Note to another folder
The Folder selection dialog needs a lot of work, but it's a start.
2020-01-29 16:51:57 +01:00
3f40a2992a Add the concept of Editors
* We no longer have a separate editing and browsing view - This does
mean we loose the ability to quick flip between notes by swiping.
However, this is more how a note editor would behave. I do later want to
add that capability back.

* We have 2 editors for now - Markdown and Raw. By default we use the
Markdown editor which can be toggled between Preview / Edit mode.

I later want to add a rich text editor and a todo editor as well.
2020-01-29 00:04:24 +01:00
8c5720c34b Note Rename: Do not let it be renamed to a non markdown file
Otherwise it disappears from the listing as we only show files which end
with a '.md'.
2020-01-27 23:11:42 +01:00
f8e7773f16 NoteBrowser: Add a button to rename notes
Fixes #23
2020-01-27 23:09:11 +01:00
a759ad4a23 Combine showSnackbar code
It's annoying to always have to remember to call it. We had forgotten in
one place and that resulted in a lot of noise.
2020-01-27 19:02:44 +01:00
b6b49e84e4 Simplify the code
Now the Note's modified/created can never have a date with a year = 10
meaning a special thing.
2020-01-07 23:56:58 +01:00
8a6b6023d6 Sync: Combine crashlytics code 2019-12-27 00:37:20 +01:00
6af3b03210 Add a sync button to the AppBar
This somewhat shows what's going on with the network. It isn't ideal, as
is a bit ugly. But it's a start to show the network status, and what's
going on in the background.
2019-12-26 20:43:12 +01:00
70877438eb Git: Take the folderPath instead of folderName
The Git Api was strange and took a foldeName and it would only allow you
to access git operations in a particular path. This has now been fixed,
and now it can operate in any path.

This was the first step to moving the git api into its own library.
2019-12-20 20:40:00 +01:00
591ba30762 Fix flutter analyze 2019-12-11 21:48:46 +01:00
abb6029798 Allow Folders to be deleted
For safety we're only allowing non-empty folders to be deleted. Ideally,
we should have some kind of undo button. Or some kind of history - since
we do have that with git.

Related to #18
2019-12-11 21:43:08 +01:00
b0b7da5291 Move storage classes into core
The Git functionality is fairly core!
2019-12-09 01:19:44 +01:00
cd24d2688f Never let the Note be in an invalid state
It's a bit confusing that the created date has to be set when creating a
new note, and the path had to be constructured properly, without which
the note shouldn't be saved. Ideally, an object shouldn't be able exist
in such an inconsistent state.
2019-12-09 01:14:45 +01:00
76f70f0d18 Note: Store when last modified
Also sort the notes based on when last modified. Now that we're moving
towards being a more note-taking app, it makes sense that a recently
modified note goes on top.

Of course, the sorting should be controllable by the user, but the
default probably should be by when modified.
2019-12-09 00:02:40 +01:00
8a49d948f0 StateContainer: Do not call setState when the notesFolder changes
The NotesFolder is now a listenable and is always accessed via Provider,
and therefore doesn't need setState to be called when it is modified.
2019-12-08 02:58:56 +01:00
62207eb6c7 StateContainer: Mark a field final
With this we're one step closer to making the StateContainer a stateless
widget.
2019-12-08 01:27:40 +01:00
7dafdaa617 StateContainer: noteRepo doesn't need to be public
Also lets call it gitRepo instead
2019-12-08 01:10:50 +01:00
8c6a33456a Allow folders to be renamed
This is a huge change which involves -
* Implementing Folder renames on the FS + Git level
* Implementing the concept of selecting an item in the FoldersListView,
  this feature isn't provided by default, and even now I'm not sure if
  the semantics which I've implemented are correct. I haven't
  implemented multiple folder selection for now.

Related to issue #18

Also, we're now one step closer to allowing notes to be renamed (#23)
2019-12-06 21:32:41 +01:00
975b235df3 Add Folder creation
Folders for now can only be created under the root folder. I cannot seem
to figure out how to design a good interface for designing how to choose
the parent folder.
2019-12-05 17:08:02 +01:00
5b8fc6342a Connect the AppState to the Folders
Now when adding/editing/removing a note, it gets modified from the
directory it was present in. There is no longer a just a plain list of
all notes, but always a tree of notes, which are inside Folders.
2019-12-04 15:33:30 +01:00
10d65cd6fb Rename NoteFolder -> NotesFolder 2019-12-04 15:33:27 +01:00
464b7512e9 Move Note and NoteFolder class into a core folder 2019-12-04 14:18:11 +01:00
56ccf00260 FolderListing: Show the actual folders
Also don't load hidden folders
2019-12-04 00:35:29 +01:00
7ba8faa57f Remove the entire concept of a subFolder
When configuring the Git Repo server, we could optionally track one folder
in the root git repo, instead of just the root folder. This was
specifically to address my use case where I have my journals in a
sub-directory. The setup screen was super ugly, though.

Since now I'm in the process of adding folder support because of #18, I
can remove this hack. It simplifies the code a lot.
2019-12-01 12:04:45 +01:00
5d69dd9de2 AppState: Remove isLoadingFromDisk
It isn't actually used anywhere. I want to simplify this as much as
possible, as I want the note loading to be as lazy as possible.
2019-10-20 00:54:34 +01:00
69003cf0ac Rename package from journal -> gitjournal
It's about time.
2019-10-07 19:30:50 +02:00
c144f14816 Avoid saving hasJournalEntries
It can be a simple getter
2019-10-04 04:37:41 +02:00
3d8aa2ad70 AppState: Move loading/saving to where the data lies 2019-10-04 04:35:02 +02:00
890fd059d4 Remove unused base class 2019-09-26 17:27:29 +02:00
186f6b0af3 Refactor: Remove FileStorage
With this, the application compiles again. And note editing is working
again. This is was the first of some small refactors in order to
implement both async note loading and a support for directories.
2019-09-26 17:22:52 +02:00
11a9023e99 Allow the Note FileName to be configured
This is super ugly, but it solves a real use case, and hopefully I'll
eventually get around to improving the UI of the Settings page.
2019-09-25 15:41:19 +02:00
74d7bdd763 Use a proper logger - Fimber
It's time to start using a proper logger so we can control the number of
log messages, also - it helps to have a central configuration point for
the logs, specially since I would like to hook them up to Crashlytics in
the future.
2019-06-19 09:45:15 +02:00
89f7c10ba9 Analytics: Send events when the notes are loaded
I want to know why they failed to load.
2019-06-14 17:26:51 +02:00
2bfd6ea199 setState may not be async 2019-06-02 15:58:57 +02:00
8ff5d02033 DartLinter: Add unnecessary_this 2019-02-23 01:33:34 +01:00
29c8da11fb Enable OnBoarding 2019-02-16 13:24:48 +01:00
475315785c Delete Note: Do not sync untill the snackbar has gone
Otherwise we would have already pushed that change to the server, and
undo-ing it will be impossible.
2019-02-15 20:12:13 +01:00
a32f01b2c4 Implement undo delete properly
This way the git History is not modified.
2019-02-15 19:58:58 +01:00
428c0bb611 Note Edit: Immediately update that note in the list
Otherwise, it's only after syncing and reloading the entire list of
notes do we see the update. This process is usually quite fast, but
not always.
2019-02-14 23:45:50 +01:00