1
0
mirror of https://github.com/etesync/android synced 2024-11-15 20:38:58 +00:00
Commit Graph

908 Commits

Author SHA1 Message Date
Tom Hacohen
1d5bcc6a3d Add a separate exception for HttpConflict. 2019-05-01 09:12:42 +01:00
Tom Hacohen
fe980f937e Fix potential crash when opening and stopping the app very quickly. 2019-04-30 14:09:35 +01:00
Tom Hacohen
9c8daf1ebd More optimise imports. 2019-04-16 17:14:49 +01:00
Tom Hacohen
c484d29a42 Optimise imports. 2019-04-16 17:14:14 +01:00
Tom Hacohen
3b0bfbb054 Don't rely on the ACCOUNTS_CHANGED broadcast receiver
I've seen some crashes there. This change brings it inline with
DAVDroid, and looks cleaner regardless.

Based on 1f7298f947a4878e86fcba0c6722e34b03cb63c6 from DAVDroid
2019-04-16 17:09:01 +01:00
Tom Hacohen
f629d23c38 Fix access to uninitialized properties in account update service. 2019-04-16 13:18:28 +01:00
Tom Hacohen
2e2841cea4 Fix encryption password change not to crash.
It was a regression from the custom cert manager update.
2019-04-15 14:20:54 +01:00
Tom Hacohen
41c7239a8c Members list: fix crash and handle correct lifecycle. 2019-04-12 09:51:56 +01:00
Tom Hacohen
7010967a31 Import: fix crash when import finishes while the activity is dead. 2019-04-04 13:59:00 +01:00
Tom Hacohen
f41c7cd4c9 Contacts sync manager: remove unnecessary not-null assertion. 2019-04-04 13:58:16 +01:00
Tom Hacohen
eef861614e Contacts sync manager: only init one resource downloader per sync.
Before this we were doing it per sync entry which could be slow.
2019-04-04 13:58:16 +01:00
Tom Hacohen
487d330a7a Contacts Sync Manager: remove redundant address book init.
Fixes #73
2019-04-04 13:58:16 +01:00
Tom Hacohen
3637fc95db Sync: catch and report SSLHandshakeExceptions.
They were not being reported as part of the general code
because SSLException inherits from IOException which is
handled differently.
2019-04-03 22:24:42 +01:00
Tom Hacohen
6ac83beb47 Debug activity: fix crash when getting sync errors.
Sync phase was passed as an Int but expected as a String.
2019-03-30 09:36:57 +00:00
Tom Hacohen
a702a4e794 Crash email: include a body with requests for more information. 2019-03-27 11:26:06 +00:00
Tom Hacohen
409f586835 Add tutanota to the list of email clients not supporting attachments.
This list is the clients that don't support attachments when called from
an intent. We want to include debug info inline for those.
2019-03-26 16:10:53 +00:00
Tom Hacohen
0a2a3b2d99 Rename queryCapabilites to prepareFetch 2019-03-21 16:09:04 +00:00
Tom Hacohen
44c516a868 Sync: fix the sync to also do the initial preparation in chunks
This fixes issues with Android killing the sync when making massive
syncs such as importing 10,000 events.

Fixes #69
2019-03-21 16:09:04 +00:00
Tom Hacohen
dcc3ec6f88 Fix crash when removing journal members 2019-03-21 16:06:37 +00:00
Tom Hacohen
d04d0f902f Fix closing of the HttpClient when syncing. 2019-03-21 16:06:37 +00:00
Tom Hacohen
bc829d0d1e Improve logging in syncmanager and import. 2019-03-21 11:40:02 +00:00
Tom Hacohen
5090a3206e Only show the custom certificate popup when using EteSync interactively
With this change, we make it so using a self-signed certificate will
have to be authorised on the first login rather than checked every time
on the background.
This was causing annoying issues with networks that mitm SSL
connections, and anyhow, we shouldn't be asking users to trust bad certs
when in 99.9% of the cases it would either be an attack or a broken
network.

