mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-06 07:57:42 +02:00
Room Creation: handle new created room as an empty room.
This commit is contained in:
@@ -26,6 +26,8 @@
|
||||
#import "MXKSearchDataSource.h"
|
||||
#import "HomeSearchViewController.h"
|
||||
|
||||
#import "AppDelegate.h"
|
||||
|
||||
@interface HomeViewController ()
|
||||
{
|
||||
RecentsViewController *recentsViewController;
|
||||
@@ -39,6 +41,8 @@
|
||||
|
||||
// Display a button to a new room
|
||||
UIImageView* createNewRoomImageView;
|
||||
|
||||
MXHTTPOperation *roomCreationRequest;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -87,6 +91,17 @@
|
||||
[self closeSelectedRoom];
|
||||
}
|
||||
|
||||
- (void)destroy
|
||||
{
|
||||
[super destroy];
|
||||
|
||||
if (roomCreationRequest)
|
||||
{
|
||||
[roomCreationRequest cancel];
|
||||
roomCreationRequest = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated
|
||||
{
|
||||
[super viewWillAppear:animated];
|
||||
@@ -577,7 +592,35 @@
|
||||
|
||||
- (void)onNewRoomPressed
|
||||
{
|
||||
[self performSegueWithIdentifier:@"presentRoomCreationStep1" sender:self];
|
||||
createNewRoomImageView.userInteractionEnabled = NO;
|
||||
|
||||
[recentsViewController startActivityIndicator];
|
||||
|
||||
// Create an empty room.
|
||||
roomCreationRequest = [self.mainSession createRoom:nil
|
||||
visibility:kMXRoomVisibilityPrivate
|
||||
roomAlias:nil
|
||||
topic:nil
|
||||
success:^(MXRoom *room) {
|
||||
|
||||
roomCreationRequest = nil;
|
||||
[recentsViewController stopActivityIndicator];
|
||||
createNewRoomImageView.userInteractionEnabled = YES;
|
||||
|
||||
[self selectRoomWithId:room.state.roomId inMatrixSession:self.mainSession];
|
||||
|
||||
} failure:^(NSError *error) {
|
||||
|
||||
roomCreationRequest = nil;
|
||||
[recentsViewController stopActivityIndicator];
|
||||
createNewRoomImageView.userInteractionEnabled = YES;
|
||||
|
||||
NSLog(@"[RoomCreation] Create new room failed");
|
||||
|
||||
// Alert user
|
||||
[[AppDelegate theDelegate] showErrorAsAlert:error];
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user