47 Commits

Author SHA1 Message Date
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
8e9e3a91b5 GitHosts: Throw RepoExists exception 2019-01-25 15:11:09 +01:00
86f01ab7d1 GitHosts: Improve error handling 2019-01-25 15:03:42 +01:00
fb202e0f1f GitHost AutoConfigure: Handle errors a bit better 2019-01-25 14:52:56 +01:00
bfcfa3b449 Add a GitHost factory
There are probably more idiomatic ways of doing this, but I'm not sure
how.
2019-01-25 11:28:38 +01:00
ac5c2be05d Add a GitHost interface
GitLab and GitHost are two implementations of that interface.
2019-01-25 11:21:58 +01:00
f8a066d5d9 Add API for GitLab
It's so awesome that I don't need to store the client secret with
GitLab. The GitHub APIs are so much easier to use + documentation, but
at least GitLab supports more OAuth methods.
2019-01-24 18:19:50 +01:00
4c1009f42f OnBoarding: Add auto-configure mode for Github
In this mode the user doesn't need to do anything but give the
GitJournal app permissions, and then it will go and create the repo, add
the ssh key and everything.

This currently does not work for Gitlab.
2019-01-24 16:45:40 +01:00
136713dc1e Github: Remove unnecessary braces 2019-01-24 15:30:55 +01:00
d87085ac29 GitHub API: Refactor it into a class 2019-01-24 15:28:04 +01:00
fbdb4d61ed Add an OAuth GitHub api
This just models the basic API that we need for GitJournal. The API
isn't great and could use improvement.

Also, yes, I know I'm committing the secret key, but I don't see any
other way of managing this. GitHub doesn't allow the implicit oauth flow
or dynamic clients registration or anything. So there isn't really any
other way.
2019-01-24 13:50:06 +01:00
a29a102667 Move git api to apis folder 2019-01-23 11:54:02 +01:00
cdc6fd9ed7 Git: Add a simplistic way to migrate between 2 git repos
This way initially all the changes are performed on the local git repo,
and then later they are applied on the remote git repo. Currently we
just copy the files, but we should be cherry-picking each commit and
applying it properly.
2019-01-23 11:24:51 +01:00