Fixes #36
2019-03-15 10:53:51 +00:00
Tom Hacohen
ee2dad4d19 Set certmanager foreground/background state. 2019-03-15 10:53:51 +00:00
Tom Hacohen
4134f78da4 Upgrade cert4android and refactor httpclient based on upstream 2019-03-15 10:53:51 +00:00
Tom Hacohen
75020c1841 Settings: add a link to the notification settings. 2019-03-15 08:56:06 +00:00
Tom Hacohen
d147728acd Add a setting to control log verbosity. 2019-03-14 21:25:47 +00:00
Tom Hacohen
705df2a536 Overhaul the notification system and add notification channels. 2019-03-14 21:15:17 +00:00
Tom Hacohen
64f8c5e1d2 Move the sync notification helper under syncadapter and rename it. 2019-03-14 20:46:36 +00:00
Tom Hacohen
ac22ece30d Don't use a separate :sync process anymore so prefs don't need IPC.
Fixes #67
2019-03-14 20:40:52 +00:00
Tom Hacohen
1cdad6232e Log to file: move to use normal preferences. 2019-03-14 20:30:07 +00:00
Tom Hacohen
df315a48ab Fix logging to file. 2019-03-14 20:10:31 +00:00
Tom Hacohen
17b6e69c86 Move everything to use the new Logger 2019-03-14 19:35:30 +00:00
Tom Hacohen
216b51d138 Create a logger object to take care of all the logging. 2019-03-14 19:14:34 +00:00
Tom Hacohen
14abc6400d Rename the logger's name to etesync. 2019-03-14 19:02:42 +00:00
Tom Hacohen
a7aed85a4c Import latest logger code from davdroid. 2019-03-14 19:01:08 +00:00
Tom Hacohen
b382b8515c Request sync after encryption password change.
This is because we need the journals to be up to date with the newly
added key, or otherwise there could be issues when editing them.
2019-03-11 18:17:42 +00:00
Tom Hacohen
a605c2ae49 Fix adding journal members following an encryption password change.
See previous commit for more details about this issue.
2019-03-10 19:01:19 +00:00
Tom Hacohen
9f0b492c42 Fix collection editing following an encryption password change.
A lot of the code dealing with collections assumes that the editing is
done by the owner (true assumption, for now), and therefore the encryption
key is derived from the master key (not true anymore, as it could be a
stored version of the old key). This commit removes this wrong assumption.
2019-03-10 19:01:02 +00:00
Tom Hacohen
6f453faf06 Import: cleanup code a bit.
This should make it easier to debug null errors.
2019-03-10 19:00:56 +00:00
Tom Hacohen
77d89f3b4b Import: Rename poorly named class. 2019-03-10 16:16:42 +00:00
Tom Hacohen
c4ee03b733 Fix null warning 2019-03-07 08:32:29 +00:00
Tom Hacohen
cf8afd541c ACRA: switch to notification alerts on crashes.
On some devices users weren't able to send stack traces because
EteSync would restart and then hide/cancel the email app chooser.
2019-03-07 08:26:10 +00:00
Tom Hacohen
332caf1631 View Collection: add checks if we successfully managed to acquire the provider. 2019-03-07 08:09:16 +00:00
Tom Hacohen
356017a541 Entry sync: also generate UUIDs for first synced deleted entries
This fixes a bug with deleting entries that were never synced before. To
reproduce:
1. Turn off wifi + data (to ensure nothing is synced).
2. Add an entry (event/task/contact).
3. Delete that entry.
4. Turn wifi + data back on
5. Hit sync
2019-03-06 19:27:43 +00:00
Tom Hacohen
f64960699b LocalTask: remove a potentiall bad logging message. 2019-03-06 19:19:40 +00:00
Tom Hacohen
e1573ef7ab Tasks journal view: show the number of tasks in the journal. 2019-03-06 19:03:32 +00:00
Tom Hacohen
7eee04f458 Remove wrong not-null assertion. 2019-03-06 18:30:36 +00:00
Tom Hacohen
db8667e84a Fix issue with OpenTasks causing a lot of syncs in some rare cases.
We weren't setting a default sync interval which meant that in some
cases it was just syncing every 10 seconds.

This fix also fixes #66.
2019-03-06 18:10:37 +00:00
Tom Hacohen
c6472fe220 Unify the sync interval settings across journal types. 2019-03-06 17:11:19 +00:00
Tom Hacohen
b765f177c7 Migrate to AndroidX. 2019-03-06 16:24:23 +00:00
Tom Hacohen
130cea18ce Tasks: move the opentasks install button to the menu.
It was quite ugly having it there.
2019-02-25 15:26:14 +00:00
Tom Hacohen
4cc664ee6c Fix misleading logging message. 2019-02-25 08:49:16 +00:00
Tom Hacohen
1b15aaab19 Import: minor code cleanups. 2019-02-24 08:48:24 +00:00
Tom Hacohen
858378b107 Revert "Event invites: Warn about clients that don't support email attachments"
We can't trigger a toast from a service, revert this for now.

