Compare commits

..

799 Commits

Author SHA1 Message Date
be2e5117ca Merge branch 'develop' into feature/sync_issues 2019-12-10 11:16:17 +01:00
35bd3946b5 Timeline: don't retry automatically to avoid totally blocking pagination 2019-12-10 10:38:10 +01:00
26c8b90e80 Read marker: fix banner visibility when following permalink 2019-12-10 10:37:31 +01:00
79ef055bfb Merge pull request #746 from vector-im/feature/fix_various_issues
Fix 2 crashes reported by the PlayStore
2019-12-10 02:14:23 +01:00
3a761be6b4 Last cleanup 2019-12-10 01:28:07 +01:00
a9e2c31c32 Remove log for privacy 2019-12-10 01:08:05 +01:00
3ac53d20e9 Bugfix: react several times with the same reaction was possible (was a TODO). 2019-12-10 01:05:20 +01:00
3c18fd5335 Improve EmojiChooserFragment: improve filtering result: sort 2019-12-10 00:42:24 +01:00
f00f34b244 Improve EmojiChooserFragment: DI 2019-12-09 23:56:53 +01:00
63e0b15f3d Split EmojiDataSource - cleanup 2019-12-09 23:08:50 +01:00
80306f20df Split EmojiDataSource - avoid !! 2019-12-09 22:57:23 +01:00
2972177541 Split EmojiDataSource - cleanup 2019-12-09 22:46:39 +01:00
1ad8f47dc1 Split EmojiDataSource 2019-12-09 22:36:38 +01:00
8527d3f162 Improve emoji picker search result 2019-12-09 22:30:29 +01:00
99423bacb2 Cleanup 2019-12-09 22:09:17 +01:00
edc6c3dd4f Cleanup 2019-12-09 22:00:41 +01:00
a761a0dbd2 Cleanup 2019-12-09 21:56:03 +01:00
d431ab23c8 Cleanup 2019-12-09 21:33:10 +01:00
f0aa34774e Create RecyclerView extensions and cleanup all the recycler views 2019-12-09 21:31:56 +01:00
2348ceca60 Timeline: handle failure when navigating to an unknown event (+ clean some files) 2019-12-09 19:26:20 +01:00
742136abe8 Create RecyclerView extensions and cleanup all the recycler views 2019-12-09 18:01:58 +01:00
36aba8554d Update CHANGES.md 2019-12-09 17:43:14 +01:00
da14ae432a Ensure we will not use EpoxyRecyclerView as a View anymore 2019-12-09 17:41:29 +01:00
9a01b4ace9 Make it through bunch of classes removing potential leaks 2019-12-09 17:41:29 +01:00
109c1fe482 Cleanup 2019-12-09 17:41:29 +01:00
dbd4525404 Make sure unhandled Rx error does not crash the app in production 2019-12-09 17:41:29 +01:00
c714266a81 Fix crash reported by the PlayStore.
NullPointerException: at im.vector.riotx.features.home.room.detail.RoomDetailFragment.updateJumpToReadMarkerViewVisibility (RoomDetailFragment.kt:524)
Also properly cleanup model build listener
2019-12-09 17:41:29 +01:00
8b1701e537 Merge pull request #738 from vector-im/feature/ban_reason
Displaay ban and other membership events reason
2019-12-09 14:53:06 +01:00
41d1b77370 Merge pull request #749 from vector-im/feature/hs_discovery
Support entering a RiotWeb client URL instead of the homeserver URL
2019-12-09 14:10:55 +01:00
ac75fe12bf Will be merged for next release 2019-12-09 14:09:03 +01:00
2f26f4b8bb Add default value (fix test compilation issue) 2019-12-09 14:09:03 +01:00
6d82ac7c59 Add default param values 2019-12-09 14:09:03 +01:00
411afb0bf3 Add shortcut for command length 2019-12-09 14:09:03 +01:00
57354cbd69 Add reason to slash commands 2019-12-09 14:09:03 +01:00
03d51281a2 Mistake 2019-12-09 14:08:06 +01:00
415511f3e0 Shortened lines 2019-12-09 14:08:06 +01:00
e0e778909d Better formatting 2019-12-09 14:08:06 +01:00
b9efc9f4bd Ensure user will never see 'null' in a String 2019-12-09 14:08:06 +01:00
872b14373b Better code 2019-12-09 14:08:06 +01:00
d28700e2bf Add reason for all membership events (https://github.com/matrix-org/matrix-doc/pull/2367) 2019-12-09 14:08:06 +01:00
18beef14cf "ban" event are not rendered correctly (#716) 2019-12-09 14:08:06 +01:00
e73923dca3 Merge pull request #741 from vector-im/feature/breadcrumbs
Breadcrumbs
2019-12-09 14:06:27 +01:00
94afd3e66d Add example of config without default homeserver url 2019-12-07 11:05:18 +01:00
5f540a5b45 Support entering a RiotWeb client URL instead of the homeserver URL during connection (#744) 2019-12-06 23:46:40 +01:00
a41617e8aa Fix lint false positive issue 2019-12-06 22:00:49 +01:00
ff1745b5dc Merge pull request #742 from vector-im/feature/fix_739
Fixes #739
2019-12-06 17:10:54 +01:00
8e3e9876b8 Fixes #739 2019-12-06 10:31:40 +01:00
9a4d8f87f6 Breadcrumbs: auto-review 2019-12-05 22:38:49 +01:00
aef76241a3 Breadcrumbs: changes 2019-12-05 22:09:55 +01:00
0768bd5c88 Breadcrumbs: nicer algorithm 2019-12-05 22:05:37 +01:00
65333e6031 Cleanup some Realm queries 2019-12-05 21:49:01 +01:00
849e7c613c Breadcrumbs: live update in correct order 2019-12-05 21:27:56 +01:00
60169d53d7 Breadcrumbs: add some visual attributes 2019-12-05 20:28:07 +01:00
4def1e0d76 Merge branch 'develop' into feature/sync_issues 2019-12-05 19:25:42 +01:00
1aa65dad7f Sync/pagination: make it possible to have multiple chunks in the db 2019-12-05 19:24:32 +01:00
4234c27af9 Version++ 2019-12-05 18:19:20 +01:00
b9eb85e0a6 Merge branch 'release/0.9.1' into develop 2019-12-05 18:17:54 +01:00
6d8850b3d6 Prepare version 0.9.1 2019-12-05 18:17:36 +01:00
d88edd578f Merge pull request #740 from vector-im/feature/hot_fix_filter
Feature/hot fix filter
2019-12-05 18:14:46 +01:00
5373d9aa21 Breadcrumbs: fix layout issue 2019-12-05 17:49:45 +01:00
ad4d5e5c02 Breadcrumbs: limit number to 20 2019-12-05 17:43:23 +01:00
eb9775e307 Fix some crypto realm issues 2019-12-05 17:14:56 +01:00
aa9d66b991 Allow returning a value from an async transaction 2019-12-05 17:14:38 +01:00
4ff12605e9 Breadcrumbs: notify viewed rooms 2019-12-05 16:06:47 +01:00
7c561ae622 Breadcrumbs simple UI 2019-12-05 14:51:12 +01:00
cec08a20e5 Handle breadcrumbs from account data 2019-12-05 12:13:45 +01:00
1c4cef9115 Merge branch 'develop' into feature/sync_issues 2019-12-05 10:46:59 +01:00
fb8ba32fb4 Version++ 2019-12-05 09:46:36 +01:00
7a05207ae4 Merge branch 'release/0.9.0' into develop 2019-12-05 09:44:06 +01:00
6b39cf3b70 Prepare release 0.9.0 2019-12-05 09:43:58 +01:00
994759e11a Merge pull request #737 from vector-im/feature/otk_upload
Improve and cleanup OneTimeKey uploader
2019-12-05 09:38:05 +01:00
20559b9fc4 Pagination: fix some timeline issue 2019-12-04 19:07:01 +01:00
f31c1b69cb Remove delay when waiting for first sync to finish and add number of sent keys in the log 2019-12-04 16:52:55 +01:00
bdb9d2fbb8 Improve and cleanup OneTimeKey uploader
Fix boolean reset if request fails
Implement https://github.com/matrix-org/matrix-js-sdk/pull/493
2019-12-04 16:34:25 +01:00
9fb50dde32 Merge pull request #726 from vector-im/feature/sign_x_stabilization
Registration stabilization
2019-12-04 16:26:48 +01:00
990a266d83 Merge branch 'develop' into feature/sync_issues 2019-12-04 16:25:35 +01:00
56e15cf054 Pagination: remove the live chunk when merging 2019-12-04 16:09:32 +01:00
a145aae0aa Avoid using !! 2019-12-04 15:38:16 +01:00
3623072f08 Attempt to properly cancel the crypto module when user signs out (#724)
Attempt to properly cancel the crypto module when user signs out (#724)
2019-12-04 15:38:16 +01:00
2717ad475a Merge pull request #699 from vector-im/feature/read_marker_rework
Feature/read marker rework
2019-12-04 14:12:41 +01:00
a6f8fe9317 Fix lint issue 2019-12-04 12:08:18 +01:00
f9eb80b4ec Simplify layout 2019-12-04 11:42:18 +01:00
9510d71cd3 Proposal for simple layout 2019-12-04 11:42:18 +01:00
e7a47ae32a Some cleanup 2019-12-04 11:42:18 +01:00
7890b929a7 Update CHANGES 2019-12-04 11:42:18 +01:00
0376de08f4 Clean files 2019-12-04 11:41:54 +01:00
90c472fef9 Read marker: fix mark all as read 2019-12-04 11:41:54 +01:00
8e873672a9 Read marker: change design 2019-12-04 11:41:54 +01:00
bba52e77d1 Read marker: fix merged items 2019-12-04 11:41:54 +01:00
64d73ae8e6 Read marker: handle the jump to read marker 2019-12-04 11:41:54 +01:00
d9982076f9 Read marker: continue rework [WIP] 2019-12-04 11:39:51 +01:00
ab489df83d Read marker: don't show unread on events we own 2019-12-04 11:33:06 +01:00
5e07e96bdb Read marker: start reworking how we manage it [WIP] 2019-12-04 11:33:06 +01:00
f8db684ed2 Sync/paginate: rebranch sender data 2019-12-03 19:55:08 +01:00
3d2cf49f53 Sync rework: continue investigating 2019-12-03 18:50:08 +01:00
c495aa4914 Merge pull request #731 from vector-im/feature/fix_pills
Fix issue with pill: also send the text after the last pills
2019-12-03 18:19:36 +01:00
ff267ba9bc Update changelog 2019-12-03 16:36:44 +01:00
69f923383c Rename some classes with "Item" suffix, as a convention (ooi) 2019-12-03 16:32:25 +01:00
c69852c849 Make url clickable on the preview of event in the bottom sheet - avoid instantiating objects in the bind() method 2019-12-03 16:17:49 +01:00
6d7f2670df Make url clickable on the preview of event in the bottom sheet 2019-12-03 16:02:07 +01:00
71de8fdad3 Display pills Avatar in the message preview 2019-12-03 15:08:44 +01:00
998d9f2c59 Bugfix: Text after the last pill was not send 2019-12-03 14:48:41 +01:00
f07ee343fd Sync/paginate: continue reworking 2019-12-03 13:30:17 +01:00
4f3da353e4 Add ellipsis char for action with another step 2019-12-03 13:23:44 +01:00
4154cb2b85 Improve wording of the title of read receipt list 2019-12-03 13:21:42 +01:00
3c6eb4bccf Rework FilterEntityQueries to fix issue of ghost Realm reference 2019-12-03 11:10:43 +01:00
7b4398404b Update wording for modular screens 2019-12-03 11:10:43 +01:00
9b882978ed Update modular link 2019-12-03 11:10:43 +01:00
49178dc633 Reduce some log level 2019-12-03 11:10:43 +01:00
490ce4b51d Fix issue of closing Realm in another thread (#725) 2019-12-03 10:05:10 +01:00
fb4b42db32 Start investigate on perfs [WIP] 2019-12-02 19:08:46 +01:00
5b63856d96 Add log to detect if a realm instance is not properly closed 2019-12-02 18:33:31 +01:00
538c4d1a64 typo 2019-12-02 18:15:21 +01:00
1cadbb8eed Ensure credentials can be stored, even if they already exist 2019-12-02 13:48:20 +01:00
3f4f7457c7 Merge pull request #689 from vector-im/feature/signin_signup
Login and Registration
2019-12-02 13:47:28 +01:00
ebf21fe9d8 Merge pull request #687 from vector-im/feature/dat_pill
Send mention pills from composer
2019-11-29 16:28:34 +01:00
a343da594f Import Strings from Riot 2019-11-29 16:22:04 +01:00
938289e8eb ktlint 2019-11-29 15:44:08 +01:00
e23763e6db Update password from email twice 2019-11-29 15:43:39 +01:00
c06b8486ea Update wording 2019-11-29 15:36:54 +01:00
67fe776d91 Update Changes 2019-11-29 13:27:50 +01:00
10cc270273 ktlint 2019-11-29 13:27:26 +01:00
46d96429e0 Create ooi extension 2019-11-29 13:27:26 +01:00
9f9c418085 Pills: cleanup and robustness 2019-11-29 13:27:26 +01:00
c412006f0e Pills: render the avatar 2019-11-29 13:27:26 +01:00
5d3c376267 Pills: remove pills when a char is deleted 2019-11-29 13:27:26 +01:00
a3f8f138a6 Create showKeyBoard() extension 2019-11-29 13:27:26 +01:00
4b273e8746 Pills: simplify and improve the algorithm 2019-11-29 13:27:26 +01:00
f11cd47df3 Pills: cleanup 2019-11-29 13:27:26 +01:00
f984758d37 Pills: Daggerization 2019-11-29 13:27:26 +01:00
97766404d6 klint 2019-11-29 13:27:26 +01:00
38b93c527b Ensure received pills spans do not overlap 2019-11-29 13:27:26 +01:00
62bae67080 Code review 2019-11-29 13:27:26 +01:00
2a4cdec020 klint cleaning 2019-11-29 13:27:26 +01:00
6bd7257cf2 Send mention pills from composer 2019-11-29 13:27:26 +01:00
500eb113b6 Login screens: add some animation for Fragment transition (WIP) 2019-11-28 20:36:29 +01:00
1bec8c29b8 Add missing items for Status theme 2019-11-28 15:52:32 +01:00
0ecb23199c Login screens: add background color 2019-11-28 13:25:56 +01:00
33925fcf57 Login screens: fix crash on back navigation 2019-11-28 12:09:28 +01:00
bf9ce4f690 Merge pull request #714 from vector-im/feature/upgrade_gif_drawable
Force android-gif-drawable version
2019-11-28 10:24:40 +01:00
d2a4163dff Merge pull request #691 from vector-im/anoa/typo
Small typo fix
2019-11-28 09:55:16 +01:00
a0d7aef92e Force android-gif-drawable version
BigImageViewer update (updated the android-gif-drawable dep)
2019-11-28 09:39:04 +01:00
29f32cf8eb Login screens: fix regression on Back press 2019-11-27 16:48:28 +01:00
bb1c988a49 Login screens: Update the local pendingSessionData synchronously, store asynchronously 2019-11-27 16:36:35 +01:00
f063abe068 Login screens: keep PendingSessionData member up to date 2019-11-27 16:15:51 +01:00
db87d8f644 Login screens: Realm migration for Auth DB 2019-11-27 15:52:02 +01:00
efa858a337 Login screens: reorder reset action for clarity 2019-11-27 15:11:02 +01:00
fd90f3b9fc Login screens: reset SDK when home server url is deleted 2019-11-27 15:08:36 +01:00
aa51764068 Login screens: save isRegistrationStarted in DB 2019-11-27 15:04:00 +01:00
0a19ded167 Login screens: extract some classes 2019-11-27 14:34:07 +01:00
2e3763e8b4 Login screens: persist all data during login or registration 2019-11-27 14:26:06 +01:00
0c4e0890b1 Use Realm.use { } 2019-11-27 10:49:33 +01:00
e532d97ec1 Login screens: persist login mode 2019-11-27 10:04:41 +01:00
fbde8d7d18 ktlint 2019-11-26 18:04:42 +01:00
f96bea742e Login screens: split long lines 2019-11-26 18:04:00 +01:00
86bfdd011e Login screens: cleanup and ignore lint issue 2019-11-26 18:03:09 +01:00
d5c2c1938c Login screens: move user choices to the ViewState 2019-11-26 17:59:01 +01:00
7ce8a13ddf Login screens: prepare for saving user state 2019-11-26 13:11:31 +01:00
9bd4dbb65f Login screens: trim homeserver url 2019-11-26 12:40:17 +01:00
ee875b359b Login screens: update wording 2019-11-26 12:25:37 +01:00
3eb2e1655f Login screens: ensure homeserver version is supported - fix bug for SSO 2019-11-26 12:16:39 +01:00
9b207dd5dc Login screens: ensure homeserver version is supported 2019-11-26 11:39:33 +01:00
3f1540b54e Update wording 2019-11-26 09:51:35 +01:00
2b30925163 Login screens: doc for sign in 2019-11-26 09:49:53 +01:00
4690754f5f Merge pull request #702 from vector-im/feature/quick_fix
2 quick fixes
2019-11-25 18:48:43 +01:00
a9526cdd92 Login screens: use homeserver and identity server Uri provided along with the credential is any 2019-11-25 18:32:24 +01:00
ab4d42fb20 Login screens: mutualize the code which create session from the credentials 2019-11-25 18:16:57 +01:00
0014e8ef06 Login screens: rename variables 2019-11-25 17:32:27 +01:00
311d8ddf7b Login screens: fix layout issue 2019-11-25 17:24:31 +01:00
6cb3c222a9 Login screens: handle mandatory dummy stage automatically 2019-11-25 16:47:17 +01:00
f84ec08847 Code cleanup, restore comment, and fix regression on delay 2019-11-25 14:11:38 +01:00
9d0188cbf1 Create user from userId during initialSync 2019-11-22 20:28:52 +01:00
73462a3045 Clean some coroutine code 2019-11-22 20:04:11 +01:00
3eebf965e5 Fix emoji filtering not working 2019-11-22 15:19:09 +01:00
bba58d25e1 Do not show long click help if only invitation are displayed 2019-11-22 14:54:22 +01:00
fedb45b019 Login screens: add doc on signin 2019-11-22 14:35:39 +01:00
9b83f08654 Login screens: fix compilation issue (lint) 2019-11-22 14:24:22 +01:00
91fcf428dd Login screens: login with unknown email 2019-11-22 14:21:14 +01:00
7e1a279fd9 Update changelog (Fixes #34, Fixes #613) 2019-11-22 12:19:15 +01:00
8de1fa835b Improve M_LIMIT_EXCEEDED error rendering 2019-11-22 12:15:19 +01:00
af45c554fd Login screens: fix scroll issue 2019-11-22 12:15:19 +01:00
11bc7051fd Login screens: splash scrollable 2019-11-22 12:15:19 +01:00
489a594027 Login screens: ensure forms are scrollable on small screens 2019-11-22 12:15:19 +01:00
3f83c161e4 Login screens: fix code quality issues 2019-11-22 12:15:19 +01:00
e0a36b794f Login screens: fix lint issues 2019-11-22 12:15:19 +01:00
d2b516bdc2 Login screens: fix issue with reset password fragment navigation 2019-11-22 12:15:19 +01:00
37166caea2 Login screens: create sub method 2019-11-22 12:15:19 +01:00
9fa131c297 Login screens: reset password: display a better popup when link is not clicked yet 2019-11-22 12:15:19 +01:00
71ae3c4a8c Login screens: reset password: display a warning when the process is not finished 2019-11-22 12:15:19 +01:00
f87526e615 Login screens: reset password: add documentation 2019-11-22 12:15:19 +01:00
51f53e2ae9 Login screens: reset password: fix a few errors 2019-11-22 12:15:19 +01:00
ef35f0a044 Login screens: disable submit button when input is empty 2019-11-22 12:15:19 +01:00
5db3f51ddb Login screens: fix bad view binding 2019-11-22 12:15:19 +01:00
49f7ce3554 Login screens: better API 2019-11-22 12:15:19 +01:00
a3111dc2d8 Login screens: rename a few classes and packages 2019-11-22 12:15:19 +01:00
be95542110 Login screens: dummy stage shoud not be mandatory 2019-11-22 12:15:19 +01:00
6723a566c2 Login screens: refacto: create an AuthenticationWizard 2019-11-22 12:15:19 +01:00
90027cc4d5 Login screens: reset password WIP 2019-11-22 12:15:19 +01:00
810b226f21 Do not trim login nor password 2019-11-22 12:15:19 +01:00
42c5adf08d ktlint 2019-11-22 12:15:19 +01:00
5edfb78721 Cleanup errors and close keyboard at each login step 2019-11-22 12:15:19 +01:00
491a38a79f Login screens: send again 3pid 2019-11-22 12:15:19 +01:00
051f77087e Email format validation 2019-11-22 12:15:19 +01:00
1a603742d0 Cleanup 2019-11-22 12:15:19 +01:00
edb65f1787 Fix some errors 2019-11-22 12:15:19 +01:00
9af8355c07 Fix wording 2019-11-22 12:15:19 +01:00
dd44078297 Login screens: fix several issue with check email screen 2019-11-22 12:15:19 +01:00
a1f96a5b5a Login screens: typo 2019-11-22 12:15:19 +01:00
5770023593 Login screens: code cleanup 2019-11-22 12:15:19 +01:00
2789268c23 Login screens: MSISDN: check format and compute country code 2019-11-22 12:15:19 +01:00
eb4355890e Login screens: setup autofill 2019-11-22 12:15:19 +01:00
4e41156db3 Login screens: doc: registration forbidden 2019-11-22 12:15:19 +01:00
1a0b8b35f8 Login screens: Doc: adapt log to correct logs and fix typo 2019-11-22 12:15:19 +01:00
5f9cdcb4b4 Login screens: Doc: add msisdn stage 2019-11-22 12:15:19 +01:00
2e4c3f850a Cleanup 2019-11-22 12:15:19 +01:00
127916a8d9 Login screens: add MSISDN 2019-11-22 12:15:19 +01:00
248a584e1a Login screens: Add Msisdn - WIP 2019-11-22 12:15:19 +01:00
b8a3ad0c43 Login screens: Wait for email validation screen 2019-11-22 12:15:19 +01:00
1f161b7e23 Login screens: Add 3Pid step 1 2019-11-22 12:15:19 +01:00
23315ede92 Login screens: update wording 2019-11-22 12:15:19 +01:00
20ad3abb60 Login screens: set initial device name 2019-11-22 12:15:19 +01:00
ac377fceba Login screens: mutualize registration callback 2019-11-22 12:15:19 +01:00
abbe56acfa Login screens: UI: display errors properly 2019-11-22 12:15:19 +01:00
f74cabd145 Login screens: UI: style to prepare for landscape 2019-11-22 12:15:19 +01:00
0e2237226f Login screens: back button management for registration 2019-11-22 12:15:19 +01:00
62d5aba796 Login screens: back button management for SSO 2019-11-22 12:15:19 +01:00
f12e6c941d Login screens: sigin button for SSO 2019-11-22 12:15:19 +01:00
7caa8ce3bc Login screens: disabled registration 2019-11-22 12:15:19 +01:00
20f969d563 Login screens: fix issue on terms 2019-11-22 12:15:19 +01:00
a8f24e5c39 Login screens: a11y 2019-11-22 12:15:19 +01:00
8ae9544b48 Login screens: Loading on Captcha step 2019-11-22 12:15:19 +01:00
3758334824 Login screens: cleanup the Fragment stack after completing stage 2019-11-22 12:15:19 +01:00
6d8e5b892e Login screens: Show disclaimer dialog only in HomeActivity, now that RiotX supports registration 2019-11-22 12:15:19 +01:00
c18c140ec9 Login screens: Animate the logo in screen transition 2019-11-22 12:15:19 +01:00
1dc7dfc896 Login screens: registration fallback 2019-11-22 12:15:19 +01:00
1c03163a33 Login screens: prepare email and msisdn 2019-11-22 12:15:19 +01:00
9aa270c7ad Login screens: Perform dummy action when user does not want to enter an email -> account created! 2019-11-22 12:15:19 +01:00
3f80076fb1 Login screens: Terms step for registration 2019-11-22 12:15:19 +01:00
dfbf448bb7 Login screens: Captcha step for registration 2019-11-22 12:15:19 +01:00
95fc20dca0 Login screens: Registration: login/password step 2019-11-22 12:15:19 +01:00
381084b2ab Login screens: USER_IN_USE error 2019-11-22 12:15:19 +01:00
41ac2c6d70 Login screens: Registration WIP 2019-11-22 12:15:19 +01:00
08ea3d049e Login screens: Simple Input form (UI) 2019-11-22 12:15:19 +01:00
f24889230c Login screens: Captch screen (UI) 2019-11-22 12:15:19 +01:00
b5f9549a8b Login screens: Fix issues on button style 2019-11-22 12:15:19 +01:00
e3e38d4c8a Login screens: Fix issues on modular tile 2019-11-22 12:15:19 +01:00
416bef7903 Login screens: button theme 2019-11-22 12:15:19 +01:00
823acebf78 Login screens: harmonize styles for containers 2019-11-22 12:15:19 +01:00
3e91125872 Fix issues 2019-11-22 12:15:19 +01:00
9a628c7b5d ktlint 2019-11-22 12:15:19 +01:00
fb46a14172 Fix compilation issue after rebase 2019-11-22 12:15:19 +01:00
ca4e75a1a0 Login screens: Fix a few bugs 2019-11-22 12:15:19 +01:00
2871e4f5b1 Login screens: forget password screens 2019-11-22 12:15:19 +01:00
b7bfb20a2e Login screens: login and registration fallback 2019-11-22 12:15:19 +01:00
a1aa16715d Login screens: move elements from ViewState to ViewModel 2019-11-22 12:15:19 +01:00
55add4734d Login screens: Fix Other rendering issue 2019-11-22 12:15:19 +01:00
2849e1f846 Login screens: Splash: update icons 2019-11-22 12:15:19 +01:00
5b9876a20c Login screens: Fix navigation issue 2019-11-22 12:15:19 +01:00
adf299081d Login screens: re-click on an item submit it 2019-11-22 12:15:19 +01:00
d50b690523 Login screens: improve LoginFragment 2019-11-22 12:15:19 +01:00
c6b0ae63ea Login screens: handle loading Views and global navigation - WIP 2019-11-22 12:15:19 +01:00
3c93807fe6 Login screens: add some doc 2019-11-22 12:15:19 +01:00
7f1f98c2e5 Login screens: reset state when navigating back 2019-11-22 12:15:19 +01:00
6525314af8 Login screens: server ur form 2019-11-22 12:15:19 +01:00
da8d6fb4f4 Login screens: signup signin selection 2019-11-22 12:15:19 +01:00
fa6a9cab7e Login screens: server selection 2019-11-22 12:15:19 +01:00
bdfc4ad8a7 Login screens: splash screen 2019-11-22 12:15:19 +01:00
6ab7209e4d Handle navigation with VectorSharedAction 2019-11-22 12:14:48 +01:00
4485d1c685 Registration flow: SDK side 2019-11-22 12:14:48 +01:00
8b63f78d76 Add documentation on the sign up flow 2019-11-22 12:14:48 +01:00
2e87e0b4c1 fix typo 2019-11-21 01:41:59 +00:00
507134407b Update CHANGES.md 2019-11-19 15:10:41 +00:00
7663cd4e23 Merge branch 'develop' of github.com:vector-im/riotx-android into anoa/typo 2019-11-19 15:10:24 +00:00
ec2954200e Version++ 2019-11-19 09:58:48 +01:00
fc367b3c3e Merge branch 'release/0.8.0' into develop 2019-11-19 09:47:56 +01:00
57dcd569f3 Prepare release 0.8.0 2019-11-19 09:47:12 +01:00
3673520ef6 Small typo fix 2019-11-18 13:30:03 +00:00
fe17050580 Merge pull request #685 from vector-im/feature/timeline_items
Feature/timeline items
2019-11-15 16:11:37 +01:00
ec40a8c969 Update CHANGES 2019-11-14 13:26:25 +01:00
6b1b3bec85 Clean code for klint 2019-11-14 13:25:04 +01:00
6bd6ececb7 Timeline: handle sticker events 2019-11-14 13:23:12 +01:00
c7db695e67 Timeline: handle join rules event 2019-11-14 12:21:55 +01:00
4cefdfedce Home: use detach/attach instead of hide/show 2019-11-14 11:18:45 +01:00
6ce241163e Merge pull request #679 from vector-im/feature/perf_again
Feature/perf again
2019-11-13 19:43:07 +01:00
79350899c5 Read receipts: use primary key to query 2019-11-13 19:21:14 +01:00
f265724a3c Login sso: handle failure 2019-11-13 19:20:03 +01:00
2e50d2a36e Clean code for klint 2019-11-13 11:38:30 +01:00
643c062858 Merge branch 'develop' into feature/perf_again 2019-11-13 10:44:59 +01:00
0e0db67aef Timeline: clear some resources when unbind 2019-11-12 20:34:19 +01:00
6dc5b126d6 Optimize room list processing 2019-11-12 19:53:07 +01:00
d2acabddd9 RoomDetail: fix enter/exit mode again after merge 2019-11-12 19:25:57 +01:00
ec71b53c1e RoomSummary: don't map read receipts 2019-11-12 19:25:21 +01:00
fc3d4187d1 Merge pull request #676 from vector-im/feature/long_click_room
Add help to reveal the long click on a room
2019-11-12 18:29:42 +01:00
a25f309990 Merge pull request #678 from vector-im/feature/block_user_menu
Add action to block user in the message action bottom sheet
2019-11-12 18:17:18 +01:00
5449592422 Add action to block user in the message action bottom sheet (following Nad's design) 2019-11-12 17:52:03 +01:00
19b415871d Extract displaymode, clear adapter on roomList/timeline and use commitNow when possible 2019-11-12 15:13:20 +01:00
6463f3439f Update Mvrx to 1.3 2019-11-12 15:11:52 +01:00
f2320f9571 Merge pull request #665 from vector-im/feature/color_theme
Ensure color is retrieved from current theme, even when theme change
2019-11-12 12:29:27 +01:00
fc91694bdd Merge pull request #673 from vector-im/feature/us
Update strings
2019-11-12 12:08:55 +01:00
dbb41108ef Improve layout 2019-11-12 11:50:16 +01:00
08c864bad7 Add help to reveal the long click on a room 2019-11-12 11:39:47 +01:00
9c5c65a243 Cleanup 2019-11-12 10:36:53 +01:00
b6199b1f27 Fix some issues with fragments managers (Home fragments) and lifecycle 2019-11-08 19:49:08 +01:00
38da54119a Merge branch 'develop' into feature/perf_again 2019-11-08 18:39:06 +01:00
65b09ad4f0 Merge pull request #675 from vector-im/feature/cleanup
Cleanup ViewModel for code clarity
2019-11-08 18:19:22 +01:00
603b8fae45 Add missing binding 2019-11-08 17:30:04 +01:00
50e2e6a823 Cleanup 2019-11-08 17:23:21 +01:00
bb237e3bbb Fix ViewModel for Signout 2019-11-08 17:21:46 +01:00
1bd2c0d220 Merge branch 'develop' into feature/perf_again 2019-11-08 17:09:22 +01:00
bcb811a7e8 Realm perf: use Dispatchers.Default for write, as we don't want to create so many threads (and we can only have one write transaction at a time) 2019-11-08 17:08:44 +01:00
ec4d7e29ec Ensure we use the correct viewModelProvider 2019-11-08 17:08:29 +01:00
a6df63f6d9 Fix crash 2019-11-08 16:56:45 +01:00
ea7213a5ae Split long lines 2019-11-08 16:16:42 +01:00
590a13334d ktlint 2019-11-08 16:04:41 +01:00
631448335d Rename stuff for code coherence 2019-11-08 15:36:12 +01:00
12376368c7 Rename class 2019-11-08 15:20:55 +01:00
f17564d743 Simple code 2019-11-08 15:08:50 +01:00
a6fcc7dca6 Move class to dedicated file 2019-11-08 15:07:01 +01:00
70bce9e7dd Ensure ViewModel follow the same pattern to handle actions 2019-11-08 15:05:11 +01:00
17f3614288 Perf: try to optimize room summary updates 2019-11-08 13:48:35 +01:00
238d1d87c6 Rename class 2019-11-08 13:31:39 +01:00
82f639b91f Rename to Shared 2019-11-08 12:09:08 +01:00
c8bc553caa Move class to dedicated file 2019-11-08 12:01:36 +01:00
fa5d44af65 Create common parent for Action view model, to handle navigation, action, or other type of event 2019-11-08 11:54:17 +01:00
cbdbe5033f Merge pull request #664 from vector-im/feature/room_list_actions
Feature/room list actions
2019-11-07 15:45:45 +01:00
61ac250e2b Merge branch 'develop' into feature/room_list_actions 2019-11-07 15:43:21 +01:00
04f72dfcb8 Clean code after Benoit's review 2019-11-07 15:19:12 +01:00
10ca5d94ea Fix issue after rebase 2019-11-07 14:29:08 +01:00
c5b8c69ae5 Merge pull request #668 from vector-im/feature/block_user
Block user and display ignored users list
2019-11-07 14:28:23 +01:00
d3d7f7cc61 Split long lines 2019-11-07 14:18:57 +01:00
b6bb714264 Display name and avatar of the user 2019-11-07 14:18:57 +01:00
a87310ac15 update comment 2019-11-07 14:18:57 +01:00
032e1b3d19 ktlint 2019-11-07 14:18:57 +01:00
d9f15c1d21 Block user possibility after reporting event content 2019-11-07 14:18:57 +01:00
99d09f71ad Changelog 2019-11-07 14:18:57 +01:00
9c952b6bc8 Display ignored users list 2019-11-07 14:18:57 +01:00
fbae3d27c2 Ignore/Unignore userIds 2019-11-07 14:13:29 +01:00
2f7d1f9f01 Ignored Users account data 2019-11-07 14:13:29 +01:00
114101699d Fix potential ignoring of account data (return@foreach) 2019-11-07 14:13:29 +01:00
f5c0dcb5ea Merge pull request #670 from vector-im/feature/fragment_factory
Feature/fragment factory
2019-11-07 13:59:46 +01:00
241220ce1f remove unused import 2019-11-07 13:59:21 +01:00
98d97e574c Fix regression when filtering emojis 2019-11-07 12:23:21 +01:00
96e610970a Finish the work 2019-11-07 12:08:17 +01:00
2027802f82 Add debug screen for all SAS emoji 2019-11-07 10:37:49 +01:00
54f93db632 RoomDetail : enter/exit special mode without waiting for draft to update 2019-11-06 20:08:19 +01:00
3af7ca9ab0 Retrofit: lazy init okhttp 2019-11-06 20:07:28 +01:00
93ef3edab3 Remove some use of sync write in realm 2019-11-06 18:47:11 +01:00
c85852262e Remove bad value 2019-11-06 18:28:16 +01:00
d0c3271628 Import string from Riot-Android and fix #671 2019-11-06 18:19:37 +01:00
ad9a48d5fa Clean code 2019-11-05 18:36:30 +01:00
219d1383e5 Fragments: use FragmentContainerView 2019-11-05 18:13:55 +01:00
8871280fab Fragments: use constructor injections in most of the Fragments 2019-11-05 18:12:04 +01:00
fb3e953e28 Merge pull request #667 from vector-im/feature/realm_cleanup
Import change form https://github.com/matrix-org/matrix-android-sdk/pull/505
2019-11-05 12:13:25 +01:00
10712fd6ab ktlint 2019-11-05 12:13:06 +01:00
9d478dbfe2 Import change form https://github.com/matrix-org/matrix-android-sdk/pull/505 2019-11-05 11:18:22 +01:00
3013d67c16 Fragment factory: start including the new version with FragmentFactory [WIP] 2019-11-04 19:33:56 +01:00
bee8c2d159 Ensure color is retrieved from current theme, even when theme change 2019-11-04 18:12:24 +01:00
945e5d5a74 Merge branch 'develop' into feature/room_list_actions 2019-11-04 17:17:43 +01:00
93df8c56a8 Fix compilation error and use mockk instead of manual mocking (prone to error) 2019-11-04 17:09:03 +01:00
cd1a964067 Merge pull request #649 from vector-im/feature/spoiler_support
Support spoilers in messages
2019-11-04 16:54:43 +01:00
e4b829f0cf Lift of 'return' 2019-11-04 16:53:51 +01:00
7206d84a6b Add FIXME 2019-11-04 16:51:45 +01:00
b3233d3eb7 Change spoiler bg colors 2019-11-04 16:50:32 +01:00
3c4c0ed46a Add /spoiler command 2019-11-04 16:50:32 +01:00
24f1262005 Merge refactoring 2019-11-04 16:49:53 +01:00
86667a6d8a Passes text color instead of context 2019-11-04 16:49:53 +01:00
42e0d0f769 Improve code to check url validity 2019-11-04 16:49:53 +01:00
e976055253 Support spoilers in messages 2019-11-04 16:49:53 +01:00
84d6c8ec16 Merge pull request #646 from vector-im/feature/search_reaction
Search reaction by name/keywords
2019-11-04 15:51:24 +01:00
9fdfd091ac Merge branch 'develop' into feature/search_reaction 2019-11-04 15:51:16 +01:00
e66766f41c Update CHANGES 2019-11-04 15:12:30 +01:00
6177e69855 Merge branch 'develop' into feature/room_list_actions 2019-11-04 15:11:20 +01:00
5c71cabb5f Clean code 2019-11-04 15:08:08 +01:00
6ebe5532c5 Room list actions: use new strings 2019-11-04 14:59:12 +01:00
8030c44f44 Room list actions: fix some UI issues and render selected notification state 2019-11-04 14:31:03 +01:00
a85b5af761 Merge pull request #641 from vector-im/feature/fix_crash
Fix crash
2019-11-04 14:28:31 +01:00
d780c74abf Merge pull request #657 from vector-im/feature/locales
Support Cyrillic script
2019-11-04 14:27:24 +01:00
5d7efa7f8f Merge pull request #660 from vector-im/feature/permission
Ask for permission to write external storage when uri comes from the keyboard (#658)
2019-11-04 14:26:12 +01:00
7e467443ed Merge pull request #651 from vector-im/feature/markdown_off
Markdown off
2019-11-04 10:23:21 +01:00
8439c337f7 Merge branch 'develop' into feature/markdown_off 2019-11-04 10:22:20 +01:00
151ad01038 Use RxBinding on searchView 2019-11-01 11:57:15 +01:00
73267442bb Fix / remove listener 2019-11-01 11:30:13 +01:00
43fd794c96 Ask for permission to write external storage when uri comes from the keyboard (#658) 2019-10-31 15:48:07 +01:00
36060fe332 Merge pull request #654 from vector-im/feature/timeline_message_code
Feature/timeline message code
2019-10-31 15:08:13 +01:00
3483debcc1 Little cleanup 2019-10-31 12:08:55 +01:00
4324f6abbd Add paragraph about a11y 2019-10-31 11:11:03 +01:00
43f8d8d8aa Merge pull request #656 from pvagner/a11y_file_type_selector
a11y: file type selector
2019-10-31 10:52:28 +01:00
fb1ff77ec4 Add string from Riot-Android 2019-10-31 10:09:27 +01:00
e355a7f6dd Changelog entry 2019-10-31 07:58:08 +01:00
33e35368fc a11y: better presentation for file type selector buttons to screen reader users
Signed-off-by: Peter Vágner <pvdeejay@gmail.com>
2019-10-31 06:36:28 +01:00
0e49a11e5e Merge pull request #648 from vector-im/feature/fix_#498
Feature/fix #498
2019-10-30 19:28:35 +01:00
d47cf7e932 Merge branch 'develop' into feature/fix_#498 2019-10-30 19:26:11 +01:00
101057520b Fix disambiguated with empty senderName 2019-10-30 19:25:24 +01:00
30b2e53002 Update CHANGES 2019-10-30 19:02:44 +01:00
5ab31a0ef5 Fix klint 2019-10-30 19:00:56 +01:00
b4ae331086 Timeline: render inline and block code 2019-10-30 19:00:00 +01:00
3f447df13c Support local script (imported from https://github.com/vector-im/riot-android/pull/3364) 2019-10-30 16:59:31 +01:00
3517873156 Timeline: Start handling code blocks. [WIP] 2019-10-29 19:08:48 +01:00
118870bc41 ktlint cleanup 2019-10-29 17:02:55 +01:00
d001ab5bef Merge pull request #640 from Dominaezzz/kotlinify
The last of the clean up.
2019-10-29 17:01:38 +01:00
7496a88dcd Markdown set to off by default (Fixes #412) 2019-10-29 16:22:12 +01:00
6567c5e6c7 Small kotlin improvement 2019-10-29 16:20:22 +01:00
361427488f Passphrase does not match (Export room keys) (Fixes #644) 2019-10-29 14:38:04 +01:00
7272343e6d Update comment 2019-10-29 14:32:05 +01:00
f0b3151d71 Merge pull request #639 from vector-im/feature/compile_tests
Build and run test on CI
2019-10-29 14:27:47 +01:00
035359cb35 Update CHANGES and clean code 2019-10-28 17:01:41 +01:00
57b640622b Sender Name: we should use disambiguated display name over senderName. PrevContent fallback is now handled in SDK 2019-10-28 16:48:55 +01:00
de4c389c76 klint cleaning 2019-10-28 15:12:49 +01:00
199456487c Search reaction by name/keywords 2019-10-28 14:36:15 +01:00
00ca5dc70a RoomListActions: handle room notification state. Still need to branch UI 2019-10-25 18:23:47 +02:00
a04802b238 CI / upgrade queue to xlarge 2019-10-25 11:14:17 +02:00
cb275aee37 Room list actions: start showing items and refact a bit RxStore 2019-10-24 19:11:49 +02:00
fbf73c7c8e shorter code 2019-10-24 18:52:34 +02:00
0040f8e924 Fix crash reported by Rageshake, stateKey can be null 2019-10-24 18:51:47 +02:00
6cca242f77 Fix Android test compilation issue 2019-10-24 17:49:34 +02:00
2929b8f617 Ensure Android tests compile and fix warnings 2019-10-24 17:24:42 +02:00
8422c6de17 Remove test sample 2019-10-24 17:21:19 +02:00
7c567b04bb Make test compile and pass 2019-10-24 16:36:12 +02:00
1ac99e92a6 Light refactoring.
Signed-off-by: Dominic Fischer <dominicfischer7@gmail.com>
2019-10-24 14:58:11 +01:00
5ab975cc5c General kotlinification.
Signed-off-by: Dominic Fischer <dominicfischer7@gmail.com>
2019-10-24 14:53:44 +01:00
2cf63ea92a Remove import java.util.* from kotlin files.
Signed-off-by: Dominic Fischer <dominicfischer7@gmail.com>
2019-10-24 14:53:10 +01:00
9e8d8ce878 Build and run test on CI 2019-10-24 15:52:40 +02:00
b766bce07d Version++ 2019-10-24 14:40:31 +02:00
0a0af221f0 Merge branch 'release/0.7.0' into develop 2019-10-24 14:37:51 +02:00
af08759af6 Prepare release 0.7.0 2019-10-24 14:37:28 +02:00
e52f0faaa7 Merge pull request #638 from vector-im/feature/filter
Fix 2 issues with share Activity: filter and room lists
2019-10-24 14:03:08 +02:00
8fa676d034 Share Activity: display rooms of all communities 2019-10-24 12:19:25 +02:00
b6594599c4 Rename member 2019-10-24 10:53:19 +02:00
8be8cc9ef7 Filter rooms when sharing element 2019-10-24 10:45:53 +02:00
9762d5be40 Room list actions: start creating all the components 2019-10-23 19:05:59 +02:00
b17b54d218 Merge pull request #637 from vector-im/feature/fix_room_summary
Feature/fix some room related stuff
2019-10-23 17:29:14 +02:00
187e2a26db Clean after Benoit's review 2019-10-23 17:26:56 +02:00
2f5fdbb7e2 Clean and fix lint 2019-10-23 16:20:38 +02:00
8b1411f533 Read marker: test if local echo before hitting the SDK to change read marker id + reduce a bit delay 2019-10-23 16:13:35 +02:00
bdee5e0687 Fix warning on Strings 2019-10-23 15:17:21 +02:00
ce4e244a3b Merge pull request #635 from vector-im/feature/strings
Import Strings from Riot
2019-10-23 15:09:58 +02:00
ff81715783 Import Strings from Riot 2019-10-23 14:18:40 +02:00
3196dcb57e MessageActions: disable if not synced atm 2019-10-23 12:20:03 +02:00
50bf6df7fe Room summary: fix some issues with local echo and sending event 2019-10-23 11:55:19 +02:00
02914495ce Merge pull request #632 from vector-im/feature/cleanuo
More cleanup
2019-10-23 10:26:54 +02:00
70a14f6350 Merge pull request #619 from vector-im/feature/attachments
Feature/attachments
2019-10-23 10:09:57 +02:00
cac5fb725a Code cleanup 2019-10-22 18:35:05 +02:00
dbc17ae515 Use AppCompatEditText instead of EditText 2019-10-22 18:23:53 +02:00
1de02c2fbb Ensure android.text.TextUtils will never be used again 2019-10-22 17:41:59 +02:00
6d55c15761 Fix lint issue 2019-10-22 17:41:21 +02:00
377a228f88 Improve code 2019-10-22 17:31:07 +02:00
2974f8b200 Merge branch 'develop' into feature/attachments 2019-10-22 17:27:15 +02:00
7388a408b8 Permissions: allow to provide the rationale message as it requires "context" and cannot be generic 2019-10-22 17:13:38 +02:00
f43dcb1183 Update room summary when saving local echo from DefaultRelationService 2019-10-22 16:54:48 +02:00
492ed3954a code cleanup 2019-10-22 16:54:48 +02:00
7890e83204 Merge pull request #630 from vector-im/feature/crypto_lock
Fix dead lock on crypto
2019-10-22 16:53:33 +02:00
00d1a2c380 Merge pull request #629 from vector-im/feature/fix_malformed_event_bug
Fix / event mapper persist the clear type in type
2019-10-22 14:47:08 +02:00
78dfd6b3e6 Fix potential lock due to nested synchronized(unknownSessionsFailure) 2019-10-22 14:20:43 +02:00
3abce34484 Add in existingRequest only if not filtered 2019-10-22 12:45:36 +02:00
4204ab262c Fix compilation issue 2019-10-22 12:42:01 +02:00
c7a4d34192 Attachments: handle rich content from keyboard 2019-10-22 12:37:59 +02:00
7416fec93e Do not decrypt event if session is unknown 2019-10-22 12:37:17 +02:00
3c40f64fb7 Add a few comments 2019-10-22 12:33:25 +02:00
b57c71b1c9 Remove unused import 2019-10-22 12:27:55 +02:00
fea54952d3 Code quality 2019-10-22 12:26:56 +02:00
3dc5ef54ab Fix compilation warnings 2019-10-22 12:21:50 +02:00
9092b97fb8 Merge pull request #622 from Dominaezzz/kotlinify
Some more clean up
2019-10-22 12:17:25 +02:00
cebd8136da Merge branch 'develop' into kotlinify 2019-10-22 12:16:20 +02:00
64b3568d51 Fix / event mapper persist the clear type in type 2019-10-22 11:57:11 +02:00
5e4e54153c Fix build error.
Signed-off-by: Dominic Fischer <dominicfischer7@gmail.com>
2019-10-21 22:52:58 +01:00
d071324694 Address review comments.
Signed-off-by: Dominic Fischer <dominicfischer7@gmail.com>
2019-10-21 22:29:36 +01:00
2c8cd89533 Handle rich content from app (WIP not compiling) 2019-10-21 19:02:28 +02:00
11b5c2c3ba Restore previous log level 2019-10-21 18:17:03 +02:00
9d7c4abb97 Merge pull request #615 from vector-im/feature/report_content
Add ability to report content
2019-10-21 18:13:44 +02:00
8e3234d188 Clean some code 2019-10-21 18:08:42 +02:00
b253722b98 Disable animation 2019-10-21 17:22:28 +02:00
fce576e3a4 Message action bottom sheet expanded 2019-10-21 17:22:28 +02:00
7ed7b18ccd Remove unused import 2019-10-21 17:22:28 +02:00
053bf7aeac Improve layout preview a bit 2019-10-21 17:22:28 +02:00
6ccd083451 Bottom sheet: fix RecyclerView usage 2019-10-21 17:22:28 +02:00
e39c4a7925 fix ktlint issue 2019-10-21 17:22:28 +02:00
abdb83b9fd Report content: change log 2019-10-21 17:22:28 +02:00
0bcc84cbd6 Try to fix the bottom sheet showing expanded by default #2
Seems ok now
2019-10-21 17:22:00 +02:00
b2f6fb8c91 Try to fix the bottom sheet showing expanded by default.
The second time it's open, it's not expanded... With this fix, the bug appear only at the third time...
2019-10-21 17:22:00 +02:00
36042ed145 Report content: red color for "block user" button 2019-10-21 17:22:00 +02:00
6ad1932fe5 Report content: custom reason 2019-10-21 17:22:00 +02:00
4a6237b50e Report content: confirmation dialogs 2019-10-21 17:22:00 +02:00
a7a19dab11 Report content: Service and REST request 2019-10-21 17:22:00 +02:00
8d0aa0437c Report content: UI menu 2019-10-21 17:21:26 +02:00
0a79b8b315 Cleanup 2019-10-21 17:21:26 +02:00
1dacfa6744 Rework message menu bottom sheet: remove sub Fragment and use Epoxy
- Also move some class to some dedicated package
2019-10-21 17:21:26 +02:00
723a007c39 Merge pull request #626 from vector-im/feature/myUserIdInject
Inject userId where possible
2019-10-21 16:01:48 +02:00
eaa1b04a4a Merge pull request #616 from vector-im/feature/big_font_regression
Fix regression after merge conflict: big font for messages with only big emoji
2019-10-18 15:03:43 +02:00
b1710fde60 Merge pull request #618 from vector-im/feature/mark_all_read
Mark all as read
2019-10-18 15:02:16 +02:00
cd0a40c18d Fix compil test issue 2019-10-18 14:34:44 +02:00
17636019e0 Change order of parameters 2019-10-18 14:32:34 +02:00
8078c39d6e Rename parameter 2019-10-18 14:29:32 +02:00
be94b2f90a Change order of parameters (no effect) 2019-10-18 14:28:12 +02:00
eff04be247 Change order of class (no effect) 2019-10-18 14:26:24 +02:00
3986839801 Inject userId 2019-10-18 14:25:19 +02:00
9e436483de Use klint 2019-10-16 10:39:42 +02:00
05a069be04 Attachments: fix themes for selection view 2019-10-16 10:04:33 +02:00
a1a71e2f1d App state: fix session 2019-10-16 10:04:11 +02:00
203da0f37e Mark all as read: not for all Room list and look if there is unread rooms 2019-10-16 10:03:30 +02:00
6cd04525aa Clean after Benoit's review 2019-10-15 11:37:22 +02:00
3c3c6aeac6 Removes the RoomList handling from a viewmodel as it doesn't have a ViewState and should be provided globally (IE, from application state) 2019-10-15 11:24:20 +02:00
e71311f576 Merge pull request #612 from vector-im/feature/browser_tab
Opening links from RiotX reuses browser tab (#599)
2019-10-15 11:05:06 +02:00
e4d0e0b0bf Update after Ganfra's review 2019-10-15 11:03:30 +02:00
28e5e42ab1 Merge pull request #614 from vector-im/feature/recycler_view_upgrade
Upgrade RecyclerView version to fix issues with a11y.
2019-10-15 10:47:59 +02:00
b860c3b0e3 Merge pull request #623 from Dominaezzz/typos
Fix some typos/errors in documentation.
2019-10-12 21:06:09 +02:00
f7f97e2098 Typos
Signed-off-by: Dominic Fischer <dominicfischer7@gmail.com>
2019-10-12 16:04:47 +01:00
e28e2dadb9 Some more clean up
Signed-off-by: Dominic Fischer <dominicfischer7@gmail.com>
2019-10-12 15:37:20 +01:00
c28be6adb0 Fix code quality check 2019-10-11 17:23:25 +02:00
c57af9cf3e Better formatting 2019-10-11 17:18:54 +02:00
679b0fff98 Use klint and update CHANGES 2019-10-11 17:12:53 +02:00
946fc36a26 Update contributing doc 2019-10-11 17:12:51 +02:00
13a5f784dc Merge branch 'develop' into feature/attachments 2019-10-11 17:05:03 +02:00
0ca8696e88 Attachments/Share: cleaning code and add contact picking 2019-10-11 16:41:04 +02:00
3622c0ecb4 Mark all as read 2019-10-11 16:22:32 +02:00
116d569fa8 Fix regression after merge conflict: big font for messages with only big emoji 2019-10-11 14:35:37 +02:00
ee5ebb4b83 Attachments: get better layout 2019-10-11 12:20:39 +02:00
0a0c344bfb Upgrade RecyclerView version to fix issues with a11y.
Also minor upgrade of some other libs
2019-10-11 10:10:16 +02:00
82fc97f619 Add dictionary specific to the project to VCS 2019-10-11 09:32:43 +02:00
20696353b8 Attachments: try to improve a bit the UI and adding options [WIP] 2019-10-10 19:12:16 +02:00
ae5b6bd2b9 Attachments/Sharing: refact a bit and handle more data. 2019-10-10 16:55:50 +02:00
1e11d4492b Merge pull request #610 from vector-im/feature/warnings
Fix all warnings and ensure they will not come back
2019-10-10 10:37:49 +02:00
6e39164b20 Sharing: start handling incoming share [WIP] 2019-10-09 20:05:37 +02:00
0a9ebb6bf6 Attachments: use a lib which handles for us all the intent stuff. 2019-10-09 19:51:00 +02:00
db009ce683 Fix warning on release build 2019-10-09 16:47:27 +02:00
55c80d3743 ktlint: ignore (experimental:annotation) rule 2019-10-09 16:44:45 +02:00
fbb23dfb66 ktlint: fix (no-empty-first-line-in-method-block) issues 2019-10-09 16:43:12 +02:00
e5779d425a ktlint: fix (experimental:multiline-if-else) issues 2019-10-09 16:40:44 +02:00
99d9704a50 ktlint: enable experimental features 2019-10-09 16:38:23 +02:00
3f8ddbe880 Opening links from RiotX reuses browser tab (#599) 2019-10-09 16:23:35 +02:00
30e43e47cd Fix filename ktlint issues 2019-10-09 15:44:01 +02:00
15dc4d6369 Fix ktlint issue automatically by running ./ktlint --android -v -F 2019-10-09 15:24:05 +02:00
dceb5ffd8d ktlint needs java 2019-10-09 15:19:07 +02:00
eec470f2ce Fix code quality issues 2019-10-09 15:15:15 +02:00
68db9c1cc0 Create a specific step for ktlint 2019-10-09 15:11:21 +02:00
cdfc402599 Fix Timber error in formatting 2019-10-09 15:06:38 +02:00
72d3f1e909 Configure ktlint 2019-10-09 15:06:38 +02:00
255fa11e89 Remove extra spaces 2019-10-09 12:49:00 +02:00
119e4c0d32 Fix warnings in the App 2019-10-09 12:49:00 +02:00
a9c474105a Fix warnings in the SDK 2019-10-09 12:49:00 +02:00
6de64cbedd Treat warnings from the kotlin compiler as errors 2019-10-09 12:49:00 +02:00
546c537e3b Upgrade build tools version from 3.5.0 to 3.5.1 2019-10-09 12:49:00 +02:00
36c5f9af13 Merge pull request #583 from vector-im/feature/invot_notification
Invitation notifications are not dismissed automatically if room is joined from another client (#347)
2019-10-09 12:48:07 +02:00
c2682c7f4b Merge pull request #609 from vector-im/feature/remove_event_bus
Stop sending bus event from SDK to App.
2019-10-09 12:47:06 +02:00
3073470c38 Attachments: start working on new UI (using system file picker) [WIP] 2019-10-08 19:59:09 +02:00
549f749682 Nest the try catch blocks 2019-10-08 14:00:11 +02:00
d4dfb76e80 Change constant value (for application upgrade reason) 2019-10-08 13:57:32 +02:00
e80191b2e0 Use mutableSet 2019-10-08 13:52:26 +02:00
c62c77f14c Stop sending bus event from SDK to App. 2019-10-08 12:00:40 +02:00
d6e5c5a857 Merge pull request #608 from vector-im/feature/a11y_review
Feature/a11y review
2019-10-08 11:16:08 +02:00
50a0660ab6 Invitation notifications are not dismissed automatically if room is joined from another client (#347) 2019-10-08 10:56:47 +02:00
ecdb3c3326 Merge pull request #591 from vector-im/feature/image_orientation
Fix issue with image orientation
2019-10-08 10:53:46 +02:00
2cd1d697fe Cleanup after Gafnra's review 2019-10-08 10:53:21 +02:00
3f9b7813bc Remove undocumented attribute and fix issue with image size when it contains exif rotation 2019-10-08 10:53:21 +02:00
f34f28b668 Add Exif orientation info to ContentAttachmentData 2019-10-08 10:52:54 +02:00
53572a3be6 Fix crash observed on the PlayStore 2019-10-08 10:52:54 +02:00
90b6199e10 Fix compilation issue 2019-10-08 10:45:45 +02:00
0aa299aa37 Private 2019-10-07 19:11:53 +02:00
d387c310c8 Cleanup code after a11y PR (#596) and fix some merging issues 2019-10-07 18:41:44 +02:00
8bd1fb08f7 Update template 2019-10-07 17:18:07 +02:00
ac6aff9175 Merge pull request #596 from pvagner/a11y
more a11y tweaks
2019-10-07 17:15:29 +02:00
adf0382d28 Merge pull request #603 from vector-im/feature/clear_corrupted_realm
Feature/clear corrupted realm
2019-10-07 16:35:23 +02:00
51554f7be0 Merge pull request #595 from vector-im/feature/lib_upgrade
Upgrade some dependencies
2019-10-07 16:22:30 +02:00
c1c1c3f999 Use latest coroutine lib: v1.3.2 2019-10-07 16:22:09 +02:00
8b04fdab77 Upgrade other libraries 2019-10-07 16:22:09 +02:00
f8b665a245 Fix warning 2019-10-07 16:21:18 +02:00
d68a9a5342 Split long line 2019-10-07 16:21:18 +02:00
5d2ff589f8 Upgrade gradle plugins 2019-10-07 16:21:18 +02:00
e85a0783fc Upgrade kotlin version 2019-10-07 16:21:18 +02:00
d6c278288d upgrade google play services plugin 2019-10-07 16:21:18 +02:00
4ad86a13a0 Upgrade the dependencies to the latest version 2019-10-07 16:21:18 +02:00
4f7ec91255 Merge pull request #604 from vector-im/feature/performance
Feature/performance
2019-10-07 16:08:39 +02:00
979b42aa30 Do not delete the crypto DB when deleting the session DB 2019-10-07 16:07:57 +02:00
fc49de080c Clean after benoit's review 2019-10-07 16:00:11 +02:00
d2b9668d4e Inject element where they are used 2019-10-07 15:25:54 +02:00
0632870be1 Merge pull request #605 from vector-im/feature/fixing_crashes
Feature/fixing crashes
2019-10-07 14:51:50 +02:00
8e39fd2a70 Clean after benoit's review 2019-10-07 14:45:58 +02:00
abbc62dd35 Clear corrupted db: add some logs 2019-10-04 19:42:27 +02:00
77de059dc9 Timeline: fix potential issues when starting/disposing the timeline 2019-10-04 19:37:44 +02:00
1931a1a4a4 Sync: use some suspending function where it makes sense 2019-10-04 19:37:23 +02:00
9c5987b682 SAS: fix potential crash 2019-10-04 19:36:22 +02:00
4e4fb4c565 Crypto store: fix potential issue with realm open/close process 2019-10-04 19:36:10 +02:00
0582d0f641 Timeline: fix some crashes 2019-10-04 12:12:39 +02:00
ef2af14529 Realm: remove RealmLiveData and use Optional for LiveData with potential null value 2019-10-03 19:19:53 +02:00
525da17678 Optimization: try to get a more performant reactions display management 2019-10-03 19:15:11 +02:00
aab41d7358 Code quality
Signed-off-by: Peter Vágner <pvdeejay@gmail.com>
2019-10-03 16:34:31 +02:00
5db3c81aa9 Add contentDescription to the jump to botton view
Signed-off-by: Peter Vágner <pvdeejay@gmail.com>
2019-10-02 20:51:57 +02:00
c763635845 Optimize: try to optimize a text message items 2019-10-02 20:36:52 +02:00
11d72b81f6 Add CHANGES.md entry 2019-10-02 20:04:33 +02:00
53543453b3 Login: add contentDescription to password reveal
Signed-off-by: Peter Vágner <pvdeejay@gmail.com>
2019-10-02 20:04:33 +02:00
d4be68191c Fix conflicts after rebase
Signed-off-by: Peter Vágner <pvdeejay@gmail.com>
2019-10-02 20:04:33 +02:00
7ef471ad0d Add contentDescription for the read receipts
Signed-off-by: Peter Vágner <pvdeejay@gmail.com>
2019-10-02 20:04:33 +02:00
73dd735ba6 Reactions: Add content descriptions to emoji chooser category tabs and individual emojis
Signed-off-by: Peter Vágner <pvdeejay@gmail.com>
2019-10-02 20:04:33 +02:00
2f6d3adb17 Message composer: describe the image button for dismissing as cancel rather than close
Signed-off-by: Peter Vágner <pvdeejay@gmail.com>
2019-10-02 20:04:33 +02:00
2edfd4e830 Message composer: add content descriptions to image buttons
Signed-off-by: Peter Vágner <pvdeejay@gmail.com>
2019-10-02 20:04:33 +02:00
ff7856c535 Optimize: start removing some constraint layout from timeline 2019-10-02 19:30:01 +02:00
650a151b18 Optimize: remove some epoxy building from main thread 2019-10-01 20:12:15 +02:00
275dd20412 Optimize: don't build OkHttp in Application OnCreate if we don't need it 2019-10-01 20:12:01 +02:00
44f6391cb4 Optimize: use LazyThreeTen 2019-10-01 20:11:15 +02:00
588e5d6e63 Hot fix: fix home navigation issue 2019-10-01 17:39:20 +02:00
716999eec6 Merge pull request #592 from vector-im/feature/read_marker
Feature/read marker
2019-10-01 13:55:09 +02:00
42e0a45f3f Merge branch 'develop' into feature/read_marker 2019-10-01 13:37:21 +02:00
31397869b2 Read marker: refine JumpToReafMarkerView 2019-10-01 12:33:38 +02:00
e842bf13b2 Timeline: fix back pagination state 2019-10-01 12:32:48 +02:00
aea34da81e Merge pull request #593 from vector-im/feature/group_avatar
Group avatar live
2019-10-01 11:45:43 +02:00
0814f53fed Group avatar: clean and optimize a bit. 2019-10-01 11:25:41 +02:00
b5c6c1af0d Realm: allow to clear corrupted session db 2019-09-30 19:09:10 +02:00
de30e7c1c6 Code cleanup 2019-09-26 19:00:38 +02:00
2d95fe921d after login, the icon in the top left is a green 'A' for (all communities) rather than my avatar (#267) - part2 (Toolbar) 2019-09-26 18:42:27 +02:00
84542326f4 HomeDetailFragment observe the selectedGroupStore instead of passing argument 2019-09-26 18:06:24 +02:00
53b1b89c47 after login, the icon in the top left is a green 'A' for (all communities) rather than my avatar (#267) 2019-09-26 17:30:30 +02:00
28315be7b9 Update CHANGES 2019-09-26 17:05:18 +02:00
8605095668 Fix quality code issues 2019-09-26 16:49:41 +02:00
737959f616 Merge branch 'develop' into feature/read_marker 2019-09-26 15:15:34 +02:00
7817f49072 Merge pull request #590 from vector-im/feature/quickfix
Fix my dirty code
2019-09-26 14:50:38 +02:00
a060431aaf Fix my dirty code 2019-09-26 13:51:44 +02:00
a3f561d788 Merge branch 'develop' into feature/read_marker 2019-09-26 12:19:40 +02:00
0ea878af8a Timeline: fix some more issues 2019-09-26 11:55:16 +02:00
99de40c980 Merge pull request #589 from vector-im/feature/media_upload_failure
Fix media upload failure
2019-09-26 11:30:54 +02:00
810a97c639 Import string from Android-SDK (#355) 2019-09-26 11:14:13 +02:00
f02f16d9c5 Use IEC units instead of SI units for file sizes 2019-09-26 10:41:52 +02:00
62b7a83a31 Update after Dominaezzz's review 2019-09-26 10:08:44 +02:00
4a80df082c Timeline: refact [WIP] 2019-09-25 19:14:12 +02:00
60f6b3ef02 Auto review 2019-09-25 17:08:58 +02:00
a0b1ef3216 Do not upload file to big for the homeserver (#587)
Also create a HomeServerCapabilitiesService which provide configuration of the homeserver.
Data are retrieved every 8 hours (as RiotWeb?)
2019-09-25 16:59:50 +02:00
1b66d1f746 Fix bad rendering of file item if the filename is long 2019-09-25 15:25:26 +02:00
643a2baabf Set click and long click listener even if information data are not displayed 2019-09-25 15:03:16 +02:00
cd62e87266 Human readable error 2019-09-25 14:44:34 +02:00
17cba1a432 Display progress in the timeline when uploading file 2019-09-25 14:39:33 +02:00
f077cc8467 Stop sending media in an infinite loop in case of error (part of #587)
Not sure how this commit fix it, but the issue is not observed anymore with it
2019-09-25 14:09:26 +02:00
f3039601bf throw Failure instead of meaning less IOException 2019-09-25 11:27:23 +02:00
4c04014e4d Do not log big data request (ex: file upload) 2019-09-25 11:26:49 +02:00
ae8bceacba Create Extension to convert a Response to a Failure -> expose to other object 2019-09-25 11:26:13 +02:00
9b91b6ea87 Create Extension to convert a Response to a Failure 2019-09-25 10:56:18 +02:00
b24a372262 Show "Clear message queue" option (in debug mode) 2019-09-25 10:50:13 +02:00
63b43de4b8 Read marker: final refact [WIP] 2019-09-24 22:52:43 +02:00
d1a61f29e4 Merge pull request #586 from vector-im/feature/persist_tab
Persist opened tab between session (i.e. after application restart)
2019-09-24 16:12:28 +02:00
f6373221de Dagger cleanup 2019-09-24 16:05:08 +02:00
b5f2f01c8d Merge branch 'hotfix/dimensionConverter' into develop 2019-09-24 14:28:51 +02:00
21d808c1ce Fix crash: MergedHeaderItem was missing dimensionConverter 2019-09-24 14:28:34 +02:00
1e963bc0dc Fix crash: MergedHeaderItem was missing dimensionConverter 2019-09-24 14:23:13 +02:00
0d80750507 Create interface for UiStateRepository and an implementation with SharedPrefs 2019-09-24 13:43:50 +02:00
1c9cf7a810 Dagger code cleanup 2019-09-24 13:40:03 +02:00
c6d01fbcf4 ReadMarker: extract from ViewModel the jump to read marker visibility logic as it's easier to deal with. 2019-09-24 12:57:32 +02:00
9e1ded941f Persist active tab between sessions (#503) 2019-09-24 12:29:37 +02:00
af433266c8 Move currentDisplayMode to the ViewState 2019-09-24 11:32:55 +02:00
05d09bf950 Merge branch 'develop' into feature/read_marker 2019-09-24 11:10:59 +02:00
6890f83810 Cleanup dead code 2019-09-24 10:47:29 +02:00
51568c30a6 Version++ 2019-09-24 10:23:51 +02:00
cc832633a5 Merge branch 'release/0.6.0' 2019-09-24 10:22:42 +02:00
e019ec6596 Merge branch 'release/0.6.0' into develop 2019-09-24 10:22:42 +02:00
eadea9016b Prepare release 0.6.0 2019-09-24 10:22:36 +02:00
6422d946c9 Merge pull request #584 from vector-im/feature/hasUnread
isEventRead() returns true if the event has been sent by the user
2019-09-24 10:17:52 +02:00
5cc3dc00e3 Merge pull request #581 from vector-im/feature/talk_back
Fix a few accessibility issues
2019-09-24 10:06:28 +02:00
5a2a9f908a isEventRead() returns true if the event has been sent by the user 2019-09-24 10:04:57 +02:00
c1f2e9f171 Fix a few accessibility issues - home menu (best compromise) 2019-09-23 17:48:13 +02:00
f6d34ec7fd Timeline: update state management 2019-09-23 17:43:37 +02:00
620ba279d8 Fix a few accessibility issues 2019-09-23 16:32:54 +02:00
3fcfa33364 Merge pull request #573 from vector-im/feature/notif_invit
Clean up push rules management and fixes several issues
2019-09-23 16:23:35 +02:00
546da0f173 Merge branch 'develop' into feature/notif_invit 2019-09-23 16:23:22 +02:00
001711d5a3 Merge pull request #574 from vector-im/feature/big_emoji
Embiggen messages with multiple emojis also for edited messages
2019-09-23 16:22:53 +02:00
8e1a964679 After Ganfra's review 2019-09-23 15:08:18 +02:00
b25a130db1 Rename DimensionUtils to DimensionConverter, and inject resources instead of context. 2019-09-23 14:39:52 +02:00
8a9e6497e8 Merge pull request #578 from vector-im/feature/fix_focus_login
Fix infinite focus on HS field
2019-09-23 10:05:43 +02:00
47e3797b7e Fix infinite focus on HS field 2019-09-23 09:44:32 +02:00
5cbc90e06a Embiggen messages with multiple emojis also for edited messages (#458)
And daggerize DimensionUtils
2019-09-20 19:22:42 +02:00
b6e18e4a8f Timeline: add badge also when unread without notif 2019-09-20 18:34:58 +02:00
7e29665fd0 Timeline: add some comments and checks 2019-09-20 18:34:31 +02:00
e04bf31faa Fix wrong "no network" banner 2019-09-20 18:18:55 +02:00
d25cf79b07 Cleanup 2019-09-20 17:50:57 +02:00
faa8e6bbb2 m.notice messages trigger push notifications (#238) 2019-09-20 17:50:57 +02:00
d3d4deb884 Rework Action (better kotlin code) 2019-09-20 17:50:57 +02:00
f6b8e0c479 Fix issue: push rules was not retrieved after a clear cache.
We now store push rules from the sync response
2019-09-20 17:50:57 +02:00
2a726f54a2 Remove userId from PushRulesEntity and PusherEntity objects 2019-09-20 17:50:15 +02:00
1197d4021d Fix regression on PushRulesApi 2019-09-20 17:50:15 +02:00
03f8120b7d Create enum for Push rules. Also add some TODOs 2019-09-20 17:50:15 +02:00
acd7a709de Dagger: create @UserId to inject userId 2019-09-20 17:50:15 +02:00
5651ea515b Merge pull request #570 from vector-im/feature/left_group
Handle left group from sync
2019-09-20 17:44:13 +02:00
9794b3a49d Fix compilation issue of F-Droid build 2019-09-20 17:35:10 +02:00
b3e1c3969d Little changes after review 2019-09-20 17:34:50 +02:00
90eeb68d36 Timeline: fix permalink towards an hidden event 2019-09-20 17:22:04 +02:00
d1ff3314a7 Timeline : add badge on jump to bottom view 2019-09-19 19:12:45 +02:00
f24bed17a2 Add missing issue number 2019-09-19 17:56:34 +02:00
a993a30203 Handle left group from sync 2019-09-19 17:08:22 +02:00
ea0809ff87 Merge branch 'develop' into feature/read_marker 2019-09-19 16:57:00 +02:00
9668487b6b Timeline/Read: update read receipt locally to 2019-09-19 16:17:58 +02:00
91cc78d2ad Merge pull request #552 from vector-im/feature/draft
Save draft of a message when exiting a room with non empty composer (#329)
2019-09-19 13:11:35 +02:00
562acc9702 Save Draft only when app goes to background. 2019-09-19 13:09:08 +02:00
dfab88ed95 Display room with draft in the Catchup screen 2019-09-19 13:09:08 +02:00
36866dd24e Save draft of a message when exiting a room with non empty composer (#329) 2019-09-19 13:09:08 +02:00
c728834273 Merge pull request #566 from vector-im/feature/redact_notification
Redact notification
2019-09-19 13:02:17 +02:00
f5020d0f63 Daggerization and cleanup of NotificationUtils 2019-09-19 13:01:00 +02:00
7da9cafcc2 Remove any notification of a redacted event (#563)
Also do some cleanup and kotlinification on the code
2019-09-19 13:01:00 +02:00
6f09eea248 Merge pull request #562 from vector-im/feature/notification_edited
Message Editing: Update notifications (#128)
2019-09-19 12:59:10 +02:00
468bd5bcc9 Message Editing: Update notifications (#128) 2019-09-19 12:57:58 +02:00
3169093c50 Quick fix on the no connection banner displayed when internet is available 2019-09-19 12:55:39 +02:00
d60d766354 Merge pull request #524 from vector-im/feature/indicate_unread_rooms
Add unread indent on room list
2019-09-19 12:50:55 +02:00
0ffb5e627e Cleanup injected constructors 2019-09-19 12:43:39 +02:00
b4a13f9504 Add unread indent on room list 2019-09-19 12:43:39 +02:00
88fb9667a3 Timeline: continue fixing issues + read marker 2019-09-18 20:21:42 +02:00
ffa8b7e73a Better fix 2019-09-18 11:24:29 +02:00
528958b3de Avoid export on env variable 2019-09-18 10:58:03 +02:00
3ffe2f7d40 Fix (again) issue with bad versionCode generated by Buildkite (#553) 2019-09-18 10:29:29 +02:00
3066d5f303 Timeline\ReadMarker: continue fixing issues 2019-09-17 19:38:05 +02:00
bf42b73713 Merge pull request #555 from vector-im/feature/room_search
Cleanup on the room search screen
2019-09-17 15:28:54 +02:00
ed93f4a6c1 Cancel any request properly 2019-09-17 14:55:57 +02:00
b3d649a4d9 Fix characters erased from the Search field when the result are coming (#545) 2019-09-17 14:55:57 +02:00
3739e50d46 Better error message for timeout 2019-09-17 14:55:48 +02:00
9bf484cf1e Create a Failure to handle cancellation, and use it to ignore cancellation on room search 2019-09-17 14:55:48 +02:00
6c2faff1f0 Version++ (0.6.0) 2019-09-17 14:53:50 +02:00
07fca0922b Merge branch 'release/0.5.0' 2019-09-17 14:50:55 +02:00
282de21708 Merge branch 'release/0.5.0' into develop 2019-09-17 14:50:55 +02:00
ba9d119892 Prepare release 0.5.0 2019-09-17 14:50:43 +02:00
4453f0ced9 Merge pull request #560 from vector-im/feature/no_network
Display a "No network" banner when the device has no network
2019-09-17 14:40:42 +02:00
77168bfd6a Merge pull request #558 from vector-im/feature/login_sso
Quick implementation of SSO login - Also handling of magic link
2019-09-17 14:28:04 +02:00
25e9a179d2 SyncThread: Fix issue when network is back and the app was in background: do not restart the thread 2019-09-17 14:26:30 +02:00
73ec0f5a83 NetworkConnectivityChecker: filter onConnected callbacks (several callback if Wifi and LTE is connected)
Also do not use merlinsBeard.isConnected, which return trus even if there is no internet access (ex: with Wifi hotspot)
2019-09-17 14:22:08 +02:00
993fa74252 Cleanup after BillCarsonFr's review 2019-09-17 11:24:37 +02:00
38fc4984fe Display a no network indicator when there is no network: Create a dedicated View 2019-09-17 11:13:00 +02:00
695d8cce00 Display a no network indicator when there is no network (#559) 2019-09-17 10:59:58 +02:00
07e99901e1 SecretStoringUtils -> move to internal package 2019-09-17 10:38:37 +02:00
20f53e9a58 Signout: propose the user to retry in case of error 2019-09-17 10:33:27 +02:00
ced72aff4f Revert change done to save alias for the client 2019-09-17 10:32:09 +02:00
fdaaca49c2 Code quality (bad import) 2019-09-16 19:27:13 +02:00
3485f023b0 All current notifications were dismissed by mistake when the app is launched from the launcher 2019-09-16 19:24:52 +02:00
384dd100e9 Daggerization and Kotlinification of SecretStoringUtils 2019-09-16 19:19:14 +02:00
1ba8a58219 Cleanup SecretStoringUtils, and delete keys when user signs out 2019-09-16 18:29:06 +02:00
69fb7bdf95 Timeline\Read marker: continue fixing potential issues 2019-09-16 18:14:41 +02:00
c8010561fc Rework on sign out task 2019-09-16 17:45:26 +02:00
1f127335bc Daggerization of RealmKeysUtils 2019-09-16 15:50:56 +02:00
138a210a73 Dagger: Screen component now exposes ActiveSessionHolder instead of Session 2019-09-16 14:43:39 +02:00
ca6bcde82d Re add the remove CurlLoggingInterceptor 2019-09-16 14:43:08 +02:00
6bda437f5d Auto configure homeserver and identity server URLs of LoginActivity with a magic link 2019-09-16 10:58:51 +02:00
5d6d0202a9 Timeline: try to fix some issues with permalink [WIP] 2019-09-14 14:11:41 +02:00
3e6b65e174 Handle M_CONSENT_NOT_GIVEN error (#64) 2019-09-13 18:21:56 +02:00
137dcab734 Curl login interceptor now log the AT (on debug mode) 2019-09-13 16:20:19 +02:00
b22b8fba02 Fix the mess up with OnBackPress support on Fragment 2019-09-13 15:55:33 +02:00
3ccdf4a244 Login: some cleanup 2019-09-13 15:35:44 +02:00
5fbd271b1c Login: add SSO support 2019-09-13 15:19:45 +02:00
db8ea0f5e8 Login: check login flow - step 1 2019-09-13 11:08:54 +02:00
a47a3ead1f Login: move login code to the ViewModel 2019-09-13 10:39:22 +02:00
05b2092ffc Login: move existing code to a Fragment, MvRx style 2019-09-13 10:07:55 +02:00
f4ab770be9 Merge branch 'develop' into feature/read_marker 2019-09-12 17:24:50 +02:00
6249a59203 Merge pull request #554 from vector-im/feature/build_number
Fix issue with bad versionCode generated by Buildkite (#553)
2019-09-12 17:24:46 +02:00
d4111d053d Read marker: only show banner until scrolled to read marker 2019-09-12 16:35:45 +02:00
618e9a4f52 Fix issue with bad versionCode generated by Buildkite (#553) 2019-09-12 16:17:44 +02:00
b8ebe3570b Timeline: refact epoxy attributes 2019-09-11 18:04:17 +02:00
f2c8d4ad02 Merge pull request #549 from vector-im/feature/third_party_invite
Fix rendering issue of accepted third party invitation event
2019-09-06 16:36:30 +02:00
be524472ec Merge pull request #546 from vector-im/feature/cleanup
Cleanup
2019-09-06 16:25:08 +02:00
1b82a1a24d Cleanup 2019-09-06 15:52:29 +02:00
cf0b331c3b Handle invite to the current user rendering 2019-09-06 15:48:42 +02:00
2a92a3dc80 Fix rendering issue of accepted third party invitation event 2019-09-06 14:34:52 +02:00
012840abba Progress in initial sync dialog is decreasing for a step and should not (#532) 2019-09-05 18:14:05 +02:00
a5975a099e Cleanup and document DefaultInitialSyncProgressService 2019-09-05 17:23:09 +02:00
38da4b9ee5 Cleanup and document DefaultInitialSyncProgressService 2019-09-05 17:02:03 +02:00
242e60fcaa Rename CryptoManager to DefaultCryptoService 2019-09-05 16:14:34 +02:00
a23be05cbf Better type 2019-09-05 16:04:41 +02:00
ed39b02924 Avoid using keyword for variable names 2019-09-05 16:04:41 +02:00
fe931b5361 Merge pull request #418 from Dominaezzz/kotlinify-1
Some more kotlinification
2019-09-05 16:02:30 +02:00
90d9cd0587 Merge pull request #416 from Dominaezzz/kt-remove_java_util
Remove most usages of the java.util package
2019-09-05 15:33:03 +02:00
9cedb18921 Merge pull request #538 from vector-im/feature/log_mgmt
Reduce release build log level
2019-09-05 15:24:04 +02:00
e89ba7b87b Update wording 2019-09-05 15:23:38 +02:00
902657c22a Merge pull request #537 from vector-im/feature/fix_crash
Fix crash due to missing informationData (#535)
2019-09-02 15:31:28 +02:00
eec2abf164 Reduce release build log level 2019-09-02 14:33:53 +02:00
6879cc8ca8 Fix crash due to missing informationData (#535) 2019-09-02 14:24:36 +02:00
fd6bbbd3b5 Fix issue with version name (Fixes #533) 2019-08-30 15:57:39 +02:00
0ff0b014a9 Version++ (0.5.0) 2019-08-30 15:07:04 +02:00
a89f0ddd1d Merge branch 'release/0.4.0' 2019-08-30 15:04:43 +02:00
fdc9e84dd5 Merge branch 'release/0.4.0' into develop 2019-08-30 15:04:43 +02:00
58f878fca9 Prepare version 0.4.0 2019-08-30 15:04:28 +02:00
88095e4bd9 Add entry in change file 2019-08-30 14:54:15 +02:00
47d22a3d5e Import translation from Riot and MatrixSDK 2019-08-30 11:21:43 +02:00
28e82cb8ea Merge pull request #531 from vector-im/feature/fix_crash_530
Fix / EmojiCompat not initialized
2019-08-29 17:46:51 +02:00
35817245cb refactoring, code review 2019-08-29 17:27:49 +02:00
75266f42bb Fix / EmojiCompat not initialized 2019-08-29 16:49:22 +02:00
95c4c9ce56 Merge pull request #527 from vector-im/feature/privacy
Privacy: remove log of notifiable event (#519)
2019-08-29 12:16:34 +02:00
ce5570105d Privacy: remove log of notifiable event (#519) 2019-08-29 10:36:45 +02:00
188a9aebfa Merge pull request #525 from vector-im/feature/read_receipt_cleanup
Feature/read receipt cleanup
2019-08-29 10:19:06 +02:00
c95223f5d2 Add long click support on unsupported event 2019-08-28 18:17:37 +02:00
ef0362ba9c Display Read Receipt on unsupported events 2019-08-28 17:31:31 +02:00
ea242f6737 Hide ReadReceipt View when it is not relevant 2019-08-28 17:17:37 +02:00
cbc08d834b Merge pull request #522 from vector-im/feature/fix_e2e_reply
Fix / regression on e2e reply and edit of reply
2019-08-28 10:38:22 +02:00
0ab6b33fb6 Merge branch 'develop' into feature/fix_e2e_reply 2019-08-28 10:38:12 +02:00
1b394527b6 cleaning + code review 2019-08-28 10:22:51 +02:00
a8f1388721 Merge pull request #520 from vector-im/feature/read_receipts_511
Improve read receipt design
2019-08-28 10:17:56 +02:00
166be4e289 Improve read receipt design 2019-08-28 09:56:10 +02:00
b49ccefe63 Merge pull request #521 from vector-im/feature/fix_dome_video_wont_play
Some video won't play
2019-08-28 03:43:35 -04:00
825760d17e Fix / regression on e2e reply and edit of reply 2019-08-27 17:05:04 +02:00
b5af62c3ea Some video won't play
VideoView fails to play some remote uri video on some device. For now video is downloaded locally in internal cache then played. This offers basic support before full media preview implementation
2019-08-27 16:50:02 +02:00
a51d96bf00 Merge pull request #325 from vector-im/feature/non_unicode_reaction
Accept non unicode reactions
2019-08-27 08:10:51 -04:00
7e142d201d Use EmojiCompat to build EmojiSpans from text 2019-08-27 11:06:52 +02:00
2be6058971 accept non unicode reactions 2019-08-27 10:58:21 +02:00
49d73f360e Merge pull request #494 from vector-im/feature/fix_441
Fix text diff removed linebreak
2019-08-27 04:36:03 -04:00
51a4c93676 Read markers: continue working on ui 2019-08-23 16:54:32 +02:00
d8f449388c Read marker: start working on it (no UI) 2019-08-20 18:30:24 +02:00
9cd69d1e33 Merge branch 'release/0.3.0' 2019-08-08 16:45:03 +02:00
456908c851 Merge branch 'develop' into kt-remove_java_util 2019-08-06 18:27:39 +01:00
215324a03e Some kotlinification
Signed-off-by: Dominic Fischer <dominicfischer7@gmail.com>
2019-08-06 11:36:39 +01:00
02e342849f Remove most usages of the java.util package
Signed-off-by: Dominic Fischer <dominicfischer7@gmail.com>
2019-07-21 23:23:56 +01:00
df6080b1da Merge branch 'release/0.2.0' 2019-07-18 17:47:39 +02:00
1447 changed files with 36927 additions and 14214 deletions

View File

@ -1,15 +1,38 @@
# Use Docker file from https://hub.docker.com/r/runmymind/docker-android-sdk
# Last docker plugin version can be found here:
# https://github.com/buildkite-plugins/docker-buildkite-plugin/releases
# Build debug version of the RiotX application, from the develop branch and the features branches
# We propagate the environment to the container (sse https://github.com/buildkite-plugins/docker-buildkite-plugin#propagate-environment-optional-boolean)
steps:
- label: "Assemble GPlay Debug version"
- label: "Compile and run Unit tests"
agents:
# We use a medium sized instance instead of the normal small ones because
# gradle build is long
# gradle build can be memory hungry
queue: "medium"
commands:
- "./gradlew clean test --stacktrace"
plugins:
- docker#v3.1.0:
image: "runmymind/docker-android-sdk"
propagate-environment: true
- label: "Compile Android tests"
agents:
# We use a medium sized instance instead of the normal small ones because
# gradle build can be memory hungry
queue: "medium"
commands:
- "./gradlew clean assembleAndroidTest --stacktrace"
plugins:
- docker#v3.1.0:
image: "runmymind/docker-android-sdk"
propagate-environment: true
- label: "Assemble GPlay Debug version"
agents:
# We use a xlarge sized instance instead of the normal small ones because
# gradle build can be memory hungry
queue: "xlarge"
commands:
- "./gradlew clean lintGplayRelease assembleGplayDebug --stacktrace"
artifact_paths:
@ -18,12 +41,13 @@ steps:
plugins:
- docker#v3.1.0:
image: "runmymind/docker-android-sdk"
propagate-environment: true
- label: "Assemble FDroid Debug version"
agents:
# We use a medium sized instance instead of the normal small ones because
# gradle build is long
queue: "medium"
# We use a xlarge sized instance instead of the normal small ones because
# gradle build can be memory hungry
queue: "xlarge"
commands:
- "./gradlew clean lintFdroidRelease assembleFdroidDebug --stacktrace"
artifact_paths:
@ -32,12 +56,13 @@ steps:
plugins:
- docker#v3.1.0:
image: "runmymind/docker-android-sdk"
propagate-environment: true
- label: "Build Google Play unsigned APK"
agents:
# We use a medium sized instance instead of the normal small ones because
# gradle build is long
queue: "medium"
# We use a xlarge sized instance instead of the normal small ones because
# gradle build can be memory hungry
queue: "xlarge"
commands:
- "./gradlew clean assembleGplayRelease --stacktrace"
artifact_paths:
@ -46,8 +71,18 @@ steps:
plugins:
- docker#v3.1.0:
image: "runmymind/docker-android-sdk"
propagate-environment: true
# Code quality
- label: "Code quality"
command: "./tools/check/check_code_quality.sh"
command:
- "./tools/check/check_code_quality.sh"
- label: "ktlint"
command:
- "curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.34.2/ktlint && chmod a+x ktlint"
- "./ktlint --android --experimental -v"
plugins:
- docker#v3.1.0:
image: "openjdk"

32
.editorconfig Normal file
View File

@ -0,0 +1,32 @@
# For ktlint configuration. Ref: https://ktlint.github.io/
[*.{kt,kts}]
# possible values: number (e.g. 2), "unset" (makes ktlint ignore indentation completely)
indent_size=unset
# true (recommended) / false
insert_final_newline=true
# possible values: number (e.g. 120) (package name, imports & comments are ignored), "off"
# it's automatically set to 100 on `ktlint --android ...` (per Android Kotlin Style Guide)
max_line_length=off
# Comma-separated list of rules to disable (Since 0.34.0)
# Note that rules in any ruleset other than the standard ruleset will need to be prefixed
# by the ruleset identifier.
disabled_rules=no-wildcard-imports,no-multi-spaces,colon-spacing,chain-wrapping,import-ordering,experimental:annotation
# The following (so far identified) rules are kept:
# no-blank-line-before-rbrace
# final-newline
# no-consecutive-blank-lines
# comment-spacing
# filename
# comma-spacing
# paren-spacing
# op-spacing
# string-template
# no-unused-imports
# curly-spacing
# no-semi
# no-empty-class-body
# experimental:multiline-if-else
# experimental:no-empty-first-line-in-method-block

14
.gitignore vendored
View File

@ -1,14 +1,18 @@
*.iml
.gradle
/local.properties
.idea/*
/.idea/*
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
# idea files: exclude everything except dictionnaries
.idea/caches
.idea/codeStyles
.idea/libraries
.idea/*.xml
.DS_Store
/build
/captures
.externalNativeBuild
/tmp
ktlint
.idea/copyright/New_vector.xml
.idea/copyright/profiles_settings.xml

24
.idea/dictionaries/bmarty.xml generated Normal file
View File

@ -0,0 +1,24 @@
<component name="ProjectDictionaryState">
<dictionary name="bmarty">
<words>
<w>backstack</w>
<w>bytearray</w>
<w>checkables</w>
<w>ciphertext</w>
<w>coroutine</w>
<w>decryptor</w>
<w>emoji</w>
<w>emojis</w>
<w>hmac</w>
<w>ktlint</w>
<w>linkified</w>
<w>linkify</w>
<w>megolm</w>
<w>msisdn</w>
<w>pbkdf</w>
<w>pkcs</w>
<w>signin</w>
<w>signup</w>
</words>
</dictionary>
</component>

View File

@ -1,25 +1,173 @@
Changes in RiotX 0.4.0 (2019-XX-XX)
Changes in RiotX 0.10.0 (2019-XX-XX)
===================================================
Features ✨:
- Breadcrumbs: switch from one room to another quickly (#571)
Improvements 🙌:
- Support entering a RiotWeb client URL instead of the homeserver URL during connection (#744)
Other changes:
- Add reason for all membership events (https://github.com/matrix-org/matrix-doc/pull/2367)
Bugfix 🐛:
- When automardown is ON, pills are sent as MD in body (#739)
- "ban" event are not rendered correctly (#716)
- Fix crash when rotating screen in Room timeline
Translations 🗣:
-
Build 🧱:
-
Changes in RiotX 0.9.1 (2019-12-05)
===================================================
Bugfix 🐛:
- Fix an issue with DB transaction (#740)
Changes in RiotX 0.9.0 (2019-12-05)
===================================================
Features ✨:
- Account creation. It's now possible to create account on any homeserver with RiotX (#34)
- Iteration of the login flow (#613)
Improvements 🙌:
- Send mention Pills from composer
- Links in message preview in the bottom sheet are now active.
- Rework the read marker to make it more usable
Other changes:
- Fix a small grammatical error when an empty room list is shown.
Bugfix 🐛:
- Do not show long click help if only invitation are displayed
- Fix emoji filtering not working
- Fix issue of closing Realm in another thread (#725)
- Attempt to properly cancel the crypto module when user signs out (#724)
Changes in RiotX 0.8.0 (2019-11-19)
===================================================
Features ✨:
- Handle long click on room in the room list (#395)
- Ignore/UnIgnore users, and display list of ignored users (#542, #617)
Improvements 🙌:
- Search reaction by name or keyword in emoji picker
- Handle code tags (#567)
- Support spoiler messages
- Support m.sticker and m.room.join_rules events in timeline
Other changes:
- Markdown set to off by default (#412)
- Accessibility improvements to the attachment file type chooser
Bugfix 🐛:
- Fix issues with some member events rendering (#498)
- Passphrase does not match (Export room keys) (#644)
- Ask for permission to write external storage when uri comes from the keyboard (#658)
- Fix issue with english US/GB translation (#671)
Changes in RiotX 0.7.0 (2019-10-24)
===================================================
Features:
- Share elements from other app to RiotX (#58)
- Read marker (#84)
- Add ability to report content (#515)
Improvements:
- Persist active tab between sessions (#503)
- Do not upload file too big for the homeserver (#587)
- Attachments: start using system pickers (#52)
- Mark all messages as read (#396)
Other changes:
- Accessibility improvements to read receipts in the room timeline and reactions emoji chooser
Bugfix:
- Fix issue on upload error in loop (#587)
- Fix opening a permalink: the targeted event is displayed twice (#556)
- Fix opening a permalink paginates all the history up to the last event (#282)
- after login, the icon in the top left is a green 'A' for (all communities) rather than my avatar (#267)
- Picture uploads are unreliable, pictures are shown in wrong aspect ratio on desktop client (#517)
- Invitation notifications are not dismissed automatically if room is joined from another client (#347)
- Opening links from RiotX reuses browser tab (#599)
Changes in RiotX 0.6.1 (2019-09-24)
===================================================
Bugfix:
- Fix crash: MergedHeaderItem was missing dimensionConverter
Changes in RiotX 0.6.0 (2019-09-24)
===================================================
Features:
- Save draft of a message when exiting a room with non empty composer (#329)
Improvements:
- Add unread indent on room list (#485)
- Message Editing: Update notifications (#128)
- Remove any notification of a redacted event (#563)
Other changes:
- Fix a few accessibility issues
Bugfix:
- Fix characters erased from the Search field when the result are coming (#545)
- "No connection" banner was displayed by mistake
- Leaving community (from another client) has no effect on RiotX (#497)
- Push rules was not retrieved after a clear cache
- m.notice messages trigger push notifications (#238)
- Embiggen messages with multiple emojis also for edited messages (#458)
Build:
- Fix (again) issue with bad versionCode generated by Buildkite (#553)
Changes in RiotX 0.5.0 (2019-09-17)
===================================================
Features:
- Implementation of login to homeserver with SSO (#557)
- Handle M_CONSENT_NOT_GIVEN error (#64)
- Auto configure homeserver and identity server URLs of LoginActivity with a magic link
Improvements:
- Reduce default release build log level, and lab option to enable more logs.
- Display a no network indicator when there is no network (#559)
Bugfix:
- Fix crash due to missing informationData (#535)
- Progress in initial sync dialog is decreasing for a step and should not (#532)
- Fix rendering issue of accepted third party invitation event
- All current notifications were dismissed by mistake when the app is launched from the launcher
Build:
- Fix issue with version name (#533)
- Fix issue with bad versionCode generated by Buildkite (#553)
Changes in RiotX 0.4.0 (2019-08-30)
===================================================
Features:
- Display read receipts in timeline (#81)
Improvements:
-
Other changes:
-
- Reactions: Reinstate the ability to react with non-unicode keys (#307)
Bugfix:
- Fix text diff linebreak display (#441)
- Date change message repeats for each redaction until a normal message (#358)
- Slide-in reply icon is distorted (#423)
Translations:
-
Build:
-
- Regression / e2e replies not encrypted
- Some video won't play
- Privacy: remove log of notifiable event (#519)
- Fix crash with EmojiCompat (#530)
Changes in RiotX 0.3.0 (2019-08-08)
===================================================
@ -93,21 +241,21 @@ Mode details here: https://medium.com/@RiotChat/introducing-the-riotx-beta-for-a
Changes in RiotX 0.0.0 (2019-XX-XX)
===================================================
Features:
Features:
-
Improvements:
Improvements 🙌:
-
Other changes:
-
Bugfix:
Bugfix 🐛:
-
Translations:
Translations 🗣:
-
Build:
Build 🧱:
-

View File

@ -40,19 +40,45 @@ Please add a line to the top of the file `CHANGES.md` describing your change.
Make sure the following commands execute without any error:
> ./tools/check/check_code_quality.sh
#### Internal tool
> ./gradlew lintGplayRelease
<pre>
./tools/check/check_code_quality.sh
</pre>
#### ktlint
<pre>
curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.34.2/ktlint && chmod a+x ktlint
./ktlint --android --experimental -v
</pre>
Note that you can run
<pre>
./ktlint --android --experimental -v -F
</pre>
For ktlint to fix some detected errors for you (you still have to check and commit the fix of course)
#### lint
<pre>
./gradlew lintGplayRelease
./gradlew lintFdroidRelease
</pre>
### Unit tests
Make sure the following commands execute without any error:
> ./gradlew testGplayReleaseUnitTest
<pre>
./gradlew testGplayReleaseUnitTest
</pre>
### Tests
RiotX is currently supported on Android Jelly Bean (API 16+): please test your change on an Android device (or Android emulator) running with API 16. Many issues can happen (including crashes) on older devices.
RiotX is currently supported on Android KitKat (API 19+): please test your change on an Android device (or Android emulator) running with API 19. Many issues can happen (including crashes) on older devices.
Also, if possible, please test your change on a real device. Testing on Android emulator may not be sufficient.
### Internationalisation
@ -60,6 +86,10 @@ Also, if possible, please test your change on a real device. Testing on Android
When adding new string resources, please only add new entries in file `value/strings.xml`. Translations will be added later by the community of translators with a specific tool named [Weblate](https://translate.riot.im/projects/riot-android/).
Do not hesitate to use plurals when appropriate.
### Accessibility
Please consider accessibility as an important point. As a minimum requirement, in layout XML files please use attributes such as `android:contentDescription` and `android:importantForAccessibility`, and test with a screen reader if it's working well. You can add new string resources, dedicated to accessibility, in this case, please prefix theirs id with `a11y_`.
### Layout
When adding or editing layouts, make sure the layout will render correctly if device uses a RTL (Right To Left) language.

View File

@ -1,9 +1,7 @@
import javax.tools.JavaCompiler
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.21'
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
@ -12,11 +10,11 @@ buildscript {
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.google.gms:google-services:4.2.0'
classpath "com.airbnb.okreplay:gradle-plugin:1.4.0"
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.google.gms:google-services:4.3.2'
classpath "com.airbnb.okreplay:gradle-plugin:1.5.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2'
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.7.1'
classpath 'com.google.android.gms:oss-licenses-plugin:0.9.5'
// NOTE: Do not place your application dependencies here; they belong
@ -61,6 +59,11 @@ allprojects {
]
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
// Warnings are potential errors, so stop ignoring them
kotlinOptions.allWarningsAsErrors = true
}
afterEvaluate {
extensions.findByName("kapt")?.arguments {
arg("dagger.gradle.incremental", "enabled")

260
docs/signin.md Normal file
View File

@ -0,0 +1,260 @@
# Sign in to a homeserver
This document describes the flow of signin to a homeserver, and also the flow when user want to reset his password. Examples come from the `matrix.org` homeserver.
## Sign up flows
### Get the flow
Client request the sign-in flows, once the homeserver is chosen by the user and its url is known (in the example it's `https://matrix.org`)
> curl -X GET 'https://matrix.org/_matrix/client/r0/login'
200
```json
{
"flows": [
{
"type": "m.login.password"
}
]
}
```
### Login with username
The user is able to connect using `m.login.password`
> curl -X POST --data $'{"identifier":{"type":"m.id.user","user":"alice"},"password":"weak_password","type":"m.login.password","initial_device_display_name":"Portable"}' 'https://matrix.org/_matrix/client/r0/login'
```json
{
"identifier": {
"type": "m.id.user",
"user": "alice"
},
"password": "weak_password",
"type": "m.login.password",
"initial_device_display_name": "Portable"
}
```
#### Incorrect password
403
```json
{
"errcode": "M_FORBIDDEN",
"error": "Invalid password"
}
```
#### Correct password:
We get credential (200)
```json
{
"user_id": "@benoit0816:matrix.org",
"access_token": "MDAxOGxvY2F0aW9uIG1hdHREDACTEDb2l0MDgxNjptYXRyaXgub3JnCjAwMTZjaWQgdHlwZSA9IGFjY2VzcwowMDIxY2lkIG5vbmNlID0gfnYrSypfdTtkNXIuNWx1KgowMDJmc2lnbmF0dXJlIOsh1XqeAkXexh4qcofl_aR4kHJoSOWYGOhE7-ubX-DZCg",
"home_server": "matrix.org",
"device_id": "GTVREDALBF",
"well_known": {
"m.homeserver": {
"base_url": "https:\/\/matrix.org\/"
}
}
}
```
### Login with email
If the user has associated an email with its account, he can signin using the email.
> curl -X POST --data $'{"identifier":{"type":"m.id.thirdparty","medium":"email","address":"alice@yopmail.com"},"password":"weak_password","type":"m.login.password","initial_device_display_name":"Portable"}' 'https://matrix.org/_matrix/client/r0/login'
```json
{
"identifier": {
"type": "m.id.thirdparty",
"medium": "email",
"address": "alice@yopmail.com"
},
"password": "weak_password",
"type": "m.login.password",
"initial_device_display_name": "Portable"
}
```
#### Unknown email
403
```json
{
"errcode": "M_FORBIDDEN",
"error": ""
}
```
#### Known email, wrong password
403
```json
{
"errcode": "M_FORBIDDEN",
"error": "Invalid password"
}
```
##### Known email, correct password
We get the credentials (200)
```json
{
"user_id": "@alice:matrix.org",
"access_token": "MDAxOGxvY2F0aW9uIG1hdHJpeC5vcmREDACTEDZXJfaWQgPSBAYmVub2l0MDgxNjptYXRyaXgub3JnCjAwMTZjaWQgdHlwZSA9IGFjY2VzcwowMDIxY2lkIG5vbmNlID0gNjtDY0MwRlNPSFFoOC5wOgowMDJmc2lnbmF0dXJlIGiTRm1mYLLxQywxOh3qzQVT8HoEorSokEP2u-bAwtnYCg",
"home_server": "matrix.org",
"device_id": "WBSREDASND",
"well_known": {
"m.homeserver": {
"base_url": "https:\/\/matrix.org\/"
}
}
}
```
### Login with Msisdn
Not supported yet in RiotX
### Login with SSO
> curl -X GET 'https://homeserver.with.sso/_matrix/client/r0/login'
200
```json
{
"flows": [
{
"type": "m.login.sso"
}
]
}
```
In this case, the user can click on "Sign in with SSO" and the web screen will be displayed on the page `https://homeserver.with.sso/_matrix/static/client/login/` and the credentials will be passed back to the native code through the JS bridge
## Reset password
Ref: `https://matrix.org/docs/spec/client_server/latest#post-matrix-client-r0-account-password-email-requesttoken`
When the user has forgotten his password, he can reset it by providing an email and a new password.
Here is the flow:
### Send email
User is asked to enter the email linked to his account and a new password.
We display a warning regarding e2e.
At the first step, we do not send the password, only the email and a client secret, generated by the application
> curl -X POST --data $'{"client_secret":"6c57f284-85e2-421b-8270-fb1795a120a7","send_attempt":0,"email":"user@domain.com"}' 'https://matrix.org/_matrix/client/r0/account/password/email/requestToken'
```json
{
"client_secret": "6c57f284-85e2-421b-8270-fb1795a120a7",
"send_attempt": 0,
"email": "user@domain.com"
}
```
#### When the email is not known
We get a 400
```json
{
"errcode": "M_THREEPID_NOT_FOUND",
"error": "Email not found"
}
```
#### When the email is known
We get a 200 with a `sid`
```json
{
"sid": "tQNbrREDACTEDldA"
}
```
Then the user is asked to click on the link in the email he just received, and to confirm when it's done.
During this step, the new password is sent to the homeserver.
If the user confirms before the link is clicked, we get an error:
> curl -X POST --data $'{"auth":{"type":"m.login.email.identity","threepid_creds":{"client_secret":"6c57f284-85e2-421b-8270-fb1795a120a7","sid":"tQNbrREDACTEDldA"}},"new_password":"weak_password"}' 'https://matrix.org/_matrix/client/r0/account/password'
```json
{
"auth": {
"type": "m.login.email.identity",
"threepid_creds": {
"client_secret": "6c57f284-85e2-421b-8270-fb1795a120a7",
"sid": "tQNbrREDACTEDldA"
}
},
"new_password": "weak_password"
}
```
401
```json
{
"errcode": "M_UNAUTHORIZED",
"error": ""
}
```
### User clicks on the link
The link has the form:
https://matrix.org/_matrix/client/unstable/password_reset/email/submit_token?token=fzZLBlcqhTKeaFQFSRbsQnQCkzbwtGAD&client_secret=6c57f284-85e2-421b-8270-fb1795a120a7&sid=tQNbrREDACTEDldA
It contains the client secret, a token and the sid
When the user click the link, if validate his ownership and the new password can now be ent by the application (on user demand):
> curl -X POST --data $'{"auth":{"type":"m.login.email.identity","threepid_creds":{"client_secret":"6c57f284-85e2-421b-8270-fb1795a120a7","sid":"tQNbrREDACTEDldA"}},"new_password":"weak_password"}' 'https://matrix.org/_matrix/client/r0/account/password'
```json
{
"auth": {
"type": "m.login.email.identity",
"threepid_creds": {
"client_secret": "6c57f284-85e2-421b-8270-fb1795a120a7",
"sid": "tQNbrREDACTEDldA"
}
},
"new_password": "weak_password"
}
```
200
```json
{}
```
The password has been changed, and all the existing token are invalidated. User can now login with the new password.

579
docs/signup.md Normal file
View File

@ -0,0 +1,579 @@
# Sign up to a homeserver
This document describes the flow of registration to a homeserver. Examples come from the `matrix.org` homeserver.
*Ref*: https://matrix.org/docs/spec/client_server/latest#account-registration-and-management
## Sign up flows
### First step
Client request the sign-up flows, once the homeserver is chosen by the user and its url is known (in the example it's `https://matrix.org`)
> curl -X POST --data $'{}' 'https://matrix.org/_matrix/client/r0/register'
```json
{
}
```
We get the flows with a 401, which also means that the registration is possible on this homeserver.
```json
{
"session": "vwehdKMtkRedactedAMwgCACZ",
"flows": [
{
"stages": [
"m.login.recaptcha",
"m.login.terms",
"m.login.dummy"
]
},
{
"stages": [
"m.login.recaptcha",
"m.login.terms",
"m.login.email.identity"
]
}
],
"params": {
"m.login.recaptcha": {
"public_key": "6LcgI54UAAAAAoREDACTEDoDdOocFpYVdjYBRe4zb"
},
"m.login.terms": {
"policies": {
"privacy_policy": {
"version": "1.0",
"en": {
"name": "Terms and Conditions",
"url": "https:\/\/matrix.org\/_matrix\/consent?v=1.0"
}
}
}
}
}
}
```
If the registration is not possible, we get a 403
```json
{
"errcode": "M_FORBIDDEN",
"error": "Registration is disabled"
}
```
### Step 1: entering user name and password
The app is displaying a form to enter username and password.
> curl -X POST --data $'{"initial_device_display_name":"Mobile device","username":"alice","password": "weak_password"}' 'https://matrix.org/_matrix/client/r0/register'
```json
{
"initial_device_display_name": "Mobile device",
"username": "alice",
"password": "weak_password"
}
```
401. Note that the `session` value has changed (because we did not provide the previous value in the request body), but it's ok, we will use the new value for the next steps.
```json
{
"session": "xptUYoREDACTEDogOWAGVnbJQ",
"flows": [
{
"stages": [
"m.login.recaptcha",
"m.login.terms",
"m.login.dummy"
]
},
{
"stages": [
"m.login.recaptcha",
"m.login.terms",
"m.login.email.identity"
]
}
],
"params": {
"m.login.recaptcha": {
"public_key": "6LcgI54UAAAAAoREDACTEDoDdOocFpYVdjYBRe4zb"
},
"m.login.terms": {
"policies": {
"privacy_policy": {
"version": "1.0",
"en": {
"name": "Terms and Conditions",
"url": "https:\/\/matrix.org\/_matrix\/consent?v=1.0"
}
}
}
}
}
}
```
#### If username already exists
We get a 400:
```json
{
"errcode": "M_USER_IN_USE",
"error": "User ID already taken."
}
```
### Step 2: entering email
User is proposed to enter an email. We skip this step.
> curl -X POST --data $'{"auth":{"session":"xptUYoREDACTEDogOWAGVnbJQ","type":"m.login.dummy"}}' 'https://matrix.org/_matrix/client/r0/register'
```json
{
"auth": {
"session": "xptUYoREDACTEDogOWAGVnbJQ",
"type": "m.login.dummy"
}
}
```
401
```json
{
"session": "xptUYoREDACTEDogOWAGVnbJQ",
"flows": [
{
"stages": [
"m.login.recaptcha",
"m.login.terms",
"m.login.dummy"
]
},
{
"stages": [
"m.login.recaptcha",
"m.login.terms",
"m.login.email.identity"
]
}
],
"params": {
"m.login.recaptcha": {
"public_key": "6LcgI54UAAAAAoREDACTEDoDdOocFpYVdjYBRe4zb"
},
"m.login.terms": {
"policies": {
"privacy_policy": {
"version": "1.0",
"en": {
"name": "Terms and Conditions",
"url": "https:\/\/matrix.org\/_matrix\/consent?v=1.0"
}
}
}
}
},
"completed": [
"m.login.dummy"
]
}
```
### Step 2 bis: we enter an email
We request a token to the homeserver. The `client_secret` is generated by the application
> curl -X POST --data $'{"client_secret":"53e679ea-oRED-ACTED-92b8-3012c49c6cfa","email":"alice@yopmail.com","send_attempt":0}' 'https://matrix.org/_matrix/client/r0/register/email/requestToken'
```json
{
"client_secret": "53e679ea-oRED-ACTED-92b8-3012c49c6cfa",
"email": "alice@yopmail.com",
"send_attempt": 0
}
```
200
```json
{
"sid": "qlBCREDACTEDEtgxD"
}
```
And
> curl -X POST --data $'{"auth":{"threepid_creds":{"client_secret":"53e679ea-oRED-ACTED-92b8-3012c49c6cfa","sid":"qlBCREDACTEDEtgxD"},"session":"xptUYoREDACTEDogOWAGVnbJQ","type":"m.login.email.identity"}}' 'https://matrix.org/_matrix/client/r0/register'
```json
{
"auth": {
"threepid_creds": {
"client_secret": "53e679ea-oRED-ACTED-92b8-3012c49c6cfa",
"sid": "qlBCREDACTEDEtgxD"
},
"session": "xptUYoREDACTEDogOWAGVnbJQ",
"type": "m.login.email.identity"
}
}
```
We get 401 since the email is not validated yet:
```json
{
"errcode": "M_UNAUTHORIZED",
"error": ""
}
```
The app is now polling on
> curl -X POST --data $'{"auth":{"threepid_creds":{"client_secret":"53e679ea-oRED-ACTED-92b8-3012c49c6cfa","sid":"qlBCREDACTEDEtgxD"},"session":"xptUYoREDACTEDogOWAGVnbJQ","type":"m.login.email.identity"}}' 'https://matrix.org/_matrix/client/r0/register'
```json
{
"auth": {
"threepid_creds": {
"client_secret": "53e679ea-oRED-ACTED-92b8-3012c49c6cfa",
"sid": "qlBCREDACTEDEtgxD"
},
"session": "xptUYoREDACTEDogOWAGVnbJQ",
"type": "m.login.email.identity"
}
}
```
We click on the link received by email `https://matrix.org/_matrix/client/unstable/registration/email/submit_token?token=vtQjQIZfwdoREDACTEDozrmKYSWlCXsJ&client_secret=53e679ea-oRED-ACTED-92b8-3012c49c6cfa&sid=qlBCREDACTEDEtgxD` which contains:
- A `token` vtQjQIZfwdoREDACTEDozrmKYSWlCXsJ
- The `client_secret`: 53e679ea-oRED-ACTED-92b8-3012c49c6cfa
- A `sid`: qlBCREDACTEDEtgxD
Once the link is clicked, the registration request (polling) returns a 401 with the following content:
```json
{
"session": "xptUYoREDACTEDogOWAGVnbJQ",
"flows": [
{
"stages": [
"m.login.recaptcha",
"m.login.terms",
"m.login.dummy"
]
},
{
"stages": [
"m.login.recaptcha",
"m.login.terms",
"m.login.email.identity"
]
}
],
"params": {
"m.login.recaptcha": {
"public_key": "6LcgI54UAAAAAoREDACTEDoDdOocFpYVdjYBRe4zb"
},
"m.login.terms": {
"policies": {
"privacy_policy": {
"version": "1.0",
"en": {
"name": "Terms and Conditions",
"url": "https:\/\/matrix.org\/_matrix\/consent?v=1.0"
}
}
}
}
},
"completed": [
"m.login.email.identity"
]
}
```
### Step 3: Accepting T&C
User is proposed to accept T&C and he accepts them
> curl -X POST --data $'{"auth":{"session":"xptUYoREDACTEDogOWAGVnbJQ","type":"m.login.terms"}}' 'https://matrix.org/_matrix/client/r0/register'
```json
{
"auth": {
"session": "xptUYoREDACTEDogOWAGVnbJQ",
"type": "m.login.terms"
}
}
```
401
```json
{
"session": "xptUYoREDACTEDogOWAGVnbJQ",
"flows": [
{
"stages": [
"m.login.recaptcha",
"m.login.terms",
"m.login.dummy"
]
},
{
"stages": [
"m.login.recaptcha",
"m.login.terms",
"m.login.email.identity"
]
}
],
"params": {
"m.login.recaptcha": {
"public_key": "6LcgI54UAAAAAoREDACTEDoDdOocFpYVdjYBRe4zb"
},
"m.login.terms": {
"policies": {
"privacy_policy": {
"version": "1.0",
"en": {
"name": "Terms and Conditions",
"url": "https:\/\/matrix.org\/_matrix\/consent?v=1.0"
}
}
}
}
},
"completed": [
"m.login.dummy",
"m.login.terms"
]
}
```
### Step 4: Captcha
User is proposed to prove he is not a robot and he does it:
> curl -X POST --data $'{"auth":{"response":"03AOLTBLSiGS9GhFDpAMblJ2nlXOmHXqAYJ5OvHCPUjiVLBef3k9snOYI_BDC32-t4D2jv-tpvkaiEI_uloobFd9RUTPpJ7con2hMddbKjSCYqXqcUQFhzhbcX6kw8uBnh2sbwBe80_ihrHGXEoACXQkL0ki1Q0uEtOeW20YBRjbNABsZPpLNZhGIWC0QVXnQ4FouAtZrl3gOAiyM-oG3cgP6M9pcANIAC_7T2P2amAHbtsTlSR9CsazNyS-rtDR9b5MywdtnWN9Aw8fTJb8cXQk_j7nvugMxzofPjSOrPKcr8h5OqPlpUCyxxnFtag6cuaPSUwh43D2L0E-ZX7djzaY2Yh_U2n6HegFNPOQ22CJmfrKwDlodmAfMPvAXyq77n3HpoREDACTEDo3830RHF4BfkGXUaZjctgg-A1mvC17hmQmQpkG7IhDqyw0onU-0vF_-ehCjq_CcQEDpS_O3uiHJaG5xGf-0rhLm57v_wA3deugbsZuO4uTuxZZycN_mKxZ97jlDVBetl9hc_5REPbhcT1w3uzTCSx7Q","session":"xptUYoREDACTEDogOWAGVnbJQ","type":"m.login.recaptcha"}}' 'https://matrix.org/_matrix/client/r0/register'
```json
{
"auth": {
"response": "03AOLTBLSiGS9GhFDpAMblJ2nlXOmHXqAYJ5OvHCPUjiVLBef3k9snOYI_BDC32-t4D2jv-tpvkaiEI_uloobFd9RUTPpJ7con2hMddbKjSCYqXqcUQFhzhbcX6kw8uBnh2sbwBe80_ihrHGXEoACXQkL0ki1Q0uEtOeW20YBRjbNABsZPpLNZhGIWC0QVXnQ4FouAtZrl3gOAiyM-oG3cgP6M9pcANIAC_7T2P2amAHbtsTlSR9CsazNyS-rtDR9b5MywdtnWN9Aw8fTJb8cXQk_j7nvugMxzofPjSOrPKcr8h5OqPlpUCyxxnFtag6cuaPSUwh43D2L0E-ZX7djzaY2Yh_U2n6HegFNPOQ22CJmfrKwDlodmAfMPvAXyq77n3HpoREDACTEDo3830RHF4BfkGXUaZjctgg-A1mvC17hmQmQpkG7IhDqyw0onU-0vF_-ehCjq_CcQEDpS_O3uiHJaG5xGf-0rhLm57v_wA3deugbsZuO4uTuxZZycN_mKxZ97jlDVBetl9hc_5REPbhcT1w3uzTCSx7Q",
"session": "xptUYoREDACTEDogOWAGVnbJQ",
"type": "m.login.recaptcha"
}
}
```
200
```json
{
"user_id": "@alice:matrix.org",
"home_server": "matrix.org",
"access_token": "MDAxOGxvY2F0aW9uIG1hdHJpeC5vcmcKMoREDACTEDo50aWZpZXIga2V5CjAwMTBjaWQgZ2VuID0gMQowMDI5Y2lkIHVzZXJfaWQgPSBAYmVub2l0eHh4eDptYXRoREDACTEDoCjAwMTZjaWQgdHlwZSA9IGFjY2VzcwowMDIxY2lkIG5vbmNlID0gNHVSVm00aVFDaWlKdoREDACTEDoJmc2lnbmF0dXJlIOmHnTLRfxiPjhrWhS-dThUX-qAzZktfRThzH1YyAsxaCg",
"device_id": "FLBAREDAJZ"
}
```
The account is created!
### Step 5: MSISDN
Some homeservers may require the user to enter MSISDN.
On matrix.org, it's not required, and not even optional, but it's still possible for the app to add a MSISDN during the registration.
The user enter a phone number and select a country, the `client_secret` is generated by the application
> curl -X POST --data $'{"client_secret":"d3e285f6-972a-496c-9a22-7915a2db57c7","send_attempt":1,"country":"FR","phone_number":"+33611223344"}' 'https://matrix.org/_matrix/client/r0/register/msisdn/requestToken'
```json
{
"client_secret": "d3e285f6-972a-496c-9a22-7915a2db57c7",
"send_attempt": 1,
"country": "FR",
"phone_number": "+33611223344"
}
```
If the msisdn is already associated to another account, you will received an error:
```json
{
"errcode": "M_THREEPID_IN_USE",
"error": "Phone number is already in use"
}
```
If it is not the case, the homeserver send the SMS and returns some data, especially a `sid` and a `submit_url`:
```json
{
"msisdn": "33611223344",
"intl_fmt": "+336 11 22 33 44",
"success": true,
"sid": "1678881798",
"submit_url": "https:\/\/matrix.org\/_matrix\/client\/unstable\/add_threepid\/msisdn\/submit_token"
}
```
When you execute the register request, with the received `sid`, you get an error since the MSISDN is not validated yet:
> curl -X POST --data $'{"auth":{"type":"m.login.msisdn","session":"xptUYoREDACTEDogOWAGVnbJQ","threepid_creds":{"client_secret":"d3e285f6-972a-496c-9a22-7915a2db57c7","sid":"1678881798"}}}' 'https://matrix.org/_matrix/client/r0/register'
```json
"auth": {
"type": "m.login.msisdn",
"session": "xptUYoREDACTEDogOWAGVnbJQ",
"threepid_creds": {
"client_secret": "d3e285f6-972a-496c-9a22-7915a2db57c7",
"sid": "1678881798"
}
}
}
```
There is an issue on Synapse, which return a 401, it sends too much data along with the classical MatrixError fields:
```json
{
"session": "xptUYoREDACTEDogOWAGVnbJQ",
"flows": [
{
"stages": [
"m.login.recaptcha",
"m.login.terms",
"m.login.dummy"
]
},
{
"stages": [
"m.login.recaptcha",
"m.login.terms",
"m.login.email.identity"
]
}
],
"params": {
"m.login.recaptcha": {
"public_key": "6LcgI54UAAAAABGdGmruw6DdOocFpYVdjYBRe4zb"
},
"m.login.terms": {
"policies": {
"privacy_policy": {
"version": "1.0",
"en": {
"name": "Terms and Conditions",
"url": "https:\/\/matrix.org\/_matrix\/consent?v=1.0"
}
}
}
}
},
"completed": [],
"error": "",
"errcode": "M_UNAUTHORIZED"
}
```
The user receive the SMS, he can enter the SMS code in the app, which is sent using the "submit_url" received ie the response of the `requestToken` request:
> curl -X POST --data $'{"client_secret":"d3e285f6-972a-496c-9a22-7915a2db57c7","sid":"1678881798","token":"123456"}' 'https://matrix.org/_matrix/client/unstable/add_threepid/msisdn/submit_token'
```json
{
"client_secret": "d3e285f6-972a-496c-9a22-7915a2db57c7",
"sid": "1678881798",
"token": "123456"
}
```
If the code is not correct, we get a 200 with:
```json
{
"success": false
}
```
And if the code is correct we get a 200 with:
```json
{
"success": true
}
```
We can now execute the registration request, to the homeserver
> curl -X POST --data $'{"auth":{"type":"m.login.msisdn","session":"xptUYoREDACTEDogOWAGVnbJQ","threepid_creds":{"client_secret":"d3e285f6-972a-496c-9a22-7915a2db57c7","sid":"1678881798"}}}' 'https://matrix.org/_matrix/client/r0/register'
```json
{
"auth": {
"type": "m.login.msisdn",
"session": "xptUYoREDACTEDogOWAGVnbJQ",
"threepid_creds": {
"client_secret": "d3e285f6-972a-496c-9a22-7915a2db57c7",
"sid": "1678881798"
}
}
}
```
Now the homeserver consider that the `m.login.msisdn` step is completed (401):
```json
{
"session": "xptUYoREDACTEDogOWAGVnbJQ",
"flows": [
{
"stages": [
"m.login.recaptcha",
"m.login.terms",
"m.login.dummy"
]
},
{
"stages": [
"m.login.recaptcha",
"m.login.terms",
"m.login.email.identity"
]
}
],
"params": {
"m.login.recaptcha": {
"public_key": "6LcgI54UAAAAABGdGmruw6DdOocFpYVdjYBRe4zb"
},
"m.login.terms": {
"policies": {
"privacy_policy": {
"version": "1.0",
"en": {
"name": "Terms and Conditions",
"url": "https:\/\/matrix.org\/_matrix\/consent?v=1.0"
}
}
}
}
},
"completed": [
"m.login.msisdn"
]
}
```

View File

@ -1,6 +1,6 @@
#Tue Mar 19 09:53:05 CET 2019
#Fri Sep 27 10:10:35 CEST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

View File

@ -5,16 +5,15 @@ apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
// Multidex is useful for tests
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
@ -29,12 +28,14 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
dependencies {
implementation project(":matrix-sdk-android")
implementation 'androidx.appcompat:appcompat:1.1.0-beta01'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'io.reactivex.rxjava2:rxkotlin:2.3.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
// Paging

View File

@ -1,42 +0,0 @@
/*
* Copyright 2019 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.matrix.rx;
import android.content.Context;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("im.vector.matrix.rx.test", appContext.getPackageName());
}
}

View File

@ -20,7 +20,6 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.Observer
import io.reactivex.Observable
import io.reactivex.android.MainThreadDisposable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
private class LiveDataObservable<T>(
@ -60,4 +59,4 @@ private class LiveDataObservable<T>(
fun <T> LiveData<T>.asObservable(): Observable<T> {
return LiveDataObservable(this).observeOn(Schedulers.computation())
}
}

View File

@ -19,7 +19,6 @@ package im.vector.matrix.rx
import im.vector.matrix.android.api.MatrixCallback
import im.vector.matrix.android.api.util.Cancelable
import io.reactivex.CompletableEmitter
import io.reactivex.SingleEmitter
internal class MatrixCallbackCompletable<T>(private val completableEmitter: CompletableEmitter) : MatrixCallback<T> {
@ -36,4 +35,4 @@ fun Cancelable.toCompletable(completableEmitter: CompletableEmitter) {
completableEmitter.setCancellable {
this.cancel()
}
}
}

View File

@ -35,4 +35,4 @@ fun <T> Cancelable.toSingle(singleEmitter: SingleEmitter<T>) {
singleEmitter.setCancellable {
this.cancel()
}
}
}

View File

@ -0,0 +1,24 @@
/*
* Copyright 2019 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.matrix.rx
import im.vector.matrix.android.api.util.Optional
import io.reactivex.Observable
fun <T : Any> Observable<Optional<T>>.unwrap(): Observable<T> {
return filter { it.hasValue() }.map { it.get() }
}

View File

@ -20,42 +20,61 @@ import im.vector.matrix.android.api.session.room.Room
import im.vector.matrix.android.api.session.room.model.EventAnnotationsSummary
import im.vector.matrix.android.api.session.room.model.ReadReceipt
import im.vector.matrix.android.api.session.room.model.RoomSummary
import im.vector.matrix.android.api.session.room.notification.RoomNotificationState
import im.vector.matrix.android.api.session.room.send.UserDraft
import im.vector.matrix.android.api.session.room.timeline.TimelineEvent
import im.vector.matrix.android.api.util.Optional
import io.reactivex.Observable
import io.reactivex.Single
class RxRoom(private val room: Room) {
fun liveRoomSummary(): Observable<RoomSummary> {
return room.liveRoomSummary().asObservable()
fun liveRoomSummary(): Observable<Optional<RoomSummary>> {
return room.getRoomSummaryLive().asObservable()
}
fun liveRoomMemberIds(): Observable<List<String>> {
return room.getRoomMemberIdsLive().asObservable()
}
fun liveAnnotationSummary(eventId: String): Observable<EventAnnotationsSummary> {
fun liveAnnotationSummary(eventId: String): Observable<Optional<EventAnnotationsSummary>> {
return room.getEventSummaryLive(eventId).asObservable()
}
fun liveTimelineEvent(eventId: String): Observable<TimelineEvent> {
return room.liveTimeLineEvent(eventId).asObservable()
fun liveTimelineEvent(eventId: String): Observable<Optional<TimelineEvent>> {
return room.getTimeLineEventLive(eventId).asObservable()
}
fun liveReadMarker(): Observable<Optional<String>> {
return room.getReadMarkerLive().asObservable()
}
fun liveReadReceipt(): Observable<Optional<String>> {
return room.getMyReadReceiptLive().asObservable()
}
fun loadRoomMembersIfNeeded(): Single<Unit> = Single.create {
room.loadRoomMembersIfNeeded(MatrixCallbackSingle(it)).toSingle(it)
}
fun joinRoom(viaServers: List<String> = emptyList()): Single<Unit> = Single.create {
room.join(viaServers, MatrixCallbackSingle(it)).toSingle(it)
fun joinRoom(reason: String? = null,
viaServers: List<String> = emptyList()): Single<Unit> = Single.create {
room.join(reason, viaServers, MatrixCallbackSingle(it)).toSingle(it)
}
fun liveEventReadReceipts(eventId: String): Observable<List<ReadReceipt>> {
return room.getEventReadReceiptsLive(eventId).asObservable()
}
fun liveDrafts(): Observable<List<UserDraft>> {
return room.getDraftsLive().asObservable()
}
fun liveNotificationState(): Observable<RoomNotificationState> {
return room.getLiveRoomNotificationState().asObservable()
}
}
fun Room.rx(): RxRoom {
return RxRoom(this)
}
}

View File

@ -24,6 +24,7 @@ import im.vector.matrix.android.api.session.room.model.RoomSummary
import im.vector.matrix.android.api.session.room.model.create.CreateRoomParams
import im.vector.matrix.android.api.session.sync.SyncState
import im.vector.matrix.android.api.session.user.model.User
import im.vector.matrix.android.api.util.Optional
import io.reactivex.Observable
import io.reactivex.Single
@ -37,6 +38,10 @@ class RxSession(private val session: Session) {
return session.liveGroupSummaries().asObservable()
}
fun liveBreadcrumbs(): Observable<List<RoomSummary>> {
return session.liveBreadcrumbs().asObservable()
}
fun liveSyncState(): Observable<SyncState> {
return session.syncState().asObservable()
}
@ -45,10 +50,18 @@ class RxSession(private val session: Session) {
return session.livePushers().asObservable()
}
fun liveUser(userId: String): Observable<Optional<User>> {
return session.liveUser(userId).asObservable().distinctUntilChanged()
}
fun liveUsers(): Observable<List<User>> {
return session.liveUsers().asObservable()
}
fun liveIgnoredUsers(): Observable<List<User>> {
return session.liveIgnoredUsers().asObservable()
}
fun livePagedUsers(filter: String? = null): Observable<PagedList<User>> {
return session.livePagedUsers(filter).asObservable()
}
@ -63,12 +76,13 @@ class RxSession(private val session: Session) {
session.searchUsersDirectory(search, limit, excludedUserIds, MatrixCallbackSingle(it)).toSingle(it)
}
fun joinRoom(roomId: String, viaServers: List<String> = emptyList()): Single<Unit> = Single.create {
session.joinRoom(roomId, viaServers, MatrixCallbackSingle(it)).toSingle(it)
fun joinRoom(roomId: String,
reason: String? = null,
viaServers: List<String> = emptyList()): Single<Unit> = Single.create {
session.joinRoom(roomId, reason, viaServers, MatrixCallbackSingle(it)).toSingle(it)
}
}
fun Session.rx(): RxSession {
return RxSession(this)
}
}

View File

@ -67,6 +67,10 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
static def gitRevision() {
@ -86,41 +90,43 @@ static def gitRevisionDate() {
dependencies {
def arrow_version = "0.8.0"
def support_version = '1.1.0-beta01'
def arrow_version = "0.8.2"
def moshi_version = '1.8.0'
def lifecycle_version = '2.0.0'
def coroutines_version = "1.0.1"
def markwon_version = '3.0.0'
def daggerVersion = '2.23.1'
def lifecycle_version = '2.1.0'
def coroutines_version = "1.3.2"
def markwon_version = '3.1.0'
def daggerVersion = '2.24'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
implementation "androidx.appcompat:appcompat:1.1.0-rc01"
implementation "androidx.recyclerview:recyclerview:1.1.0-beta01"
implementation "androidx.appcompat:appcompat:1.1.0"
implementation "androidx.recyclerview:recyclerview:1.1.0-beta05"
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
kapt "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
// Network
implementation 'com.squareup.retrofit2:retrofit:2.6.0'
implementation 'com.squareup.retrofit2:converter-moshi:2.4.0'
implementation 'com.squareup.okhttp3:okhttp:3.14.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
implementation 'com.squareup.retrofit2:retrofit:2.6.2'
implementation 'com.squareup.retrofit2:converter-moshi:2.6.2'
implementation 'com.squareup.okhttp3:okhttp:4.2.2'
implementation 'com.squareup.okhttp3:logging-interceptor:4.2.2'
implementation 'com.novoda:merlin:1.2.0'
implementation "com.squareup.moshi:moshi-adapters:$moshi_version"
kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshi_version"
implementation "ru.noties.markwon:core:$markwon_version"
// Image
implementation 'androidx.exifinterface:exifinterface:1.0.0'
// Database
implementation 'com.github.Zhuinden:realm-monarchy:0.5.1'
kapt 'dk.ilios:realmfieldnameshelper:1.1.1'
// Work
implementation "androidx.work:work-runtime-ktx:2.1.0-rc01"
implementation "androidx.work:work-runtime-ktx:2.3.0-alpha01"
// FP
implementation "io.arrow-kt:arrow-core:$arrow_version"
@ -132,21 +138,25 @@ dependencies {
// DI
implementation "com.google.dagger:dagger:$daggerVersion"
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
compileOnly 'com.squareup.inject:assisted-inject-annotations-dagger2:0.4.0'
kapt 'com.squareup.inject:assisted-inject-processor-dagger2:0.4.0'
compileOnly 'com.squareup.inject:assisted-inject-annotations-dagger2:0.5.0'
kapt 'com.squareup.inject:assisted-inject-processor-dagger2:0.5.0'
// Logging
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'com.facebook.stetho:stetho-okhttp3:1.5.0'
implementation 'com.facebook.stetho:stetho-okhttp3:1.5.1'
debugImplementation 'com.airbnb.okreplay:okreplay:1.4.0'
releaseImplementation 'com.airbnb.okreplay:noop:1.4.0'
androidTestImplementation 'com.airbnb.okreplay:espresso:1.4.0'
// Bus
implementation 'org.greenrobot:eventbus:3.1.1'
debugImplementation 'com.airbnb.okreplay:okreplay:1.5.0'
releaseImplementation 'com.airbnb.okreplay:noop:1.5.0'
androidTestImplementation 'com.airbnb.okreplay:espresso:1.5.0'
testImplementation 'junit:junit:4.12'
testImplementation 'org.robolectric:robolectric:4.0.2'
testImplementation 'org.robolectric:robolectric:4.3'
//testImplementation 'org.robolectric:shadows-support-v4:3.0'
testImplementation "io.mockk:mockk:1.8.13.kotlin13"
// Note: version sticks to 1.9.2 due to https://github.com/mockk/mockk/issues/281
testImplementation 'io.mockk:mockk:1.9.2.kotlin12'
testImplementation 'org.amshove.kluent:kluent-android:1.44'
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
@ -156,7 +166,8 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'org.amshove.kluent:kluent-android:1.44'
androidTestImplementation "io.mockk:mockk-android:1.8.13.kotlin13"
// Note: version sticks to 1.9.2 due to https://github.com/mockk/mockk/issues/281
androidTestImplementation 'io.mockk:mockk-android:1.9.2.kotlin12'
androidTestImplementation "androidx.arch.core:core-testing:$lifecycle_version"
androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"

View File

@ -17,15 +17,15 @@
package im.vector.matrix.android
import android.content.Context
import androidx.test.InstrumentationRegistry
import androidx.test.core.app.ApplicationProvider
import java.io.File
interface InstrumentedTest {
fun context(): Context {
return InstrumentationRegistry.getTargetContext()
return ApplicationProvider.getApplicationContext()
}
fun cacheDir(): File {
return context().cacheDir
}
}
}

View File

@ -29,4 +29,4 @@ class OkReplayRuleChainNoActivity(
return RuleChain.outerRule(PermissionRule(configuration))
.around(RecorderRule(configuration))
}
}
}

View File

@ -19,4 +19,4 @@ package im.vector.matrix.android
import im.vector.matrix.android.internal.util.MatrixCoroutineDispatchers
import kotlinx.coroutines.Dispatchers.Main
internal val testCoroutineDispatchers = MatrixCoroutineDispatchers(Main, Main, Main, Main, Main)
internal val testCoroutineDispatchers = MatrixCoroutineDispatchers(Main, Main, Main, Main, Main)

View File

@ -17,22 +17,21 @@
package im.vector.matrix.android.auth
import androidx.test.annotation.UiThreadTest
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.rule.GrantPermissionRule
import androidx.test.runner.AndroidJUnit4
import im.vector.matrix.android.InstrumentedTest
import im.vector.matrix.android.OkReplayRuleChainNoActivity
import im.vector.matrix.android.api.auth.Authenticator
import im.vector.matrix.android.api.auth.AuthenticationService
import okreplay.*
import org.junit.ClassRule
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
internal class AuthenticatorTest : InstrumentedTest {
internal class AuthenticationServiceTest : InstrumentedTest {
lateinit var authenticator: Authenticator
lateinit var authenticationService: AuthenticationService
lateinit var okReplayInterceptor: OkReplayInterceptor
private val okReplayConfig = OkReplayConfig.Builder()
@ -50,7 +49,6 @@ internal class AuthenticatorTest : InstrumentedTest {
@UiThreadTest
@OkReplay(tape = "auth", mode = TapeMode.READ_WRITE)
fun auth() {
}
companion object {
@ -59,6 +57,4 @@ internal class AuthenticatorTest : InstrumentedTest {
val grantExternalStoragePermissionRule: GrantPermissionRule =
GrantPermissionRule.grant(android.Manifest.permission.WRITE_EXTERNAL_STORAGE)
}
}
}

View File

@ -21,7 +21,7 @@ import im.vector.matrix.android.internal.crypto.store.IMXCryptoStore
import im.vector.matrix.android.internal.crypto.store.db.RealmCryptoStore
import im.vector.matrix.android.internal.crypto.store.db.RealmCryptoStoreModule
import io.realm.RealmConfiguration
import java.util.*
import kotlin.random.Random
internal class CryptoStoreHelper {
@ -35,10 +35,10 @@ internal class CryptoStoreHelper {
}
fun createCredential() = Credentials(
userId = "userId_" + Random().nextInt(),
userId = "userId_" + Random.nextInt(),
homeServer = "http://matrix.org",
accessToken = "access_token",
refreshToken = null,
deviceId = "deviceId_sample"
)
}
}

View File

@ -114,4 +114,4 @@ class CryptoStoreTest {
olmAccount1.releaseAccount()
olmAccount2.releaseAccount()
}
}
}

View File

@ -62,8 +62,6 @@ internal class JsonCanonicalizerTest : InstrumentedTest {
JsonCanonicalizer.canonicalize("{\"a\":\"\\\"\"}"))
}
/* ==========================================================================================
* Test from https://matrix.org/docs/spec/appendices.html#examples
* ========================================================================================== */
@ -74,7 +72,6 @@ internal class JsonCanonicalizerTest : InstrumentedTest {
JsonCanonicalizer.canonicalize("""{}"""))
}
@Test
fun matrixOrg002Test() {
assertEquals("""{"one":1,"two":"Two"}""",
@ -84,7 +81,6 @@ internal class JsonCanonicalizerTest : InstrumentedTest {
}"""))
}
@Test
fun matrixOrg003Test() {
assertEquals("""{"a":"1","b":"2"}""",
@ -94,14 +90,12 @@ internal class JsonCanonicalizerTest : InstrumentedTest {
}"""))
}
@Test
fun matrixOrg004Test() {
assertEquals("""{"a":"1","b":"2"}""",
JsonCanonicalizer.canonicalize("""{"b":"2","a":"1"}"""))
}
@Test
fun matrixOrg005Test() {
assertEquals("""{"auth":{"mxid":"@john.doe:example.com","profile":{"display_name":"John Doe","three_pids":[{"address":"john.doe@example.org","medium":"email"},{"address":"123456789","medium":"msisdn"}]},"success":true}}""",
@ -126,7 +120,6 @@ internal class JsonCanonicalizerTest : InstrumentedTest {
}"""))
}
@Test
fun matrixOrg006Test() {
assertEquals("""{"a":"日本語"}""",
@ -135,7 +128,6 @@ internal class JsonCanonicalizerTest : InstrumentedTest {
}"""))
}
@Test
fun matrixOrg007Test() {
assertEquals("""{"日":1,"本":2}""",
@ -145,7 +137,6 @@ internal class JsonCanonicalizerTest : InstrumentedTest {
}"""))
}
@Test
fun matrixOrg008Test() {
assertEquals("""{"a":"日"}""",
@ -159,4 +150,4 @@ internal class JsonCanonicalizerTest : InstrumentedTest {
"a": null
}"""))
}
}
}

View File

@ -28,14 +28,12 @@ import im.vector.matrix.android.session.room.timeline.RoomDataHelper.createFakeR
import io.realm.Realm
import io.realm.RealmConfiguration
import io.realm.kotlin.createObject
import org.amshove.kluent.shouldBeFalse
import org.amshove.kluent.shouldBeTrue
import org.amshove.kluent.shouldEqual
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
internal class ChunkEntityTest : InstrumentedTest {
@ -48,13 +46,12 @@ internal class ChunkEntityTest : InstrumentedTest {
monarchy = Monarchy.Builder().setRealmConfiguration(testConfig).build()
}
@Test
fun add_shouldAdd_whenNotAlreadyIncluded() {
monarchy.runTransactionSync { realm ->
val chunk: ChunkEntity = realm.createObject()
val fakeEvent = createFakeMessageEvent()
chunk.add("roomId", fakeEvent, PaginationDirection.FORWARDS)
chunk.add(realm, "roomId", fakeEvent, PaginationDirection.FORWARDS)
chunk.timelineEvents.size shouldEqual 1
}
}
@ -64,8 +61,8 @@ internal class ChunkEntityTest : InstrumentedTest {
monarchy.runTransactionSync { realm ->
val chunk: ChunkEntity = realm.createObject()
val fakeEvent = createFakeMessageEvent()
chunk.add("roomId", fakeEvent, PaginationDirection.FORWARDS)
chunk.add("roomId", fakeEvent, PaginationDirection.FORWARDS)
chunk.add(realm, "roomId", fakeEvent, PaginationDirection.FORWARDS)
chunk.add(realm, "roomId", fakeEvent, PaginationDirection.FORWARDS)
chunk.timelineEvents.size shouldEqual 1
}
}
@ -75,7 +72,7 @@ internal class ChunkEntityTest : InstrumentedTest {
monarchy.runTransactionSync { realm ->
val chunk: ChunkEntity = realm.createObject()
val fakeEvent = createFakeRoomMemberEvent()
chunk.add("roomId", fakeEvent, PaginationDirection.FORWARDS)
chunk.add(realm, "roomId", fakeEvent, PaginationDirection.FORWARDS)
chunk.lastStateIndex(PaginationDirection.FORWARDS) shouldEqual 1
}
}
@ -85,7 +82,7 @@ internal class ChunkEntityTest : InstrumentedTest {
monarchy.runTransactionSync { realm ->
val chunk: ChunkEntity = realm.createObject()
val fakeEvent = createFakeMessageEvent()
chunk.add("roomId", fakeEvent, PaginationDirection.FORWARDS)
chunk.add(realm, "roomId", fakeEvent, PaginationDirection.FORWARDS)
chunk.lastStateIndex(PaginationDirection.FORWARDS) shouldEqual 0
}
}
@ -96,7 +93,9 @@ internal class ChunkEntityTest : InstrumentedTest {
val chunk: ChunkEntity = realm.createObject()
val fakeEvents = createFakeListOfEvents(30)
val numberOfStateEvents = fakeEvents.filter { it.isStateEvent() }.size
chunk.addAll("roomId", fakeEvents, PaginationDirection.FORWARDS)
fakeEvents.forEach {
chunk.add(realm, "roomId", it, PaginationDirection.FORWARDS)
}
chunk.lastStateIndex(PaginationDirection.FORWARDS) shouldEqual numberOfStateEvents
}
}
@ -109,7 +108,9 @@ internal class ChunkEntityTest : InstrumentedTest {
val numberOfStateEvents = fakeEvents.filter { it.isStateEvent() }.size
val lastIsState = fakeEvents.last().isStateEvent()
val expectedStateIndex = if (lastIsState) -numberOfStateEvents + 1 else -numberOfStateEvents
chunk.addAll("roomId", fakeEvents, PaginationDirection.BACKWARDS)
fakeEvents.forEach {
chunk.add(realm, "roomId", it, PaginationDirection.BACKWARDS)
}
chunk.lastStateIndex(PaginationDirection.BACKWARDS) shouldEqual expectedStateIndex
}
}
@ -119,8 +120,12 @@ internal class ChunkEntityTest : InstrumentedTest {
monarchy.runTransactionSync { realm ->
val chunk1: ChunkEntity = realm.createObject()
val chunk2: ChunkEntity = realm.createObject()
chunk1.addAll("roomId", createFakeListOfEvents(30), PaginationDirection.BACKWARDS)
chunk2.addAll("roomId", createFakeListOfEvents(30), PaginationDirection.BACKWARDS)
createFakeListOfEvents(30).forEach {
chunk1.add(realm, "roomId", it, PaginationDirection.BACKWARDS)
}
createFakeListOfEvents(30).forEach {
chunk2.add(realm, "roomId", it, PaginationDirection.BACKWARDS)
}
chunk1.merge("roomId", chunk2, PaginationDirection.BACKWARDS)
chunk1.timelineEvents.size shouldEqual 60
}
@ -135,14 +140,20 @@ internal class ChunkEntityTest : InstrumentedTest {
val eventsForChunk2 = eventsForChunk1 + createFakeListOfEvents(10)
chunk1.isLastForward = true
chunk2.isLastForward = false
chunk1.addAll("roomId", eventsForChunk1, PaginationDirection.FORWARDS)
chunk2.addAll("roomId", eventsForChunk2, PaginationDirection.BACKWARDS)
eventsForChunk1.forEach {
chunk1.add(realm, "roomId", it, PaginationDirection.FORWARDS)
}
eventsForChunk2.forEach {
chunk2.add(realm, "roomId", it, PaginationDirection.BACKWARDS)
}
chunk1.merge("roomId", chunk2, PaginationDirection.BACKWARDS)
chunk1.timelineEvents.size shouldEqual 40
chunk1.isLastForward.shouldBeTrue()
}
}
/*
@Test
fun merge_shouldEventsBeLinked_whenMergingLinkedWithUnlinked() {
monarchy.runTransactionSync { realm ->
@ -195,4 +206,5 @@ internal class ChunkEntityTest : InstrumentedTest {
}
}
}
*/
}

View File

@ -32,6 +32,4 @@ internal class FakeGetContextOfEventTask constructor(private val tokenChunkEvent
)
return tokenChunkEventPersistor.insertInDb(tokenChunkEvent, params.roomId, PaginationDirection.BACKWARDS)
}
}
}

View File

@ -28,6 +28,4 @@ internal class FakePaginationTask @Inject constructor(private val tokenChunkEven
val tokenChunkEvent = FakeTokenChunkEvent(params.from, Random.nextLong(System.currentTimeMillis()).toString(), fakeEvents)
return tokenChunkEventPersistor.insertInDb(tokenChunkEvent, params.roomId, params.direction)
}
}

View File

@ -23,4 +23,4 @@ internal data class FakeTokenChunkEvent(override val start: String?,
override val end: String?,
override val events: List<Event> = emptyList(),
override val stateEvents: List<Event> = emptyList()
) : TokenChunkEvent
) : TokenChunkEvent

View File

@ -88,6 +88,4 @@ object RoomDataHelper {
roomEntity.addOrUpdate(chunkEntity)
}
}
}
}

View File

@ -66,7 +66,7 @@ internal class TimelineTest : InstrumentedTest {
// val latch = CountDownLatch(2)
// var timelineEvents: List<TimelineEvent> = emptyList()
// timeline.listener = object : Timeline.Listener {
// override fun onUpdated(snapshot: List<TimelineEvent>) {
// override fun onTimelineUpdated(snapshot: List<TimelineEvent>) {
// if (snapshot.isNotEmpty()) {
// if (initialLoad == 0) {
// initialLoad = snapshot.size
@ -81,6 +81,4 @@ internal class TimelineTest : InstrumentedTest {
// timelineEvents.size shouldEqual initialLoad + paginationCount
// timeline.dispose()
// }
}
}

View File

@ -22,6 +22,7 @@ import okhttp3.Interceptor
import okhttp3.Response
import okhttp3.logging.HttpLoggingInterceptor
import okio.Buffer
import timber.log.Timber
import java.io.IOException
import java.nio.charset.Charset
import javax.inject.Inject
@ -51,27 +52,33 @@ internal class CurlLoggingInterceptor @Inject constructor(private val logger: Ht
var compressed = false
var curlCmd = "curl"
if (curlOptions != null) {
curlCmd += " " + curlOptions!!
curlOptions?.let {
curlCmd += " $it"
}
curlCmd += " -X " + request.method()
curlCmd += " -X " + request.method
val requestBody = request.body()
val requestBody = request.body
if (requestBody != null) {
val buffer = Buffer()
requestBody.writeTo(buffer)
var charset: Charset? = UTF8
val contentType = requestBody.contentType()
if (contentType != null) {
charset = contentType.charset(UTF8)
if (requestBody.contentLength() > 100_000) {
Timber.w("Unable to log curl command data, size is too big (${requestBody.contentLength()})")
// Ensure the curl command will failed
curlCmd += "DATA IS TOO BIG"
} else {
val buffer = Buffer()
requestBody.writeTo(buffer)
var charset: Charset? = UTF8
val contentType = requestBody.contentType()
if (contentType != null) {
charset = contentType.charset(UTF8)
}
// try to keep to a single line and use a subshell to preserve any line breaks
curlCmd += " --data $'" + buffer.readString(charset!!).replace("\n", "\\n") + "'"
}
// try to keep to a single line and use a subshell to preserve any line breaks
curlCmd += " --data $'" + buffer.readString(charset!!).replace("\n", "\\n") + "'"
}
val headers = request.headers()
val headers = request.headers
var i = 0
val count = headers.size()
val count = headers.size
while (i < count) {
val name = headers.name(i)
val value = headers.value(i)
@ -82,7 +89,7 @@ internal class CurlLoggingInterceptor @Inject constructor(private val logger: Ht
i++
}
curlCmd += ((if (compressed) " --compressed " else " ") + "'" + request.url().toString()
curlCmd += ((if (compressed) " --compressed " else " ") + "'" + request.url.toString()
// Replace localhost for emulator by localhost for shell
.replace("://10.0.2.2:8080/".toRegex(), "://127.0.0.1:8080/")
+ "'")
@ -90,7 +97,7 @@ internal class CurlLoggingInterceptor @Inject constructor(private val logger: Ht
// Add Json formatting
curlCmd += " | python -m json.tool"
logger.log("--- cURL (" + request.url() + ")")
logger.log("--- cURL (" + request.url + ")")
logger.log(curlCmd)
return chain.proceed(request)

View File

@ -51,7 +51,6 @@ class FormattedJsonHttpLogger : HttpLoggingInterceptor.Logger {
// Finally this is not a JSON string...
Timber.e(e)
}
} else if (message.startsWith("[")) {
// JSON Array detected
try {
@ -61,7 +60,6 @@ class FormattedJsonHttpLogger : HttpLoggingInterceptor.Logger {
// Finally not JSON...
Timber.e(e)
}
}
// Else not a json string to log
}
@ -73,4 +71,4 @@ class FormattedJsonHttpLogger : HttpLoggingInterceptor.Logger {
Timber.v(s)
}
}
}
}

View File

@ -22,7 +22,7 @@ import androidx.work.Configuration
import androidx.work.WorkManager
import com.zhuinden.monarchy.Monarchy
import im.vector.matrix.android.BuildConfig
import im.vector.matrix.android.api.auth.Authenticator
import im.vector.matrix.android.api.auth.AuthenticationService
import im.vector.matrix.android.internal.SessionManager
import im.vector.matrix.android.internal.di.DaggerMatrixComponent
import im.vector.matrix.android.internal.network.UserAgentHolder
@ -38,7 +38,6 @@ data class MatrixConfiguration(
interface Provider {
fun providesMatrixConfiguration(): MatrixConfiguration
}
}
/**
@ -47,7 +46,7 @@ data class MatrixConfiguration(
*/
class Matrix private constructor(context: Context, matrixConfiguration: MatrixConfiguration) {
@Inject internal lateinit var authenticator: Authenticator
@Inject internal lateinit var authenticationService: AuthenticationService
@Inject internal lateinit var userAgentHolder: UserAgentHolder
@Inject internal lateinit var backgroundDetectionObserver: BackgroundDetectionObserver
@Inject internal lateinit var olmManager: OlmManager
@ -65,8 +64,8 @@ class Matrix private constructor(context: Context, matrixConfiguration: MatrixCo
fun getUserAgent() = userAgentHolder.userAgent
fun authenticator(): Authenticator {
return authenticator
fun authenticationService(): AuthenticationService {
return authenticationService
}
companion object {
@ -98,5 +97,4 @@ class Matrix private constructor(context: Context, matrixConfiguration: MatrixCo
return BuildConfig.VERSION_NAME + " (" + BuildConfig.GIT_SDK_REVISION + ")"
}
}
}

View File

@ -27,7 +27,7 @@ interface MatrixCallback<in T> {
* @param data the data successfully returned from the async function
*/
fun onSuccess(data: T) {
//no-op
// no-op
}
/**
@ -35,7 +35,6 @@ interface MatrixCallback<in T> {
* @param failure the failure data returned from the async function
*/
fun onFailure(failure: Throwable) {
//no-op
// no-op
}
}
}

View File

@ -16,7 +16,6 @@
package im.vector.matrix.android.api
/**
* This class contains pattern to match the different Matrix ids
*/
@ -154,6 +153,5 @@ object MatrixPatterns {
return if (index == -1) {
null
} else matrixId.substring(index + 1)
}
}

View File

@ -0,0 +1,92 @@
/*
* Copyright 2019 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.matrix.android.api.auth
import im.vector.matrix.android.api.MatrixCallback
import im.vector.matrix.android.api.auth.data.Credentials
import im.vector.matrix.android.api.auth.data.HomeServerConnectionConfig
import im.vector.matrix.android.api.auth.data.LoginFlowResult
import im.vector.matrix.android.api.auth.data.SessionParams
import im.vector.matrix.android.api.auth.login.LoginWizard
import im.vector.matrix.android.api.auth.registration.RegistrationWizard
import im.vector.matrix.android.api.session.Session
import im.vector.matrix.android.api.util.Cancelable
/**
* This interface defines methods to authenticate or to create an account to a matrix server.
*/
interface AuthenticationService {
/**
* Request the supported login flows for this homeserver.
* This is the first method to call to be able to get a wizard to login or the create an account
*/
fun getLoginFlow(homeServerConnectionConfig: HomeServerConnectionConfig, callback: MatrixCallback<LoginFlowResult>): Cancelable
/**
* Return a LoginWizard, to login to the homeserver. The login flow has to be retrieved first.
*/
fun getLoginWizard(): LoginWizard
/**
* Return a RegistrationWizard, to create an matrix account on the homeserver. The login flow has to be retrieved first.
*/
fun getRegistrationWizard(): RegistrationWizard
/**
* True when login and password has been sent with success to the homeserver
*/
val isRegistrationStarted: Boolean
/**
* Cancel pending login or pending registration
*/
fun cancelPendingLoginOrRegistration()
/**
* Reset all pending settings, including current HomeServerConnectionConfig
*/
fun reset()
/**
* Check if there is an authenticated [Session].
* @return true if there is at least one active session.
*/
fun hasAuthenticatedSessions(): Boolean
/**
* Get the last authenticated [Session], if there is an active session.
* @return the last active session if any, or null
*/
fun getLastAuthenticatedSession(): Session?
/**
* Get an authenticated session. You should at least call authenticate one time before.
* If you logout, this session will no longer be valid.
*
* @param sessionParams the sessionParams to open with.
* @return the associated session if any, or null
*/
fun getSession(sessionParams: SessionParams): Session?
/**
* Create a session after a SSO successful login
*/
fun createSessionFromSso(homeServerConnectionConfig: HomeServerConnectionConfig,
credentials: Credentials,
callback: MatrixCallback<Session>): Cancelable
}

View File

@ -1,59 +0,0 @@
/*
* Copyright 2019 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.matrix.android.api.auth
import im.vector.matrix.android.api.MatrixCallback
import im.vector.matrix.android.api.auth.data.HomeServerConnectionConfig
import im.vector.matrix.android.api.auth.data.SessionParams
import im.vector.matrix.android.api.session.Session
import im.vector.matrix.android.api.util.Cancelable
/**
* This interface defines methods to authenticate to a matrix server.
*/
interface Authenticator {
/**
* @param homeServerConnectionConfig this param is used to configure the Homeserver
* @param login the login field
* @param password the password field
* @param callback the matrix callback on which you'll receive the result of authentication.
* @return return a [Cancelable]
*/
fun authenticate(homeServerConnectionConfig: HomeServerConnectionConfig, login: String, password: String, callback: MatrixCallback<Session>): Cancelable
/**
* Check if there is an authenticated [Session].
* @return true if there is at least one active session.
*/
fun hasAuthenticatedSessions(): Boolean
/**
* Get the last authenticated [Session], if there is an active session.
* @return the last active session if any, or null
*/
fun getLastAuthenticatedSession(): Session?
/**
* Get an authenticated session. You should at least call authenticate one time before.
* If you logout, this session will no longer be valid.
*
* @param sessionParams the sessionParams to open with.
* @return the associated session if any, or null
*/
fun getSession(sessionParams: SessionParams): Session?
}

View File

@ -30,4 +30,7 @@ data class Credentials(
@Json(name = "home_server") val homeServer: String,
@Json(name = "access_token") val accessToken: String,
@Json(name = "refresh_token") val refreshToken: String?,
@Json(name = "device_id") val deviceId: String?)
@Json(name = "device_id") val deviceId: String?,
// Optional data that may contain info to override home server and/or identity server
@Json(name = "well_known") val wellKnown: WellKnown? = null
)

View File

@ -25,7 +25,7 @@ import okhttp3.TlsVersion
/**
* This data class holds how to connect to a specific Homeserver.
* It's used with [im.vector.matrix.android.api.auth.Authenticator] class.
* It's used with [im.vector.matrix.android.api.auth.AuthenticationService] class.
* You should use the [Builder] to create one.
*/
@JsonClass(generateAdapter = true)
@ -253,13 +253,5 @@ data class HomeServerConnectionConfig(
forceUsageTlsVersions
)
}
}
}

View File

@ -0,0 +1,30 @@
/*
* Copyright 2019 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.matrix.android.api.auth.data
import im.vector.matrix.android.internal.auth.data.LoginFlowResponse
// Either a LoginFlowResponse, or an error if the homeserver is outdated
sealed class LoginFlowResult {
data class Success(
val loginFlowResponse: LoginFlowResponse,
val isLoginAndRegistrationSupported: Boolean,
val homeServerUrl: String
) : LoginFlowResult()
object OutdatedHomeserver : LoginFlowResult()
}

View File

@ -0,0 +1,111 @@
/*
* Copyright 2018 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.matrix.android.api.auth.data
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
/**
* Model for https://matrix.org/docs/spec/client_server/latest#get-matrix-client-versions
*
* Ex:
* <pre>
* {
* "unstable_features": {
* "m.lazy_load_members": true
* },
* "versions": [
* "r0.0.1",
* "r0.1.0",
* "r0.2.0",
* "r0.3.0"
* ]
* }
* </pre>
*/
@JsonClass(generateAdapter = true)
data class Versions(
@Json(name = "versions")
val supportedVersions: List<String>? = null,
@Json(name = "unstable_features")
val unstableFeatures: Map<String, Boolean>? = null
)
// MatrixClientServerAPIVersion
private const val r0_0_1 = "r0.0.1"
private const val r0_1_0 = "r0.1.0"
private const val r0_2_0 = "r0.2.0"
private const val r0_3_0 = "r0.3.0"
private const val r0_4_0 = "r0.4.0"
private const val r0_5_0 = "r0.5.0"
private const val r0_6_0 = "r0.6.0"
// MatrixVersionsFeature
private const val FEATURE_LAZY_LOAD_MEMBERS = "m.lazy_load_members"
private const val FEATURE_REQUIRE_IDENTITY_SERVER = "m.require_identity_server"
private const val FEATURE_ID_ACCESS_TOKEN = "m.id_access_token"
private const val FEATURE_SEPARATE_ADD_AND_BIND = "m.separate_add_and_bind"
/**
* Return true if the SDK supports this homeserver version
*/
fun Versions.isSupportedBySdk(): Boolean {
return supportLazyLoadMembers()
}
/**
* Return true if the SDK supports this homeserver version for login and registration
*/
fun Versions.isLoginAndRegistrationSupportedBySdk(): Boolean {
return !doesServerRequireIdentityServerParam()
&& doesServerAcceptIdentityAccessToken()
&& doesServerSeparatesAddAndBind()
}
/**
* Return true if the server support the lazy loading of room members
*
* @return true if the server support the lazy loading of room members
*/
private fun Versions.supportLazyLoadMembers(): Boolean {
return supportedVersions?.contains(r0_5_0) == true
|| unstableFeatures?.get(FEATURE_LAZY_LOAD_MEMBERS) == true
}
/**
* Indicate if the `id_server` parameter is required when registering with an 3pid,
* adding a 3pid or resetting password.
*/
private fun Versions.doesServerRequireIdentityServerParam(): Boolean {
if (supportedVersions?.contains(r0_6_0) == true) return false
return unstableFeatures?.get(FEATURE_REQUIRE_IDENTITY_SERVER) ?: true
}
/**
* Indicate if the `id_access_token` parameter can be safely passed to the homeserver.
* Some homeservers may trigger errors if they are not prepared for the new parameter.
*/
private fun Versions.doesServerAcceptIdentityAccessToken(): Boolean {
return supportedVersions?.contains(r0_6_0) == true
|| unstableFeatures?.get(FEATURE_ID_ACCESS_TOKEN) ?: false
}
private fun Versions.doesServerSeparatesAddAndBind(): Boolean {
return supportedVersions?.contains(r0_6_0) == true
|| unstableFeatures?.get(FEATURE_SEPARATE_ADD_AND_BIND) ?: false
}

View File

@ -0,0 +1,82 @@
/*
* Copyright 2019 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.matrix.android.api.auth.data
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
/**
* https://matrix.org/docs/spec/client_server/r0.4.0.html#server-discovery
* <pre>
* {
* "m.homeserver": {
* "base_url": "https://matrix.org"
* },
* "m.identity_server": {
* "base_url": "https://vector.im"
* }
* "m.integrations": {
* "managers": [
* {
* "api_url": "https://integrations.example.org",
* "ui_url": "https://integrations.example.org/ui"
* },
* {
* "api_url": "https://bots.example.org"
* }
* ]
* }
* }
* </pre>
*/
@JsonClass(generateAdapter = true)
data class WellKnown(
@Json(name = "m.homeserver")
var homeServer: WellKnownBaseConfig? = null,
@Json(name = "m.identity_server")
var identityServer: WellKnownBaseConfig? = null,
@Json(name = "m.integrations")
var integrations: Map<String, @JvmSuppressWildcards Any>? = null
) {
/**
* Returns the list of integration managers proposed
*/
fun getIntegrationManagers(): List<WellKnownManagerConfig> {
val managers = ArrayList<WellKnownManagerConfig>()
integrations?.get("managers")?.let {
(it as? ArrayList<*>)?.let { configs ->
configs.forEach { config ->
(config as? Map<*, *>)?.let { map ->
val apiUrl = map["api_url"] as? String
val uiUrl = map["ui_url"] as? String ?: apiUrl
if (apiUrl != null
&& apiUrl.startsWith("https://")
&& uiUrl!!.startsWith("https://")) {
managers.add(WellKnownManagerConfig(
apiUrl = apiUrl,
uiUrl = uiUrl
))
}
}
}
}
}
return managers
}
}

View File

@ -0,0 +1,34 @@
/*
* Copyright 2019 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.matrix.android.api.auth.data
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
/**
* https://matrix.org/docs/spec/client_server/r0.4.0.html#server-discovery
* <pre>
* {
* "base_url": "https://vector.im"
* }
* </pre>
*/
@JsonClass(generateAdapter = true)
data class WellKnownBaseConfig(
@Json(name = "base_url")
val baseURL: String? = null
)

View File

@ -0,0 +1,21 @@
/*
* Copyright 2019 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.matrix.android.api.auth.data
data class WellKnownManagerConfig(
val apiUrl : String,
val uiUrl: String
)

View File

@ -0,0 +1,48 @@
/*
* Copyright 2019 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.matrix.android.api.auth.login
import im.vector.matrix.android.api.MatrixCallback
import im.vector.matrix.android.api.session.Session
import im.vector.matrix.android.api.util.Cancelable
interface LoginWizard {
/**
* @param login the login field
* @param password the password field
* @param deviceName the initial device name
* @param callback the matrix callback on which you'll receive the result of authentication.
* @return return a [Cancelable]
*/
fun login(login: String,
password: String,
deviceName: String,
callback: MatrixCallback<Session>): Cancelable
/**
* Reset user password
*/
fun resetPassword(email: String,
newPassword: String,
callback: MatrixCallback<Unit>): Cancelable
/**
* Confirm the new password, once the user has checked his email
*/
fun resetPasswordMailConfirmed(callback: MatrixCallback<Unit>): Cancelable
}

View File

@ -0,0 +1,22 @@
/*
* Copyright 2019 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.matrix.android.api.auth.registration
sealed class RegisterThreePid {
data class Email(val email: String) : RegisterThreePid()
data class Msisdn(val msisdn: String, val countryCode: String) : RegisterThreePid()
}

View File

@ -0,0 +1,30 @@
/*
* Copyright 2019 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.matrix.android.api.auth.registration
import im.vector.matrix.android.api.session.Session
// Either a session or an object containing data about registration stages
sealed class RegistrationResult {
data class Success(val session: Session) : RegistrationResult()
data class FlowResponse(val flowResult: FlowResult) : RegistrationResult()
}
data class FlowResult(
val missingStages: List<Stage>,
val completedStages: List<Stage>
)

View File

@ -0,0 +1,46 @@
/*
* Copyright 2019 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.matrix.android.api.auth.registration
import im.vector.matrix.android.api.MatrixCallback
import im.vector.matrix.android.api.util.Cancelable
interface RegistrationWizard {
fun getRegistrationFlow(callback: MatrixCallback<RegistrationResult>): Cancelable
fun createAccount(userName: String, password: String, initialDeviceDisplayName: String?, callback: MatrixCallback<RegistrationResult>): Cancelable
fun performReCaptcha(response: String, callback: MatrixCallback<RegistrationResult>): Cancelable
fun acceptTerms(callback: MatrixCallback<RegistrationResult>): Cancelable
fun dummy(callback: MatrixCallback<RegistrationResult>): Cancelable
fun addThreePid(threePid: RegisterThreePid, callback: MatrixCallback<RegistrationResult>): Cancelable
fun sendAgainThreePid(callback: MatrixCallback<RegistrationResult>): Cancelable
fun handleValidateThreePid(code: String, callback: MatrixCallback<RegistrationResult>): Cancelable
fun checkIfEmailHasBeenValidated(delayMillis: Long, callback: MatrixCallback<RegistrationResult>): Cancelable
val currentThreePid: String?
// True when login and password has been sent with success to the homeserver
val isRegistrationStarted: Boolean
}

View File

@ -0,0 +1,44 @@
/*
* Copyright 2019 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.matrix.android.api.auth.registration
sealed class Stage(open val mandatory: Boolean) {
// m.login.recaptcha
data class ReCaptcha(override val mandatory: Boolean, val publicKey: String) : Stage(mandatory)
// m.login.oauth2
// m.login.email.identity
data class Email(override val mandatory: Boolean) : Stage(mandatory)
// m.login.msisdn
data class Msisdn(override val mandatory: Boolean) : Stage(mandatory)
// m.login.token
// m.login.dummy, can be mandatory if there is no other stages. In this case the account cannot be created by just sending a username
// and a password, the dummy stage has to be done
data class Dummy(override val mandatory: Boolean) : Stage(mandatory)
// Undocumented yet: m.login.terms
data class Terms(override val mandatory: Boolean, val policies: TermPolicies) : Stage(mandatory)
// For unknown stages
data class Other(override val mandatory: Boolean, val type: String, val params: Map<*, *>?) : Stage(mandatory)
}
typealias TermPolicies = Map<*, *>

View File

@ -17,7 +17,6 @@
package im.vector.matrix.android.api.comparators
import im.vector.matrix.android.api.interfaces.DatedObject
import java.util.*
object DatedObjectComparators {
@ -38,4 +37,4 @@ object DatedObjectComparators {
(datedObject2.date - datedObject1.date).toInt()
}
}
}
}

View File

@ -0,0 +1,27 @@
/*
* Copyright 2019 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.matrix.android.api.crypto
import im.vector.matrix.android.api.session.crypto.sas.EmojiRepresentation
import im.vector.matrix.android.internal.crypto.verification.getEmojiForCode
/**
* Provide all the emojis used for SAS verification (for debug purpose)
*/
fun getAllVerificationEmojis(): List<EmojiRepresentation> {
return (0..63).map { getEmojiForCode(it) }
}

View File

@ -19,7 +19,6 @@ package im.vector.matrix.android.api.extensions
import im.vector.matrix.android.api.comparators.DatedObjectComparators
import im.vector.matrix.android.internal.crypto.model.MXDeviceInfo
import im.vector.matrix.android.internal.crypto.model.rest.DeviceInfo
import java.util.*
/* ==========================================================================================
* MXDeviceInfo
@ -29,7 +28,6 @@ fun MXDeviceInfo.getFingerprintHumanReadable() = fingerprint()
?.chunked(4)
?.joinToString(separator = " ")
fun List<DeviceInfo>.sortByLastSeen() {
Collections.sort(this, DatedObjectComparators.descComparator)
}
fun MutableList<DeviceInfo>.sortByLastSeen() {
sortWith(DatedObjectComparators.descComparator)
}

View File

@ -0,0 +1,22 @@
/*
* Copyright 2019 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.matrix.android.api.failure
// This data class will be sent to the bus
data class ConsentNotGivenError(
val consentUri: String
)

View File

@ -31,15 +31,16 @@ import java.io.IOException
*/
sealed class Failure(cause: Throwable? = null) : Throwable(cause = cause) {
data class Unknown(val throwable: Throwable? = null) : Failure(throwable)
data class Cancelled(val throwable: Throwable? = null) : Failure(throwable)
data class NetworkConnection(val ioException: IOException? = null) : Failure(ioException)
data class ServerError(val error: MatrixError, val httpCode: Int) : Failure(RuntimeException(error.toString()))
object SuccessError : Failure(RuntimeException(RuntimeException("SuccessResult is false")))
// When server send an error, but it cannot be interpreted as a MatrixError
data class OtherServerError(val errorBody: String, val httpCode: Int) : Failure(RuntimeException(errorBody))
data class OtherServerError(val errorBody: String, val httpCode: Int) : Failure(RuntimeException("HTTP $httpCode: $errorBody"))
data class RegistrationFlowError(val registrationFlowResponse: RegistrationFlowResponse) : Failure(RuntimeException(registrationFlowResponse.toString()))
data class CryptoError(val error: MXCryptoError) : Failure(error)
abstract class FeatureFailure : Failure()
}
}

View File

@ -31,8 +31,9 @@ data class MatrixError(
@Json(name = "consent_uri") val consentUri: String? = null,
// RESOURCE_LIMIT_EXCEEDED data
@Json(name = "limit_type") val limitType: String? = null,
@Json(name = "admin_contact") val adminUri: String? = null) {
@Json(name = "admin_contact") val adminUri: String? = null,
// For LIMIT_EXCEEDED
@Json(name = "retry_after_ms") val retryAfterMillis: Long? = null) {
companion object {
const val FORBIDDEN = "M_FORBIDDEN"
@ -64,4 +65,4 @@ data class MatrixError(
// Possible value for "limit_type"
const val LIMIT_TYPE_MAU = "monthly_active_user"
}
}
}

View File

@ -25,4 +25,4 @@ interface ProgressListener {
* @param total
*/
fun onProgress(progress: Int, total: Int)
}
}

View File

@ -31,4 +31,4 @@ interface StepProgressListener {
* @param step The current step, containing progress data if available. Else you should consider progress as indeterminate
*/
fun onStepProgress(step: Step)
}
}

View File

@ -30,9 +30,9 @@ object MatrixLinkify {
*
* @param spannable the text in which the matrix items has to be clickable.
*/
fun addLinks(spannable: Spannable?, callback: MatrixPermalinkSpan.Callback?): Boolean {
fun addLinks(spannable: Spannable, callback: MatrixPermalinkSpan.Callback?): Boolean {
// sanity checks
if (spannable.isNullOrEmpty()) {
if (spannable.isEmpty()) {
return false
}
val text = spannable.toString()
@ -51,5 +51,4 @@ object MatrixLinkify {
}
return hasMatch
}
}
}

View File

@ -35,6 +35,4 @@ class MatrixPermalinkSpan(private val url: String,
override fun onClick(widget: View) {
callback?.onUrlClicked(url)
}
}
}

View File

@ -33,5 +33,4 @@ sealed class PermalinkData {
data class GroupLink(val groupId: String) : PermalinkData()
data class FallbackLink(val uri: Uri) : PermalinkData()
}

View File

@ -16,7 +16,6 @@
package im.vector.matrix.android.api.permalinks
import android.text.TextUtils
import im.vector.matrix.android.api.session.events.model.Event
/**
@ -48,10 +47,9 @@ object PermalinkFactory {
* @return the permalink, or null in case of error
*/
fun createPermalink(id: String): String? {
return if (TextUtils.isEmpty(id)) {
return if (id.isEmpty()) {
null
} else MATRIX_TO_URL_BASE + escape(id)
}
/**
@ -72,16 +70,14 @@ object PermalinkFactory {
* @param url the universal link, Ex: "https://matrix.to/#/@benoit:matrix.org"
* @return the id from the url, ex: "@benoit:matrix.org", or null if the url is not a permalink
*/
fun getLinkedId(url: String?): String? {
val isSupported = url != null && url.startsWith(MATRIX_TO_URL_BASE)
fun getLinkedId(url: String): String? {
val isSupported = url.startsWith(MATRIX_TO_URL_BASE)
return if (isSupported) {
url!!.substring(MATRIX_TO_URL_BASE.length)
url.substring(MATRIX_TO_URL_BASE.length)
} else null
}
/**
* Escape '/' in id, because it is used as a separator
*
@ -89,6 +85,6 @@ object PermalinkFactory {
* @return the escaped id
*/
private fun escape(id: String): String {
return id.replace("/".toRegex(), "%2F")
return id.replace("/", "%2F")
}
}

View File

@ -72,5 +72,4 @@ object PermalinkParser {
else -> PermalinkData.FallbackLink(uri)
}
}
}
}

View File

@ -18,78 +18,111 @@ package im.vector.matrix.android.api.pushrules
import im.vector.matrix.android.api.pushrules.rest.PushRule
import timber.log.Timber
sealed class Action {
object Notify : Action()
object DoNotNotify : Action()
data class Sound(val sound: String = ACTION_OBJECT_VALUE_VALUE_DEFAULT) : Action()
data class Highlight(val highlight: Boolean) : Action()
}
class Action(val type: Type) {
private const val ACTION_NOTIFY = "notify"
private const val ACTION_DONT_NOTIFY = "dont_notify"
private const val ACTION_COALESCE = "coalesce"
enum class Type(val value: String) {
NOTIFY("notify"),
DONT_NOTIFY("dont_notify"),
COALESCE("coalesce"),
SET_TWEAK("set_tweak");
// Ref: https://matrix.org/docs/spec/client_server/latest#tweaks
private const val ACTION_OBJECT_SET_TWEAK_KEY = "set_tweak"
companion object {
private const val ACTION_OBJECT_SET_TWEAK_VALUE_SOUND = "sound"
private const val ACTION_OBJECT_SET_TWEAK_VALUE_HIGHLIGHT = "highlight"
fun safeValueOf(value: String): Type? {
try {
return valueOf(value)
} catch (e: IllegalArgumentException) {
return null
}
private const val ACTION_OBJECT_VALUE_KEY = "value"
private const val ACTION_OBJECT_VALUE_VALUE_DEFAULT = "default"
/**
* Ref: https://matrix.org/docs/spec/client_server/latest#actions
*
* Convert
* <pre>
* "actions": [
* "notify",
* {
* "set_tweak": "sound",
* "value": "default"
* },
* {
* "set_tweak": "highlight"
* }
* ]
*
* To
* [
* Action.Notify,
* Action.Sound("default"),
* Action.Highlight(true)
* ]
*
* </pre>
*/
@Suppress("IMPLICIT_CAST_TO_ANY")
fun List<Action>.toJson(): List<Any> {
return map { action ->
when (action) {
is Action.Notify -> ACTION_NOTIFY
is Action.DoNotNotify -> ACTION_DONT_NOTIFY
is Action.Sound -> {
mapOf(
ACTION_OBJECT_SET_TWEAK_KEY to ACTION_OBJECT_SET_TWEAK_VALUE_SOUND,
ACTION_OBJECT_VALUE_KEY to action.sound
)
}
}
}
var tweak_action: String? = null
var stringValue: String? = null
var boolValue: Boolean? = null
companion object {
fun mapFrom(pushRule: PushRule): List<Action>? {
val actions = ArrayList<Action>()
pushRule.actions.forEach { actionStrOrObj ->
if (actionStrOrObj is String) {
when (actionStrOrObj) {
Action.Type.NOTIFY.value -> Action(Action.Type.NOTIFY)
Action.Type.DONT_NOTIFY.value -> Action(Action.Type.DONT_NOTIFY)
else -> {
Timber.w("Unsupported action type ${actionStrOrObj}")
null
}
}?.let {
actions.add(it)
}
} else if (actionStrOrObj is Map<*, *>) {
val tweakAction = actionStrOrObj["set_tweak"] as? String
when (tweakAction) {
"sound" -> {
(actionStrOrObj["value"] as? String)?.let { stringValue ->
Action(Action.Type.SET_TWEAK).also {
it.tweak_action = "sound"
it.stringValue = stringValue
actions.add(it)
}
}
}
"highlight" -> {
(actionStrOrObj["value"] as? Boolean)?.let { boolValue ->
Action(Action.Type.SET_TWEAK).also {
it.tweak_action = "highlight"
it.boolValue = boolValue
actions.add(it)
}
}
}
else -> {
Timber.w("Unsupported action type ${actionStrOrObj}")
}
}
} else {
Timber.w("Unsupported action type ${actionStrOrObj}")
return null
}
is Action.Highlight -> {
mapOf(
ACTION_OBJECT_SET_TWEAK_KEY to ACTION_OBJECT_SET_TWEAK_VALUE_HIGHLIGHT,
ACTION_OBJECT_VALUE_KEY to action.highlight
)
}
return if (actions.isEmpty()) null else actions
}
}
}
fun PushRule.getActions(): List<Action> {
val result = ArrayList<Action>()
actions.forEach { actionStrOrObj ->
when (actionStrOrObj) {
ACTION_NOTIFY -> Action.Notify
ACTION_DONT_NOTIFY -> Action.DoNotNotify
is Map<*, *> -> {
when (actionStrOrObj[ACTION_OBJECT_SET_TWEAK_KEY]) {
ACTION_OBJECT_SET_TWEAK_VALUE_SOUND -> {
(actionStrOrObj[ACTION_OBJECT_VALUE_KEY] as? String)?.let { stringValue ->
Action.Sound(stringValue)
}
// When the value is not there, default sound (not specified by the spec)
?: Action.Sound(ACTION_OBJECT_VALUE_VALUE_DEFAULT)
}
ACTION_OBJECT_SET_TWEAK_VALUE_HIGHLIGHT -> {
(actionStrOrObj[ACTION_OBJECT_VALUE_KEY] as? Boolean)?.let { boolValue ->
Action.Highlight(boolValue)
}
// When the value is not there, default is true, says the spec
?: Action.Highlight(true)
}
else -> {
Timber.w("Unsupported set_tweak value ${actionStrOrObj[ACTION_OBJECT_SET_TWEAK_KEY]}")
null
}
}
}
else -> {
Timber.w("Unsupported action type $actionStrOrObj")
null
}
}?.let {
result.add(it)
}
}
return result
}

View File

@ -35,9 +35,7 @@ abstract class Condition(val kind: Kind) {
else -> UNRECOGNIZE
}
}
}
}
abstract fun isSatisfied(conditionResolver: ConditionResolver): Boolean
@ -45,4 +43,4 @@ abstract class Condition(val kind: Kind) {
open fun technicalDescription(): String {
return "Kind: $kind"
}
}
}

View File

@ -25,4 +25,4 @@ interface ConditionResolver {
fun resolveRoomMemberCountCondition(roomMemberCountCondition: RoomMemberCountCondition): Boolean
fun resolveSenderNotificationPermissionCondition(senderNotificationPermissionCondition: SenderNotificationPermissionCondition): Boolean
fun resolveContainsDisplayNameCondition(containsDisplayNameCondition: ContainsDisplayNameCondition) : Boolean
}
}

View File

@ -15,13 +15,11 @@
*/
package im.vector.matrix.android.api.pushrules
import android.text.TextUtils
import im.vector.matrix.android.api.session.events.model.Event
import im.vector.matrix.android.api.session.events.model.EventType
import im.vector.matrix.android.api.session.events.model.toModel
import im.vector.matrix.android.api.session.room.model.message.MessageContent
import timber.log.Timber
import java.util.regex.Pattern
class ContainsDisplayNameCondition : Condition(Kind.contains_display_name) {
@ -34,11 +32,11 @@ class ContainsDisplayNameCondition : Condition(Kind.contains_display_name) {
}
fun isSatisfied(event: Event, displayName: String): Boolean {
var message = when (event.type) {
val message = when (event.type) {
EventType.MESSAGE -> {
event.content.toModel<MessageContent>()
}
//TODO the spec says:
// TODO the spec says:
// Matches any message whose content is unencrypted and contains the user's current display name
// EventType.ENCRYPTED -> {
// event.root.getClearContent()?.toModel<MessageContent>()
@ -49,7 +47,6 @@ class ContainsDisplayNameCondition : Condition(Kind.contains_display_name) {
return caseInsensitiveFind(displayName, message.body)
}
companion object {
/**
* Returns whether a string contains an occurrence of another, as a standalone word, regardless of case.
@ -60,20 +57,18 @@ class ContainsDisplayNameCondition : Condition(Kind.contains_display_name) {
*/
fun caseInsensitiveFind(subString: String, longString: String): Boolean {
// add sanity checks
if (TextUtils.isEmpty(subString) || TextUtils.isEmpty(longString)) {
if (subString.isEmpty() || longString.isEmpty()) {
return false
}
var res = false
try {
val pattern = Pattern.compile("(\\W|^)" + Pattern.quote(subString) + "(\\W|$)", Pattern.CASE_INSENSITIVE)
res = pattern.matcher(longString).find()
val regex = Regex("(\\W|^)" + Regex.escape(subString) + "(\\W|$)", RegexOption.IGNORE_CASE)
return regex.containsMatchIn(longString)
} catch (e: Exception) {
Timber.e(e, "## caseInsensitiveFind() : failed")
}
return res
return false
}
}
}
}

View File

@ -29,28 +29,25 @@ class EventMatchCondition(val key: String, val pattern: String) : Condition(Kind
return "'$key' Matches '$pattern'"
}
fun isSatisfied(event: Event): Boolean {
//TODO encrypted events?
// TODO encrypted events?
val rawJson = MoshiProvider.providesMoshi().adapter(Event::class.java).toJsonValue(event) as? Map<*, *>
?: return false
val value = extractField(rawJson, key) ?: return false
//Patterns with no special glob characters should be treated as having asterisks prepended
// Patterns with no special glob characters should be treated as having asterisks prepended
// and appended when testing the condition.
try {
val modPattern = if (hasSpecialGlobChar(pattern)) simpleGlobToRegExp(pattern) else simpleGlobToRegExp("*$pattern*")
val regex = Regex(modPattern, RegexOption.DOT_MATCHES_ALL)
return regex.containsMatchIn(value)
} catch (e: Throwable) {
//e.g PatternSyntaxException
// e.g PatternSyntaxException
Timber.e(e, "Failed to evaluate push condition")
return false
}
}
private fun extractField(jsonObject: Map<*, *>, fieldPath: String): String? {
val fieldParts = fieldPath.split(".")
if (fieldParts.isEmpty()) return null
@ -77,9 +74,9 @@ class EventMatchCondition(val key: String, val pattern: String) : Condition(Kind
return glob.contains("*") || glob.contains("?")
}
//Very simple glob to regexp converter
// Very simple glob to regexp converter
private fun simpleGlobToRegExp(glob: String): String {
var out = ""//"^"
var out = "" // "^"
for (i in 0 until glob.length) {
val c = glob[i]
when (c) {
@ -90,8 +87,8 @@ class EventMatchCondition(val key: String, val pattern: String) : Condition(Kind
else -> out += c
}
}
out += ""//'$'.toString()
out += "" // '$'.toString()
return out
}
}
}
}

View File

@ -25,14 +25,18 @@ interface PushRuleService {
/**
* Fetch the push rules from the server
*/
fun fetchPushRules(scope: String = "global")
fun fetchPushRules(scope: String = RuleScope.GLOBAL)
//TODO get push rule set
fun getPushRules(scope: String = "global"): List<PushRule>
// TODO get push rule set
fun getPushRules(scope: String = RuleScope.GLOBAL): List<PushRule>
//TODO update rule
// TODO update rule
fun updatePushRuleEnableStatus(kind: String, pushRule: PushRule, enabled: Boolean, callback: MatrixCallback<Unit>): Cancelable
fun updatePushRuleEnableStatus(kind: RuleKind, pushRule: PushRule, enabled: Boolean, callback: MatrixCallback<Unit>): Cancelable
fun addPushRule(kind: RuleKind, pushRule: PushRule, callback: MatrixCallback<Unit>): Cancelable
fun removePushRule(kind: RuleKind, pushRule: PushRule, callback: MatrixCallback<Unit>): Cancelable
fun addPushRuleListener(listener: PushRuleListener)
@ -42,7 +46,9 @@ interface PushRuleService {
interface PushRuleListener {
fun onMatchRule(event: Event, actions: List<Action>)
fun onRoomJoined(roomId: String)
fun onRoomLeft(roomId: String)
fun onEventRedacted(redactedEventId: String)
fun batchFinish()
}
}
}

View File

@ -18,18 +18,17 @@ package im.vector.matrix.android.api.pushrules
import im.vector.matrix.android.api.session.events.model.Event
import im.vector.matrix.android.api.session.room.RoomService
import timber.log.Timber
import java.util.regex.Pattern
private val regex = Pattern.compile("^(==|<=|>=|<|>)?(\\d*)$")
private val regex = Regex("^(==|<=|>=|<|>)?(\\d*)$")
class RoomMemberCountCondition(val `is`: String) : Condition(Kind.room_member_count) {
class RoomMemberCountCondition(val iz: String) : Condition(Kind.room_member_count) {
override fun isSatisfied(conditionResolver: ConditionResolver): Boolean {
return conditionResolver.resolveRoomMemberCountCondition(this)
}
override fun technicalDescription(): String {
return "Room member count is $`is`"
return "Room member count is $iz"
}
fun isSatisfied(event: Event, session: RoomService?): Boolean {
@ -56,16 +55,12 @@ class RoomMemberCountCondition(val `is`: String) : Condition(Kind.room_member_co
*/
private fun parseIsField(): Pair<String?, Int>? {
try {
val match = regex.matcher(`is`)
if (match.find()) {
val prefix = match.group(1)
val count = match.group(2).toInt()
return prefix to count
}
val match = regex.find(iz) ?: return null
val (prefix, count) = match.destructured
return prefix to count.toInt()
} catch (t: Throwable) {
Timber.d(t)
}
return null
}
}
}

View File

@ -37,7 +37,7 @@ object RuleIds {
// Default Underride Rules
const val RULE_ID_CALL = ".m.rule.call"
const val RULE_ID_one_to_one_encrypted_room = ".m.rule.encrypted_room_one_to_one"
const val RULE_ID_ONE_TO_ONE_ENCRYPTED_ROOM = ".m.rule.encrypted_room_one_to_one"
const val RULE_ID_ONE_TO_ONE_ROOM = ".m.rule.room_one_to_one"
const val RULE_ID_ALL_OTHER_MESSAGES_ROOMS = ".m.rule.message"
const val RULE_ID_ENCRYPTED = ".m.rule.encrypted"

View File

@ -15,12 +15,6 @@
*/
package im.vector.matrix.android.api.pushrules
enum class RulesetKey(val value: String) {
CONTENT("content"),
OVERRIDE("override"),
ROOM("room"),
SENDER("sender"),
UNDERRIDE("underride"),
UNKNOWN("")
}
object RuleScope {
const val GLOBAL = "global"
}

View File

@ -0,0 +1,33 @@
/*
* Copyright 2019 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.matrix.android.api.pushrules
/**
* Ref: https://matrix.org/docs/spec/client_server/latest#get-matrix-client-r0-pushrules
*/
enum class RuleSetKey(val value: String) {
CONTENT("content"),
OVERRIDE("override"),
ROOM("room"),
SENDER("sender"),
UNDERRIDE("underride")
}
/**
* Ref: https://matrix.org/docs/spec/client_server/latest#get-matrix-client-r0-pushrules-scope-kind-ruleid
*/
typealias RuleKind = RuleSetKey

View File

@ -18,7 +18,6 @@ package im.vector.matrix.android.api.pushrules
import im.vector.matrix.android.api.session.events.model.Event
import im.vector.matrix.android.api.session.room.model.PowerLevels
class SenderNotificationPermissionCondition(val key: String) : Condition(Kind.sender_notification_permission) {
override fun isSatisfied(conditionResolver: ConditionResolver): Boolean {
@ -29,8 +28,7 @@ class SenderNotificationPermissionCondition(val key: String) : Condition(Kind.se
return "User power level <$key>"
}
fun isSatisfied(event: Event, powerLevels: PowerLevels): Boolean {
return event.senderId != null && powerLevels.getUserPowerLevel(event.senderId) >= powerLevels.notificationLevel(key)
}
}
}

View File

@ -71,9 +71,9 @@ data class PushCondition(
this.key?.let { SenderNotificationPermissionCondition(it) }
}
Condition.Kind.UNRECOGNIZE -> {
Timber.e("Unknwon kind $kind")
Timber.e("Unknown kind $kind")
null
}
}
}
}
}

View File

@ -19,7 +19,6 @@ package im.vector.matrix.android.api.pushrules.rest
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
data class PushRule(
/**
@ -47,4 +46,3 @@ data class PushRule(
*/
val pattern: String? = null
)

View File

@ -24,4 +24,4 @@ data class Ruleset(
val room: List<PushRule>? = null,
val sender: List<PushRule>? = null,
val underride: List<PushRule>? = null
)
)

View File

@ -20,10 +20,10 @@ import androidx.lifecycle.LiveData
interface InitialSyncProgressService {
fun getLiveStatus() : LiveData<Status?>
fun getInitialSyncProgressStatus() : LiveData<Status?>
data class Status(
@StringRes val statusText: Int?,
@StringRes val statusText: Int,
val percentProgress: Int = 0
)
}
}

View File

@ -19,6 +19,7 @@ package im.vector.matrix.android.api.session
import androidx.annotation.MainThread
import androidx.lifecycle.LiveData
import im.vector.matrix.android.api.auth.data.SessionParams
import im.vector.matrix.android.api.failure.ConsentNotGivenError
import im.vector.matrix.android.api.pushrules.PushRuleService
import im.vector.matrix.android.api.session.cache.CacheService
import im.vector.matrix.android.api.session.content.ContentUploadStateTracker
@ -26,9 +27,11 @@ import im.vector.matrix.android.api.session.content.ContentUrlResolver
import im.vector.matrix.android.api.session.crypto.CryptoService
import im.vector.matrix.android.api.session.file.FileService
import im.vector.matrix.android.api.session.group.GroupService
import im.vector.matrix.android.api.session.homeserver.HomeServerCapabilitiesService
import im.vector.matrix.android.api.session.pushers.PushersService
import im.vector.matrix.android.api.session.room.RoomDirectoryService
import im.vector.matrix.android.api.session.room.RoomService
import im.vector.matrix.android.api.session.securestorage.SecureStorageService
import im.vector.matrix.android.api.session.signout.SignOutService
import im.vector.matrix.android.api.session.sync.FilterService
import im.vector.matrix.android.api.session.sync.SyncState
@ -50,7 +53,9 @@ interface Session :
FileService,
PushRuleService,
PushersService,
InitialSyncProgressService {
InitialSyncProgressService,
HomeServerCapabilitiesService,
SecureStorageService {
/**
* The params associated to the session
@ -63,7 +68,6 @@ interface Session :
val myUserId: String
get() = sessionParams.credentials.userId
/**
* This method allow to open a session. It does start some service on the background.
*/
@ -87,7 +91,7 @@ interface Session :
/**
* This method start the sync thread.
*/
fun startSync(fromForeground : Boolean)
fun startSync(fromForeground: Boolean)
/**
* This method stop the sync thread.
@ -136,6 +140,9 @@ interface Session :
*/
fun onInvalidToken()
/**
* A M_CONSENT_NOT_GIVEN error has been received from the homeserver
*/
fun onConsentNotGivenError(consentNotGivenError: ConsentNotGivenError)
}
}
}

View File

@ -19,7 +19,7 @@ package im.vector.matrix.android.api.session.cache
import im.vector.matrix.android.api.MatrixCallback
/**
* This interface defines a method to sign out. It's implemented at the session level.
* This interface defines a method to clear the cache. It's implemented at the session level.
*/
interface CacheService {
@ -27,5 +27,4 @@ interface CacheService {
* Clear the whole cached data, except credentials. Once done, the session is closed and has to be opened again
*/
fun clearCache(callback: MatrixCallback<Unit>)
}
}

View File

@ -17,6 +17,7 @@
package im.vector.matrix.android.api.session.content
import android.os.Parcelable
import androidx.exifinterface.media.ExifInterface
import kotlinx.android.parcel.Parcelize
@Parcelize
@ -26,6 +27,7 @@ data class ContentAttachmentData(
val date: Long = 0,
val height: Long? = 0,
val width: Long? = 0,
val exifOrientation: Int = ExifInterface.ORIENTATION_UNDEFINED,
val name: String? = null,
val path: String,
val mimeType: String,
@ -38,5 +40,4 @@ data class ContentAttachmentData(
AUDIO,
VIDEO
}
}
}

View File

@ -22,6 +22,8 @@ interface ContentUploadStateTracker {
fun untrack(key: String, updateListener: UpdateListener)
fun clear()
interface UpdateListener {
fun onUpdate(state: State)
}
@ -35,4 +37,4 @@ interface ContentUploadStateTracker {
object Success : State()
data class Failure(val throwable: Throwable) : State()
}
}
}

View File

@ -44,4 +44,4 @@ interface ContentUrlResolver {
* @return the URL to access the described resource, or null if the url is invalid.
*/
fun resolveThumbnail(contentUrl: String?, width: Int, height: Int, method: ThumbnailMethod): String?
}
}

View File

@ -109,10 +109,7 @@ interface CryptoService {
fun downloadKeys(userIds: List<String>, forceDownload: Boolean, callback: MatrixCallback<MXUsersDevicesMap<MXDeviceInfo>>)
fun clearCryptoCache(callback: MatrixCallback<Unit>)
fun addNewSessionListener(newSessionListener: NewSessionListener)
fun removeSessionListener(listener: NewSessionListener)
}
}

View File

@ -90,4 +90,4 @@ sealed class MXCryptoError : Throwable() {
const val NO_MORE_ALGORITHM_REASON = "Room was previously configured to use encryption, but is no longer." +
" Perhaps the homeserver is hiding the configuration event."
}
}
}

View File

@ -210,5 +210,4 @@ interface KeysBackupService {
val isEnabled: Boolean
val isStucked: Boolean
val state: KeysBackupState
}
}

View File

@ -72,4 +72,4 @@ enum class KeysBackupState {
WillBackUp,
// e2e keys are being sent to the homeserver
BackingUp
}
}

View File

@ -23,4 +23,4 @@ interface KeysBackupStateListener {
* @param newState the new state
*/
fun onStateChange(newState: KeysBackupState)
}
}

View File

@ -30,4 +30,4 @@ enum class CancelCode(val value: String, val humanReadable: String) {
fun safeValueOf(code: String?): CancelCode {
return CancelCode.values().firstOrNull { code == it.value } ?: CancelCode.User
}
}

View File

@ -19,4 +19,4 @@ package im.vector.matrix.android.api.session.crypto.sas
import androidx.annotation.StringRes
data class EmojiRepresentation(val emoji: String,
@StringRes val nameResId: Int)
@StringRes val nameResId: Int)

View File

@ -31,4 +31,4 @@ interface IncomingSasVerificationTransaction {
CANCELLED_BY_ME,
CANCELLED_BY_OTHER
}
}
}

View File

@ -29,4 +29,4 @@ interface OutgoingSasVerificationRequest {
CANCELLED_BY_ME,
CANCELLED_BY_OTHER
}
}
}

View File

@ -19,4 +19,4 @@ package im.vector.matrix.android.api.session.crypto.sas
object SasMode {
const val DECIMAL = "decimal"
const val EMOJI = "emoji"
}
}

View File

@ -36,4 +36,4 @@ interface SasVerificationService {
fun transactionUpdated(tx: SasVerificationTransaction)
fun markedAsManuallyVerified(userId: String, deviceId: String)
}
}
}

