62 Commits

Author SHA1 Message Date
540078c413 Improve repo migrations
Earlier we had one folder 'journal_local', when the remote would be
setup a new folder called 'journal' would be created, and each all the
files would be copied over. This meant the local history was being
destroyed.

Now, we only have 1 folder 'journal', and on 'cloning', we add the url
as a remote, and do a git fetch + merge.

This simplifies everything drastically, and opens the door for multiple
remotes.
2020-10-15 12:18:47 +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
da459c65e3 NNBD: try fixing some of the errors 2020-09-13 20:52:16 +02:00
9e045519bb Add tests for GitHub & GitLab apis for fetching the list of repos 2020-09-05 11:18:54 +02:00
ccf5f65e55 List Repos: Print the http req as curl
Makes it easier to test
2020-09-05 11:03:15 +02:00
0c92ab2d26 GitLab: Fix license parsing 2020-09-03 21:53:54 +02:00
e4fd84d4a4 RepoList: Parse more information
This way in the future we can make the repo list a bit prettier. It
currently looks quite ugly.
2020-09-03 20:54:46 +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
66a76a0767 Revert "Use flutter_web_auth instead of our own OAuth mechanism"
This reverts commit 763cbf8493c610dec0e7e344bee40ad331e7a272.
This reverts commit ddad699b259bafe6c7ed630e7afc2eb38b7825e6.

This is causing way too many problems -

On Android with GitHub we occasionally get a User Cancelled exception.
On iOS this doesn't work < ios11

I prefer keeping my way till then. Even though it doesn't support
KeepAlive on Android.
2020-06-10 11:53:43 +02:00
763cbf8493 Use flutter_web_auth instead of our own OAuth mechanism
This works slightly better on iOS and on Android it has a keep alive,
which will prevent our app from being killed. Additionally, this way
there is less for me to maintain, which is always nicer.

The API for flutter_web_auth is also much simpler.

This also inolves some custom logic for parsing the Query Parameters
from the GitLab callback, as it doesn't seem to be a proper URI. Not
sure what is going on with Gitlab.
2020-06-09 17:09:38 +02:00
ef29186677 Remove getGitBaseDirectory function
Instead lets just use the path_provider. This was being used as for some
reason I wanted the files to reside inside the 'files' folder and not in
the 'app_flutter' directory.

However, that requires maintaining a fork of path_provider, which I no
longer want to do.
2020-05-31 09:29:15 +02:00
18db4899b2 GitHostSetup: Allow the user to choose between repos
This way they don't need to use a repo called 'journal'.
2020-05-15 15:28:44 +02:00
66eeaa552b Bump git_bindings and pass fresh version of gitAuthor/Email
This way the Settings change for git author is immediately reflected.

Fixes #130
2020-05-13 11:36:08 +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
f119e60b79 OAuth: close the webview explicitly afterwords
Hopefully this will fix the problem on iOS
2020-04-02 17:21:25 +02:00
1741fbf458 GitHub: Use http authentication header
Passing the oauth token via the query parameter has been deprecated and
will be removed on the 1st of July.
2020-02-09 16:32:35 +01:00
04af625a3b Log git exceptions in Crashlytics 2019-12-26 17:41:27 +01:00
757bf0b7ac Update dependencies and gradle 2019-12-23 12:25:31 +01:00
63170445d7 Move libgit2 code to git_bindings repo
We now have a much clearer separation between Git code and this app
specific code. This is awesome, it will allow other people to easily
integrate Git within their apps. Also, eventually it will be trivial to
switch to another implemention of Git (via JGit or a git client written
completely in Dart)

This breaks the iOS version as I haven't moved the code to build the ios
version. Maybe this will be a good excuse for me to setup a proper CI/CD
system for ios builds.