This reverts commit 0cda396d20.
2019-02-24 08:07:11 +00:00
Tom Hacohen
b64b95e204 Import from file: fix issues with sometimes importing from file. 2019-02-24 08:07:11 +00:00
Tom Hacohen
4fb49cf5f4 Import from file: dismiss dialog and print an error in a missed error case. 2019-02-23 21:24:26 +00:00
Tom Hacohen
98ca5fa318 Fix the setting controlling change notifications. 2019-02-21 19:24:39 +00:00
Tom Hacohen
cb570978e5 Account activity: don't hide collection headers even if empty.
This was an annoying remanent from DAVDroid. Maybe it makes sense for
DAV, but it defo doesn't make sense for us where we can just create
collections (and anyhow always have existing defaults!).
2019-02-20 16:30:55 +00:00
Tom Hacohen
1aed0106cd Add a button for installing OpenTasks if not already installed. 2019-02-20 16:30:55 +00:00
Tom Hacohen
bbbfbffe59 Add a helper function for checking if a package is installed. 2019-02-20 16:30:55 +00:00
Tom Hacohen
0cda396d20 Event invites: Warn about clients that don't support email attachments 2019-02-20 16:30:26 +00:00
Tom Hacohen
09ee9a2bd1 Rename and move the function checking if email attachments are supported. 2019-02-20 15:35:14 +00:00
Tom Hacohen
4d661117e5 Don't pop up notifications on bad gatewary errors as most likely a server restart.
The server is and should be monitored for misconfigurations, we don't want to annoy
users with temporary issues.
2019-02-13 19:06:32 +00:00
Tom Hacohen
ea0add8f45 Gracefully handle getting non json responses when expecting json. 2019-02-13 19:06:32 +00:00
Tom Hacohen
143092ecf3 Don't pop up notifications when server is under maintenance. 2019-02-13 18:52:58 +00:00
Tom Hacohen
5e8bb06b03 Add an exception for a bad gateway error. 2019-02-13 18:52:58 +00:00
Tom Hacohen
79ddd1d7c9 Fix bug with resetting contact deleted state. 2019-02-13 14:47:05 +00:00
Tom Hacohen
cabea0c3ec Revert changes when changing read only journals. 2019-02-13 14:47:05 +00:00
Tom Hacohen
7216a177c5 Member list: indicate if a member is read only or not. 2019-02-13 13:13:55 +00:00
Tom Hacohen
e44c4a394c Add the UI to invite read only members to journals. 2019-02-13 12:58:52 +00:00
Tom Hacohen
a43d0fceb8 Fix journal readOnly json to use the correct field name. 2019-02-13 11:02:28 +00:00
Tom Hacohen
e7186df6b8 Fix compilation warning. 2019-02-12 21:50:48 +00:00
Tom Hacohen
b6453718f4 Import fragment: move the null assertions around a bit
Better this way. Easier to know what's going on.
2019-02-12 10:18:29 +00:00
Tom Hacohen
69bf028481 Apply group memberships: be more defensive with potentially missing members.
This should never happen, but it has:

kotlin.TypeCastException: null cannot be cast to non-null type com.etesync.syncadapter.resource.LocalContact
at com.etesync.syncadapter.resource.LocalGroup$Companion.applyPendingMemberships(LocalGroup.kt:66)
at com.etesync.syncadapter.syncadapter.ContactsSyncManager.postProcess(ContactsSyncManager.kt:122)
at com.etesync.syncadapter.syncadapter.SyncManager.performSync(SyncManager.kt:169)
at com.etesync.syncadapter.syncadapter.ContactsSyncAdapterService$ContactsSyncAdapter.onPerformSync(ContactsSyncAdapterService.kt:59)
at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:259)

We call it at post process exactly because we want to make sure that all
the members already exist.

I guess a deletion on a misbehaving client (maybe even the web client?)
can cause this. Potentially also with some DAV clients.

Anyhow, it's better to be more defensive here.
2019-02-12 09:27:44 +00:00
Tom Hacohen
b13be67820 Import: improve group import and fix a potential crash
Fixes a potential crash when e.g. importing a file with a group that has
members that don't actually exist (e.g. importing a partial vcf).

This change also fixes importing files that have the groups show up
before their members.
2019-02-04 13:58:06 +00:00
Tom Hacohen
efa8719ce5 Account settings: add a link to the dashboard and clean up a bit. 2019-02-01 12:48:49 +00:00
Tom Hacohen
635a512ca6 Create collection: fix the shown color to be the default color. 2019-01-29 23:15:05 +00:00
Tom Hacohen
a1051856ec Fix usage of tasklist colour in collection members activity. 2019-01-29 23:10:38 +00:00
Tom Hacohen
e161233453 Edit task list: fix saving of task list colour.
Fixes #60
2019-01-29 23:10:32 +00:00
Tom Hacohen
96fc87cad4 Fix loading tasklist color in edit collection activity. 2019-01-29 23:05:36 +00:00
Tom Hacohen
18a00716f8 Remove build time from app.
It was never needed, slows down development builds, and is annoying for
reproducible builds
2019-01-23 19:48:18 +00:00
Tom Hacohen
f9fc14b0dd Address book import: add support for importing groups from file
Fixes #54
2019-01-12 12:06:08 +00:00
Tom Hacohen
0ae278aabd Addressbook import: implement group import when importing from account.
Partially fixes #54. Only the from account is currently implemented, but
that should be sufficient for most people already.
2019-01-12 11:42:41 +00:00
Tom Hacohen
4795bd40ef Fix tests following kotlin migration. 2019-01-12 00:14:34 +00:00
Tom Hacohen
5c894e001f Implementing changing encryption password.
The way it's done is by changing the password and adding ourselves as
journal members with our public keys. Same way shared journals works.

