mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-21 17:12:45 +02:00
merged from element 1.8.13
This commit is contained in:
@@ -65,6 +65,7 @@ typedef NS_ENUM(NSUInteger, SECTION_TAG)
|
||||
SECTION_TAG_IGNORED_USERS,
|
||||
SECTION_TAG_INTEGRATIONS,
|
||||
SECTION_TAG_USER_INTERFACE,
|
||||
SECTION_TAG_PRESENCE,
|
||||
SECTION_TAG_ADVANCED,
|
||||
SECTION_TAG_ABOUT,
|
||||
SECTION_TAG_LABS,
|
||||
@@ -168,6 +169,11 @@ typedef NS_ENUM(NSUInteger, IDENTITY_SERVER)
|
||||
IDENTITY_SERVER_INDEX
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSUInteger, PRESENCE)
|
||||
{
|
||||
PRESENCE_OFFLINE_MODE = 0,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSUInteger, ADVANCED)
|
||||
{
|
||||
ADVANCED_SHOW_NSFW_ROOMS_INDEX = 0,
|
||||
@@ -201,6 +207,7 @@ typedef NS_ENUM(NSUInteger, LABS_ENABLE)
|
||||
LABS_ENABLE_RINGING_FOR_GROUP_CALLS_INDEX = 0,
|
||||
LABS_ENABLE_THREADS_INDEX,
|
||||
LABS_ENABLE_MESSAGE_BUBBLES_INDEX,
|
||||
LABS_ENABLE_AUTO_REPORT_DECRYPTION_ERRORS,
|
||||
LABS_USE_ONLY_LATEST_USER_AVATAR_AND_NAME_INDEX
|
||||
};
|
||||
|
||||
@@ -227,7 +234,8 @@ SingleImagePickerPresenterDelegate,
|
||||
SettingsDiscoveryTableViewSectionDelegate, SettingsDiscoveryViewModelCoordinatorDelegate,
|
||||
SettingsIdentityServerCoordinatorBridgePresenterDelegate,
|
||||
ServiceTermsModalCoordinatorBridgePresenterDelegate,
|
||||
TableViewSectionsDelegate>
|
||||
TableViewSectionsDelegate,
|
||||
ThreadsBetaCoordinatorBridgePresenterDelegate>
|
||||
{
|
||||
// Current alert (if any).
|
||||
__weak UIAlertController *currentAlert;
|
||||
@@ -330,6 +338,8 @@ TableViewSectionsDelegate>
|
||||
|
||||
@property (nonatomic, strong) UserInteractiveAuthenticationService *userInteractiveAuthenticationService;
|
||||
|
||||
@property (nonatomic, strong) ThreadsBetaCoordinatorBridgePresenter *threadsBetaBridgePresenter;
|
||||
|
||||
/**
|
||||
Whether or not to check for contacts access after the user accepts the service terms. The value of this property is
|
||||
set automatically when calling `prepareIdentityServiceAndPresentTermsWithSession:checkingAccessForContactsOnAccept`
|
||||
@@ -608,6 +618,18 @@ TableViewSectionsDelegate>
|
||||
if (BuildSettings.bwiPersonalNotesRoom) {
|
||||
[sectionUserInterface addRowWithTag:USER_INTERFACE_PERSONAL_NOTES];
|
||||
}
|
||||
if(BuildSettings.settingsScreenPresenceAllowConfiguration)
|
||||
{
|
||||
Section *sectionPresence = [Section sectionWithTag:SECTION_TAG_PRESENCE];
|
||||
[sectionPresence addRowWithTag:PRESENCE_OFFLINE_MODE];
|
||||
sectionPresence.headerTitle = VectorL10n.settingsPresence;
|
||||
sectionPresence.footerTitle = VectorL10n.settingsPresenceOfflineModeDescription;
|
||||
|
||||
[tmpSections addObject:sectionPresence];
|
||||
}
|
||||
|
||||
Section *sectionAdvanced = [Section sectionWithTag:SECTION_TAG_ADVANCED];
|
||||
sectionAdvanced.headerTitle = [VectorL10n settingsAdvanced];
|
||||
|
||||
if (BuildSettings.settingsScreenShowAdvancedSettings)
|
||||
{
|
||||
@@ -695,6 +717,7 @@ TableViewSectionsDelegate>
|
||||
[sectionLabs addRowWithTag:LABS_ENABLE_RINGING_FOR_GROUP_CALLS_INDEX];
|
||||
[sectionLabs addRowWithTag:LABS_ENABLE_THREADS_INDEX];
|
||||
[sectionLabs addRowWithTag:LABS_ENABLE_MESSAGE_BUBBLES_INDEX];
|
||||
[sectionLabs addRowWithTag:LABS_ENABLE_AUTO_REPORT_DECRYPTION_ERRORS];
|
||||
[sectionLabs addRowWithTag:LABS_USE_ONLY_LATEST_USER_AVATAR_AND_NAME_INDEX];
|
||||
sectionLabs.headerTitle = [VectorL10n settingsLabs];
|
||||
if (sectionLabs.hasAnyRows)
|
||||
@@ -1612,6 +1635,21 @@ TableViewSectionsDelegate>
|
||||
return labelAndSwitchCell;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)buildAutoReportDecryptionErrorsCellForTableView:(UITableView*)tableView
|
||||
atIndexPath:(NSIndexPath*)indexPath
|
||||
{
|
||||
MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
|
||||
|
||||
labelAndSwitchCell.mxkLabel.text = [VectorL10n settingsLabsEnableAutoReportDecryptionErrors];
|
||||
|
||||
labelAndSwitchCell.mxkSwitch.on = RiotSettings.shared.enableUISIAutoReporting;
|
||||
labelAndSwitchCell.mxkSwitch.onTintColor = ThemeService.shared.theme.tintColor;
|
||||
labelAndSwitchCell.mxkSwitch.enabled = YES;
|
||||
[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleEnableAutoReportDecryptionErrors:) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
return labelAndSwitchCell;
|
||||
}
|
||||
|
||||
#pragma mark - 3Pid Add
|
||||
|
||||
- (void)showAuthenticationIfNeededForAdding:(MX3PIDMedium)medium withSession:(MXSession*)session completion:(void (^)(NSDictionary* authParams))completion
|
||||
@@ -2455,6 +2493,25 @@ TableViewSectionsDelegate>
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleDefault;
|
||||
}
|
||||
}
|
||||
else if (section == SECTION_TAG_PRESENCE)
|
||||
{
|
||||
if (row == PRESENCE_OFFLINE_MODE)
|
||||
{
|
||||
MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
|
||||
|
||||
labelAndSwitchCell.mxkLabel.text = VectorL10n.settingsPresenceOfflineMode;
|
||||
|
||||
MXKAccount *account = MXKAccountManager.sharedManager.accounts.firstObject;
|
||||
|
||||
labelAndSwitchCell.mxkSwitch.on = account.preferredSyncPresence == MXPresenceOffline;
|
||||
labelAndSwitchCell.mxkSwitch.onTintColor = ThemeService.shared.theme.tintColor;
|
||||
labelAndSwitchCell.mxkSwitch.enabled = YES;
|
||||
[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(togglePresenceOfflineMode:) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
cell = labelAndSwitchCell;
|
||||
}
|
||||
}
|
||||
// $$$ else if (section == SECTION_TAG_ADVANCED)
|
||||
else if (section == SECTION_TAG_ABOUT)
|
||||
{
|
||||
if (row == ABOUT_VERSION_INDEX)
|
||||
@@ -2726,6 +2783,10 @@ TableViewSectionsDelegate>
|
||||
{
|
||||
cell = [self buildMessageBubblesCellForTableView:tableView atIndexPath:indexPath];
|
||||
}
|
||||
else if (row == LABS_ENABLE_AUTO_REPORT_DECRYPTION_ERRORS)
|
||||
{
|
||||
cell = [self buildAutoReportDecryptionErrorsCellForTableView:tableView atIndexPath:indexPath];
|
||||
}
|
||||
else if (row == LABS_USE_ONLY_LATEST_USER_AVATAR_AND_NAME_INDEX)
|
||||
{
|
||||
MXKTableViewCellWithLabelAndSwitch *labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
|
||||
@@ -3553,8 +3614,31 @@ TableViewSectionsDelegate>
|
||||
|
||||
- (void)toggleEnableThreads:(UISwitch *)sender
|
||||
{
|
||||
RiotSettings.shared.enableThreads = sender.isOn;
|
||||
MXSDKOptions.sharedInstance.enableThreads = sender.isOn;
|
||||
if (sender.isOn && !self.mainSession.store.supportedMatrixVersions.supportsThreads)
|
||||
{
|
||||
// user wants to turn on the threads setting but the server does not support it
|
||||
if (self.threadsBetaBridgePresenter)
|
||||
{
|
||||
[self.threadsBetaBridgePresenter dismissWithAnimated:YES completion:nil];
|
||||
self.threadsBetaBridgePresenter = nil;
|
||||
}
|
||||
|
||||
self.threadsBetaBridgePresenter = [[ThreadsBetaCoordinatorBridgePresenter alloc] initWithThreadId:@""
|
||||
infoText:VectorL10n.threadsDiscourageInformation1
|
||||
additionalText:VectorL10n.threadsDiscourageInformation2];
|
||||
self.threadsBetaBridgePresenter.delegate = self;
|
||||
|
||||
[self.threadsBetaBridgePresenter presentFrom:self.presentedViewController?:self animated:YES];
|
||||
return;
|
||||
}
|
||||
|
||||
[self enableThreads:sender.isOn];
|
||||
}
|
||||
|
||||
- (void)enableThreads:(BOOL)enable
|
||||
{
|
||||
RiotSettings.shared.enableThreads = enable;
|
||||
MXSDKOptions.sharedInstance.enableThreads = enable;
|
||||
[[MXKRoomDataSourceManager sharedManagerForMatrixSession:self.mainSession] reset];
|
||||
[[AppDelegate theDelegate] restoreEmptyDetailsViewController];
|
||||
}
|
||||
@@ -4254,6 +4338,19 @@ TableViewSectionsDelegate>
|
||||
self.deactivateAccountViewController = deactivateAccountViewController;
|
||||
}
|
||||
|
||||
- (void)togglePresenceOfflineMode:(UISwitch *)sender
|
||||
{
|
||||
MXKAccount *account = MXKAccountManager.sharedManager.accounts.firstObject;
|
||||
if (sender.isOn)
|
||||
{
|
||||
account.preferredSyncPresence = MXPresenceOffline;
|
||||
}
|
||||
else
|
||||
{
|
||||
account.preferredSyncPresence = MXPresenceOnline;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)toggleNSFWPublicRoomsFiltering:(UISwitch *)sender
|
||||
{
|
||||
RiotSettings.shared.showNSFWPublicRooms = sender.isOn;
|
||||
@@ -4280,6 +4377,12 @@ TableViewSectionsDelegate>
|
||||
[roomDataSourceManager reset];
|
||||
}
|
||||
|
||||
|
||||
- (void)toggleEnableAutoReportDecryptionErrors:(UISwitch *)sender
|
||||
{
|
||||
RiotSettings.shared.enableUISIAutoReporting = sender.isOn;
|
||||
}
|
||||
|
||||
#pragma mark - TextField listener
|
||||
|
||||
- (IBAction)textFieldDidChange:(id)sender
|
||||
@@ -5284,4 +5387,24 @@ TableViewSectionsDelegate>
|
||||
return [[[ServerDowntimeDefaultService alloc] init] downtimeTextColor];
|
||||
}
|
||||
|
||||
#pragma mark - ThreadsBetaCoordinatorBridgePresenterDelegate
|
||||
|
||||
- (void)threadsBetaCoordinatorBridgePresenterDelegateDidTapEnable:(ThreadsBetaCoordinatorBridgePresenter *)coordinatorBridgePresenter
|
||||
{
|
||||
MXWeakify(self);
|
||||
[self.threadsBetaBridgePresenter dismissWithAnimated:YES completion:^{
|
||||
MXStrongifyAndReturnIfNil(self);
|
||||
[self enableThreads:YES];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)threadsBetaCoordinatorBridgePresenterDelegateDidTapCancel:(ThreadsBetaCoordinatorBridgePresenter *)coordinatorBridgePresenter
|
||||
{
|
||||
MXWeakify(self);
|
||||
[self.threadsBetaBridgePresenter dismissWithAnimated:YES completion:^{
|
||||
MXStrongifyAndReturnIfNil(self);
|
||||
[self updateSections];
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user