168 Commits

Author SHA1 Message Date
5d48229736 use IMap instead of ListMap 2022-02-02 01:51:02 +04:00
0a085e78e7 MdYamlDoc: Make it immutable 2022-01-27 15:17:56 +01:00
afd7690611 Use fast_immutable_collections instead of Kt
It's much more intuitive to use, and is way more performant.
2022-01-27 12:13:34 +01:00
3841cdcab9 Note.tags: Use an compile time immutable set 2022-01-27 11:52:43 +01:00
30a6beab73 Note.created: Make sure it stays the same
It was being updated
2022-01-25 11:04:04 +01:00
9249dd1246 Add convenience method to reset the Oid 2022-01-21 16:12:24 +01:00
571d7adae4 Note: Mark collections as unmodifyable 2022-01-20 17:20:55 +01:00
adc31c2392 Note: Ensure the title is never empty 2022-01-20 12:27:37 +01:00
ee50fb3183 Simplify code 2022-01-19 17:49:11 +01:00
f17542bf89 Mark Note as immutable 2022-01-18 23:34:58 +01:00
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
e6a24f8897 Fix note renaming to change editor type 2022-01-14 17:34:19 +01:00
a6eb613b5a Fix note renaming 2022-01-14 17:09:41 +01:00
0c8ec7dbbb Ensure title is null 2022-01-14 16:55:11 +01:00
0488714e89 Refactor note file naming logic
I want to make the note class immutable, and the file path naming logic
is the toughest part.
2022-01-14 12:55:27 +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
8655d5f01c Fix serialization problem
This is so strange

Fixes #572
2021-12-22 21:05:39 +01:00
b0f70605da Minor cleanup 2021-12-16 16:26:21 +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
c2c53d5c49 Hackish improvement for Txt/OrgFile support 2021-12-10 17:05:58 +01:00
ccf571cbe9 NotesCache: Store the entire note
This way the disk barely needs to be accessed when loading GitJournal,
and we can hide how long it takes GitJournal to parse all the notes in
the background.
2021-12-09 20:04:08 +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
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
f8926d9eda NotesCache: Add pinned files
This way the view doesn't change later.
2021-11-04 15:10:24 +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
f87793acbf NotesCache: Save it as a 'File'
This way it'll also be sorted correctly later.
2021-10-20 22:31:12 +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
ff46c38599 NotesFolderFS: Operate on 'File' instead of 'Note'
Also simplify the loading logic. This makes it much easier to
understand.

With this, I can now slowly migrate the interface of a NotesFolder to be
based on Files instead of Notes.
2021-10-15 15:38:12 +02:00
88697c1965 Make Note implement the 'File' interface.
I'm trying to expand GitJournal and let it understand the concept of
different Files. Right now everything is mashed into the "Note" class,
which is messy.
2021-10-15 12:41:54 +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
efffec0a1a Allow changing the default note file format 2021-10-12 14:02:22 +02:00
c4ef1f569b Use flutter_lint
Instead of picking lint values. This way I don't need to routinely
looking at extra lints to enable.
2021-09-21 15:42:13 +02:00
4daea0a14f Use optional instead of checking if empty
This is legacy code before we had null checks
2021-09-16 22:49:09 +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
c53b7ebbd1 Note: fileLastModified should never be null
This simplifies so much of the code.
2021-09-07 00:00:42 +02:00
665d1dce2b Add a Materialized View for the Links
Calculating the links is very expensive, this way we finally don't need
to do it each time!
2021-09-06 16:57:30 +02:00
db80229209 Stop Note from being a ChangeNotifier
The only one listening was the parent folder. This simplifies the note
class a lot. Also it gets us one step closer from making the note more
dumb.
2021-09-05 11:23:51 +02:00
7abfc505e3 Note: move rename function to the parent
I want the note class to have a simple object with no internal state
mutation.
2021-09-05 11:15:24 +02:00
0231cbd3bc Note: Move 'move' function out of note
It doesn't need access to any of the note internals. For now I've placed
it in notes_folder_fs, though it really doesn't need to be there as
well.
2021-09-05 11:09:17 +02:00
abc9a31290 Add InlineTags Materialized View
This way we avoid parsing the tags from the body again and again, also
I can make the tags processing more complex without worrying too much
about the computational overhead.
2021-08-31 22:59:41 +02:00
130eb852b2 Note: Move summary to a MaterializedView
This way it doesn't need to be computed each time the app loads.
2021-08-31 21:48:27 +02:00
0384bba656 Note: Remove unused member 'images' 2021-08-31 17:12:50 +02:00
5ea80fb617 Note: Move Image code to its own class
The Note class is way way too huge and has too many responsabilities. I
would like the Note class to be very small and immutable.
2021-08-31 12:30:47 +02:00