mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-21 17:12:45 +02:00
MESSENGER-5304 add room federation decision sheet
This commit is contained in:
@@ -242,6 +242,9 @@ static CGSize kThreadListBarButtonItemImageSize;
|
||||
// Check if we should wait for other participants
|
||||
@property (nonatomic, readonly) BOOL shouldWaitForOtherParticipants;
|
||||
|
||||
// bwi: #5304 show federation decision sheet
|
||||
@property (nonatomic) BOOL wasFederationDecisionSheetShownBefore;
|
||||
|
||||
@end
|
||||
|
||||
@implementation RoomViewController
|
||||
@@ -434,6 +437,9 @@ static CGSize kThreadListBarButtonItemImageSize;
|
||||
[self setupCompletionSuggestionViewIfNeeded];
|
||||
|
||||
[self.topBannersStackView vc_removeAllSubviews];
|
||||
|
||||
// bwi: #5304 show federation decision sheet
|
||||
self.wasFederationDecisionSheetShownBefore = false;
|
||||
}
|
||||
|
||||
- (void)userInterfaceThemeDidChange
|
||||
@@ -717,6 +723,10 @@ static CGSize kThreadListBarButtonItemImageSize;
|
||||
}
|
||||
|
||||
[self setMaximisedToolbarIsHiddenIfNeeded: NO];
|
||||
|
||||
|
||||
// bwi: #5304 show federation decision sheet only for admins and only in rooms / not in DMs
|
||||
[self showFederationDecisionSheet];
|
||||
}
|
||||
|
||||
- (void)viewDidDisappear:(BOOL)animated
|
||||
@@ -8231,6 +8241,29 @@ static CGSize kThreadListBarButtonItemImageSize;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - BWI Federation
|
||||
|
||||
// bwi: #5304 show federation decision sheet only for admins and only in rooms / not in DMs
|
||||
- (void)showFederationDecisionSheet {
|
||||
if (!self.wasFederationDecisionSheetShownBefore && BWIBuildSettings.shared.isFederationEnabled && !self.roomDataSource.room.isDirect)
|
||||
{
|
||||
MXRoomPowerLevels *powerLevels = self.roomDataSource.roomState.powerLevels;
|
||||
if ([powerLevels powerLevelOfUserWithUserID:self.mainSession.myUser.userId] == RoomPowerLevelAdmin)
|
||||
{
|
||||
[self.roomDataSource.room getCurrentRoomServerACLSettingsWithCompletion:^(NSString *serverACL)
|
||||
{
|
||||
if (serverACL == nil) {
|
||||
self.wasFederationDecisionSheetShownBefore = true;
|
||||
RoomFederationDecisionSheet *federationDecisionView = [[RoomFederationDecisionSheet alloc] init];
|
||||
UIViewController *sheetViewController = [federationDecisionView makeViewControllerWithRoom:self.roomDataSource.room roomAvatarImage: ((RoomTitleView*)self.titleView).pictureView.image];
|
||||
sheetViewController.modalPresentationStyle = UIModalPresentationFormSheet;
|
||||
[self presentViewController:sheetViewController animated:YES completion:nil];
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - UserSuggestionCoordinatorBridgeDelegate
|
||||
|
||||
- (void)completionSuggestionCoordinatorBridge:(CompletionSuggestionCoordinatorBridge *)coordinator
|
||||
|
||||
Reference in New Issue
Block a user