merged element 1.8.10

This commit is contained in:
Arnfried Griesert
2022-05-03 12:48:01 +02:00
1235 changed files with 50869 additions and 23132 deletions
@@ -19,7 +19,8 @@
#import "MediaPickerViewController.h"
#import "TableViewCellWithCheckBoxes.h"
@class AnalyticsScreenTimer;
@class AnalyticsScreenTracker;
@protocol RoomSettingsViewControllerDelegate;
/**
List the settings fields. Used to preselect/edit a field
@@ -57,7 +58,23 @@ typedef enum : NSUInteger {
/**
The screen timer used for analytics if they've been enabled. The default value is nil.
*/
@property (nonatomic) AnalyticsScreenTimer *screenTimer;
@property (nonatomic) AnalyticsScreenTracker *screenTracker;
/**
Delegate of this view controller.
*/
@property (nonatomic, weak) id<RoomSettingsViewControllerDelegate> delegate;
@end
@protocol RoomSettingsViewControllerDelegate <NSObject>
- (void)roomSettingsViewControllerDidLeaveRoom:(RoomSettingsViewController *)controller;
- (void)roomSettingsViewController:(RoomSettingsViewController *)controller didReplaceRoomWithReplacementId:(NSString *)newRoomId;
- (void)roomSettingsViewControllerDidCancel:(RoomSettingsViewController *)controller;
- (void)roomSettingsViewControllerDidComplete:(RoomSettingsViewController *)controller;
@end
@@ -39,6 +39,7 @@ enum
{
SECTION_TAG_MAIN,
SECTION_TAG_ACCESS,
SECTION_TAG_PROMOTION,
SECTION_TAG_HISTORY,
SECTION_TAG_ADDRESSES,
SECTION_TAG_FLAIR,
@@ -61,6 +62,7 @@ enum
enum
{
ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_ACCESS,
ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_INVITED_ONLY,
ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_ANYONE_APART_FROM_GUEST,
ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_ANYONE,
@@ -69,6 +71,11 @@ enum
ROOM_SETTINGS_ROOM_ACCESS_BW
};
enum
{
ROOM_SETTINGS_ROOM_PROMOTE_SECTION_ROW_SUGGEST
};
enum
{
ROOM_SETTINGS_HISTORY_VISIBILITY_SECTION_ROW_ANYONE,
@@ -131,7 +138,7 @@ NSString *const kRoomSettingsAdvancedCellViewIdentifier = @"kRoomSettingsAdvance
NSString *const kRoomSettingsAdvancedEnableE2eCellViewIdentifier = @"kRoomSettingsAdvancedEnableE2eCellViewIdentifier";
NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSettingsAdvancedE2eEnabledCellViewIdentifier";
@interface RoomSettingsViewController () <SingleImagePickerPresenterDelegate, TableViewSectionsDelegate>
@interface RoomSettingsViewController () <SingleImagePickerPresenterDelegate, TableViewSectionsDelegate, RoomAccessCoordinatorBridgePresenterDelegate, RoomSuggestionCoordinatorBridgePresenterDelegate>
{
// The updated user data
NSMutableDictionary<NSString*, id> *updatedItemsDict;
@@ -170,9 +177,6 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
// The pending http operation
MXHTTPOperation* pendingOperation;
// the updating spinner
UIActivityIndicatorView* updatingSpinner;
UIAlertController *currentAlert;
// listen to more events than the mother class
@@ -186,6 +190,10 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
// Observe kThemeServiceDidChangeThemeNotification to handle user interface theme change.
id kThemeServiceDidChangeThemeNotificationObserver;
RoomAccessCoordinatorBridgePresenter *roomAccessPresenter;
RoomSuggestionCoordinatorBridgePresenter *roomSuggestionPresenter;
}
@property (nonatomic, strong) SingleImagePickerPresenter *imagePickerPresenter;
@@ -269,6 +277,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
[self.tableView registerClass:TableViewCellWithCheckBoxes.class forCellReuseIdentifier:[TableViewCellWithCheckBoxes defaultReuseIdentifier]];
[self.tableView registerClass:TableViewCellWithCheckBoxAndLabel.class forCellReuseIdentifier:[TableViewCellWithCheckBoxAndLabel defaultReuseIdentifier]];
[self.tableView registerClass:MXKTableViewCell.class forCellReuseIdentifier:[MXKTableViewCell defaultReuseIdentifier]];
[self.tableView registerClass:TitleAndRightDetailTableViewCell.class forCellReuseIdentifier:[TitleAndRightDetailTableViewCell defaultReuseIdentifier]];
// Enable self sizing cells
self.tableView.rowHeight = UITableViewAutomaticDimension;
@@ -317,6 +326,8 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
{
[super viewWillAppear:animated];
[self.screenTracker trackScreen];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didUpdateRules:) name:kMXNotificationCenterDidUpdateRules object:nil];
// Observe appDelegateDidTapStatusBarNotificationObserver.
@@ -336,8 +347,6 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
{
self.selectedRoomSettingsField = _selectedRoomSettingsField;
}
[self.screenTimer start];
}
- (void)viewWillDisappear:(BOOL)animated
@@ -355,12 +364,6 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
}
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
[self.screenTimer stop];
}
// Those methods are called when the viewcontroller is added or removed from a container view controller.
- (void)willMoveToParentViewController:(nullable UIViewController *)parent
{
@@ -564,24 +567,45 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
if (RiotSettings.shared.roomSettingsScreenAllowChangingAccessSettings)
{
Section *sectionAccess = [Section sectionWithTag:SECTION_TAG_ACCESS];
[sectionAccess addRowWithTag:ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_INVITED_ONLY];
[sectionAccess addRowWithTag:ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_ANYONE_APART_FROM_GUEST];
[sectionAccess addRowWithTag:ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_ANYONE];
// Check whether a room address is required for the current join rule
NSString *joinRule = updatedItemsDict[kRoomSettingsJoinRuleKey];
if (!joinRule)
if (@available(iOS 14, *))
{
// Use the actual values if no change is pending.
joinRule = mxRoomState.joinRule;
[sectionAccess addRowWithTag:ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_ACCESS];
// Check whether a room address is required for the current join rule
NSString *joinRule = updatedItemsDict[kRoomSettingsJoinRuleKey];
if (!joinRule)
{
// Use the actual values if no change is pending.
joinRule = mxRoomState.joinRule;
}
if ([joinRule isEqualToString:kMXRoomJoinRulePublic] && !roomAddresses.count)
{
// Notify the user that a room address is required.
[sectionAccess addRowWithTag:ROOM_SETTINGS_ROOM_ACCESS_MISSING_ADDRESS_WARNING];
}
}
if ([joinRule isEqualToString:kMXRoomJoinRulePublic] && !roomAddresses.count)
else
{
// Notify the user that a room address is required.
[sectionAccess addRowWithTag:ROOM_SETTINGS_ROOM_ACCESS_MISSING_ADDRESS_WARNING];
[sectionAccess addRowWithTag:ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_INVITED_ONLY];
[sectionAccess addRowWithTag:ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_ANYONE_APART_FROM_GUEST];
[sectionAccess addRowWithTag:ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_ANYONE];
// Check whether a room address is required for the current join rule
NSString *joinRule = updatedItemsDict[kRoomSettingsJoinRuleKey];
if (!joinRule)
{
// Use the actual values if no change is pending.
joinRule = mxRoomState.joinRule;
}
if ([joinRule isEqualToString:kMXRoomJoinRulePublic] && !roomAddresses.count)
{
// Notify the user that a room address is required.
[sectionAccess addRowWithTag:ROOM_SETTINGS_ROOM_ACCESS_MISSING_ADDRESS_WARNING];
}
[sectionAccess addRowWithTag:ROOM_SETTINGS_ROOM_ACCESS_DIRECTORY_VISIBILITY];
}
[sectionAccess addRowWithTag:ROOM_SETTINGS_ROOM_ACCESS_DIRECTORY_VISIBILITY];
if (mxRoom.isDirect)
{
@@ -592,6 +616,17 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
sectionAccess.headerTitle = [VectorL10n roomDetailsAccessSection];
}
[tmpSections addObject:sectionAccess];
if (@available(iOS 14, *)) {
if (RiotSettings.shared.roomSettingsScreenAllowChangingAccessSettings)
{
Section *promotionAccess = [Section sectionWithTag:SECTION_TAG_PROMOTION];
promotionAccess.headerTitle = VectorL10n.roomDetailsPromoteRoomTitle;
[promotionAccess addRowWithTag:ROOM_SETTINGS_ROOM_ACCESS_DIRECTORY_VISIBILITY];
[promotionAccess addRowWithTag:ROOM_SETTINGS_ROOM_PROMOTE_SECTION_ROW_SUGGEST];
[tmpSections addObject:promotionAccess];
}
}
}
if ( BuildSettings.roomSettingsScreenShowAccessSettingsBW && !mxRoom.isDirect ){
@@ -879,7 +914,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
message:[VectorL10n roomDetailsSaveChangesPrompt]
preferredStyle:UIAlertControllerStyleAlert];
[currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n no]
[currentAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n no]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
@@ -890,12 +925,19 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
[self->updatedItemsDict removeAllObjects];
[self withdrawViewControllerAnimated:YES completion:nil];
if (self.delegate)
{
[self.delegate roomSettingsViewControllerDidCancel:self];
}
else
{
[self withdrawViewControllerAnimated:YES completion:nil];
}
}
}]];
[currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n yes]
[currentAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n yes]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
@@ -946,7 +988,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
}]];
[currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel]
[currentAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n cancel]
style:UIAlertActionStyleCancel
handler:^(UIAlertAction * action) {
@@ -1072,7 +1114,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
{
MXKPasteboardManager.shared.pasteboard.URL = url;
[self.view vc_toastWithMessage:VectorL10n.roomEventCopyLinkInfo
image:[UIImage imageNamed:@"link_icon"]
image:AssetImages.linkIcon.image
duration:2.0
position:ToastPositionBottom
additionalMargin:0.0];
@@ -1087,7 +1129,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
// The user can only delete alias they has created, even if the Admin has set it as canonical.
// So, let the server answer if it's possible to delete an alias.
[currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n delete]
[currentAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n delete]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
@@ -1101,7 +1143,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
}]];
[currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel]
[currentAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n cancel]
style:UIAlertActionStyleCancel
handler:^(UIAlertAction * action) {
@@ -1419,7 +1461,14 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
}
else
{
[self withdrawViewControllerAnimated:YES completion:nil];
if (self.delegate)
{
[self.delegate roomSettingsViewControllerDidCancel:self];
}
else
{
[self withdrawViewControllerAnimated:YES completion:nil];
}
}
}
@@ -1431,7 +1480,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
currentAlert = [UIAlertController alertControllerWithTitle:nil message:message preferredStyle:UIAlertControllerStyleAlert];
[currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel]
[currentAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n cancel]
style:UIAlertActionStyleCancel
handler:^(UIAlertAction * action) {
@@ -2167,7 +2216,14 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
[self stopActivityIndicator];
[self withdrawViewControllerAnimated:YES completion:nil];
if (self.delegate)
{
[self.delegate roomSettingsViewControllerDidComplete:self];
}
else
{
[self withdrawViewControllerAnimated:YES completion:nil];
}
}
#pragma mark - UITableViewDataSource
@@ -2535,6 +2591,41 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
{
cell = [self cellForAccessSwitch:tableView indexPath:indexPath];
}
else if (row == ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_ACCESS)
{
TitleAndRightDetailTableViewCell *roomAccessCell = [tableView dequeueReusableCellWithIdentifier:[TitleAndRightDetailTableViewCell defaultReuseIdentifier] forIndexPath:indexPath];
// Retrieve the potential updated values for joinRule and guestAccess
NSString *joinRule = updatedItemsDict[kRoomSettingsJoinRuleKey];
NSString *guestAccess = updatedItemsDict[kRoomSettingsGuestAccessKey];
// Use the actual values if no change is pending
if (!joinRule)
{
joinRule = mxRoomState.joinRule;
}
if (!guestAccess)
{
guestAccess = mxRoomState.guestAccess;
}
roomAccessCell.titleLabel.text = [VectorL10n roomDetailsAccessRowTitle];
NSString *access = VectorL10n.private;
if ([joinRule isEqualToString:kMXRoomJoinRulePublic])
{
access = VectorL10n.public;
}
else if ([joinRule isEqualToString:kMXRoomJoinRuleRestricted])
{
access = VectorL10n.createRoomTypeRestricted;
}
roomAccessCell.detailLabel.text = access;
// Check whether the user can change this option
roomAccessCell.userInteractionEnabled = (oneSelfPowerLevel >= [powerLevels minimumPowerLevelForSendingEventAsStateEvent:kMXEventTypeStringRoomJoinRules]);
cell = roomAccessCell;
}
else
{
TableViewCellWithCheckBoxAndLabel *roomAccessCell = [tableView dequeueReusableCellWithIdentifier:[TableViewCellWithCheckBoxAndLabel defaultReuseIdentifier] forIndexPath:indexPath];
@@ -2601,6 +2692,54 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
cell = roomAccessCell;
}
}
else if (section == SECTION_TAG_PROMOTION)
{
if (row == ROOM_SETTINGS_ROOM_ACCESS_DIRECTORY_VISIBILITY)
{
MXKTableViewCellWithLabelAndSwitch *directoryToggleCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
if (mxRoom.isDirect)
{
directoryToggleCell.mxkLabel.text = [VectorL10n roomDetailsAccessSectionDirectoryToggleForDm];
}
else
{
directoryToggleCell.mxkLabel.text = [VectorL10n roomDetailsAccessSectionDirectoryToggle];
}
[directoryToggleCell.mxkSwitch addTarget:self action:@selector(toggleDirectoryVisibility:) forControlEvents:UIControlEventValueChanged];
if (updatedItemsDict[kRoomSettingsDirectoryKey])
{
directoryToggleCell.mxkSwitch.on = ((NSNumber*) updatedItemsDict[kRoomSettingsDirectoryKey]).boolValue;
}
else
{
// Use the last retrieved value if any
directoryToggleCell.mxkSwitch.on = actualDirectoryVisibility ? [actualDirectoryVisibility isEqualToString:kMXRoomDirectoryVisibilityPublic] : NO;
}
// Check whether the user can change this option
directoryToggleCell.mxkSwitch.enabled = (oneSelfPowerLevel >= powerLevels.stateDefault);
// Store the switch to be able to update it
directoryVisibilitySwitch = directoryToggleCell.mxkSwitch;
cell = directoryToggleCell;
}
else if (row == ROOM_SETTINGS_ROOM_PROMOTE_SECTION_ROW_SUGGEST)
{
TitleAndRightDetailTableViewCell *roomSuggestionCell = [tableView dequeueReusableCellWithIdentifier:[TitleAndRightDetailTableViewCell defaultReuseIdentifier] forIndexPath:indexPath];
roomSuggestionCell.titleLabel.text = [VectorL10n roomDetailsPromoteRoomSuggestTitle];
roomSuggestionCell.detailLabel.text = [self.mainSession.spaceService directParentIdsOfRoomWithId:self.roomId whereRoomIsSuggested:YES].count ? [VectorL10n on] : [VectorL10n off];
// Check whether the user can change this option
roomSuggestionCell.userInteractionEnabled = (oneSelfPowerLevel >= [powerLevels minimumPowerLevelForSendingEventAsStateEvent:kMXEventTypeStringRoomJoinRules]);
cell = roomSuggestionCell;
}
}
else if (section == SECTION_TAG_HISTORY)
{
TableViewCellWithCheckBoxAndLabel *historyVisibilityCell = [tableView dequeueReusableCellWithIdentifier:[TableViewCellWithCheckBoxAndLabel defaultReuseIdentifier] forIndexPath:indexPath];
@@ -2675,7 +2814,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
addAddressCell.mxkLabel.text = nil;
addAddressCell.accessoryType = UITableViewCellAccessoryNone;
addAddressCell.accessoryView = [[UIImageView alloc] initWithImage:[[UIImage imageNamed:@"plus_icon"] vc_tintedImageUsingColor:ThemeService.shared.theme.textPrimaryColor]];
addAddressCell.accessoryView = [[UIImageView alloc] initWithImage:[AssetImages.plusIcon.image vc_tintedImageUsingColor:ThemeService.shared.theme.textPrimaryColor]];
addAddressTextField = addAddressCell.mxkTextField;
addAddressTextField.placeholder = [VectorL10n roomDetailsNewAddressPlaceholder:self.mainSession.matrixRestClient.homeserverSuffix];
@@ -2752,7 +2891,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
{
if ([alias isEqualToString:canonicalAlias])
{
addressCell.accessoryView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"main_alias_icon"]];
addressCell.accessoryView = [[UIImageView alloc] initWithImage:AssetImages.mainAliasIcon.image];
}
}
}
@@ -2776,7 +2915,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
addCommunityCell.mxkLabel.text = nil;
addCommunityCell.accessoryType = UITableViewCellAccessoryNone;
addCommunityCell.accessoryView = [[UIImageView alloc] initWithImage:[[UIImage imageNamed:@"plus_icon"] vc_tintedImageUsingColor:ThemeService.shared.theme.textPrimaryColor]];
addCommunityCell.accessoryView = [[UIImageView alloc] initWithImage:[AssetImages.plusIcon.image vc_tintedImageUsingColor:ThemeService.shared.theme.textPrimaryColor]];
addGroupTextField = addCommunityCell.mxkTextField;
addGroupTextField.placeholder = [VectorL10n roomDetailsNewFlairPlaceholder:self.mainSession.matrixRestClient.homeserverSuffix];
@@ -3185,6 +3324,10 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
}
}
}
else if (row == ROOM_SETTINGS_ROOM_ACCESS_SECTION_ROW_ACCESS)
{
[self showRoomAccessFlow];
}
if (isUpdated)
{
@@ -3193,6 +3336,13 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
[self getNavigationItem].rightBarButtonItem.enabled = (updatedItemsDict.count != 0);
}
}
else if (section == SECTION_TAG_PROMOTION)
{
if (row == ROOM_SETTINGS_ROOM_PROMOTE_SECTION_ROW_SUGGEST)
{
[self showSuggestToSpaceMembers];
}
}
else if (section == SECTION_TAG_HISTORY)
{
// Ignore the selection if the option is already enabled
@@ -3305,7 +3455,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
completionHandler(YES);
}];
removeAddressAction.backgroundColor = ThemeService.shared.theme.headerBackgroundColor;
removeAddressAction.image = [[UIImage imageNamed:@"remove_icon"] vc_notRenderedImage];
removeAddressAction.image = [AssetImages.removeIcon.image vc_notRenderedImage];
// Create swipe action configuration
@@ -3326,7 +3476,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
completionHandler(YES);
}];
removeAddressAction.backgroundColor = ThemeService.shared.theme.headerBackgroundColor;
removeAddressAction.image = [[UIImage imageNamed:@"remove_icon"] vc_notRenderedImage];
removeAddressAction.image = [AssetImages.removeIcon.image vc_notRenderedImage];
// Create swipe action configuration
@@ -3355,7 +3505,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
message:[VectorL10n roomDetailsHistorySectionPromptMsg]
preferredStyle:UIAlertControllerStyleAlert];
[currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel]
[currentAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n cancel]
style:UIAlertActionStyleCancel
handler:^(UIAlertAction * action) {
@@ -3367,7 +3517,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
}]];
[currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n continue]
[currentAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n continue]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
@@ -3443,7 +3593,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
message:[VectorL10n roomDetailsAddressesDisableMainAddressPromptMsg]
preferredStyle:UIAlertControllerStyleAlert];
[currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel]
[currentAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n cancel]
style:UIAlertActionStyleCancel
handler:^(UIAlertAction * action) {
@@ -3455,7 +3605,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
}]];
[currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n continue]
[currentAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n continue]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
@@ -3522,7 +3672,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
message:message
preferredStyle:UIAlertControllerStyleAlert];
[currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n cancel]
[currentAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n cancel]
style:UIAlertActionStyleCancel
handler:^(UIAlertAction * action) {
@@ -3546,7 +3696,11 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
[self startActivityIndicator];
[self->mxRoom leave:^{
[[LegacyAppDelegate theDelegate] restoreInitialDisplay:nil];
if (self.delegate) {
[self.delegate roomSettingsViewControllerDidLeaveRoom:self];
} else {
[[LegacyAppDelegate theDelegate] restoreInitialDisplay:nil];
}
} failure:^(NSError *error) {
@@ -3711,6 +3865,28 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
[self getNavigationItem].rightBarButtonItem.enabled = (updatedItemsDict.count != 0);
}
- (void)showRoomAccessFlow
{
MXRoom *room = [self.mainSession roomWithRoomId:self.roomId];
if (room) {
roomAccessPresenter = [[RoomAccessCoordinatorBridgePresenter alloc] initWithRoom:room];
roomAccessPresenter.delegate = self;
[roomAccessPresenter presentFrom:self animated:YES];
}
}
- (void)showSuggestToSpaceMembers
{
MXRoom *room = [self.mainSession roomWithRoomId:self.roomId];
if (room) {
roomSuggestionPresenter = [[RoomSuggestionCoordinatorBridgePresenter alloc] initWithRoom:room];
roomSuggestionPresenter.delegate = self;
[roomSuggestionPresenter presentFrom:self animated:YES];
}
}
- (void)setRoomAliasAsMainAddress:(NSString *)alias
{
NSString *currentCanonicalAlias = mxRoomState.canonicalAlias;
@@ -3906,7 +4082,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
message:alertMsg
preferredStyle:UIAlertControllerStyleAlert];
[currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok]
[currentAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n ok]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
@@ -3971,7 +4147,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
message:alertMsg
preferredStyle:UIAlertControllerStyleAlert];
[currentAlert addAction:[UIAlertAction actionWithTitle:[MatrixKitL10n ok]
[currentAlert addAction:[UIAlertAction actionWithTitle:[VectorL10n ok]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
@@ -4257,4 +4433,52 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti
self.tableViewSections.sections = tmpSections;
}
#pragma mark - RoomAccessCoordinatorBridgePresenterDelegate
- (void)roomAccessCoordinatorBridgePresenterDelegate:(RoomAccessCoordinatorBridgePresenter *)coordinatorBridgePresenter didCancelRoomWithId:(NSString *)roomId
{
if (![roomId isEqualToString: self.roomId]) {
// Room Access Coordinator upgraded the actual room -> Need to move to replacement room
[self.delegate roomSettingsViewController:self didReplaceRoomWithReplacementId:roomId];
}
MXWeakify(self);
[roomAccessPresenter dismissWithAnimated:YES completion:^{
MXStrongifyAndReturnIfNil(self);
self->roomAccessPresenter = nil;
}];
}
- (void)roomAccessCoordinatorBridgePresenterDelegate:(RoomAccessCoordinatorBridgePresenter *)coordinatorBridgePresenter didCompleteRoomWithId:(NSString *)roomId
{
if (![roomId isEqualToString: self.roomId]) {
// Room Access Coordinator upgraded the actual room -> Need to move to replacement room
[self.delegate roomSettingsViewController:self didReplaceRoomWithReplacementId:roomId];
}
MXWeakify(self);
[roomAccessPresenter dismissWithAnimated:YES completion:^{
MXStrongifyAndReturnIfNil(self);
self->roomAccessPresenter = nil;
}];
}
#pragma mark - RoomSuggestionCoordinatorBridgePresenterDelegate
- (void)roomSuggestionCoordinatorBridgePresenterDelegateDidCancel:(RoomSuggestionCoordinatorBridgePresenter *)coordinatorBridgePresenter
{
[roomSuggestionPresenter dismissWithAnimated:YES completion:nil];
roomSuggestionPresenter = nil;
}
- (void)roomSuggestionCoordinatorBridgePresenterDelegateDidComplete:(RoomSuggestionCoordinatorBridgePresenter *)coordinatorBridgePresenter
{
MXWeakify(self);
[roomSuggestionPresenter dismissWithAnimated:YES completion:^{
MXStrongifyAndReturnIfNil(self);
self->roomSuggestionPresenter = nil;
[self refreshRoomSettings];
}];
}
@end
@@ -34,11 +34,11 @@
{
if (enabled)
{
_checkBox.image = [UIImage imageNamed:@"selection_tick"];
_checkBox.image = AssetImages.selectionTick.image;
}
else
{
_checkBox.image = [UIImage imageNamed:@"selection_untick"];
_checkBox.image = AssetImages.selectionUntick.image;
}
_enabled = enabled;
@@ -131,7 +131,7 @@
[checkboxContainer addSubview:checkbox];
// Store the new check box unselected by default
checkbox.image = [UIImage imageNamed:@"selection_untick"];
checkbox.image = AssetImages.selectionUntick.image;
checkbox.tintColor = ThemeService.shared.theme.tintColor;
checkbox.tag = 0;
[checkBoxesArray addObject:checkbox];
@@ -263,7 +263,7 @@
if (isSelected && !checkBox.tag)
{
checkBox.image = [UIImage imageNamed:@"selection_tick"];
checkBox.image = AssetImages.selectionTick.image;
checkBox.tag = 1;
if (!self.allowsMultipleSelection)
@@ -276,7 +276,7 @@
checkBox = checkBoxesArray[k];
if (checkBox.tag)
{
checkBox.image = [UIImage imageNamed:@"selection_untick"];
checkBox.image = AssetImages.selectionUntick.image;
checkBox.tag = 0;
}
}
@@ -285,7 +285,7 @@
}
else if (!isSelected && checkBox.tag)
{
checkBox.image = [UIImage imageNamed:@"selection_untick"];
checkBox.image = AssetImages.selectionUntick.image;
checkBox.tag = 0;
}
}
@@ -0,0 +1,48 @@
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import UIKit
class TitleAndRightDetailTableViewCell: MXKTableViewCell {
// MARK: Outlet
@IBOutlet var titleLabel: UILabel!
@IBOutlet var detailLabel: UILabel!
// MARK: Properties
override var isUserInteractionEnabled: Bool {
didSet {
titleLabel.alpha = isUserInteractionEnabled ? 1 : 0.3
detailLabel.alpha = isUserInteractionEnabled ? 1 : 0.3
}
}
// MARK: - MXKTableViewCell
override func customizeRendering() {
super.customizeRendering()
let theme = ThemeService.shared().theme
titleLabel.textColor = theme.colors.primaryContent
titleLabel.font = theme.fonts.body
detailLabel.textColor = theme.colors.secondaryContent
detailLabel.font = theme.fonts.body
}
}
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" id="Tgv-My-C1l" customClass="TitleAndRightDetailTableViewCell" customModule="Riot" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="Tgv-My-C1l" id="BJV-sE-Mvs">
<rect key="frame" x="0.0" y="0.0" width="384.5" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="3wR-ut-4aU">
<rect key="frame" x="0.0" y="0.0" width="0.0" height="44"/>
<state key="normal" title="Button"/>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="alK-rA-Dk5">
<rect key="frame" x="16" y="12" width="310.5" height="20"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="250" text="detail" textAlignment="natural" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="h19-3t-q46">
<rect key="frame" x="334.5" y="12" width="42" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="alK-rA-Dk5" secondAttribute="bottom" constant="12" id="1Dg-X4-7xc"/>
<constraint firstItem="3wR-ut-4aU" firstAttribute="top" secondItem="BJV-sE-Mvs" secondAttribute="top" id="298-Q8-nW7"/>
<constraint firstItem="alK-rA-Dk5" firstAttribute="leading" secondItem="BJV-sE-Mvs" secondAttribute="leading" constant="16" id="2zu-HX-e3O"/>
<constraint firstAttribute="leading" secondItem="3wR-ut-4aU" secondAttribute="trailing" id="5dd-tf-Z9d"/>
<constraint firstAttribute="bottom" secondItem="3wR-ut-4aU" secondAttribute="bottom" id="Eqc-lA-4Vh"/>
<constraint firstItem="alK-rA-Dk5" firstAttribute="top" secondItem="BJV-sE-Mvs" secondAttribute="top" constant="12" id="SpX-3q-4E6"/>
<constraint firstItem="3wR-ut-4aU" firstAttribute="leading" secondItem="BJV-sE-Mvs" secondAttribute="leading" id="gxw-sS-kSr"/>
<constraint firstItem="h19-3t-q46" firstAttribute="firstBaseline" secondItem="alK-rA-Dk5" secondAttribute="firstBaseline" id="i5e-qN-Zqj"/>
<constraint firstAttribute="trailing" secondItem="h19-3t-q46" secondAttribute="trailing" constant="8" id="qwJ-h7-jFe"/>
<constraint firstItem="h19-3t-q46" firstAttribute="leading" secondItem="alK-rA-Dk5" secondAttribute="trailing" constant="8" id="wev-Ez-iia"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="detailLabel" destination="h19-3t-q46" id="WBD-Jq-908"/>
<outlet property="titleLabel" destination="alK-rA-Dk5" id="HPw-Ub-A6A"/>
</connections>
<point key="canvasLocation" x="-59" y="-21"/>
</tableViewCell>
</objects>
</document>