mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-11 00:38:54 +03:00
Warn the user if room alias is not empty and he wants to leave the form.
This commit is contained in:
parent
16b6678aa2
commit
507d5d3758
1 changed files with 5 additions and 1 deletions
|
@ -20,6 +20,7 @@ import android.net.Uri
|
||||||
import com.airbnb.mvrx.Async
|
import com.airbnb.mvrx.Async
|
||||||
import com.airbnb.mvrx.MvRxState
|
import com.airbnb.mvrx.MvRxState
|
||||||
import com.airbnb.mvrx.Uninitialized
|
import com.airbnb.mvrx.Uninitialized
|
||||||
|
import org.matrix.android.sdk.api.extensions.orTrue
|
||||||
|
|
||||||
data class CreateRoomViewState(
|
data class CreateRoomViewState(
|
||||||
val avatarUri: Uri? = null,
|
val avatarUri: Uri? = null,
|
||||||
|
@ -41,7 +42,10 @@ data class CreateRoomViewState(
|
||||||
/**
|
/**
|
||||||
* Return true if there is not important input from user
|
* Return true if there is not important input from user
|
||||||
*/
|
*/
|
||||||
fun isEmpty() = avatarUri == null && roomName.isEmpty() && roomTopic.isEmpty()
|
fun isEmpty() = avatarUri == null
|
||||||
|
&& roomName.isEmpty()
|
||||||
|
&& roomTopic.isEmpty()
|
||||||
|
&& (roomType as? RoomType.Public)?.aliasLocalPart?.isEmpty().orTrue()
|
||||||
|
|
||||||
sealed class RoomType {
|
sealed class RoomType {
|
||||||
object Private : RoomType()
|
object Private : RoomType()
|
||||||
|
|
Loading…
Add table
Reference in a new issue