From 2ad094b836406674369d35c033d7e5284021f8fe Mon Sep 17 00:00:00 2001 From: Gil Eluard Date: Thu, 23 Sep 2021 17:35:49 +0200 Subject: [PATCH] [Spaces] M10.6.1 Handle space link #4498 - Change (+) button behaviour in home screen according to current space --- Riot/Modules/Home/HomeViewController.m | 80 +++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 2 deletions(-) diff --git a/Riot/Modules/Home/HomeViewController.m b/Riot/Modules/Home/HomeViewController.m index b67209a1bc..3909c1a6fe 100644 --- a/Riot/Modules/Home/HomeViewController.m +++ b/Riot/Modules/Home/HomeViewController.m @@ -26,7 +26,7 @@ #import "MXRoom+Riot.h" -@interface HomeViewController () +@interface HomeViewController () { RecentsDataSource *recentsDataSource; @@ -48,6 +48,8 @@ @interface HomeViewController () currentAlert = nil; + + [self showRoomDirectory]; + } + + }]]; + + [currentAlert addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"room_details_people", @"Vector", nil) + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) { + + if (weakSelf) + { + typeof(self) self = weakSelf; + self->currentAlert = nil; + + self.spaceMembersCoordinatorBridgePresenter = [[SpaceMembersCoordinatorBridgePresenter alloc] initWithUserSessionsService:[UserSessionsService shared] session:self.mainSession spaceId:self.dataSource.currentSpace.spaceId]; + self.spaceMembersCoordinatorBridgePresenter.delegate = self; + [self.spaceMembersCoordinatorBridgePresenter presentFrom:self animated:YES]; + } + + }]]; + + + [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] + style:UIAlertActionStyleCancel + handler:^(UIAlertAction * action) { + + if (weakSelf) + { + typeof(self) self = weakSelf; + self->currentAlert = nil; + } + + }]]; + + [currentAlert popoverPresentationController].sourceView = plusButtonImageView; + [currentAlert popoverPresentationController].sourceRect = plusButtonImageView.bounds; + + [currentAlert mxk_setAccessibilityIdentifier:@"RecentsVCCreateRoomAlert"]; + [self presentViewController:currentAlert animated:YES completion:nil]; } - (void)cancelEditionMode:(BOOL)forceRefresh @@ -872,4 +939,13 @@ - (NSUInteger)totalItemCounts + recentsDataSource.suggestedRoomCellDataArray.count; } +#pragma mark - SpaceMembersCoordinatorBridgePresenterDelegate + +- (void)spaceMembersCoordinatorBridgePresenterDelegateDidComplete:(SpaceMembersCoordinatorBridgePresenter *)coordinatorBridgePresenter +{ + [coordinatorBridgePresenter dismissWithAnimated:YES completion:^{ + self.spaceMembersCoordinatorBridgePresenter = nil; + }]; +} + @end