58 Commits

Author SHA1 Message Date
93effc32b1 dev: Fix test on CI
Stupid timezone issues
2024-08-25 13:48:07 +02:00
b4302fe467 feat: Add support for YYYY-MM-DD in the YAML frontmatter
Fixes #972

This required regenerating the protobufs generated files, which seem to
have tons of extra changes, and needed some manual changes to get them
to compile.

Overall, the entire protobuf idea wasn't the best in retrospect, and in
the next version of GitJournal, I'll be going with a simple relational
database instead.
2024-08-24 23:05:09 +02:00
657721adc6 Update dart-git and stop using the Result class
Instead we're going to move back to standard exceptions.

Using a custom Result class has created far far more problems
- The Stacktraces aren't always right
- Sometimes one forgets to check the Result error
- All other exception throwing code needing to be converted to Results
- Non idiomatic Dart code

I think it's better to just go back to exceptions. They have their
problems, but overall, I think it's a better approach.
2023-11-24 14:03:30 +01:00
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
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
6eaae014da NotesFolderFS: Simplify
Avoid passing the FileStorage since the parent already has it
2022-01-26 12:01:47 +01:00
2aa4d46a66 Note test: Remove useless group 2022-01-26 12:01:47 +01:00
901e4b5cb9 Avoid importing dart_git's Result class
It's easier to see where all dart_git is used this way, and this result
class should be refactored into its own package anyway.
2022-01-22 10:11:45 +01:00
f03ef9cbfa Note: Add tests for renaming logic 2022-01-20 18:45:10 +01:00
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
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
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
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
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
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
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
e90233d45c Update modified/created as unix timestamp if already in that format
Related to #349
2021-08-10 10:57:31 +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
2505d00dfb Replace dart:io with universal_io
Platform from dart:io cannot be used on the web for reasons. And this
way we get a fake File/Directory class which we can use for atleast
running the web version, even if it won't work.
2021-07-30 11:39:26 +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
09cf55bc80 Add a failing test for Dendron Frontmatter
This is trickier to implement than I thought.
2021-07-14 12:24:46 +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
9acf3d15f6 null safety++ 2021-06-02 09:40:53 +02:00
96c2809d3e Migrate most of the tests to null safety 2021-05-19 12:09:45 +02:00
d008f0d982 First version of dart migrate
Most of the files haven't been migrated. Lets work on this bit by bit
2021-04-10 22:18:35 +02:00
d2d9504dc9 Make sure all notes end with a \n
Fixes #383
2021-03-26 10:09:15 +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
c94ff85804 Overhaul Link parsing
We were mixing up header links with wiki links and the alt text. It was
a bit messy. We currently do not support linking to a particular part of
a note. Nor do we support wiki links as link references.

Fixes APP-A0
2020-09-14 12:20:15 +02:00
2668d14510 Replace test with simpler test
Also lets not auto convert old notes title format.
2020-08-19 11:40:50 +02:00
ada656c675 Do not write the title as h1 if it is in the yaml header
In general, we try to follow the conventions in the note parsed over
whatever the default config.

Related to #214
2020-08-19 11:31:16 +02:00
2fa475e10a Add an extra test for txt files and the title
Just to make sure it's never parsed.
2020-07-29 16:29:27 +02:00
30f9f86ad3 Fix all the broken tests because of title change 2020-07-29 15:58:43 +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
67c2777d9b Parse links in wiki syntax [[term]]
This way we can use this faster syntax which is also supported by
Obsidian.
2020-06-08 00:52:03 +02:00