From d9009540ddb235084308f22fd4e59ed2d708ef77 Mon Sep 17 00:00:00 2001 From: Onuray Sahin Date: Thu, 27 Aug 2020 16:43:11 +0300 Subject: [PATCH 01/47] Don't try to use bluetooth headset if it is not connected. --- CHANGES.md | 1 + .../main/java/im/vector/app/features/call/CallAudioManager.kt | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index c923053b24..07b50ef632 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,6 +14,7 @@ Bugfix πŸ›: - Fix FontSize issue (#1483, #1787) - Fix bad color for settings icon on Android < 24 (#1786) - Change user or room avatar: when selecting Gallery, I'm not proposed to crop the selected image (#1590) + - Loudspeaker is always used (#1685) Translations πŸ—£: - diff --git a/vector/src/main/java/im/vector/app/features/call/CallAudioManager.kt b/vector/src/main/java/im/vector/app/features/call/CallAudioManager.kt index fde562ee63..2a773c2f9b 100644 --- a/vector/src/main/java/im/vector/app/features/call/CallAudioManager.kt +++ b/vector/src/main/java/im/vector/app/features/call/CallAudioManager.kt @@ -125,7 +125,7 @@ class CallAudioManager( } else { // if a wired headset is plugged, sound will be directed to it // (can't really force earpiece when headset is plugged) - if (isBluetoothHeadsetOn()) { + if (isBluetoothHeadsetConnected(audioManager)) { Timber.v("##VOIP: AudioManager default to WIRELESS_HEADSET ") setCurrentSoundDevice(SoundDevice.WIRELESS_HEADSET) // try now in case already connected? @@ -246,7 +246,7 @@ class CallAudioManager( } private fun isHeadsetOn(): Boolean { - return isWiredHeadsetOn() || isBluetoothHeadsetOn() + return isWiredHeadsetOn() || (audioManager?.let { isBluetoothHeadsetConnected(it) } ?: false) } private fun isWiredHeadsetOn(): Boolean { From 66dfcbc2f8052e0df609ba58d4e53f698a7a977e Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 28 Aug 2020 10:11:38 +0200 Subject: [PATCH 02/47] Add documentation on the flows --- docs/add_email.md | 177 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 docs/add_email.md diff --git a/docs/add_email.md b/docs/add_email.md new file mode 100644 index 0000000000..64227418a3 --- /dev/null +++ b/docs/add_email.md @@ -0,0 +1,177 @@ +# Adding an email to an account + +## User enter the email + +> POST https://homeserver.org/_matrix/client/r0/account/3pid/email/requestToken + +```json +{ + "email": "alice@email-provider.org", + "client_secret": "TixzvOnw7nLEUdiQEmkHzkXKrY4HhiGh", + "send_attempt": 1 +} +``` + +### The email is already adding to an account + +400 + +```json +{ + "errcode": "M_THREEPID_IN_USE", + "error": "Email is already in use" +} +``` + +### The email is free + +Wording: "We've sent you an email to verify your address. Please follow the instructions there and then click the button below." + +200 + +```json +{ + "sid": "bxyDHuJKsdkjMlTJ" +} +``` + +## User receive an e-mail + +> [homeserver.org] Validate your email +> +> A request to add an email address to your Matrix account has been received. If this was you, please click the link below to confirm adding this email: + https://homeserver.org/_matrix/client/unstable/add_threepid/email/submit_token?token=WUnEhQAmJrXupdEbXgdWvnVIKaGYZFsU&client_secret=TixzvOnw7nLEUdiQEmkHzkXKrY4HhiGh&sid=bxyDHuJKsdkjMlTJ +> +> If this was not you, you can safely ignore this email. Thank you. + +## User clicks on the link + +The browser displays the following message: + +> Your email has now been validated, please return to your client. You may now close this window. + +## User returns on Element + +User clicks on CONTINUE + +> POST https://homeserver.org/_matrix/client/r0/account/3pid/add + +```json +{ + "sid": "bxyDHuJKsdkjMlTJ", + "client_secret": "TixzvOnw7nLEUdiQEmkHzkXKrY4HhiGh" +} +``` + +401 User Interactive Authentication + +```json +{ + "session": "ppvvnozXCQZFaggUBlHJYPjA", + "flows": [ + { + "stages": [ + "m.login.password" + ] + } + ], + "params": { + } +} +``` + +## User enters his password + +POST https://homeserver.org/_matrix/client/r0/account/3pid/add + +```json +{ + "sid": "bxyDHuJKsdkjMlTJ", + "client_secret": "TixzvOnw7nLEUdiQEmkHzkXKrY4HhiGh", + "auth": { + "session": "ppvvnozXCQZFaggUBlHJYPjA", + "type": "m.login.password", + "user": "@benoitx:matrix.org", + "identifier": { + "type": "m.id.user", + "user": "@benoitx:matrix.org" + }, + "password": "weak_password" + } +} +``` + +### The link has not been clicked + +400 + +```json +{ + "errcode": "M_THREEPID_AUTH_FAILED", + "error": "No validated 3pid session found" +} +``` + +### Wrong password + +401 + +```json +{ + "session": "fXHOvoQsPMhEebVqTnIrzZJN", + "flows": [ + { + "stages": [ + "m.login.password" + ] + } + ], + "params": { + }, + "completed":[ + ], + "error": "Invalid password", + "errcode": "M_FORBIDDEN" +} +``` + +### The link has been clicked and the account password is correct + +200 + +```json +{} +``` + +# Remove email + +## User want to remove the email from his account + +> POST https://homeserver.org/_matrix/client/r0/account/3pid/delete + +```json +{ + "medium": "email", + "address": "alice@email-provider.org" +} +``` + +### Email was not bound to an identity server + +200 + +```json +{ + "id_server_unbind_result": "no-support" +} +``` + +### Email was bound to an identity server + +200 + +```json +{ + "id_server_unbind_result": "success" +} +``` From b11eced4f14b179ab0cacd7a4c3bfdf93b228fdb Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 28 Aug 2020 11:12:29 +0200 Subject: [PATCH 03/47] Fix a refresh problem on the user avatar --- .../app/core/preference/UserAvatarPreference.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/vector/src/main/java/im/vector/app/core/preference/UserAvatarPreference.kt b/vector/src/main/java/im/vector/app/core/preference/UserAvatarPreference.kt index e3b4430fe0..3bb50c6284 100755 --- a/vector/src/main/java/im/vector/app/core/preference/UserAvatarPreference.kt +++ b/vector/src/main/java/im/vector/app/core/preference/UserAvatarPreference.kt @@ -26,6 +26,7 @@ import im.vector.app.R import im.vector.app.core.extensions.vectorComponent import im.vector.app.features.home.AvatarRenderer import org.matrix.android.sdk.api.session.user.model.User +import org.matrix.android.sdk.api.util.MatrixItem import org.matrix.android.sdk.api.util.toMatrixItem class UserAvatarPreference : Preference { @@ -34,6 +35,8 @@ class UserAvatarPreference : Preference { private var avatarRenderer: AvatarRenderer = context.vectorComponent().avatarRenderer() + private var userItem: MatrixItem.UserItem? = null + constructor(context: Context) : super(context) constructor(context: Context, attrs: AttributeSet) : super(context, attrs) @@ -50,9 +53,16 @@ class UserAvatarPreference : Preference { super.onBindViewHolder(holder) mAvatarView = holder.itemView.findViewById(R.id.settings_avatar) mLoadingProgressBar = holder.itemView.findViewById(R.id.avatar_update_progress_bar) + refreshUi() } fun refreshAvatar(user: User) { - mAvatarView?.let { avatarRenderer.render(user.toMatrixItem(), it) } + userItem = user.toMatrixItem() + refreshUi() + } + + private fun refreshUi() { + val safeUserItem = userItem ?: return + mAvatarView?.let { avatarRenderer.render(safeUserItem, it) } } } From 46d3608ccb5c705fea92f7f585cba8fce6d92cbc Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 28 Aug 2020 11:25:16 +0200 Subject: [PATCH 04/47] RiotX -> Element --- .../{RiotXFeature => ElementFeature}/globals.xml.ftl | 0 .../templates/{RiotXFeature => ElementFeature}/recipe.xml.ftl | 0 .../root/res/layout/fragment.xml.ftl | 0 .../root/src/app_package/Action.kt.ftl | 0 .../root/src/app_package/Activity.kt.ftl | 0 .../root/src/app_package/Fragment.kt.ftl | 0 .../root/src/app_package/ViewEvents.kt.ftl | 0 .../root/src/app_package/ViewModel.kt.ftl | 0 .../root/src/app_package/ViewState.kt.ftl | 0 tools/templates/{RiotXFeature => ElementFeature}/template.xml | 2 +- tools/templates/configure.sh | 4 ++-- 11 files changed, 3 insertions(+), 3 deletions(-) rename tools/templates/{RiotXFeature => ElementFeature}/globals.xml.ftl (100%) rename tools/templates/{RiotXFeature => ElementFeature}/recipe.xml.ftl (100%) rename tools/templates/{RiotXFeature => ElementFeature}/root/res/layout/fragment.xml.ftl (100%) rename tools/templates/{RiotXFeature => ElementFeature}/root/src/app_package/Action.kt.ftl (100%) rename tools/templates/{RiotXFeature => ElementFeature}/root/src/app_package/Activity.kt.ftl (100%) rename tools/templates/{RiotXFeature => ElementFeature}/root/src/app_package/Fragment.kt.ftl (100%) rename tools/templates/{RiotXFeature => ElementFeature}/root/src/app_package/ViewEvents.kt.ftl (100%) rename tools/templates/{RiotXFeature => ElementFeature}/root/src/app_package/ViewModel.kt.ftl (100%) rename tools/templates/{RiotXFeature => ElementFeature}/root/src/app_package/ViewState.kt.ftl (100%) rename tools/templates/{RiotXFeature => ElementFeature}/template.xml (99%) diff --git a/tools/templates/RiotXFeature/globals.xml.ftl b/tools/templates/ElementFeature/globals.xml.ftl similarity index 100% rename from tools/templates/RiotXFeature/globals.xml.ftl rename to tools/templates/ElementFeature/globals.xml.ftl diff --git a/tools/templates/RiotXFeature/recipe.xml.ftl b/tools/templates/ElementFeature/recipe.xml.ftl similarity index 100% rename from tools/templates/RiotXFeature/recipe.xml.ftl rename to tools/templates/ElementFeature/recipe.xml.ftl diff --git a/tools/templates/RiotXFeature/root/res/layout/fragment.xml.ftl b/tools/templates/ElementFeature/root/res/layout/fragment.xml.ftl similarity index 100% rename from tools/templates/RiotXFeature/root/res/layout/fragment.xml.ftl rename to tools/templates/ElementFeature/root/res/layout/fragment.xml.ftl diff --git a/tools/templates/RiotXFeature/root/src/app_package/Action.kt.ftl b/tools/templates/ElementFeature/root/src/app_package/Action.kt.ftl similarity index 100% rename from tools/templates/RiotXFeature/root/src/app_package/Action.kt.ftl rename to tools/templates/ElementFeature/root/src/app_package/Action.kt.ftl diff --git a/tools/templates/RiotXFeature/root/src/app_package/Activity.kt.ftl b/tools/templates/ElementFeature/root/src/app_package/Activity.kt.ftl similarity index 100% rename from tools/templates/RiotXFeature/root/src/app_package/Activity.kt.ftl rename to tools/templates/ElementFeature/root/src/app_package/Activity.kt.ftl diff --git a/tools/templates/RiotXFeature/root/src/app_package/Fragment.kt.ftl b/tools/templates/ElementFeature/root/src/app_package/Fragment.kt.ftl similarity index 100% rename from tools/templates/RiotXFeature/root/src/app_package/Fragment.kt.ftl rename to tools/templates/ElementFeature/root/src/app_package/Fragment.kt.ftl diff --git a/tools/templates/RiotXFeature/root/src/app_package/ViewEvents.kt.ftl b/tools/templates/ElementFeature/root/src/app_package/ViewEvents.kt.ftl similarity index 100% rename from tools/templates/RiotXFeature/root/src/app_package/ViewEvents.kt.ftl rename to tools/templates/ElementFeature/root/src/app_package/ViewEvents.kt.ftl diff --git a/tools/templates/RiotXFeature/root/src/app_package/ViewModel.kt.ftl b/tools/templates/ElementFeature/root/src/app_package/ViewModel.kt.ftl similarity index 100% rename from tools/templates/RiotXFeature/root/src/app_package/ViewModel.kt.ftl rename to tools/templates/ElementFeature/root/src/app_package/ViewModel.kt.ftl diff --git a/tools/templates/RiotXFeature/root/src/app_package/ViewState.kt.ftl b/tools/templates/ElementFeature/root/src/app_package/ViewState.kt.ftl similarity index 100% rename from tools/templates/RiotXFeature/root/src/app_package/ViewState.kt.ftl rename to tools/templates/ElementFeature/root/src/app_package/ViewState.kt.ftl diff --git a/tools/templates/RiotXFeature/template.xml b/tools/templates/ElementFeature/template.xml similarity index 99% rename from tools/templates/RiotXFeature/template.xml rename to tools/templates/ElementFeature/template.xml index 33d2edfc70..14c718c993 100644 --- a/tools/templates/RiotXFeature/template.xml +++ b/tools/templates/ElementFeature/template.xml @@ -2,7 +2,7 @@