mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-06 12:28:29 +00:00
implemented the space selection list and the selection logic
# Conflicts: # ElementX/Sources/Screens/CreateRoomScreen/View/CreateRoomScreen.swift
This commit is contained in:
@@ -85,6 +85,7 @@
|
|||||||
"action_enable" = "Enable";
|
"action_enable" = "Enable";
|
||||||
"action_end_poll" = "End poll";
|
"action_end_poll" = "End poll";
|
||||||
"action_enter_pin" = "Enter PIN";
|
"action_enter_pin" = "Enter PIN";
|
||||||
|
"action_explore_public_spaces" = "Explore public spaces";
|
||||||
"action_finish" = "Finish";
|
"action_finish" = "Finish";
|
||||||
"action_forgot_password" = "Forgot password?";
|
"action_forgot_password" = "Forgot password?";
|
||||||
"action_forward" = "Forward";
|
"action_forward" = "Forward";
|
||||||
@@ -553,6 +554,9 @@
|
|||||||
"screen_create_room_room_address_section_footer" = "You’ll need an address in order to make it visible in the public directory.";
|
"screen_create_room_room_address_section_footer" = "You’ll need an address in order to make it visible in the public directory.";
|
||||||
"screen_create_room_room_address_section_title" = "Address";
|
"screen_create_room_room_address_section_title" = "Address";
|
||||||
"screen_create_room_room_visibility_section_title" = "Room visibility";
|
"screen_create_room_room_visibility_section_title" = "Room visibility";
|
||||||
|
"screen_create_room_space_selection_no_space_description" = "(no space)";
|
||||||
|
"screen_create_room_space_selection_no_space_title" = "Home";
|
||||||
|
"screen_create_room_space_selection_sheet_title" = "Add to space";
|
||||||
"screen_create_room_topic_placeholder" = "Add description…";
|
"screen_create_room_topic_placeholder" = "Add description…";
|
||||||
"screen_decline_and_block_block_user_option_description" = "You will not see any messages or room invites from this user";
|
"screen_decline_and_block_block_user_option_description" = "You will not see any messages or room invites from this user";
|
||||||
"screen_decline_and_block_report_user_option_description" = "Report this room to your account provider.";
|
"screen_decline_and_block_report_user_option_description" = "Report this room to your account provider.";
|
||||||
|
|||||||
@@ -85,6 +85,7 @@
|
|||||||
"action_enable" = "Enable";
|
"action_enable" = "Enable";
|
||||||
"action_end_poll" = "End poll";
|
"action_end_poll" = "End poll";
|
||||||
"action_enter_pin" = "Enter PIN";
|
"action_enter_pin" = "Enter PIN";
|
||||||
|
"action_explore_public_spaces" = "Explore public spaces";
|
||||||
"action_finish" = "Finish";
|
"action_finish" = "Finish";
|
||||||
"action_forgot_password" = "Forgot password?";
|
"action_forgot_password" = "Forgot password?";
|
||||||
"action_forward" = "Forward";
|
"action_forward" = "Forward";
|
||||||
@@ -553,6 +554,9 @@
|
|||||||
"screen_create_room_room_address_section_footer" = "You’ll need an address in order to make it visible in the public directory.";
|
"screen_create_room_room_address_section_footer" = "You’ll need an address in order to make it visible in the public directory.";
|
||||||
"screen_create_room_room_address_section_title" = "Address";
|
"screen_create_room_room_address_section_title" = "Address";
|
||||||
"screen_create_room_room_visibility_section_title" = "Room visibility";
|
"screen_create_room_room_visibility_section_title" = "Room visibility";
|
||||||
|
"screen_create_room_space_selection_no_space_description" = "(no space)";
|
||||||
|
"screen_create_room_space_selection_no_space_title" = "Home";
|
||||||
|
"screen_create_room_space_selection_sheet_title" = "Add to space";
|
||||||
"screen_create_room_topic_placeholder" = "Add description…";
|
"screen_create_room_topic_placeholder" = "Add description…";
|
||||||
"screen_decline_and_block_block_user_option_description" = "You will not see any messages or room invites from this user";
|
"screen_decline_and_block_block_user_option_description" = "You will not see any messages or room invites from this user";
|
||||||
"screen_decline_and_block_report_user_option_description" = "Report this room to your account provider.";
|
"screen_decline_and_block_report_user_option_description" = "Report this room to your account provider.";
|
||||||
|
|||||||
@@ -204,6 +204,8 @@ internal enum L10n {
|
|||||||
internal static var actionEndPoll: String { return L10n.tr("Localizable", "action_end_poll") }
|
internal static var actionEndPoll: String { return L10n.tr("Localizable", "action_end_poll") }
|
||||||
/// Enter PIN
|
/// Enter PIN
|
||||||
internal static var actionEnterPin: String { return L10n.tr("Localizable", "action_enter_pin") }
|
internal static var actionEnterPin: String { return L10n.tr("Localizable", "action_enter_pin") }
|
||||||
|
/// Explore public spaces
|
||||||
|
internal static var actionExplorePublicSpaces: String { return L10n.tr("Localizable", "action_explore_public_spaces") }
|
||||||
/// Finish
|
/// Finish
|
||||||
internal static var actionFinish: String { return L10n.tr("Localizable", "action_finish") }
|
internal static var actionFinish: String { return L10n.tr("Localizable", "action_finish") }
|
||||||
/// Forgot password?
|
/// Forgot password?
|
||||||
@@ -1634,6 +1636,12 @@ internal enum L10n {
|
|||||||
internal static var screenCreateRoomRoomAddressSectionTitle: String { return L10n.tr("Localizable", "screen_create_room_room_address_section_title") }
|
internal static var screenCreateRoomRoomAddressSectionTitle: String { return L10n.tr("Localizable", "screen_create_room_room_address_section_title") }
|
||||||
/// Room visibility
|
/// Room visibility
|
||||||
internal static var screenCreateRoomRoomVisibilitySectionTitle: String { return L10n.tr("Localizable", "screen_create_room_room_visibility_section_title") }
|
internal static var screenCreateRoomRoomVisibilitySectionTitle: String { return L10n.tr("Localizable", "screen_create_room_room_visibility_section_title") }
|
||||||
|
/// (no space)
|
||||||
|
internal static var screenCreateRoomSpaceSelectionNoSpaceDescription: String { return L10n.tr("Localizable", "screen_create_room_space_selection_no_space_description") }
|
||||||
|
/// Home
|
||||||
|
internal static var screenCreateRoomSpaceSelectionNoSpaceTitle: String { return L10n.tr("Localizable", "screen_create_room_space_selection_no_space_title") }
|
||||||
|
/// Add to space
|
||||||
|
internal static var screenCreateRoomSpaceSelectionSheetTitle: String { return L10n.tr("Localizable", "screen_create_room_space_selection_sheet_title") }
|
||||||
/// Topic (optional)
|
/// Topic (optional)
|
||||||
internal static var screenCreateRoomTopicLabel: String { return L10n.tr("Localizable", "screen_create_room_topic_label") }
|
internal static var screenCreateRoomTopicLabel: String { return L10n.tr("Localizable", "screen_create_room_topic_label") }
|
||||||
/// Add description…
|
/// Add description…
|
||||||
|
|||||||
@@ -234,7 +234,10 @@ struct CreateRoomScreen: View {
|
|||||||
context.showSpaceSelectionSheet = true
|
context.showSpaceSelectionSheet = true
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
ListRow(label: .default(title: "Test", icon: \.home),
|
ListRow(label: .default(title: L10n.screenCreateRoomSpaceSelectionNoSpaceTitle,
|
||||||
|
description: L10n.screenCreateRoomSpaceSelectionNoSpaceDescription,
|
||||||
|
icon: \.home,
|
||||||
|
iconAlignment: .top),
|
||||||
kind: .navigationLink {
|
kind: .navigationLink {
|
||||||
context.showSpaceSelectionSheet = true
|
context.showSpaceSelectionSheet = true
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -5,18 +5,80 @@
|
|||||||
// Please see LICENSE files in the repository root for full details.
|
// Please see LICENSE files in the repository root for full details.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
import Compound
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct CreateRoomSpaceSelectionSheet: View {
|
struct CreateRoomSpaceSelectionSheet: View {
|
||||||
@ObservedObject var context: CreateRoomScreenViewModel.Context
|
@ObservedObject var context: CreateRoomScreenViewModel.Context
|
||||||
|
@Environment(\.dismiss) private var dismiss
|
||||||
|
|
||||||
|
private var dragIndicatorVisibilty: Visibility {
|
||||||
|
if #available(iOS 26, *) {
|
||||||
|
.hidden
|
||||||
|
} else {
|
||||||
|
.automatic
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
EmptyView()
|
NavigationStack {
|
||||||
|
List {
|
||||||
|
Section {
|
||||||
|
ListRow(label: .default(title: L10n.screenCreateRoomSpaceSelectionNoSpaceTitle,
|
||||||
|
description: L10n.screenCreateRoomSpaceSelectionNoSpaceDescription,
|
||||||
|
icon: \.home),
|
||||||
|
kind: .selection(isSelected: context.selectedSpace == nil) {
|
||||||
|
context.selectedSpace = nil
|
||||||
|
dismiss()
|
||||||
|
})
|
||||||
|
ForEach(context.viewState.topLevelSpaces, id: \.id) { space in
|
||||||
|
ListRow(label: .avatar(title: space.name,
|
||||||
|
description: space.canonicalAlias,
|
||||||
|
icon: RoomAvatarImage(avatar: space.avatar,
|
||||||
|
avatarSize: .room(on: .createRoomSelectSpace),
|
||||||
|
mediaProvider: context.mediaProvider)),
|
||||||
|
kind: .selection(isSelected: context.selectedSpace?.id == space.id) {
|
||||||
|
context.selectedSpace = space
|
||||||
|
dismiss()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.listStyle(.plain)
|
||||||
|
.environment(\.defaultMinListRowHeight, 66)
|
||||||
|
.scrollContentBackground(.hidden)
|
||||||
|
.background(Color.compound.bgCanvasDefault.ignoresSafeArea())
|
||||||
|
.navigationTitle(L10n.screenCreateRoomSpaceSelectionSheetTitle)
|
||||||
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
|
.toolbar {
|
||||||
|
ToolbarItem(placement: .topBarTrailing) {
|
||||||
|
ToolbarButton(role: .cancel) {
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.presentationDetents([.medium, .large])
|
||||||
|
.presentationDragIndicator(dragIndicatorVisibilty)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CreateRoomSpaceSelectionSheet_Previews: PreviewProvider, TestablePreview {
|
struct CreateRoomSpaceSelectionSheet_Previews: PreviewProvider, TestablePreview {
|
||||||
|
static let viewModel = {
|
||||||
|
let clientProxy = ClientProxyMock(.init(userID: "@userid:example.com"))
|
||||||
|
clientProxy.spaceService = SpaceServiceProxyMock(.init(topLevelSpaces: .mockJoinedSpaces2))
|
||||||
|
let userSession = UserSessionMock(.init(clientProxy: clientProxy))
|
||||||
|
|
||||||
|
return CreateRoomScreenViewModel(isSpace: false,
|
||||||
|
spaceSelectionMode: .list,
|
||||||
|
shouldShowCancelButton: false,
|
||||||
|
userSession: userSession,
|
||||||
|
analytics: ServiceLocator.shared.analytics,
|
||||||
|
userIndicatorController: UserIndicatorControllerMock(),
|
||||||
|
appSettings: ServiceLocator.shared.settings)
|
||||||
|
}()
|
||||||
|
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
EmptyView()
|
CreateRoomSpaceSelectionSheet(context: viewModel.context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user