Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sp2 adding rooms to spaces #5548

Merged
merged 25 commits into from
Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
19ed010
Merge branch 'gil/5225_invite_to_space_in_room_landing' into gil/5224…
gileluard Dec 14, 2021
8e32734
Merge branch 'gil/5225_invite_to_space_in_room_landing' into gil/5224…
gileluard Dec 14, 2021
e4f5be0
Merge branch 'gil/5225_invite_to_space_in_room_landing' into gil/5224…
gileluard Dec 15, 2021
791b26a
Merge branch 'gil/5228_let_people_know_when_rooms_have_moved' into gi…
gileluard Dec 15, 2021
8f9df84
Merge branch 'gil/5225_invite_to_space_in_room_landing' into gil/5224…
gileluard Dec 15, 2021
f60441d
Merge branch 'develop' into gil/5224_space_creation
gileluard Dec 16, 2021
3350b26
Merge branch 'gil/143_create_public_space' into gil/5224_space_creation
gileluard Dec 16, 2021
21b46b7
Merge branch 'gil/5225_invite_to_space_in_room_landing' into gil/5224…
gileluard Dec 16, 2021
0b0a814
Merge branch 'gil/143_create_public_space' into gil/5224_space_creation
gileluard Dec 16, 2021
8195117
SP2: Adding Rooms to Spaces element-ios#5230
gileluard Dec 23, 2021
4c4f668
Merge branch 'develop' into gil/5230_SP2-Adding_Rooms_to_Spaces
gileluard Jan 17, 2022
601ba0b
Merge branch gil/SP1_space_creation into gil/5230_SP2-Adding_Rooms_to…
gileluard Feb 4, 2022
97e22f5
SP2: Adding Rooms to Spaces #523o
gileluard Feb 5, 2022
4a0f86e
Merge branch 'gil/SP1_space_creation' into gil/5230_SP2-Adding_Rooms_…
gileluard Feb 11, 2022
10959ca
Update RiotSwiftUI/Modules/Spaces/MatrixItemChooser/View/MatrixItemCh…
gileluard Feb 15, 2022
b9339d3
Update Riot/Routers/TabRouters/TabBarRouter.swift
gileluard Feb 15, 2022
ebbf1c8
Update RiotSwiftUI/Modules/Spaces/AddRoomSelector/View/AddRoomSelecto…
gileluard Feb 15, 2022
a916e5a
Update RiotSwiftUI/Modules/Spaces/MatrixItemChooser/View/MatrixItemCh…
gileluard Feb 15, 2022
efec050
Update RiotSwiftUI/Modules/Spaces/MatrixItemChooser/View/MatrixItemCh…
gileluard Feb 15, 2022
bdf2635
Update RiotSwiftUI/Modules/Spaces/MatrixItemChooser/View/MatrixItemCh…
gileluard Feb 15, 2022
06590ff
SP2: Adding Rooms to Spaces #523o
gileluard Feb 15, 2022
bd37bac
Update RiotSwiftUI/Modules/Spaces/AddRoomSelector/Service/AddRoomItem…
gileluard Feb 17, 2022
b601d60
SP2: Adding Rooms to Spaces #523o
gileluard Feb 17, 2022
f4e6b86
SP2: Adding Rooms to Spaces #523o
gileluard Feb 17, 2022
7b92f8a
SP2: Adding Rooms to Spaces #523o
gileluard Feb 17, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 25 additions & 10 deletions Riot/Assets/en.lproj/Vector.strings
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
"private" = "Private";
"public" = "Public";
"stop" = "Stop";
"new_word" = "New";
"existing" = "Existing";
"add" = "Add";
"ok" = "OK";

// Call Bar
Expand Down Expand Up @@ -1692,20 +1695,27 @@ Tap the + to start adding people.";
// MARK: - Create Room

"create_room_title" = "New Room";
"create_room_section_header_name" = "Room name";
"create_room_section_header_name" = "NAME";
"create_room_placeholder_name" = "Name";
"create_room_section_header_topic" = "Room topic (optional)";
"create_room_placeholder_topic" = "Topic";
"create_room_section_header_encryption" = "Room encryption";
"create_room_section_header_topic" = "TOPIC (OPTIONAL)";
"create_room_placeholder_topic" = "What is this room about?";
"create_room_section_header_encryption" = "ENCRYPTION";
"create_room_enable_encryption" = "Enable Encryption";
"create_room_section_footer_encryption" = "Encryption can’t be disabled afterwards.";
"create_room_section_header_type" = "Room type";
"create_room_type_private" = "Private Room";
"create_room_type_public" = "Public Room";
"create_room_section_footer_type" = "People join a private room only with the room invitation.";
"create_room_show_in_directory" = "Show the room in the directory";
"create_room_section_header_address" = "Room address";
"create_room_section_header_type" = "WHO CAN ACCESS";
"create_room_type_private" = "Private Room (invite only)";
"create_room_type_restricted" = "Space members";
"create_room_type_public" = "Public Room (anyone)";
"create_room_section_footer_type_private" = "Only people invited can find and join.";
"create_room_section_footer_type_restricted" = "Anyone in Space name can find and join.";
"create_room_section_footer_type_public" = "Only people invited can find and join, not just people in Space name.";
"create_room_promotion_header" = "PROMOTION";
"create_room_show_in_directory" = "Show in room directory";
"create_room_show_in_directory_footer" = "This will help people find and join.";
"create_room_section_header_address" = "ADDRESS";
"create_room_placeholder_address" = "#testroom:matrix.org";
"create_room_suggest_room" = "Suggest to space members";
"create_room_suggest_room_footer" = "Suggested rooms are promoted to space members as good to join.";

