mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 17:35:54 +03:00
Merge branch 'develop' into feature/fix_crashes_attachment_viewer
This commit is contained in:
commit
96a3b25adb
5 changed files with 26 additions and 13 deletions
|
@ -15,9 +15,11 @@ Bugfix 🐛:
|
||||||
- Fix FontSize issue (#1483, #1787)
|
- Fix FontSize issue (#1483, #1787)
|
||||||
- Fix bad color for settings icon on Android < 24 (#1786)
|
- 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)
|
- Change user or room avatar: when selecting Gallery, I'm not proposed to crop the selected image (#1590)
|
||||||
|
- Loudspeaker is always used (#1685)
|
||||||
- Fix uploads still don't work with room v6 (#1879)
|
- Fix uploads still don't work with room v6 (#1879)
|
||||||
- Can't handle ongoing call events in background (#1992)
|
- Can't handle ongoing call events in background (#1992)
|
||||||
- Crash / Attachment viewer: Cannot draw a recycled Bitmap #2034
|
- Crash / Attachment viewer: Cannot draw a recycled Bitmap #2034
|
||||||
|
- Login with Matrix-Id | Autodiscovery fails if identity server is invalid and Homeserver ok (#2027)
|
||||||
|
|
||||||
Translations 🗣:
|
Translations 🗣:
|
||||||
-
|
-
|
||||||
|
|
|
@ -45,7 +45,7 @@ sealed class WellknownResult {
|
||||||
/**
|
/**
|
||||||
* Inform the user that auto-discovery failed due to invalid/empty data and PROMPT for the parameter.
|
* Inform the user that auto-discovery failed due to invalid/empty data and PROMPT for the parameter.
|
||||||
*/
|
*/
|
||||||
object FailPrompt : WellknownResult()
|
data class FailPrompt(val homeServerUrl: String?, val wellKnown: WellKnown?) : WellknownResult()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inform the user that auto-discovery did not return any usable URLs. Do not continue further with the current login process.
|
* Inform the user that auto-discovery did not return any usable URLs. Do not continue further with the current login process.
|
||||||
|
|
|
@ -97,7 +97,7 @@ internal class DefaultGetWellknownTask @Inject constructor(
|
||||||
// Success
|
// Success
|
||||||
val homeServerBaseUrl = wellKnown.homeServer?.baseURL
|
val homeServerBaseUrl = wellKnown.homeServer?.baseURL
|
||||||
if (homeServerBaseUrl.isNullOrBlank()) {
|
if (homeServerBaseUrl.isNullOrBlank()) {
|
||||||
WellknownResult.FailPrompt
|
WellknownResult.FailPrompt(null, null)
|
||||||
} else {
|
} else {
|
||||||
if (homeServerBaseUrl.isValidUrl()) {
|
if (homeServerBaseUrl.isValidUrl()) {
|
||||||
// Check that HS is a real one
|
// Check that HS is a real one
|
||||||
|
@ -120,11 +120,11 @@ internal class DefaultGetWellknownTask @Inject constructor(
|
||||||
is Failure.OtherServerError -> {
|
is Failure.OtherServerError -> {
|
||||||
when (throwable.httpCode) {
|
when (throwable.httpCode) {
|
||||||
HttpsURLConnection.HTTP_NOT_FOUND -> WellknownResult.Ignore
|
HttpsURLConnection.HTTP_NOT_FOUND -> WellknownResult.Ignore
|
||||||
else -> WellknownResult.FailPrompt
|
else -> WellknownResult.FailPrompt(null, null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is MalformedJsonException, is EOFException -> {
|
is MalformedJsonException, is EOFException -> {
|
||||||
WellknownResult.FailPrompt
|
WellknownResult.FailPrompt(null, null)
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
throw throwable
|
throw throwable
|
||||||
|
@ -162,7 +162,7 @@ internal class DefaultGetWellknownTask @Inject constructor(
|
||||||
// All is ok
|
// All is ok
|
||||||
WellknownResult.Prompt(homeServerBaseUrl, identityServerBaseUrl, wellKnown)
|
WellknownResult.Prompt(homeServerBaseUrl, identityServerBaseUrl, wellKnown)
|
||||||
} else {
|
} else {
|
||||||
WellknownResult.FailError
|
WellknownResult.FailPrompt(homeServerBaseUrl, wellKnown)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
WellknownResult.FailError
|
WellknownResult.FailError
|
||||||
|
|
|
@ -125,7 +125,7 @@ class CallAudioManager(
|
||||||
} else {
|
} else {
|
||||||
// if a wired headset is plugged, sound will be directed to it
|
// if a wired headset is plugged, sound will be directed to it
|
||||||
// (can't really force earpiece when headset is plugged)
|
// (can't really force earpiece when headset is plugged)
|
||||||
if (isBluetoothHeadsetOn()) {
|
if (isBluetoothHeadsetConnected(audioManager)) {
|
||||||
Timber.v("##VOIP: AudioManager default to WIRELESS_HEADSET ")
|
Timber.v("##VOIP: AudioManager default to WIRELESS_HEADSET ")
|
||||||
setCurrentSoundDevice(SoundDevice.WIRELESS_HEADSET)
|
setCurrentSoundDevice(SoundDevice.WIRELESS_HEADSET)
|
||||||
// try now in case already connected?
|
// try now in case already connected?
|
||||||
|
@ -246,7 +246,7 @@ class CallAudioManager(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isHeadsetOn(): Boolean {
|
private fun isHeadsetOn(): Boolean {
|
||||||
return isWiredHeadsetOn() || isBluetoothHeadsetOn()
|
return isWiredHeadsetOn() || (audioManager?.let { isBluetoothHeadsetConnected(it) } ?: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isWiredHeadsetOn(): Boolean {
|
private fun isWiredHeadsetOn(): Boolean {
|
||||||
|
|
|
@ -522,6 +522,13 @@ class LoginViewModel @AssistedInject constructor(
|
||||||
when (data) {
|
when (data) {
|
||||||
is WellknownResult.Prompt ->
|
is WellknownResult.Prompt ->
|
||||||
onWellknownSuccess(action, data, homeServerConnectionConfig)
|
onWellknownSuccess(action, data, homeServerConnectionConfig)
|
||||||
|
is WellknownResult.FailPrompt ->
|
||||||
|
// Relax on IS discovery if home server is valid
|
||||||
|
if (data.homeServerUrl != null && data.wellKnown != null) {
|
||||||
|
onWellknownSuccess(action, WellknownResult.Prompt(data.homeServerUrl!!, null, data.wellKnown!!), homeServerConnectionConfig)
|
||||||
|
} else {
|
||||||
|
onWellKnownError()
|
||||||
|
}
|
||||||
is WellknownResult.InvalidMatrixId -> {
|
is WellknownResult.InvalidMatrixId -> {
|
||||||
setState {
|
setState {
|
||||||
copy(
|
copy(
|
||||||
|
@ -531,12 +538,7 @@ class LoginViewModel @AssistedInject constructor(
|
||||||
_viewEvents.post(LoginViewEvents.Failure(Exception(stringProvider.getString(R.string.login_signin_matrix_id_error_invalid_matrix_id))))
|
_viewEvents.post(LoginViewEvents.Failure(Exception(stringProvider.getString(R.string.login_signin_matrix_id_error_invalid_matrix_id))))
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
setState {
|
onWellKnownError()
|
||||||
copy(
|
|
||||||
asyncLoginAction = Uninitialized
|
|
||||||
)
|
|
||||||
}
|
|
||||||
_viewEvents.post(LoginViewEvents.Failure(Exception(stringProvider.getString(R.string.autodiscover_well_known_error))))
|
|
||||||
}
|
}
|
||||||
}.exhaustive
|
}.exhaustive
|
||||||
}
|
}
|
||||||
|
@ -547,6 +549,15 @@ class LoginViewModel @AssistedInject constructor(
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun onWellKnownError() {
|
||||||
|
setState {
|
||||||
|
copy(
|
||||||
|
asyncLoginAction = Uninitialized
|
||||||
|
)
|
||||||
|
}
|
||||||
|
_viewEvents.post(LoginViewEvents.Failure(Exception(stringProvider.getString(R.string.autodiscover_well_known_error))))
|
||||||
|
}
|
||||||
|
|
||||||
private fun onWellknownSuccess(action: LoginAction.LoginOrRegister,
|
private fun onWellknownSuccess(action: LoginAction.LoginOrRegister,
|
||||||
wellKnownPrompt: WellknownResult.Prompt,
|
wellKnownPrompt: WellknownResult.Prompt,
|
||||||
homeServerConnectionConfig: HomeServerConnectionConfig?) {
|
homeServerConnectionConfig: HomeServerConnectionConfig?) {
|
||||||
|
|
Loading…
Reference in a new issue