This should not be used if you believe your encryption password has been
compromised. That would require a much more intrusive action (as the
note there indicates).
2019-01-11 23:47:06 +00:00
Tom Hacohen
6e2ab7d972 UserInfoManager: fix the wrong conversion to kotlin. 2019-01-11 21:32:30 +00:00
Tom Hacohen
92908b9a60 Handle readonly journal exceptions. 2019-01-11 16:13:25 +00:00
Tom Hacohen
dcd0393a31 Fix journal creation. 2019-01-11 15:46:43 +00:00
Tom Hacohen
5dbca6e00f Add support for associate accounts. 2019-01-11 15:40:06 +00:00
Tom Hacohen
e005064be6 Fix a lot of kotlin warnings 2019-01-09 21:00:41 +00:00
Tom Hacohen
15309911a5 Fix potential crash when there's an error getting journal members. 2019-01-09 20:44:04 +00:00
Tom Hacohen
ea81696424 Fix date being sometimes incorrect in the journal item preview.
Fixes #56.
2019-01-09 18:24:15 +00:00
Tom Hacohen
e3ff58c1c2 Fix issue with Calendars missing from the account view. 2019-01-09 15:38:02 +00:00
Tom Hacohen
743c9e2de7 Many warning fixes. 2019-01-09 15:09:21 +00:00
Tom Hacohen
723790178c Optimise imports. 2019-01-09 14:55:50 +00:00
Tom Hacohen
e39e882c0a Fix many compilation warnings
Either deprecated usage or kotlin warnings
2019-01-09 14:54:37 +00:00
Tom Hacohen
594aacf396 Remove redundant null assertions. 2019-01-09 09:55:34 +00:00
Tom Hacohen
3729401aac Fix crash in setup encryption. 2019-01-09 09:54:34 +00:00
Tom Hacohen
fe7aa2208b Event invitations: add a button to send an email invite from the journal item view. 2019-01-08 19:46:59 +00:00
Tom Hacohen
7b0cdff9dc Email invitation: move the code to handle the invitation generation to a different file. 2019-01-08 18:42:42 +00:00
Tom Hacohen
0e8dc1d266 Event invitation: use a random uid rather than the event uid when sharing.
The reason for that, is that in some cases it stops working for certain
files, so using a different filename works around that issue.

I haven't managed to resolve that unfortunately.
2019-01-08 18:27:29 +00:00
Tom Hacohen
8af6858422 Tasks: add ability to create, edit, deleted and view task journals 2019-01-08 11:38:10 +00:00
Tom Hacohen
3996f1824d Migrate from AsyncTask to anko's doAsync. 2019-01-08 01:07:20 +00:00
Tom Hacohen
c27a8b44ac Catch IllegalStateExceptions in the account changed receiver.
These are bad, and shouldn't happen, but ignoring them is not
the end of the world, especially since I plan on overhauling this
code very soon (probably remove).

So for now, we'll just ignore them.
2019-01-07 21:53:15 +00:00
Tom Hacohen
7f2ab44bca Implement Tasks support via OpenTasks
This adds support for tasks via OpenTasks.
https://github.com/dmfs/opentasks

Need the OpenTasks client for it to be used.

Currently you can't create new task lists. You can only have the default
one, but that's just a UI thing.

Fixes #7
2019-01-07 11:18:15 +00:00
Tom Hacohen
dbe3730fe4 ACRA: Only send reports in the body if Protonmail is installed. 2019-01-07 01:35:03 +00:00
Tom Hacohen
633e1228f0 Fix issue with sync on devices that don't require the hash hack.
This commit also unifies the handling so such issues don't recur.
2019-01-06 21:45:42 +00:00
Tom Hacohen
93f0e17144 Fix account and collection deletion on some devices.
Fixes #55
2019-01-06 21:13:26 +00:00
Tom Hacohen
34939ee7e3 Account Settings: drop very old upgrade path.
The cod was rotting and people should already be very much up
to date.
2019-01-06 21:13:26 +00:00
Tom Hacohen
b88ad593d7 Fix issue with deleted entries being re-added. 2019-01-06 21:13:26 +00:00
Tom Hacohen
b2f7cc811f Fix applying of groups from journal. 2019-01-06 21:13:26 +00:00
Tom Hacohen
c4daed9391 Upgrade vcard4android and ical4android.
This is a monster commit because to be honest, it's a monster change. It
was impossible to do it in smaller steps because things just wouldn't
compile.
We couldn't do the migration step by step because they moved to Kotlin
which was causing a lot of troubles.

