1
0
mirror of https://github.com/etesync/android synced 2024-11-22 16:08:13 +00:00
Commit Graph

687 Commits

Author SHA1 Message Date
Tom Hacohen
26c0a62dc4 Don't crash when immediately entering collection after creation. 2017-04-27 11:56:17 +01:00
Tom Hacohen
674ea1eeca Workaround Android account creation issue (ignoring userData)
It seems like there's an issue with Android that sometimes the userData
passed to addAccountExplicitly is not correctly set in the Android cache
making it return null on subsequent fetches. It doesn't always happen
because some cases clear the cache, however I can consistently trigger
it by creating and deleting an account a few times in a row.
2017-04-27 11:49:06 +01:00
Tom Hacohen
db82757bc4 Show an error message when failing to create an account. 2017-04-27 11:49:05 +01:00
Tom Hacohen
aeae7de077 Workaround: ignore invalid account errors when syncing contacts
This is an ugly workaround. For some reason a sync is called when an
account is removed. Since the main account is removed, we get an invalid
account exception when trying to fetch it.

Need to find out why a sync is even triggered and just remove it there.
2017-04-27 11:49:05 +01:00
Tom Hacohen
c81ba0cddb Create an AndroidCompat class to wrap around Android oddities.
As part of it, move removeAccount to that class.
2017-04-27 11:49:05 +01:00
Tom Hacohen
de6a124bf2 Remove unnecessary InvalidAccountException
Based on commit d4e386441091ae3a84382f2088dfad03ea80c666 from DAVdroid.
2017-04-27 11:49:05 +01:00
Tom Hacohen
068e0c6b4d Expose appName from App and use it. 2017-04-27 11:49:05 +01:00
Ricki Hirner
51840c3a22 Fix some inconsistencies 2017-04-27 11:49:05 +01:00
Ricki Hirner
138d344a5b Open DAVdroid main activity when add a "DAVdroid Address book" account is added over Settings 2017-04-27 11:49:05 +01:00
Tom Hacohen
d6ace869fe Remove add, share and delete restrictions on address books
Now that we have multiple address books support, we can share and delete
address books like we did calendars.
2017-04-27 11:49:05 +01:00
Tom Hacohen
2f95ddbda2 Import: Fix address book import.
The import code assumed there can be only one address book, and that
it's the main one. This commit fixes that wrong assumption.
2017-04-27 11:48:01 +01:00
Tom Hacohen
e729bcff42 ViewCollection: fix addressbook stats. 2017-04-27 11:48:01 +01:00
Tom Hacohen
51aecba9a0 LocalAddressBook: Add a way to get address book by UID. 2017-04-27 11:48:01 +01:00
Tom Hacohen
19b955f981 Change LocalAddressBook to look like LocalCalendar (accept journalentity) 2017-04-27 11:48:01 +01:00
Tom Hacohen
48a77530a8 Make account type strings non-translateable. 2017-04-27 11:48:01 +01:00
Tom Hacohen
dfb8981752 Remove the ACCOUNT_TYPE constant (now a string resource)
This corresponds to commit 41dae8bcb3335b9e77d9e73b33e9bb14f8900af9 from
DAVdroid, but was done manually.
2017-04-27 11:48:01 +01:00
Ricki Hirner
0d7e2362b3 Improve address book details in debug info 2017-04-27 11:48:01 +01:00
Ricki Hirner
310b94e280 Add more debug information
* power saving status
* permissions
* address book accounts
2017-04-27 11:48:01 +01:00
Tom Hacohen
1422d95ccf Disallow user removal of address book accounts
We don't want users to remove address books on their own, we want to
control these automatically. This commit blocks it.
2017-04-27 11:48:01 +01:00
Tom Hacohen
83ef63e94b Remove getCollections and add the afterLoad workaround to getJournals. 2017-04-27 11:48:01 +01:00
Tom Hacohen
589f81c50d Add multiple address books support
Android allows only having one address book per account, so until now
users of EteSync were only able to have one address book. This was
always an annoying limitation, but even more so now that journal sharing
is implemented.

