Warn the user if room alias is not empty and he wants to leave the form.

This commit is contained in:
Benoit Marty 2020-11-18 14:21:53 +01:00
parent 16b6678aa2
commit 507d5d3758

View file

@ -20,6 +20,7 @@ import android.net.Uri
import com.airbnb.mvrx.Async
import com.airbnb.mvrx.MvRxState
import com.airbnb.mvrx.Uninitialized
import org.matrix.android.sdk.api.extensions.orTrue
data class CreateRoomViewState(
val avatarUri: Uri? = null,
@ -41,7 +42,10 @@ data class CreateRoomViewState(
/**
* 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 {
object Private : RoomType()