Now we are all on Kotlin, so things should hopefully work just fine.
2019-01-06 21:12:09 +00:00
Tom Hacohen
cd33b5def8 Kotlin: move resources to Kotlin (almost compiles).
It just needs a few tiny wrappers around some public statics. I'm not
doing that because it'll sort itself out the moment we update
vcard4android and ical4android.
2019-01-06 21:06:45 +00:00
Tom Hacohen
5d05a2e6e0 Acra: disable for debug builds. 2019-01-06 21:06:45 +00:00
Tom Hacohen
6af90b38ae Acra report: include installFrom. 2019-01-05 22:32:03 +00:00
Tom Hacohen
f46bccab8e SSLSocketFactory: import newer settings from DAVDroid. 2019-01-05 16:52:15 +00:00
Tom Hacohen
1901cf1bb1 Fix sharing calendar email to not be case sensitive.
Fixes #46.
2019-01-05 16:35:42 +00:00
Tom Hacohen
3f6147d4ad Acra: Don't report as file for now so it works with ProtonMail 2019-01-05 16:25:59 +00:00
Tom Hacohen
16b7747d9f Update ACRA. 2019-01-05 15:50:34 +00:00
Tom Hacohen
e38c720d1a Kotlin: more kotlin migration. 2019-01-05 15:40:17 +00:00
Tom Hacohen
f0a0717541 Kotlin: more kotlin migration. 2019-01-05 15:27:45 +00:00
Tom Hacohen
093eee6409 Kotlin: more kotlin migration. 2019-01-05 15:23:39 +00:00
Tom Hacohen
26715f2f34 Kotlin: fix some wrong null assertions. 2019-01-05 13:03:33 +00:00
Tom Hacohen
d98d91a67f Revert "Don't rely on LOGIN_ACCOUNTS_CHANGED_ACTION"
Actually, let's not make this change just yet so we are sure we haven't
broken anything.

This reverts commit dda23fb484.
2019-01-05 13:03:33 +00:00
Tom Hacohen
dda23fb484 Don't rely on LOGIN_ACCOUNTS_CHANGED_ACTION
Based on the davdroid commit: 1f7298f947a4878e86fcba0c6722e34b03cb63c6
2019-01-05 12:26:38 +00:00
Tom Hacohen
0b21502645 Widgets: use the support library edit password widget. 2019-01-05 12:01:00 +00:00
Tom Hacohen
6ef78085bd Kotlin: more kotlin migration. 2019-01-05 11:45:17 +00:00
Tom Hacohen
4d516c5fe1 Kotlin: more kotlin migration. 2019-01-05 11:44:14 +00:00
Tom Hacohen
4c4c94ca1c Kotlin: more kotlin migration. 2019-01-05 11:29:03 +00:00
Tom Hacohen
f77063ff1a Kotlin: more kotlin migration. 2019-01-05 11:21:26 +00:00
Tom Hacohen
943611a511 Kotlin: more kotlin migration. 2019-01-05 10:01:36 +00:00
Tom Hacohen
959bc4992b Kotlin: migrate to kotlin. 2019-01-05 09:18:25 +00:00
Tom Hacohen
828254a1f7 Event invites: gracefully handle missing timezone information.
The code before didn't fallback to UTC nicely and was causing a crash.
2019-01-04 20:33:06 +00:00
Tom Hacohen
12c41b450c Contact import: Don't list accounts with an empty account name or type. 2018-12-25 09:58:22 +00:00
Tom Hacohen
25759a4e86 Fix typo in error message. 2018-12-25 09:54:01 +00:00
Tom Hacohen
e20e79e840 Fix bug causing group duplication every time a group is changed.
The bug was causing a new group to be created every time a group was changed
instead of just changing the group itself.
2018-12-25 09:19:20 +00:00
Tom Hacohen
4184751664 Event invites: fix issue with times showing wrong across timezones.
Fixes #52.
2018-12-24 12:05:45 +00:00
Tom Hacohen
cd58a6bcac Event invites: don't hardcode the locale when formatting time. 2018-12-05 14:58:26 +00:00
Tom Hacohen
b93c5228c7 Event invites: add location information to email summary. 2018-11-30 11:18:41 +00:00
Tom Hacohen
f5d08e07bb Event invites: add timezone information to email summary. 2018-11-30 11:18:35 +00:00
Tom Hacohen
3efa76579e Fix crash with missing contact downloader when importing. 2018-10-30 21:34:54 +00:00
Tal Hacohen
47b04132a6 Add settings to control the change notifications 2018-10-26 14:23:45 +01:00
Tom Hacohen
0bd459c280 Journal contact view: correctly handle partial dates. 2018-09-20 10:37:51 +01:00
Tom Hacohen
5e568ec43e Fix crash when viewing contacts with empty (but existing) nicknames. 2018-09-18 12:00:05 +01:00
Tom Hacohen
34b8fce5c4 Move to the new method of getting end date.
This also fixes the issues with events having both an end date
and duration.
2018-09-06 16:28:52 +01:00
tal
cb54e51280 Add invite attendees notification for new and modified calendar events 2018-08-21 09:45:02 +01:00
tal
20feee0df7 Add notification channel to all notifications
Android SDK 26 requirs setting a channel in order to show nofiticaitons
2018-08-21 09:45:02 +01:00
tal
182d6ebe66 Restore WebView state on orientation changes
This fixes #28
2018-04-16 17:18:09 +01:00
Tom Hacohen
8982e4a800 Don't crash when deleting a non-existent record
This shouldn't even happen, but it apparently happened to a user. This
commit changes it so it logs a warning instead of crashing.
2018-04-11 10:17:31 +01:00
Tom Hacohen
5a64bd90cc Fix adding members on some devices.
Networking is not allowed on the main thread, and on some devices with strict
mode on, even the creation of the http handler is enough to trigger an
exception (i.e even if not used from the thread).

