24 Commits

Author SHA1 Message Date
92e73c414d Move core Note classes into a separate file
I'm trying to get ride of this huge 'Note' class, and have it be quite
dumb. The idea is that we'll have separate Note subclasses - TxtNote,
MdNote, etc
2022-04-24 13:09:14 +02:00
6237161a28 Enable logging in tests
It makes it easier to diagnose issues on the CI
2022-02-20 01:24:07 +05:30
7fce95c187 Make Note class immutable
This greatly simplifies the entire data flow. Though, it comes at the
risk of introducing bugs, but I think it's worth it.

Plus, it makes everything far far more testable.
2022-01-18 21:42:56 +01:00
a149371a44 Map EditorTypes with NoteFileFormat
Certain Editors only support certain file formats. We can create an
editor either by -

* Giving it a Note, and letting it choose an editor based on the default
/ note metadata
* New Note with a file type
* New Note with a editor type + possible file type
2021-11-09 15:43:57 +01:00
e1ea7a4953 Fetch the modified + created time from git
Fixes #78

This is probably the largest commit that I have ever made. From now on -
every File always has an mtime and ctime which is fetched from git.
Notes can optionally override that time by providing yaml metadata.

Additionally the 'filePath' and 'folderPath' is now relative to the
repoPath instead of being the full path.

This will slow down GitJournal like crazy as all the mtimes and ctime
still need to be cached. For my test repo it takes about 23 seconds for
GitJournal to become responsive.
2021-10-26 17:49:08 +02:00
7a56d0f423 Remove Note's default constructor
Instead there is a new type called 'UnopenedFile'. This was part of my
effort to not have everything inside the 'Note' class and to make it a
bit more immutable.

But, wow, this took a very long time. The 'Note' class seems to be very
deeply integrated everywhere.
2021-10-18 13:03:22 +02:00
6a915864f2 Move NotesFolder's code to their own folder
The 'core' folder is becoming way too huge.
2021-10-15 12:31:35 +02:00
510b277398 Add Note.apply
Avoid calling each setter as each results in the entire tree being
rebuilt.
2021-09-16 20:07:33 +02:00
fb2ebcdd6c Reuse: Add licenseing to the tests 2021-09-15 13:11:50 +02:00
c53b7ebbd1 Note: fileLastModified should never be null
This simplifies so much of the code.
2021-09-07 00:00:42 +02:00
3c9994fca7 Remove title based sorting
Now that we support multiple file types, sorting by title gets confusing
since a lot of notes don't have a title. Also, this simplifies a lot of
the code base.
2021-08-26 07:34:55 +02:00
c6665fa63e Simplify Settings/Config classes 2021-07-29 12:45:33 +02:00
c66eaf1052 NotesFolderConfig: Read directly from the SharedPref
It's super annoying that we have this class which reading from the
settings, so adding any new value involves updating some 12 new things.
2021-07-27 16:33:16 +02:00
d6e2f09a72 Move all settings code to its own folder
Jumping around between the widgets / screens and outside is bit
confusing. Also this way, I can add the stories right here.
2021-06-05 12:23:28 +02:00
eb2f4519a6 Make sorting case insensitive 2021-01-12 15:49:44 +01:00
f75e119995 Make Settings take the folderName as a parameter 2020-10-23 02:29:48 +02:00
9499cea164 Remove Settings global
Stop it being a singleton. This means it needs to be passed around a
lot. This sucks, but it's how it should be. I shouldn't be using a
global variable to get around this.

This is needed as Settings will soon become repo specific when we
support multiple repos.

This breaks saving the settings in a file, that feature was toggled off
anyway. It needs to be thought over again.
2020-10-09 00:59:19 +02:00
46269dd94a Implementing controlling of the sorting order
The dialog looks quite ugly right now, but at least everything works. I
can work on making it prettier after this.
2020-08-14 19:17:38 +02:00
9d00fdac06 Use import_sorter
flutter pub run import_sorter:main --no-comments

The code feels much cleaner
2020-07-24 12:43:28 +02:00
88552fe8e9 Revert "Workaround intl bug by harding 'en' locale"
This reverts commit 303192d9d575b26a77a00f7a62212f310ec1e329.
This reverts commit cd9d128b47ed523036f7ae1232ec7adcf04ed8a9.

GitJournal is used by non-English speakers (a lot in China and Russia)
and while we don't support those languages completely, we do support
them a little bit. I don't want to loose this functionality. It would be
better for us to fix the bug in intl.
2020-06-10 09:31:08 +02:00
303192d9d5 Initialize intl in tests
This sucks.
2020-06-09 18:44:37 +02: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
f0eeefe125 SortedNotesFolder: Avoid calling sort again and again
For long lists of notes this could get very very expensive.
2020-03-08 04:00:27 +01:00
09ff8b2704 Fix sorting mode
First sort based on datetime, and then based on filename.
2020-03-08 00:41:20 +01:00