mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-23 01:45:52 +03:00
Fix some errors
This commit is contained in:
parent
9af8355c07
commit
edb65f1787
4 changed files with 32 additions and 19 deletions
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* 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.riotx.features.login
|
||||
|
||||
// TODO Check the link with Nad
|
||||
const val MODULAR_LINK = "https://modular.im/?utm_source=riot-web&utm_medium=web&utm_campaign=riot-web-authentication"
|
|
@ -191,9 +191,8 @@ class LoginFragment @Inject constructor(
|
|||
renderPasswordField()
|
||||
}
|
||||
is Fail -> {
|
||||
// TODO This does not work, we want the error to be on without text. Fix that
|
||||
loginFieldTil.error = ""
|
||||
// TODO Handle error text properly
|
||||
// Trick to display the error without text.
|
||||
loginFieldTil.error = " "
|
||||
passwordFieldTil.error = errorFormatter.toHumanReadable(state.asyncLoginAction.error)
|
||||
}
|
||||
// Success is handled by the LoginActivity
|
||||
|
|
|
@ -68,11 +68,12 @@ class LoginServerSelectionFragment @Inject constructor(
|
|||
loginServerChoiceModularLearnMore.text = span {
|
||||
text = getString(R.string.login_server_modular_learn_more)
|
||||
textDecorationLine = "underline"
|
||||
onClick = {
|
||||
// TODO this does not work
|
||||
openUrlInExternalBrowser(requireActivity(), "https://example.org")
|
||||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.loginServerChoiceModularLearnMore)
|
||||
fun learMore() {
|
||||
openUrlInExternalBrowser(requireActivity(), MODULAR_LINK)
|
||||
}
|
||||
|
||||
@OnClick(R.id.loginServerChoiceMatrixOrg)
|
||||
|
|
|
@ -50,15 +50,10 @@ class LoginServerUrlFormFragment @Inject constructor(
|
|||
}
|
||||
|
||||
private fun setupHomeServerField() {
|
||||
// TODO Import code from Riot to clear error on TIL
|
||||
loginServerUrlFormHomeServerUrl.textChanges()
|
||||
.subscribe(
|
||||
{
|
||||
.subscribe {
|
||||
loginServerUrlFormHomeServerUrlTil.error = null
|
||||
},
|
||||
{
|
||||
// Ignore error
|
||||
})
|
||||
}
|
||||
.disposeOnDestroyView()
|
||||
|
||||
loginServerUrlFormHomeServerUrl.setOnEditorActionListener { _, actionId, _ ->
|
||||
|
@ -88,14 +83,13 @@ class LoginServerUrlFormFragment @Inject constructor(
|
|||
loginServerUrlFormHomeServerUrlTil.hint = getText(R.string.login_server_url_form_other_hint)
|
||||
loginServerUrlFormNotice.text = getString(R.string.login_server_url_form_other_notice)
|
||||
}
|
||||
else -> error("This fragment should not be display in matrix.org mode")
|
||||
else -> error("This fragment should not be displayed in matrix.org mode")
|
||||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.loginServerUrlFormLearnMore)
|
||||
fun learMore() {
|
||||
// TODO
|
||||
openUrlInExternalBrowser(requireActivity(), "https://example.org")
|
||||
openUrlInExternalBrowser(requireActivity(), MODULAR_LINK)
|
||||
}
|
||||
|
||||
override fun resetViewModel() {
|
||||
|
@ -134,7 +128,6 @@ class LoginServerUrlFormFragment @Inject constructor(
|
|||
override fun invalidate() = withState(loginViewModel) { state ->
|
||||
when (state.asyncHomeServerLoginFlowRequest) {
|
||||
is Fail -> {
|
||||
// TODO Error text is not correct
|
||||
loginServerUrlFormHomeServerUrlTil.error = errorFormatter.toHumanReadable(state.asyncHomeServerLoginFlowRequest.error)
|
||||
}
|
||||
is Success -> {
|
||||
|
|
Loading…
Reference in a new issue