This moves even the creation to a thread which fixes the issue.
2018-04-10 13:38:28 +01:00
Tom Hacohen
1e7a38159f Increase HTTP logging verbose level.
HTTP requests and responses are logged when logging to file. Until now,
only the existence of requests was logged. With this change, also the
content and headers of the requests and responses is printed to the log.
2018-02-06 19:15:04 +00:00
Tom Hacohen
a28b46f8f9 Don't print content of added/changed contacts and groups.
Before this change we were printing added/changed contacts and groups
to the adb log. This is not a big deal on its own, but now since we
have ACRA, we share these logs on crash (if user approves) so it's
better to remove personal information to make sure it's not being
accidentally shared.
2018-01-25 10:51:50 +00:00
Tom Hacohen
2f1a9281b8 SyncManager: change pushing entries in chunks to also process in chunks
Android annoyingly kill sync managers that don't have a significant
amount of network traffic within a given minute. This means that if we
have a lot of entries to process, we may get killed by the system if we
have a lot of entries to prepare for pushing. We were sending in chunks,
for network performance, but now we make the whole process work in
chunks.

This should fix an issue reported by a user who imported a significant
amount of contacts in one go.

This is similar to the issue fixed for fetch in:
f7104bbcef
2018-01-24 16:02:20 +00:00
Tom Hacohen
5a2f8260c7 Sync: don't re-apply local entries.
We were doing it to make sure we don't get overridden by
server changes. But we already changed this behaviour in
the past, so this call was just doing nothing and slowing
down the sync.
2018-01-24 15:22:08 +00:00
Tom Hacohen
90434e0d82 ACRA: Share more logs (500 last lines instead of 100) 2018-01-24 12:00:38 +00:00
Tom Hacohen
64a86e50d4 Debug info: when sharing, also share the full ACRA info. 2018-01-24 11:58:40 +00:00
Tom Hacohen
2e92422ea6 Import: fix showing the import finished dialog. 2018-01-22 16:40:48 +00:00
Tom Hacohen
c93e21e2d3 Contact import: fix accidental double-import. 2018-01-22 16:40:48 +00:00
Tom Hacohen
536bef9815 Import: always import, don't try to find duplicates based on UID.
This was causing issues when importing from a Google account in some cases
because we were getting weird UIDs.

This was also problematic when importing from other sources that
reported weird UIDs.
2018-01-22 16:40:48 +00:00
Tom Hacohen
dd96ea38d0 Remove lombok usage entirely, but keep it for the submodules 2018-01-22 16:40:36 +00:00
Tom Hacohen
1046164b83 Delombokify: remove Setter/Getter usages. 2018-01-19 19:44:03 +00:00
Tom Hacohen
13c718977e Delombokify: remove RequiredArgsConstructor usages. 2018-01-19 19:26:25 +00:00
Tom Hacohen
6ab3401bf5 Move journal owner tests to the journal and make case insensitive. 2018-01-19 19:01:47 +00:00
Tom Hacohen
b8299a81ce Add ACRA for crash reporting.
This will make it easier to identify and fix crashes.

Until now we relied on user to automatically figure out if the app has
crashed and gather debug info manually. This didn't work well,
especially in places like "import" where they just assumed the import
finished successfully if there was a crash.

This change makes it so whenever there's a crash, the email app is
opened with a template email and the stack trace attached.

This should make it easier for us to detect and fix issues.

