mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-01-02 04:46:47 +01:00
Create DM: now any userId can be entered, so deal with the case of the userId does not exists.
Use same string resource value than Riot-Web
This commit is contained in:
parent
06cf59bca7
commit
1363100f94
@ -28,6 +28,7 @@ import com.airbnb.mvrx.Fail
|
||||
import com.airbnb.mvrx.Loading
|
||||
import com.airbnb.mvrx.Success
|
||||
import com.airbnb.mvrx.viewModel
|
||||
import im.vector.matrix.android.api.failure.Failure
|
||||
import im.vector.matrix.android.api.session.room.failure.CreateRoomFailure
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.di.ScreenComponent
|
||||
@ -37,6 +38,7 @@ import im.vector.riotx.core.extensions.addFragmentToBackstack
|
||||
import im.vector.riotx.core.platform.SimpleFragmentActivity
|
||||
import im.vector.riotx.core.platform.WaitingViewData
|
||||
import kotlinx.android.synthetic.main.activity.*
|
||||
import java.net.HttpURLConnection
|
||||
import javax.inject.Inject
|
||||
|
||||
class CreateDirectRoomActivity : SimpleFragmentActivity() {
|
||||
@ -91,8 +93,14 @@ class CreateDirectRoomActivity : SimpleFragmentActivity() {
|
||||
if (error is CreateRoomFailure.CreatedWithTimeout) {
|
||||
finish()
|
||||
} else {
|
||||
val message = if (error is Failure.ServerError && error.httpCode == HttpURLConnection.HTTP_INTERNAL_ERROR /*500*/) {
|
||||
// This error happen if the invited userId does not exist.
|
||||
getString(R.string.create_room_dm_failure)
|
||||
} else {
|
||||
errorFormatter.toHumanReadable(error)
|
||||
}
|
||||
AlertDialog.Builder(this)
|
||||
.setMessage(errorFormatter.toHumanReadable(error))
|
||||
.setMessage(message)
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.show()
|
||||
}
|
||||
|
@ -29,4 +29,5 @@
|
||||
|
||||
<!-- END Strings added by Others -->
|
||||
|
||||
<string name="create_room_dm_failure">"We couldn't create your DM. Please check the users you want to invite and try again."</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user