29 Commits

Author SHA1 Message Date
83d122d06f Note.oid: The oid is now only empty when the file hasn't yet been saved 2022-01-20 17:51:32 +01:00
b38c97454b Compute the file hash on saving a note
It's not ideal as the hash is now calculated twice, but it simplifies
such a large porition of the code as I can put proper asserts to make
sure all Files in the NotesFolderFS always have a valid GitHash.
2022-01-20 15:43:22 +01:00
7bdf52165c Ensure the Note's file is reloaded on reloading the Note
Also add more asserts.
2022-01-20 14:34:48 +01:00
f17542bf89 Mark Note as immutable 2022-01-18 23:34:58 +01:00
e6a24f8897 Fix note renaming to change editor type 2022-01-14 17:34:19 +01:00
7bb7fb94f2 note.title: Let it be null
This is a remanent from the time when non-nulllable didn't exist in
Dart.
2022-01-14 10:26:03 +01:00
125d24d9ba Ensure all exceptions implement the Exception interface 2021-12-20 09:28:00 +01:00
60b2922176 NotesFolder: Only notify if modified if really modified
Reloading the note doesn't count as a modification
2021-12-20 09:28:00 +01:00
567835b9c5 make fmt 2021-12-14 16:28:08 +01:00
4b658e3580 Move markdown handling to its own folder 2021-12-14 14:12:12 +01:00
015659d58f Allow a note to be renamed to whatever
Earlier one could never change a note type, and therefore its extension.
Now you can rename a note's filename to whatever and accordingly the
editor will change.

A warning message is shown when changing the file type.

Fixes #474
2021-11-15 12:39:12 +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
28f34ca5e6 Avoid catching only Exceptions
We also occasionally get Errors in runtime. It seems like a terrible
decission for Error and Exception to not have a common subtype.
2021-10-20 09:59:14 +02:00
729764c518 Remove NoteLoadState
It's no longer required as a Note can never be in an Error state, it
becomes an 'IgnoredFile'
2021-10-18 13:09:47 +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
5f07543db2 Remove Note's doc setter
This makes us one step closer to making the Note class immutable which
will help GitJournal's overall architecture a lot. Plus it makes me one
step closer to having proper web support.
2021-10-17 22:22:33 +02:00
7f9beb0d5c NoteFileTypes: Hook up selector to the settings 2021-10-15 17:33:19 +02:00
be038c7e3e Ensure metadata is not stored when disabled
Fixes #544
2021-10-12 14:43:57 +02:00
1bf2f2f5be Avoid logging failed notes
These mostly seem to be due to utf8 compatibilities.

Fixes APP-1EQ
2021-10-11 21:43:11 +02:00
7e0a77ace3 Fix many cases of 'avoid-ignoring-return-values'
Now that dart-code-metrics has been updated, this lint can finally be
used. So far all of these are false positives, in the sense that I don't
care about their return values.

I wish there was an easy way of marking functions whose return value
shouldn't ever be ignored.
2021-09-27 18:39:18 +02:00
ee4c48b186 Note.save: Make sure the lastModified is exactly right
Otherwise the cache isn't always valid.
2021-09-17 09:57:38 +02:00
4bf0a78fee MaterializedView: Avoid re-computing many times
Ideally the Note's lastModified shouldn't ever be 0.
2021-09-17 09:55:33 +02:00
af7665bc5a Avoid logging the note's value
Urgh, so stupid.
2021-09-17 08:35:58 +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
33a731a3d7 Add reuse licensing to files in lib 2021-09-15 13:06:43 +02:00
cfaf1436f1 Move the MarkdownYamlCodec out of the Note class 2021-09-09 10:08:38 +02:00
fdc79828c7 Move note.load to NoteStorage
Now the note class is almost ready to become immutable
2021-09-09 10:01:36 +02:00
a0a97aa8cb Cleanup code 2021-08-04 08:17:49 +02:00
39096c270c Note.save: Move to NoteStorage
I'm trying to move all FS related operations out of the Note class, and
ideally make it super small. This class will need to be serialized over
the wire for the web version, and that needs it to be small.
2021-08-04 08:03:48 +02:00