Important to note: nothing is sent automatically.
2018-01-19 15:40:12 +00:00
Tom Hacohen
99afd923d5 Add detection and a pop-up of vendor specific bugs.
Some device manufacturers (I'm looking at you Xiaomi!) made some changes
to Android that break content providers and other background apps. This
affects a few apps, including DAVdroid from which EteSync is derived.

This change attempts to automatically detect such devices, alert users
and point them to the relevant FAQ entry.

I've already had to deal with a few bug reports stemming from this
issue, so it's good to have this handled automatically.

This addresses #22
2018-01-18 11:42:27 +00:00
Tom Hacohen
9d12e9c809 Fix confusing error message when creating/fetching user info. 2018-01-07 17:29:10 +00:00
Tom Hacohen
3a1b980384 Improve error message when using the wrong password on account creation. 2017-12-16 14:46:00 +00:00
Tom Hacohen
cf15bc39c0 Update compile and target sdk version. 2017-12-11 17:28:49 +00:00
Tom Hacohen
0e6ee9c101 Fix content provider leak. 2017-11-29 13:05:11 +00:00
Tom Hacohen
71563eddfe Import: fix crash when import finishes while the app is minimised. 2017-11-29 10:05:48 +00:00
Tom Hacohen
c2521bf556 Fix DB resource leak.
It doesn't affect anything in a noticeable way, but still, obviously,
   worth fixing.
2017-11-29 09:59:16 +00:00
Tom Hacohen
f6007019e8 Add support for setting custom servers
This makes it easier to host your own etesync server.
2017-11-19 20:26:19 +00:00
Tal Hacohen
d1fa0114e6 Add debug option to force language.
Resolves #3 Add option to force a language
2017-09-12 17:35:28 +01:00
Tal Hacohen
f631fe4452 Notify the user on journal modification.
This Resolves #13.
2017-09-08 18:33:20 +01:00
Tom Hacohen
09685d08e3 LocalGroup: correctly check if a group is local only or not. 2017-05-16 14:28:39 +01:00
Tom Hacohen
873fc0ad0c Journal item activity: Improve presentation of groups. 2017-05-16 12:24:21 +01:00
Tom Hacohen
c54baccdc7 SyncManager: add back support for contact groups
Groups are saved as separate vCards. We removed support for groups to
speed up development and deferred adding them back until there was
demand.

There is demand now, and also, not having this support resulted in the
sync not working, not just groups not supported.

Many thanks to "359" (this user's preferred alias) for investigating and
reporting this issue.
2017-05-16 12:05:26 +01:00
Ricki Hirner
5031efe845 Remove "ical4android" from iCal PRODID (same format as for VCard) 2017-05-16 11:19:45 +01:00
Ricki Hirner
7391dfd656 Remove "vcard4android" from VCard PRODID to avoid folding for better compatibility 2017-05-16 11:19:45 +01:00
Tom Hacohen
7ddb11c670 Change PRODID to better match the davdroid format. 2017-05-16 11:19:45 +01:00
Tom Hacohen
04e50459d4 Syncmanager: fix an issue causing local cache corruption when failing to push.
Due to a logical issue in the code, new journal entries were added to the
local cache after they've been created locally, and not after they've
been added to the server. Under normal circumstances this doesn't pose a
problem, however when pushing to the server fails, the local cache
would have the new entries as if they were saved on the server, causing
the app to think there has been a corruption on the server (as entries
should never be removed from the server) and halt the sync.

This change makes it so the entries are saved to the local cache only
after they've been saved on the server.

Note: this was not spotted until now because it relies on an unfortunate
specific sequence of events. It only happens when creating journal
entries, and when trying to sync them successfully connecting to the
server to fetch the journal list and the content of the journal itself,
and only failing when coming to push the journals.

Many thanks to "359" (this user's preferred alias) for reporting the
issue that resulted in this fix.
2017-05-15 16:17:48 +01:00
Tom Hacohen
30fa0128b6 AsyncTask: cancel background tasks when the fragments are destroyed.
I assumed the lifecycle of the fragment and the task were tied because they
are tied to the instance, but it looks like I was wrong. We need to
explicitly cancel tasks.
2017-05-12 20:28:47 +01:00
Tom Hacohen
28aa80fe07 Syncmanager: don't try to fetch again if we already fetched everything.
This patch changes the fetching so if the last fetch returned less entries
than the limit, we don't try and fetch again because we already know there
are no others left.
2017-05-12 19:27:05 +01:00
Tom Hacohen
f7104bbcef Syncmanager: fetch journal entries in chunks.
Before this commit we used to fetch the whole journal entry list in one
go, which caused issues in two cases:
1. On slow internet connections the download may fail.
2. With big journals: Android interrupts sync managers if they don't
    perform any significant network traffic for over a minute[1],
    and because we would first download and only then process, we would
    sometimes hit this threshold.

Current chunk size is set to 50.

1: https://developer.android.com/reference/android/content/AbstractThreadedSyncAdapter.html
2017-05-12 14:36:43 +01:00
Tom Hacohen
9cdd63f1d9 Journal manager crypto: change RSA key length to 3072.
I set it to 2048 following the NIST recommendations[1] which said it was
OK, but actually, as pointed out by Dominik Schürmann, it's probably a
better idea to set to 3072.

Users who already have a 2048 key pair won't be affected, while users
who don't will have a 3072 key created for them. Users with different
key lengths can interact with each other without any issues.

1: https://www.keylength.com/en/4/
2017-05-12 12:42:35 +01:00
Tom Hacohen
b33e5003d4 Setup Encryption: use the more reliable AsyncTask over AsyncTaskLoader.
I had issues with not being able to add accounts in some cases.
2017-05-12 12:38:08 +01:00
Tom Hacohen
0503efa8ac Journal item activity: Use string resources instead of hardcoded strings. 2017-05-12 11:26:57 +01:00
Tom Hacohen
c3ee3aac22 Journal item: Implement showing contacts.
This shows address book journal items in a nicer way.
2017-05-11 22:42:59 +01:00
Tom Hacohen
b964b8dfe1 Journal item: implement showing calendar events (based on etar)
This shows the calendar events in a nicer way based on Etar[1] which is
in turn based on the AOSP calendar.

1: https://github.com/Etar-Group/Etar-Calendar/
2017-05-11 22:42:59 +01:00
Tom Hacohen
7dba220d06 Journal item activity: create the infrastructure for a nicer interface 2017-05-11 22:42:59 +01:00
Tom Hacohen
e6ba52074a Journal item: view journal item in a separate activity.
This change makes clicking on journal items in the list to show in a
separate activity. At the moment it just makes for a slightly nicer
presentation. In the future we would change it to show the data in a
nice formatted way instead of a raw dump of the vObject.
2017-05-11 22:42:59 +01:00
Tom Hacohen
889eede699 Journal list: Use icons for actions instead of text. 2017-05-11 22:42:59 +01:00
Tom Hacohen
a3e4fc48ab Collection header: set owner visibility to gone when there's no owner. 2017-05-11 22:42:37 +01:00
Tom Hacohen
1cf1d0f5b0 BaseActivity: Add an activity that all other activities inherit from.
Now that we have this activity, remove the duplication of onResume/onPause and
onOptionsItemSelected.
2017-05-11 22:42:36 +01:00
Tom Hacohen
d86edd7688 Journal model: add a unique constraint to journal UIDs.
Journals and services should be unique together, this wasn't there
because of an issue with requery that should now be resolved.
2017-05-05 16:50:54 +01:00
Tom Hacohen
10095bd4ee WebView: correctly handle checking if a url should open in app or browser.
There was an issue that for the first load it would only check the url
after a redirect (if there is one), which meant that for example,
the dashboard, would open in app because you'd be redirected to the
login page.
2017-05-03 19:25:39 +01:00
Tom Hacohen
a9eba1af4e Account upgrade: raise an error when account migration fails.
Account migration works in most cases, though while testing I managed to
get it to fail in some rare occasions. This commit adds a check to
verify the number of contacts we thought we migrated is equal to the
number of contacts we have after migration.

If the check fails, it presents the user with a notification that opens
the relevant FAQ entry on the EteSync website.
2017-05-03 19:04:42 +01:00
Tom Hacohen
20568c850a SyncManager: Request for a full sync if interrupted.
This doesn't work well, but I'm keeping it since it's still better than
what was there before.

We have a problem that on initial sync with long enough logs, Android
kills the sync manager before completion. The reason for that is that
due to the fact that EteSync first downloads the whole journal and only then
processes it, the sync manager spends a minute without making any
network traffic, which in turn makes Android kill the sync[1].

This should probably be fixed by paginating the initial download, that
is, downloading and processing the journal in chunks, which is possibly
a good idea regardless.

1: https://developer.android.com/reference/android/content/AbstractThreadedSyncAdapter.html
2017-05-03 19:04:42 +01:00
Tom Hacohen
a107cd3fa2 AccountSettings: remove wrong version set.
This was a leftover from the cherry-pick from DAVdroid. The version is
set outside of this function, so this was redundant, and wrong.
2017-05-03 19:04:07 +01:00
Ricki Hirner
643e2b23ea Use UUIDs for newly generated event/task UIDs (RFC 7986 5.3 UID Property) 2017-05-02 11:35:52 +01:00
Tom Hacohen
eb95eada91 Import: Add an alias for our addressbook and davdroid account types. 2017-04-27 11:56:19 +01:00
Tom Hacohen
861d5e4b4e Fix account type and authority to use function and not string. 2017-04-27 11:56:18 +01:00
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
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