mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Add alias to public room creation (#3450)
* added the address section * updated code and strings * syncing name and address * improved code * added a way to reset the state * better documentation * update strings * handling the alias * alias error state * update strings * error handling * improved the error handling * new preview tests, even if they do not work well * improved tests * unit tests * pr comments and using the correct value * fix * pr comments * to improve safety and control of the FF * fixed a test * updated tests * update SDK
This commit is contained in:
@@ -25,20 +25,32 @@ enum CreateRoomViewModelAction {
|
||||
}
|
||||
|
||||
struct CreateRoomViewState: BindableState {
|
||||
var roomName: String
|
||||
let serverName: String
|
||||
let isKnockingFeatureEnabled: Bool
|
||||
var selectedUsers: [UserProfileProxy]
|
||||
var aliasLocalPart: String
|
||||
var bindings: CreateRoomViewStateBindings
|
||||
var avatarURL: URL?
|
||||
var canCreateRoom: Bool {
|
||||
!bindings.roomName.isEmpty
|
||||
!roomName.isEmpty && aliasErrors.isEmpty
|
||||
}
|
||||
|
||||
var aliasErrors: Set<CreateRoomAliasErrorState> = []
|
||||
var aliasErrorDescription: String? {
|
||||
if aliasErrors.contains(.alreadyExists) {
|
||||
return L10n.screenCreateRoomRoomAddressNotAvailableErrorDescription
|
||||
} else if aliasErrors.contains(.invalidSymbols) {
|
||||
return L10n.screenCreateRoomRoomAddressInvalidSymbolsErrorDescription
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
struct CreateRoomViewStateBindings {
|
||||
var roomName: String
|
||||
var roomTopic: String
|
||||
var isRoomPrivate: Bool
|
||||
var isKnockingOnly = false
|
||||
var isKnockingOnly: Bool
|
||||
var showAttachmentConfirmationDialog = false
|
||||
|
||||
/// Information describing the currently displayed alert.
|
||||
@@ -51,4 +63,11 @@ enum CreateRoomViewAction {
|
||||
case displayCameraPicker
|
||||
case displayMediaPicker
|
||||
case removeImage
|
||||
case updateRoomName(String)
|
||||
case updateAliasLocalPart(String)
|
||||
}
|
||||
|
||||
enum CreateRoomAliasErrorState {
|
||||
case alreadyExists
|
||||
case invalidSymbols
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user