// MARK: - Room Info

Expand Down Expand Up @@ -1888,6 +1898,11 @@ Tap the + to start adding people.";
"spaces_creation_in_many_spaces" = "in %@ spaces";
"spaces_creation_in_one_space" = "in 1 space";

"spaces_invite_people" = "Invite people";
"spaces_add_room" = "Add room";
"spaces_add_room_missing_permission_message" = "You do not have permissions to add rooms to this space.";
"spaces_add_space" = "Add space";

// Mark: Avatar

"space_avatar_view_accessibility_label" = "avatar";
Expand Down
34 changes: 28 additions & 6 deletions Riot/Categories/UIViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,50 @@ extension UIViewController {
/// - Parameters:
/// - viewController: The child view controller to add.
/// - view: The view on which to add the child view controller view.
func vc_addChildViewController(viewController: UIViewController, onView view: UIView) {
/// - animated: true to add a fade in animation
func vc_addChildViewController(viewController: UIViewController, onView view: UIView, animated: Bool = false) {
self.addChild(viewController)

viewController.view.frame = view.bounds
if animated {
viewController.view.alpha = 0
}
view.vc_addSubViewMatchingParent(viewController.view)
if animated {
UIView.animate(withDuration: 0.2) {
viewController.view.alpha = 1
}
}
viewController.didMove(toParent: self)
}


/// Remove a child view controller from current view controller.
///
/// - Parameter viewController: The child view controller to remove.
func vc_removeChildViewController(viewController: UIViewController) {
/// - Parameters:
/// - viewController: The child view controller to remove.
/// - animated: true to add a fade out animation
func vc_removeChildViewController(viewController: UIViewController, animated: Bool = false) {
viewController.willMove(toParent: nil)
viewController.view.removeFromSuperview()
if animated {
UIView.animate(withDuration: 0.2) {
viewController.view.alpha = 0
} completion: { finished in
viewController.view.removeFromSuperview()
viewController.view.alpha = 1
}
} else {
viewController.view.removeFromSuperview()
}
viewController.removeFromParent()
}


/// Remove current view controller from parent.
func vc_removeFromParent() {
self.vc_removeChildViewController(viewController: self)
///
/// - Parameter animated: true to add a fade out animation
func vc_removeFromParent(animated: Bool = false) {
self.vc_removeChildViewController(viewController: self, animated: animated)
}

/// Adds a floating action button to the bottom-right of the page.
Expand Down
68 changes: 56 additions & 12 deletions Riot/Generated/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ public class VectorL10n: NSObject {
public static func activeCallDetails(_ p1: String) -> String {
return VectorL10n.tr("Vector", "active_call_details", p1)
}
/// Add
public static var add: String {
return VectorL10n.tr("Vector", "add")
}
/// Help us identify issues and improve %@ by sharing anonymous usage data. To understand how people use multiple devices, we’ll generate a random identifier, shared by your devices.
public static func analyticsPromptMessageNewUser(_ p1: String) -> String {
return VectorL10n.tr("Vector", "analytics_prompt_message_new_user", p1)
Expand Down Expand Up @@ -659,54 +663,82 @@ public class VectorL10n: NSObject {
public static var createRoomPlaceholderName: String {
return VectorL10n.tr("Vector", "create_room_placeholder_name")
}
/// Topic
/// What is this room about?
public static var createRoomPlaceholderTopic: String {
return VectorL10n.tr("Vector", "create_room_placeholder_topic")
}
/// PROMOTION
public static var createRoomPromotionHeader: String {
return VectorL10n.tr("Vector", "create_room_promotion_header")
}
/// Encryption can’t be disabled afterwards.
public static var createRoomSectionFooterEncryption: String {
return VectorL10n.tr("Vector", "create_room_section_footer_encryption")
}
/// People join a private room only with the room invitation.
public static var createRoomSectionFooterType: String {
return VectorL10n.tr("Vector", "create_room_section_footer_type")
/// Only people invited can find and join.
public static var createRoomSectionFooterTypePrivate: String {
return VectorL10n.tr("Vector", "create_room_section_footer_type_private")
}
/// Room address
/// Only people invited can find and join, not just people in Space name.
public static var createRoomSectionFooterTypePublic: String {
return VectorL10n.tr("Vector", "create_room_section_footer_type_public")
}
/// Anyone in Space name can find and join.
public static var createRoomSectionFooterTypeRestricted: String {
return VectorL10n.tr("Vector", "create_room_section_footer_type_restricted")
}
/// ADDRESS
public static var createRoomSectionHeaderAddress: String {
return VectorL10n.tr("Vector", "create_room_section_header_address")
}
/// Room encryption
/// ENCRYPTION
public static var createRoomSectionHeaderEncryption: String {
return VectorL10n.tr("Vector", "create_room_section_header_encryption")
}
/// Room name
/// NAME
public static var createRoomSectionHeaderName: String {
return VectorL10n.tr("Vector", "create_room_section_header_name")
}
/// Room topic (optional)
/// TOPIC (OPTIONAL)
public static var createRoomSectionHeaderTopic: String {
return VectorL10n.tr("Vector", "create_room_section_header_topic")
}
/// Room type
/// WHO CAN ACCESS
public static var createRoomSectionHeaderType: String {
return VectorL10n.tr("Vector", "create_room_section_header_type")
}
/// Show the room in the directory
/// Show in room directory
public static var createRoomShowInDirectory: String {
return VectorL10n.tr("Vector", "create_room_show_in_directory")
}
/// This will help people find and join.
public static var createRoomShowInDirectoryFooter: String {
return VectorL10n.tr("Vector", "create_room_show_in_directory_footer")
}
/// Suggest to space members
public static var createRoomSuggestRoom: String {
return VectorL10n.tr("Vector", "create_room_suggest_room")
}
/// Suggested rooms are promoted to space members as good to join.
public static var createRoomSuggestRoomFooter: String {
return VectorL10n.tr("Vector", "create_room_suggest_room_footer")
}
/// New Room
public static var createRoomTitle: String {
return VectorL10n.tr("Vector", "create_room_title")
}
/// Private Room
/// Private Room (invite only)
public static var createRoomTypePrivate: String {
return VectorL10n.tr("Vector", "create_room_type_private")
}
/// Public Room
/// Public Room (anyone)
public static var createRoomTypePublic: String {
return VectorL10n.tr("Vector", "create_room_type_public")
}
/// Space members
public static var createRoomTypeRestricted: String {
return VectorL10n.tr("Vector", "create_room_type_restricted")
}
/// Verify your other devices easier
public static var crossSigningSetupBannerSubtitle: String {
return VectorL10n.tr("Vector", "cross_signing_setup_banner_subtitle")
Expand Down Expand Up @@ -1451,6 +1483,10 @@ public class VectorL10n: NSObject {
public static func eventFormatterWidgetRemovedByYou(_ p1: String) -> String {
return VectorL10n.tr("Vector", "event_formatter_widget_removed_by_you", p1)
}
/// Existing
public static var existing: String {
return VectorL10n.tr("Vector", "existing")
}
/// The link %@ is taking you to another site: %@\n\nAre you sure you want to continue?
public static func externalLinkConfirmationMessage(_ p1: String, _ p2: String) -> String {
return VectorL10n.tr("Vector", "external_link_confirmation_message", p1, p2)
Expand Down Expand Up @@ -2379,6 +2415,10 @@ public class VectorL10n: NSObject {
public static var networkOfflinePrompt: String {
return VectorL10n.tr("Vector", "network_offline_prompt")
}
/// New
public static var newWord: String {
return VectorL10n.tr("Vector", "new_word")
}
/// Next
public static var next: String {
return VectorL10n.tr("Vector", "next")
Expand Down Expand Up @@ -5375,6 +5415,10 @@ public class VectorL10n: NSObject {
public static var spacesAddRoom: String {
return VectorL10n.tr("Vector", "spaces_add_room")
}
/// You do not have permissions to add rooms to this space.
public static var spacesAddRoomMissingPermissionMessage: String {
return VectorL10n.tr("Vector", "spaces_add_room_missing_permission_message")
}
/// Adding rooms coming soon
public static var spacesAddRoomsComingSoonTitle: String {
return VectorL10n.tr("Vector", "spaces_add_rooms_coming_soon_title")
Expand Down
8 changes: 7 additions & 1 deletion Riot/Modules/Common/Recents/RecentsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1989,7 +1989,7 @@ - (void)createNewRoom
// Sanity check
if (self.mainSession)
{
self.createRoomCoordinatorBridgePresenter = [[CreateRoomCoordinatorBridgePresenter alloc] initWithSession:self.mainSession];
self.createRoomCoordinatorBridgePresenter = [[CreateRoomCoordinatorBridgePresenter alloc] initWithSession:self.mainSession parentSpace: self.dataSource.currentSpace];
self.createRoomCoordinatorBridgePresenter.delegate = self;
[self.createRoomCoordinatorBridgePresenter presentFrom:self animated:YES];
}
Expand Down Expand Up @@ -2197,6 +2197,12 @@ - (void)createRoomCoordinatorBridgePresenterDelegateDidCancel:(CreateRoomCoordin
coordinatorBridgePresenter = nil;
}

- (void)createRoomCoordinatorBridgePresenterDelegate:(CreateRoomCoordinatorBridgePresenter *)coordinatorBridgePresenter didAddRoomsWithIds:(NSArray<NSString *> *)roomIds
{
[coordinatorBridgePresenter dismissWithAnimated:YES completion:nil];
coordinatorBridgePresenter = nil;
}

#pragma mark - Empty view management

- (void)showEmptyViewIfNeeded
Expand Down
50 changes: 43 additions & 7 deletions Riot/Modules/CreateRoom/CreateRoomCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ final class CreateRoomCoordinator: CreateRoomCoordinatorType {
// MARK: Private

private let navigationRouter: NavigationRouterType
private let tabRouter: TabbedRouterType
private let session: MXSession
private(set) var parentSpace: MXSpace?

// MARK: Public

Expand All @@ -37,23 +39,50 @@ final class CreateRoomCoordinator: CreateRoomCoordinatorType {

// MARK: - Setup

init(session: MXSession) {
init(session: MXSession, parentSpace: MXSpace?) {
gileluard marked this conversation as resolved.
Show resolved Hide resolved
self.navigationRouter = NavigationRouter(navigationController: RiotNavigationController())
let segmentedController = RiotSegmentedController.instantiate()
segmentedController.title = VectorL10n.spacesAddRoom
self.tabRouter = SegmentedRouter(segmentedController: segmentedController)
self.session = session
self.parentSpace = parentSpace
}

// MARK: - Public methods

func start() {

let rootCoordinator = self.createEnterNewRoomDetailsCoordinator()
let createRoomCoordinator = self.createEnterNewRoomDetailsCoordinator()

rootCoordinator.start()
createRoomCoordinator.start()

self.add(childCoordinator: rootCoordinator)
self.add(childCoordinator: createRoomCoordinator)

self.navigationRouter.setRootModule(rootCoordinator)
}
if let parentSpace = self.parentSpace, #available(iOS 14, *) {
let roomSelectionCoordinator = self.createRoomSelectorCoordinator(parentSpace: parentSpace)
roomSelectionCoordinator.completion = { [weak self] result in
guard let self = self else {
return
}

switch result {
case .done(let selectedItemIds):
self.delegate?.createRoomCoordinator(self, didAddRoomsWithIds: selectedItemIds)
default:
self.delegate?.createRoomCoordinatorDidCancel(self)
}
}
roomSelectionCoordinator.start()
self.add(childCoordinator: roomSelectionCoordinator)
self.tabRouter.tabs = [
TabbedRouterTab(title: VectorL10n.newWord, icon: nil, module: createRoomCoordinator),
TabbedRouterTab(title: VectorL10n.existing, icon: nil, module: roomSelectionCoordinator)
]
self.navigationRouter.setRootModule(self.tabRouter)
} else {
self.navigationRouter.setRootModule(createRoomCoordinator)
}
}

func toPresentable() -> UIViewController {
return self.navigationRouter.toPresentable()
Expand All @@ -62,10 +91,17 @@ final class CreateRoomCoordinator: CreateRoomCoordinatorType {
// MARK: - Private methods

private func createEnterNewRoomDetailsCoordinator() -> EnterNewRoomDetailsCoordinator {
let coordinator = EnterNewRoomDetailsCoordinator(session: self.session)
let coordinator = EnterNewRoomDetailsCoordinator(session: self.session, parentSpace: self.parentSpace)
coordinator.delegate = self
return coordinator
}

@available(iOS 14.0, *)
private func createRoomSelectorCoordinator(parentSpace: MXSpace) -> MatrixItemChooserCoordinator {
let paramaters = MatrixItemChooserCoordinatorParameters(session: self.session, viewProvider: AddRoomSelectorViewProvider(), itemsProcessor: AddRoomItemsProcessor(parentSpace: parentSpace))
let coordinator = MatrixItemChooserCoordinator(parameters: paramaters)
return coordinator
}
}

// MARK: - EnterNewRoomDetailsCoordinatorDelegate
Expand Down
Loading