View File

@ -47,4 +47,4 @@ interface SasVerificationTransaction {
* both short codes do match
*/
fun userHasVerifiedShortCode()
}
}

View File

@ -43,7 +43,7 @@ enum class SasVerificationTxState {
Verifying,
Verified,
//Global: The verification has been cancelled (by me or other), see cancelReason for details
// Global: The verification has been cancelled (by me or other), see cancelReason for details
Cancelled,
OnCancelled
}

View File

@ -34,9 +34,9 @@ import com.squareup.moshi.JsonClass
*/
@JsonClass(generateAdapter = true)
data class AggregatedAnnotation (
data class AggregatedAnnotation(
override val limited: Boolean? = false,
override val count: Int? = 0,
val chunk: List<RelationChunkInfo>? = null
) : UnsignedRelationInfo
) : UnsignedRelationInfo

View File

@ -50,4 +50,4 @@ import com.squareup.moshi.JsonClass
data class AggregatedRelations(
@Json(name = "m.annotation") val annotations: AggregatedAnnotation? = null,
@Json(name = "m.reference") val references: DefaultUnsignedRelationInfo? = null
)
)

View File

@ -23,4 +23,4 @@ data class DefaultUnsignedRelationInfo(
override val count: Int? = 0,
val chunk: List<Map<String, Any>>? = null
) : UnsignedRelationInfo
) : UnsignedRelationInfo

Some files were not shown because too many files have changed in this diff Show More