112 Commits

Author SHA1 Message Date
84c67a08db Log an exception properly 2020-09-28 13:05:09 +02:00
58de0498ac Replace git pull with git fetch + merge
This way we can swap the merge out easily for our own custom merge code.
Also, this makes it easier to do a merge as a way of migrating.

This commit probably breaks stuff on ios
2020-09-26 20:27:07 +02:00
15c5d5e422 Another case of the Settings singleton 2020-09-25 01:07:35 +02:00
eb4d99338b Remove some uses of the Settings singleton
It needs to be removed from everywhere.
2020-09-25 00:40:23 +02:00
fe08834259 Split Settings into AppSettings and Settings
This way I can eventually change Settings into RepoSettings without
breaking anything.
2020-09-25 00:33:54 +02:00
f30c52f595 Move all persistent state from AppState to Settings
This way all the persistant state of the app is managed from the same
place. It makes everything much easier. Also, it's required for when
GitJournal supports multiple repositories.
2020-09-24 23:45:37 +02:00
4bcbf8226a Move onBoardingCompleted from AppState to Settings
I want to get rid of the AppState entirely. It serves exactly the same
purpose as Settings.
2020-08-16 15:29:49 +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
84fab89f48 Do not allow us to edit the Note Editor if the Note cannot be saved
In some rare cases the note just doesn't get saved on disk - in those
cases instead of silently failing we will refuse to exit the note
editor, forcing the user to copy the note and paste it somewhere else in
order to not lose the date.

This isn't the best solution, but it prevents data loss, in a few edge
cases which I cannot reproduce.

Fixes #124
2020-07-13 17:13:02 +02:00
c98d01415f NoteRename: Do it before trying to get the lock
Another operation coule be blocking git.
2020-06-10 15:16:22 +02:00
97812e1501 Convert more prints to logs
This way they will show up in the LogViewer
2020-06-10 13:25:22 +02:00
5714642e15 NoteEditing: Make sure we report exceptions on save
We don't want to silently ignore these.
2020-06-10 13:18:48 +02:00
51ececd150 Immediately save the note when changing
Earlier we would wait till we got the 'mutex' to make a change, however
with the way libgit2 works, during a git push/pull other git operations
such as add/rm/commit block.

So performing a save, while the push/pull is occuring - might have
resulted in a note being lost

Related to #124
2020-06-10 13:03:28 +02:00
267ecb7499 Implement a very basic file system view
This will show all the files and not just the "notes". This way the user
can easily figure out why a file isn't included in the list of notes.

It's currently disabled by default as it clearly needs a lot more work.
2020-06-10 00:54:15 +02:00
d665981182 Allow Git remote host to be reset
This is quick and dirty way of fixing the problem. It doesn't migrate
the notes from the previous repo and just discards them, so you cannot
move your notes from one repo to another using GitJournal (for now), but
at least its better than having to re-install the app.

Related to #36
2020-05-26 23:53:14 +02:00
ee1009b087 Avoid hardcoding the git repo folder's name everywhere
This way, in the future we can support multiple repos, and more
importantly it will be easier to reconfigure the git host.
2020-05-26 23:49:57 +02:00
c6ec94dab6 Log when lock obtained
Notes don't always seem to get deleted, and I'm not sure why that's
happening.
2020-05-18 00:35:48 +02:00
188740974f Firebase Analytics: Set onboarded property
This makes it easier to calculate the actual retention rate as some
40-50% of the users never land up setting up a git sync.
.
2020-05-13 11:56:36 +02:00
8636021952 SyncButton: Show number of unpushed changes
Related to #123
2020-05-01 11:09:40 +02:00
152a95d4e9 Record when an action is performed on a Note/Folder
This way I'll have statistics about how the app is used and more
importantly, figuring out crash reports will be easier as there will be
a rough trail of actions.
2020-04-22 01:31:48 +02:00
77e67fca11 Rename Folders properly
1. Actually rename the folder instead of calling rename with the oldPath
2. Inform the parentFolder that a sub-folder has been renamed so it can
accordingly update its mapping.

Fixes #108
2020-04-20 02:11:42 +02:00
5784399ac6 Remove NotesFolderFS::insert
The position of the note in the folder doesn't matter as Virtual folders
on top of this sort it according to how to how the user wants them to be
sorted.
2020-04-20 01:56:32 +02:00
ff2ac647c5 Remove unused imports 2020-04-17 10:33:31 +02:00
6c47016c8b logException: Also log to Sentry 2020-04-17 09:42:19 +02:00
bbaf5b4452 Wait for previous completion of loadNotes
Fixes APP-R
2020-04-16 09:35:18 +02:00
bb0e574495 Abstract out the logging
This way moving away from Fimber will be much easier.
2020-04-04 11:50:57 +02:00
fe08b53539 Add a .gitjournal.yaml file in a folder
This file will be added to save the settings of how we want that folder
to behave. For example - default Editor, view, sorting mode, etc.

