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

189 Commits

Author SHA1 Message Date
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
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
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
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
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
dd425ecbe2 HttpUrl: Add a way to create from string host and auth token. 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
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
Ricki Hirner
be833b03ee Retain Events.UID_2445 when preparing events for upload
* move file name/UID generation from SyncManager to LocalContact, LocalEvent, LocalTask
* rename updateFileNameAndUID() to prepareForUpload()
* use random UUID for contacts, UidGenerator with Android device ID for events/tasks
* LocalEvent.prepareForUpload(): use existing UID_2445 if available
2017-04-05 18:29:15 +01:00
Ricki Hirner
97aefad0a2 Android 7 workaround: update hash after group membership operations 2017-04-05 18:09:58 +01:00
Tom Hacohen
9486719cbb Import: Resolved account name and icon when possible.
We assume the name of the account == package name, which is the best guess
we have. Android doesn't have a way to get account name/icon at the moment.
2017-04-03 22:52:39 +01:00
Tal Hacohen
e4fc23eb70 Journal - Load entries on background 2017-04-03 22:11:52 +01:00
Tal Hacohen
2706021a5e Import - Add account type to calendar account list 2017-04-03 21:41:47 +03:00
Tal Hacohen
bee502a440 Sort contacts accounts by name and type 2017-04-03 21:40:54 +03:00
Tom Hacohen
1227a66409 Import: Make icon acessible and get it for address book. 2017-04-03 14:21:21 +01:00
Tom Hacohen
15580374fa Import: Make the select calendar/account lists nicer
This also adds an icon (that will soon be replaced with the icon of the
relevant account), and shares the design between the calendar and the
contacts.
2017-04-03 13:47:13 +01:00
Tom Hacohen
7915a51f1f Import: Make account import activity prettier. 2017-04-03 13:10:35 +01:00
Tom Hacohen
0d848f0573 Merge: Add import from local accounts
This set of commits add import from local accounts.
It's a bit rough around the edges, but it's good enough to go in, so work can continue
collaboratively.
2017-04-03 12:56:52 +01:00
Tal Hacohen
9684123f68 Use App.log instead of Log in import fragmnets 2017-04-03 14:33:04 +03:00
Tal Hacohen
6820d9d413 Change desgin of both import lists 2017-04-03 14:27:48 +03:00
Tal Hacohen
8d208b3438 Refactor calendar account to import package 2017-04-03 14:27:48 +03:00
Tal Hacohen
1e9e055924 Import - Use ResultFragment in all import framgnets 2017-04-03 14:27:47 +03:00
Tal Hacohen
56aba7c669 Extract ResultFragment from ImportFragment 2017-04-03 14:27:25 +03:00
Tal Hacohen
a7c5ccadc9 Import - Change toolbar title according to relevant fragment 2017-04-03 14:27:24 +03:00
Tal Hacohen
1629ffba9f Import - Add fragment to import all contacts from account 2017-04-03 14:27:23 +03:00
Tal Hacohen
7cac473c74 Import - Split ImportActivity to fragments and activity 2017-04-02 14:04:14 +03:00
Tal Hacohen
33a310344b Import - Add all events to selected calendar 2017-03-30 16:09:22 +03:00
Tal Hacohen
594c401038 Import - Show calendars in expandable list view 2017-03-30 16:09:22 +03:00
Tal Hacohen
466870ff50 Import - Add basic import activity 2017-03-30 16:09:22 +03:00
Tal Hacohen
2261d6e385 Import calendar: Add calendar account class.
CalendarAccount loads all different accounts and their calendar lists.
2017-03-30 10:10:32 +03:00
Tom Hacohen
1482fb01cb JournalManager: make jorunal version read-only. 2017-03-29 23:46:11 +01:00
Tom Hacohen
cd5e5487a8 JournalManager: make IntegrityException inherit from GeneralSecurityException. 2017-03-29 18:27:50 +01:00
Tom Hacohen
cf805d4e72 JournalManager: add version info to Journals and use it in crypto
The crypto class now behaves differently depending on the version of the
journal.
The current difference is in the key derivation, and that the new
version of the crypto also hmacs the version automatically whenever it
hmacs anything.

