diff --git a/Riot/Modules/Common/Recents/RecentsViewController.h b/Riot/Modules/Common/Recents/RecentsViewController.h index 6fefeed34..8e4e2b76c 100644 --- a/Riot/Modules/Common/Recents/RecentsViewController.h +++ b/Riot/Modules/Common/Recents/RecentsViewController.h @@ -131,9 +131,9 @@ - (void)onPlusButtonPressed; /** - Create an empty room. + Open screen to create a new room. */ -- (void)createAnEmptyRoom; +- (void)createNewRoom; /** Join a room by alias or id. diff --git a/Riot/Modules/Common/Recents/RecentsViewController.m b/Riot/Modules/Common/Recents/RecentsViewController.m index 63d2daa56..e6c9118ab 100644 --- a/Riot/Modules/Common/Recents/RecentsViewController.m +++ b/Riot/Modules/Common/Recents/RecentsViewController.m @@ -1656,25 +1656,11 @@ typeof(self) self = weakSelf; self->currentAlert = nil; - [self createAnEmptyRoom]; + [self createNewRoom]; } }]]; - [currentAlert addAction:[UIAlertAction actionWithTitle:@"Create room (v2)" - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { - - if (weakSelf) - { - typeof(self) self = weakSelf; - self->currentAlert = nil; - - [self createNewRoom]; - } - - }]]; - [currentAlert addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"room_recents_join_room", @"Vector", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { @@ -1719,79 +1705,6 @@ } } -- (void)createAnEmptyRoom -{ - // Sanity check - if (self.mainSession) - { - // Create one room at time - if (!currentRequest) - { - [self startActivityIndicator]; - - // Create an empty room. - MXWeakify(self); - currentRequest = [self.mainSession createRoom:nil - visibility:kMXRoomDirectoryVisibilityPrivate - roomAlias:nil - topic:nil - success:^(MXRoom *room) { - MXStrongifyAndReturnIfNil(self); - - self->currentRequest = nil; - [self stopActivityIndicator]; - if (self->currentAlert) - { - [self->currentAlert dismissViewControllerAnimated:NO completion:nil]; - self->currentAlert = nil; - } - - [self dispayRoomWithRoomId:room.roomId inMatrixSession:self.mainSession]; - - } failure:^(NSError *error) { - MXStrongifyAndReturnIfNil(self); - - self->currentRequest = nil; - [self stopActivityIndicator]; - if (self->currentAlert) - { - [self->currentAlert dismissViewControllerAnimated:NO completion:nil]; - self->currentAlert = nil; - } - - NSLog(@"[RecentsViewController] Create new room failed"); - - // Alert user - [[AppDelegate theDelegate] showErrorAsAlert:error]; - - }]; - } - else - { - // Ask the user to wait - __weak __typeof(self) weakSelf = self; - currentAlert = [UIAlertController alertControllerWithTitle:nil - message:NSLocalizedStringFromTable(@"room_creation_wait_for_creation", @"Vector", nil) - preferredStyle:UIAlertControllerStyleAlert]; - - [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"ok"] - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) { - - if (weakSelf) - { - typeof(self) self = weakSelf; - self->currentAlert = nil; - } - - }]]; - - [currentAlert mxk_setAccessibilityIdentifier:@"RecentsVCRoomCreationInProgressAlert"]; - [self presentViewController:currentAlert animated:YES completion:nil]; - } - } -} - - (void)joinARoom { [currentAlert dismissViewControllerAnimated:NO completion:nil]; diff --git a/Riot/Modules/Rooms/RoomsViewController.m b/Riot/Modules/Rooms/RoomsViewController.m index bc16e8f8f..144b02770 100644 --- a/Riot/Modules/Rooms/RoomsViewController.m +++ b/Riot/Modules/Rooms/RoomsViewController.m @@ -370,7 +370,7 @@ - (void)roomsDirectoryCoordinatorBridgePresenterDelegateDidTapCreateNewRoom:(RoomsDirectoryCoordinatorBridgePresenter *)coordinatorBridgePresenter { [coordinatorBridgePresenter dismissWithAnimated:YES completion:^{ - [self createAnEmptyRoom]; + [self createNewRoom]; }]; self.roomsDirectoryCoordinatorBridgePresenter = nil; }