There is also a chance this breaks Crashalytics NDK symbols :(
2019-12-21 01:06:15 +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
7ba8faa57f Remove the entire concept of a subFolder
When configuring the Git Repo server, we could optionally track one folder
in the root git repo, instead of just the root folder. This was
specifically to address my use case where I have my journals in a
sub-directory. The setup screen was super ugly, though.

Since now I'm in the process of adding folder support because of #18, I
can remove this hack. It simplifies the code a lot.
2019-12-01 12:04:45 +01:00
fddefa3ff3 Revert "git clone: Force use of ssh protocol if not specified"
This reverts commit 8d11634108c6508674cde5e0e1b69c346a5a6bfd.
2019-11-14 13:22:15 +01:00
8d11634108 git clone: Force use of ssh protocol if not specified
If we don't specify the protocol, then specifying the port number
doens't work.
2019-11-11 02:06:08 +01:00
7e005d9900 Ignore 'invalid credentials' platform exception 2019-11-11 01:17:20 +01:00
7450f06a08 Ignore more git platform errors 2019-11-01 23:12:01 +01:00
8de58c138a Make constructor const 2019-10-20 01:37:39 +01:00
e7b05d7231 Enable unnecessary_const 2019-10-20 01:15:58 +01:00
992e2042a7 Ignore another network message 2019-10-08 16:00:56 +02:00
69003cf0ac Rename package from journal -> gitjournal
It's about time.
2019-10-07 19:30:50 +02:00
674655b5a8 Ignore one more PlatformException
It's nice that we're logging all of these platform exceptions. It really
lets us see all the different errors people are having over time.
2019-10-06 11:46:16 +02:00
2059d81529 Crashlytics: Ignore another network error 2019-09-26 15:22:40 +02:00
076afb3303 Do not log "No address associated with hostname" exceptions
We log all exceptions to Firebase. It's time to start clearing out the
ones that do not matter.
2019-09-25 17:38:00 +02:00
7c79c328bd Git: Call Firebase.logException on exceptions
We want to Git layer to always work. And ideally these exceptions should
never occur.
2019-08-21 08:44:26 +02:00
74d7bdd763 Use a proper logger - Fimber
It's time to start using a proper logger so we can control the number of
log messages, also - it helps to have a central configuration point for
the logs, specially since I would like to hook them up to Crashlytics in
the future.
2019-06-19 09:45:15 +02:00
d653663a47 Change Git dart API
Use a class instead of a many functions. This way we avoid passing the
same arguments again and again.
2019-06-17 19:38:56 +02:00
3e563c3d0e Fix typo 2019-06-03 18:16:04 +02:00
c79249cbe1 Dart: Give all functions explicit types
It makes the code easier to understand and this way the static type
checker will catch bugs for us.
2019-06-02 15:51:43 +02:00
64c8ddd7b0 Android: Use the c library for git pull
It's not perfect as our implementation of git pull results in an extra
merge commit and doesn't handle conflicts properly, but it is a basic
implementation, so at least we have something.
2019-05-16 12:23:27 +02:00
9ce4e5b1b9 DartLinter: Add prefer_collection_literals 2019-02-23 01:36:32 +01:00
8ff5d02033 DartLinter: Add unnecessary_this 2019-02-23 01:33:34 +01:00
1f7871fe12 Add a GitResetLast command
This way we can revert the last committed change.
2019-02-15 19:27:40 +01:00
7d380e1ea2 GitMigration: Change commit message
Lets keep it as 'Added Journal Entry', as this way it isn't obvious
that'we loosing the history of the changes when moving from the local to
the remote repo.

Implementing proper migration would take me hours, and its not a
priority right now.
2019-02-15 00:24:51 +01:00
03e46ce8cd Allow notes to be stored inside a sub-folder in a git repo 2019-02-14 12:59:43 +01:00
06dc62e967 GitSetup: Use the 'journal' repo if it already exists 2019-02-14 11:06:49 +01:00
c5c4d44431 GitHost: Improve error handling
In the case of OAuth errors which we get through the message
channel, throwing an exception doesn't help us as the init function
will not be aware about it.

So for now, I've moved the nodejs style error handling in this
particular case.
2019-02-13 22:43:34 +01:00
5452fc0a78 GitHostSetup: Automatically open the correct url
This is a behaviour that got lost during the refactor.
2019-02-13 21:02:33 +01:00
acede95536 Dart: Add analysis_options
For now I've mostly tried to follow the same style guide as the flutter
repository, with many options disabled. Eventually, maybe it would make
sense to be far stricter.
2019-02-13 13:08:15 +01:00
dc29d523cc GitSetup: Get the user's name + email from the GitHost
This way they aren't committing under the name of 'GitJournal'.
2019-02-09 16:47:53 +01:00
c7915d8feb Settings Screen: Actually save the gitAuthor + email
There is too much code duplication over here, but - meh - I'll clean it
up later.
2019-02-09 16:30:12 +01:00
4de157e6b1 Add an automated test for testing git clone in github
It currently fails :(
2019-02-06 15:06:08 +01:00