The versioning was added for better future-proofing of the code.
The derivation change was done because before we were creating the same
password for all of the journals, now we do it per-journal. This means
that we can, if needed in the future use this password as the journal
password when sharing journals without compromising the security of the
rest of the journals.
2017-03-29 18:27:39 +01:00
Tom Hacohen
7357447786 Collectioninfo: fix typo in ToString field exclusion. 2017-03-29 15:10:52 +01:00
Tom Hacohen
c3e30138dd Syncmanager: get a collection info for all sync managers. 2017-03-29 14:47:43 +01:00
Tom Hacohen
01add874dc Remove unneeded fixme. 2017-03-29 13:27:56 +01:00
Tom Hacohen
d2eaf5f434 Use the new CryptoManager instead of the main encryption password.
This will give us more flexibility in the future because now the
encryption key and derivation is all managed in one place.
2017-03-29 13:01:04 +01:00
Tom Hacohen
4004eca762 Syncmanager: use the journalId as the unique collection id. 2017-03-29 12:45:14 +01:00
Tom Hacohen
1e6fc5a9cb Crypto: rename Cipher to CryptoManager. 2017-03-29 12:35:44 +01:00
Tom Hacohen
abd13d4d3d Crypto: refactor the Cipher class.
Include the hmac in the cipher class.
Derive keys on class creation instead of on encrypt/decrypt.
2017-03-29 12:27:22 +01:00
Tom Hacohen
0fbee1ea02 JournalManager: rename Helpers to Crypto.
These are crypto helpers, this should have been named this way from the start.
2017-03-29 12:12:35 +01:00
Tom Hacohen
225d01c143 Crypto: Only create random generator as needed. 2017-03-29 12:02:13 +01:00
Tom Hacohen
1d87de2e7a App update: set the app version on first launch if not already set.
The app update broadcast receiver is only called on the first update,
not install, which was causing EteSync to think it was updating from
version 1 on the first update, doesn't matter which version one was
updating from.
This fixes it by saving the version on the first run.
2017-03-28 16:44:53 +01:00
Tom Hacohen
784070c27c SyncManager: add remote entries to cache only after they've been processed
Before this change we were adding them to cache before they were
processed, potentially persisting malformed entries, or entries we
haven't yet processed causing issues if sync was aborted before an entry
was fully processed.
2017-03-27 16:08:45 +01:00
Tom Hacohen
987076d95e Webview: fix behaviour of toolbar back button and simplify. 2017-03-24 19:15:57 +00:00
Tom Hacohen
3a83cf8303 Collection deletion: mark as deleted in cache, but don't actually delete.
This is important for protecting against potential data loss.
2017-03-24 18:55:12 +00:00
Tom Hacohen
ba9f217d66 Webview: also open tos and about from within the app. 2017-03-24 18:42:28 +00:00
Tom Hacohen
9ba84109b2 Login: add a "forgot password" link. 2017-03-24 16:11:24 +00:00
Tom Hacohen
d21a498925 Webview: improve whitelist, and include all of the "accounts/" subpath. 2017-03-24 16:09:19 +00:00
Tom Hacohen
e7694924b4 Automatically fix non-dirty entries with null etag on upgrade
Commit 5d1c90dcba fixed a bug where
entries added from the server were marked as "local only" (null etag)
which was causing issues. That commit fixes it for newly added resources,
but existing resources remained broken.

This commit goes through the database and fixes all of the existing
broken resources. It skips dirty entries because figuring out if they
were just created or updated is complex, and the chances of doing an
update at exactly the same time there are dirty entries is quite low,
so the complexity involved is just not worth it.
2017-03-24 15:33:07 +00:00
Tom Hacohen
7562a7a76b ViewCollection: use the new LocalCalendar.findByName to get calendar. 2017-03-24 14:52:27 +00:00
Tom Hacohen
5d1c90dcba Resource: set eTag when creating a new one from server.
Before this commit we would create new entries from the server without
an etag, essentially marking them as "local only". While the actual
value of the eTag is not currently used, null or not matters.
Because the resources were "local only", we would get weird behaviours
like having an "ADD" action when changing a resource.
2017-03-24 14:40:29 +00:00
Tom Hacohen
84244330b7 Always log deletes, even when not previously added to server.
Before this change we would only add "deletes" to the server when the
resource has been previously uploaded. This means that if a resource has
been created and then deleted before a sync, it would not be saved,
which is essentially data-loss.
This commit fixes it, so we always upload a delete entry.
2017-03-24 14:08:57 +00:00
Tom Hacohen
99fe3457fc Refresh ViewCollectionActivity when edited/deleted
Until now we were just closing it when opening a view that can cause a
change. This is nicer.
2017-03-24 13:57:25 +00:00
Tom Hacohen
0cd57851ad Journal model: call the postLoad callback on fetch too.
It's really annoying that it doesn't do it automatically as it should,
in the meanwhile, add this workaround.

I reported it to upstream:
https://github.com/requery/requery/issues/487
2017-03-24 13:57:25 +00:00
Tom Hacohen
415d5d5447 Clear journal cache on account deletion (fix account re-add issue)
Clearing the cache is a good idea regardless, though because of the
unique constraints in the cache on the journal name, this was causing
issues when deleting an account and then adding it back.
2017-03-24 13:57:25 +00:00
Tom Hacohen
f984b76ec6 Add import from vCard (vcf)/iCal (ics)
This commit adds a basic UI for importing contacts and calendars from a
file.
2017-03-24 13:57:25 +00:00
Tom Hacohen
24b170a170 View collection activity: only create fragment on first load. 2017-03-24 12:49:19 +00:00
Tom Hacohen
231684e0d4 Local event/contact: Add a way to add/update as dirty 2017-03-24 12:49:11 +00:00