This feature is currently disabled as it will only be a part of the pro
mode.
2020-03-31 14:02:38 +02:00
965639e6f2 Add the concept of Folder Settings
This contains the default editor / view / sortingMode / etc. For now the
folder settings are shared among all Folders. But the idea is that we
should be able to set different settings per folder (real or virtual)
2020-03-31 11:16:04 +02:00
577b73ff3c SyncButton: Seperate pulling and pushing
This way we also refresh the view after the pulling, as we don't need to
wait for a push for that.
2020-03-30 13:00:28 +02:00
a99eca9131 Simplify code by using pathSpec 2020-03-21 00:52:54 +01:00
eb7d7dc2e7 Add a lock between all git operations
This way in between a git add + git commit, no other git operation will
run. This rarely occurs but it was a posibility depending on the speed
of the users actions.
2020-03-21 00:44:14 +01: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
31262e5f7d Add some debug messages 2020-03-01 14:53:11 +01:00
d50f772468 Only have one SortingMode class
It doesn't make sense to duplicate it.
2020-03-01 13:40:16 +01:00
78d7e6cef0 Integrate the NotesCache
It doesn't make any difference as -

1. The sort order shown our SortedNotesFolder is different
2. Rebuilds of the tree affect everything. Even the elements which
should be in the correct place.
2020-02-28 14:55:52 +01:00
12122be7fe AppState.notesFolder: Avoid changing the object
We're accessing appState.notesFolder directly in the parent. Ideally it
would be nice if we passed it down via the Provider, but that doesn't
seem to be working for me. I've spent over 30 minutes. I now give up.
2020-02-11 19:57:57 +01:00
3a3ec76529 StateContainer: Use Provider
This way we can avoid listening for changes in many places.
2020-02-11 19:10:34 +01:00
e0f03d703e Allow remote sync frequency to be controller
For now the only 2 options are - automaitic and manual.

I rather name it "Automatic" instead of "After each change" as that way
I can choose to do it more frequently, if desired.

Fixes #8
2020-02-09 22:23:39 +01:00
49192026a7 NotesFolder: Do not allow changes in the folderPath
Otherwise the NotesFolder can reach an inconsistent state.
2020-02-09 17:08:31 +01:00
0c0fd17543 syncNotes: Catch the exception outside the StateContainer
The StateContainer doesn't have access to the snackbar.
2020-02-09 16:32:35 +01:00
56fa627de7 moveNote: Do nothing if dest is the current folder 2020-01-29 17:05:21 +01:00
43281bd2bb Add support for moving a Note to another folder
The Folder selection dialog needs a lot of work, but it's a start.
2020-01-29 16:51:57 +01:00
3f40a2992a Add the concept of Editors
* We no longer have a separate editing and browsing view - This does
mean we loose the ability to quick flip between notes by swiping.
However, this is more how a note editor would behave. I do later want to
add that capability back.

* We have 2 editors for now - Markdown and Raw. By default we use the
Markdown editor which can be toggled between Preview / Edit mode.

I later want to add a rich text editor and a todo editor as well.
2020-01-29 00:04:24 +01:00
8c5720c34b Note Rename: Do not let it be renamed to a non markdown file
Otherwise it disappears from the listing as we only show files which end
with a '.md'.
2020-01-27 23:11:42 +01:00
f8e7773f16 NoteBrowser: Add a button to rename notes
Fixes #23
2020-01-27 23:09:11 +01:00
a759ad4a23 Combine showSnackbar code
It's annoying to always have to remember to call it. We had forgotten in
one place and that resulted in a lot of noise.
2020-01-27 19:02:44 +01:00
b6b49e84e4 Simplify the code
Now the Note's modified/created can never have a date with a year = 10
meaning a special thing.
2020-01-07 23:56:58 +01:00
8a6b6023d6 Sync: Combine crashlytics code 2019-12-27 00:37:20 +01:00
6af3b03210 Add a sync button to the AppBar
This somewhat shows what's going on with the network. It isn't ideal, as
is a bit ugly. But it's a start to show the network status, and what's
going on in the background.
2019-12-26 20:43:12 +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