29 Commits

Author SHA1 Message Date
63170445d7 Move libgit2 code to git_bindings repo
We now have a much clearer separation between Git code and this app
specific code. This is awesome, it will allow other people to easily
integrate Git within their apps. Also, eventually it will be trivial to
switch to another implemention of Git (via JGit or a git client written
completely in Dart)

This breaks the iOS version as I haven't moved the code to build the ios
version. Maybe this will be a good excuse for me to setup a proper CI/CD
system for ios builds.

There is also a chance this breaks Crashalytics NDK symbols :(
2019-12-21 01:06:15 +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
3657a88ce5 FolderListing: Show the full path of subfolders
It's confusing otherwise, though this doesn't look very pretty.
2019-12-14 12:18:52 +01:00
6096ef8054 Sort Folders based on name
Eventually this sorting should be configurable.
2019-12-14 12:10:20 +01:00
6790bfe9f5 Fix Note sorting function 2019-12-14 12:06:07 +01:00
bc6f7c1b8f Note: Load the modified tag properly 2019-12-14 12:05:52 +01:00
106953ad68 GitRepo: Change commit messages to say "Note" instead of "Journal" 2019-12-14 02:19:02 +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
880f290d82 New note: fix 'created' not being serialized 2019-12-09 01:36:55 +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
ca83cb79a6 JournalListing: Remove recursive option
We aren't using it, and if we implement a recursive option it should
somehow showcase which folder it is under. Evernote does it in an
interesting way.
2019-12-09 00:53:53 +01:00
6c10fa8a0f Improve Note sorting
* First by modified
* Then by created
* Then by file Path

I feel like there must be a simpler way of writing this compareTo
function.
2019-12-09 00:14:00 +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
ee9d38e420 NotesFolder: Make sure listeners are always added/removed
Also make sure the _entities and _entityMap are always in sync.

The NotesFolder is complex enough that it could really use some proper
unit testing. Though since it is so tightly coupled to the FileSystem,
it would be quite an elaborate test to write.
2019-12-08 02:26:35 +01:00
1eb9611140 Do not reparse every note on any change
Earlier whenever anything changed we would discard all the Notes +
NotesFolders in memory, and reconstruct the hierarchy. This would means
Notes which haven't changed at all, still need to parsed all over again.

Now we only reload what has actually changed.

This should result in a huge performance boost.

We still shouldn't be loading everything on boot, but that's a different
problem.
2019-12-08 01:56:59 +01:00
92f0109733 NotesFolder: Allow only one folder to be loaded
We don't always need to load everything recursively.
2019-12-08 01:26:20 +01:00
9e2d59f3fa NotesFolder: Listen to changes of the subFolders and Notes
A NotesFolder doesn't only change when a note/folder is added or
removed. It is also changed when the contents of the Notes/Folders it
contains have changed.
2019-12-08 01:04:28 +01:00
644ef47076 NotesFolder rename: Actually update the filePath
The filePath was still the old one, this was causing all kinds of
errors.
2019-12-07 17:06:46 +01:00
6288a7cfa0 NotesFolder: Notify listeners on rename 2019-12-07 16:30:39 +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
a51f8f170f Make Note and NotesFolder ChangeNotifiers
This will allow us for finer grained notifications of when things change
so we don't have to rebuild everything, like we do currently.
2019-12-06 01:22:57 +01:00
f08d72bb00 FolderListing: Show the number of notes per folder 2019-12-05 17:48:31 +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
e287d41ffe Split out NoteFSEntity into its own file 2019-12-04 14:20:58 +01:00
464b7512e9 Move Note and NoteFolder class into a core folder 2019-12-04 14:18:11 +01:00