Luckily, DAVdroid recently implemented multiple account support by
creating sub-accounts for address books.

This patch is an import of the DAVdroid changes, with adjustments to
work with EteSync, and a few changes that did not make sense for
EteSync. The original commits' split didn't provide any value over this
squash, and the amount of adjustments and addition needed to be done to
apply them, made me decide to squash this change together.

This commit is mostly based on:
dfec72ce6b8ff5e0780e9ac4418c81d080f4b60b
9817594da14ad8dffae18de386e14aeaf41312b9
2017-04-27 11:42:05 +01:00
Tom Hacohen
2e25c44d78 Journalmanager crypto: Make AsymmetricKeyPair serializable.
This should fix a rare crash on the login page.
2017-04-26 19:47:32 +01:00
Tom Hacohen
71d694c1c1 Fingerprint: Change the fingerprint format to be numeric instead of hex.
Thanks to @dschuermann for the suggestion. This makes it easier for
people of non-latin speaking cultures to compare the fingerprints.

Code is based off of Signal's fingerprint generation.
2017-04-25 16:05:57 +01:00
Tom Hacohen
be108389c5 Journal viewer: verify journal entry content is not null before searching it.
This actually happened for a user, which is weird, because entries should never be null,
but I guess it is a possible scenario.
2017-04-25 16:05:55 +01:00
Tom Hacohen
96443a0b57 Journal model: fix broken database migration
Add missing readOnly column
Make the new_Entry foreign key refer to new_Journal and not the old one.
2017-04-24 16:13:20 +01:00
Tom Hacohen
fab8aa90ac Collection owner: Handle the case of owner == null. 2017-04-21 20:52:51 +01:00
Tom Hacohen
201e4e09eb Update to the new jorunal entries API. 2017-04-21 15:03:19 +01:00
Tom Hacohen
148260110a Journal members: update according to the new members API. 2017-04-21 14:10:13 +01:00
Tom Hacohen
53e7ba98ab Debug activity: Remove references to jbworkaround (we don't need it). 2017-04-21 11:28:02 +01:00
Tom Hacohen
1ab32be0f6 Add support for read-only journals.
This change only works for calendars at the moment, because we don't have shared
address books anyway.
This is currently only implemented in the client, and only as a read-only attribute,
you can't make a journal read-only yet. This requires server support that is not yet
there, but it's better to be ready for this sooner rather than later.
2017-04-21 11:19:10 +01:00
Tom Hacohen
df3db6b357 LocalCalendar: accept JournalEntity, not CollectionInfo when creating and updating.
Some of the information is now saved there, and more will be transferred
soon. CollectionInfo includes the encrypted part, and journalentity the
non-encrypted part of the journal info, so both are needed.
2017-04-21 11:08:20 +01:00
Tom Hacohen
f8d0878003 Journal sharing: Add a nice error message when journal is not found. 2017-04-21 10:33:52 +01:00
Tom Hacohen
5c2601f408 Fingerprint verification: dismiss dialog when not trusting fingerprint. 2017-04-21 10:28:14 +01:00
Tom Hacohen
3c1cad8960 Fingerprint: Improve how the fingerprint dialog looks like. 2017-04-21 10:27:52 +01:00
Tom Hacohen
fc52194d39 Journalmanager: rename CRUD method to be more consistent.
All are now on of: list, delete, create and update.
2017-04-20 20:48:12 +01:00
Tom Hacohen
0bade21aae ViewCollection: list the journal's owner if it's not owned by us. 2017-04-20 20:10:43 +01:00
Tom Hacohen
348e24c3e3 Account: indicate on the list if a collection is shared. 2017-04-20 20:04:09 +01:00
Tom Hacohen
eeda46338d Disallow sharing of journals with version < 2.
The reason for that is that before version 2, all the journals of a
particular user shared the same encryption key, which means, sharing a
journal of version one, would essentially give away the encryption key
of all of its journals, even the private ones.

This is thus blocked for security reasons.
2017-04-20 19:48:46 +01:00
Tom Hacohen
4c47384198 Journals: support adding back deleted journals.
This currently just adds the journal back, but doesn't re-apply the
journal, so the calendar for example would be empty, but the journal
itself would be listed and visible.
2017-04-20 19:48:46 +01:00
Tom Hacohen
d3057f86f0 Disallow sharing of address books.
At the moment we only support one address book per user, and sharing
address books will interfere with this model. Hopefully, we'll add
multiple address book support in the next release, and then we'll
re-enable this.
2017-04-20 19:48:46 +01:00
Tom Hacohen
93fb1e3c54 Remove redundant dbhelper calls.
These calls were made obsolete after the switch to requery. We no longer
need to get the database, because we no longer use it.
2017-04-20 19:48:46 +01:00
Tom Hacohen
e15a26af9c User info: fix version detection, and don't verify on fetch.
We were not detecting the version correctly, but always just assumed
latest version, which is obviously wrong.
In addition, before this commit we used to automatically verify on
fetch, which wasn't flexible enough for some use cases. This fixes that
too.
2017-04-20 19:48:46 +01:00
Tom Hacohen
9fb9db9327 ViewCollection: only allow owner to edit collections. 2017-04-20 19:48:46 +01:00
Tom Hacohen
656dad3615 Add UI to add/remove/list journal members.
Only owners of a journal are allowed to control and view its members.
2017-04-20 19:48:46 +01:00
Tom Hacohen
4246ae7ede Add a way to view own fingerprint.
This adds a menu option from the account page to view your own keypair
(to compare when sharing).
2017-04-20 19:48:46 +01:00
Tom Hacohen
4c6176a6f4 Fetch userinfo on account creation.
We need the keypair to access shared journals, so we need to make sure
to fetch it at the moment we create the local account, which is what
this commit does.
2017-04-20 19:48:46 +01:00
Tom Hacohen
a57936982d Add a fragment to setup user info.
This is used to create a keypair and put it on the server if one doesn't
exist, and fetch it and save it locally if one does.

It's currently called from the account activity.
2017-04-20 19:48:46 +01:00
Tom Hacohen
beccb33904 Journal: use journal keys if available.
If a journal has a key set to it (usually used for shared journals), use
it instead of the symmetric key. The key of the journal is asymmetrically
encrypted using our keypair.
2017-04-20 19:48:45 +01:00
Tom Hacohen
43803b6d3e AccountSettings: Add a keypair setting.
This is used for storing the asymmetric key pair.
2017-04-20 19:48:45 +01:00
Tom Hacohen
ae08510729 Requery: Fix database to have the correct constraints (on upgrade).
Requery doesn't automatically update column constraints, and there was
an issue with it applying indexes before adding the new columns which
was also causing troubles. This commit, while ugly, just manually
updates the database using raw SQL to what we expect it to be.
2017-04-20 19:48:45 +01:00
Tom Hacohen
e2f206e02e Services: Move to a requery model instead of raw SQL and improve models.
Having it in raw sql was slowing down development, and was error-prone.
It's much cleaner now, easier to handle, and enables us to develop
faster.

In this change I also fixed the fetching of journals to be by service
and id, not just id, because just id is not guaranteed to be unique.
2017-04-20 19:48:45 +01:00
Tom Hacohen
8b79529a94 Bump version. 2017-04-20 19:48:45 +01:00
Tom Hacohen
88ceeaa2a5 Entry and journal: fix uniqueness to be composited, and not just by uid.
Before this change, uid was unique on its own, this was wrong, because
due to shared journals, we can have the same journal in two accounts,
and we can thus have both journal and entry UIDs more than once.

This fixes the constraint to be unique for journal, uid, and service,
uid combinations.

This is currently disabled for journals because of a bug in requery.
2017-04-20 19:48:45 +01:00
Tom Hacohen
a4a32045e8 Journal: get and persist owner and key.
The server was changed so the owner of the journal, and the encrypted
key (if a shared journal) would be exposed. This change fetches it, and
saves it.
2017-04-20 19:48:45 +01:00
Tom Hacohen
efe832ddb4 Journalmanager: Add api for the members endpoint.
This API controls the members of a journal, that is, access control.
2017-04-20 19:48:45 +01:00
Tom Hacohen
11e37dbd1e Journalmanager: add API to interact with the UserInfo
This is where the keypair is stored on the server. Both the public
facing public key, and the encrypted private key
2017-04-20 19:48:45 +01:00
Tom Hacohen
e836b4c716 Crypto: Add basic asymmetric encryption methods 2017-04-20 19:48:45 +01:00
Tom Hacohen
89731519e9 Account view: cleanup and share collection list items and adapter.
They were redundant and needed some cleanup, now they are better, and
shared between calendar and contact.
2017-04-20 19:48:37 +01:00
Ricki Hirner
17d90a4569 Allow null values for IS_ORGANIZER 2017-04-20 14:15:04 +01:00
Tom Hacohen
e82d8affe8 Update okhttp and submodules to latest. 2017-04-20 14:14:40 +01:00
Tom Hacohen
30af730048 requery: update to 1.3.0.
Although this release is claimed to fix the afterLoad issue, this is not
the case. We are just updating it so the upgrade path later one would be
easier.
2017-04-20 14:08:17 +01:00
Tom Hacohen
190ec89c2c JournalModel: don't convert to list when getting collections.
Just use the iterator we get back already.
2017-04-20 14:01:28 +01:00
Tom Hacohen
da87d14ae9 Journalmanager: always use the api error message when available. 2017-04-20 11:15:10 +01:00
Tom Hacohen
6579ac8cf1 View/EditCollection: Add icons to menu operations 2017-04-19 17:54:10 +01:00
Tom Hacohen
8f1f4785a6 Revert "Update requery and remove the afterLoad workaround."
Unfortunately this requery version introduced a regression. When adding
a new account, it takes syncign a few times until it works. It looks
like requery is not loading the recently saved instances.

This reverts commit f0f70ff1c61996d0e45d8f72d24654c739c325f7.
2017-04-19 17:53:42 +01:00
Tom Hacohen
57f447d372 Requery: Don't destroy and recreate db when updating. 2017-04-19 17:53:41 +01:00
Tom Hacohen
d80cce9aad CryptoManager: add an HMAC_SIZE (in bytes) constant. 2017-04-19 17:53:21 +01:00
Tom Hacohen
56996b98c4 Update requery and remove the afterLoad workaround.
Prior to this version of requery there was an issue that prevented
afterLoad to be called in some cases. This issue forced us to add an
explicit call to afterLoad. It's now fixed, so the workaround is no
longer required.

Reference issue: https://github.com/requery/requery/issues/487
2017-04-19 17:53:00 +01:00
Tom Hacohen
c95aaaf5fd HintManager: simplify by moving to strings and removing the need to register 2017-04-07 09:50:55 +01:00
Tom Hacohen
c42602d030 Contacts/Event: Set PRODID to EteSync. 2017-04-07 09:41:27 +01:00
Tom Hacohen
4e0cd7f554 SyncManager: Use the last journal id as the ctag, instead of storing it.
We were storing the ctag separately although the data was already
present in the journal. The last entry's ID is always the CTAG.
This could cause issues if sync is aborted exactly at the right time.
I managed to trigger this issue on rare cases.
2017-04-06 23:33:11 +01:00
Tom Hacohen
338dd5e075 Database: Mark collections class as deprecated.
It's only used for migrations, and has been considered deprecated for a
while. Mark it as deprecated to make it extra obvious that this should
not be used.
2017-04-06 23:32:25 +01:00
Tom Hacohen
fcbf26a03b Tests: Add journalentrymanager tests. 2017-04-06 19:05:48 +01:00
Tom Hacohen
14e6f757c5 Journalmanager: Change getUuid to getUid (the rest says uid too). 2017-04-06 17:29:25 +01:00
Tom Hacohen
7cefb64db2 CollectionInfo: rename url -> uid. 2017-04-06 17:28:03 +01:00
Tom Hacohen
2e7ac65883 Tests: Add some basic tests. 2017-04-06 17:25:06 +01:00
Tom Hacohen
dd425ecbe2 HttpUrl: Add a way to create from string host and auth token. 2017-04-06 17:01:18 +01:00
Tom Hacohen
d41b7827ee Tests: Move constants to a shared file. 2017-04-06 17:01:18 +01:00
Tom Hacohen
9ba0f39660 Tests: Add basic authenticator tests. 2017-04-06 17:01:18 +01:00
Tom Hacohen
94f2682195 Tests: add basic encryption tests. 2017-04-06 17:01:18 +01:00
Tom Hacohen
a77e49c033 Tests: remove useless HttpClient test. 2017-04-06 17:01:18 +01:00
Tom Hacohen
70b549033c Crypto: add an exception to when crypto version is too new. 2017-04-06 17:01:18 +01:00
Tom Hacohen
5abf635fa0 Base64: Pull in the base64 impl from the android source code.
It seems like this is the only (semi) sane way to get base64 to work on both
Android and local tests.
2017-04-06 17:01:18 +01:00
Tom Hacohen
e3c48a0560 ImportFragment: move to the import package. 2017-04-06 15:06:42 +01:00
Tom Hacohen
ea91063178 Use the safe getDrawable function instead of the version specific one. 2017-04-06 15:02:36 +01:00
Tom Hacohen
52723dac67 View collection: add a showcase to explain how to import. 2017-04-06 14:29:15 +01:00
Tom Hacohen
51d9c75c56 AccountActivity: Add a showcase to the account activity. 2017-04-06 14:29:15 +01:00
Tom Hacohen
cb140a3387 Main activity: Add a showcase for adding an account.
Turn it off by default if upgrading to this version, because this means
the user most likely already knows how to add an account.
2017-04-06 14:29:15 +01:00
Tom Hacohen
f650d38435 Hints manager: Add a class to manage hints (show once info)
This is much cleaner than what was there before, and enables to easily
add more hints.
2017-04-06 12:08:32 +01:00
Tom Hacohen
2570c9671d Bump version 2017-04-06 12:02:49 +01:00
Tom Hacohen
4dd11a1912 Update minsdk version to 4.1 (16).
Prior to this version, the list of available crypto was quite poor.
2017-04-06 10:55:33 +01:00
Tom Hacohen
80fad58de4 Fix build break. 2017-04-06 10:34:05 +01:00
Ricki Hirner
c83b28c3bb Account settings: restart loader after sync interval update
* debug info: add signature
2017-04-06 10:08:16 +01:00
Tom Hacohen
4920bc0c81 SSLSocketFactory: Update the cipher priority list to something more secure.
We can assume much safer ciphers since we control the server too and
we don't have to work with old insecure servers.
2017-04-06 10:04:15 +01:00
Ricki Hirner
3a0c112fad Enable SSL_RSA_WITH_3DES_EDE_CBC_SHA for all Android versions
* refactor cipher selection
2017-04-06 09:30:07 +01:00
Tom Hacohen
c2e7914290 CollectionInfo: remove the obsolete support VEVENT and support VTODO. 2017-04-05 19:24:55 +01:00
Tom Hacohen
0a4d4a9d9e Calendar sync adapter service: minor cleanup. 2017-04-05 18:56:45 +01:00
Ricki Hirner
1295e4557e AccountsActivity: show message when global sync is disabled 2017-04-05 18:37:24 +01:00
Ricki Hirner
433484626f Don't use uid2445 column on Android <4.2; alarm ACTION: compare only value (ignore parameters) 2017-04-05 18:34:24 +01:00
Ricki Hirner
f1ea00d816 Improve Android 7 workaround behavior in combination with CATEGORIES/VCard4 contact groups 2017-04-05 18:32:52 +01:00