mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-26 03:20:50 +02:00
Merge commit '80bda1906235b6007b98f18fb13681fff587f4a3' into feature/basis_update_192
# Conflicts: # Config/AppVersion.xcconfig # Config/BuildSettings.swift # DesignKit/Source/ColorsSwiftUI.swift # DesignKit/Source/FontsSwiftUI.swift # DesignKit/Source/ThemeV2.swift # DesignKit/Variants/Colors/Dark/DarkColors.swift # DesignKit/Variants/Colors/Light/LightColors.swift # Podfile.lock # Riot/Assets/de.lproj/InfoPlist.strings # Riot/Assets/de.lproj/Vector.strings # Riot/Assets/en.lproj/Vector.strings # Riot/Generated/Images.swift # Riot/Generated/Strings.swift # Riot/Managers/PushNotification/PushNotificationService.m # Riot/Managers/Settings/RiotSettings.swift # Riot/Modules/Common/Recents/DataSources/RecentsDataSource.h # Riot/Modules/Common/Recents/RecentsViewController.m # Riot/Modules/Communities/Home/GroupHomeViewController.m # Riot/Modules/Room/RoomViewController.m # Riot/Modules/SetPinCode/PinCodePreferences.swift # Riot/Modules/Settings/SettingsViewController.m # Riot/Modules/TabBar/MasterTabBarController.h # Riot/Modules/TabBar/MasterTabBarController.m # Riot/Modules/TabBar/TabBarCoordinator.swift # fastlane/Fastfile # project.yml
This commit is contained in:
@@ -37,9 +37,6 @@
|
||||
#import "ThemeService.h"
|
||||
#import "TableViewCellWithPhoneNumberTextField.h"
|
||||
|
||||
#import "GroupsDataSource.h"
|
||||
#import "GroupTableViewCellWithSwitch.h"
|
||||
|
||||
#import "GBDeviceInfo_iOS.h"
|
||||
|
||||
#import "MediaPickerViewController.h"
|
||||
@@ -72,7 +69,6 @@ typedef NS_ENUM(NSUInteger, SECTION_TAG)
|
||||
SECTION_TAG_ADVANCED,
|
||||
SECTION_TAG_ABOUT,
|
||||
SECTION_TAG_LABS,
|
||||
SECTION_TAG_FLAIR,
|
||||
SECTION_TAG_DEACTIVATE_ACCOUNT,
|
||||
SECTION_TAG_DOWNTIME_WARNING,
|
||||
SECTION_TAG_OUTDATED_WARNING,
|
||||
@@ -233,6 +229,7 @@ typedef NS_ENUM(NSUInteger, SECURITY)
|
||||
{
|
||||
SECURITY_BUTTON_INDEX = 0,
|
||||
SECURITY_MATOMO_INDEX,
|
||||
DEVICE_MANAGER_INDEX
|
||||
};
|
||||
|
||||
enum
|
||||
@@ -249,7 +246,7 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)(void);
|
||||
|
||||
#pragma mark - SettingsViewController
|
||||
|
||||
@interface SettingsViewController () <UITextFieldDelegate, MXKCountryPickerViewControllerDelegate, MXKLanguagePickerViewControllerDelegate, MXKDataSourceDelegate, DeactivateAccountViewControllerDelegate,
|
||||
@interface SettingsViewController () <UITextFieldDelegate, MXKCountryPickerViewControllerDelegate, MXKLanguagePickerViewControllerDelegate, DeactivateAccountViewControllerDelegate,
|
||||
NotificationSettingsCoordinatorBridgePresenterDelegate,
|
||||
SecureBackupSetupCoordinatorBridgePresenterDelegate,
|
||||
SignOutAlertPresenterDelegate,
|
||||
@@ -292,9 +289,6 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
|
||||
CountryPickerViewController *newPhoneNumberCountryPicker;
|
||||
NBPhoneNumber *newPhoneNumber;
|
||||
|
||||
// Flair: the groups data source
|
||||
GroupsDataSource *groupsDataSource;
|
||||
|
||||
// Observe kAppDelegateDidTapStatusBarNotification to handle tap on clock status bar.
|
||||
__weak id kAppDelegateDidTapStatusBarNotificationObserver;
|
||||
|
||||
@@ -354,6 +348,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
|
||||
|
||||
@property (nonatomic, strong) ThreadsBetaCoordinatorBridgePresenter *threadsBetaBridgePresenter;
|
||||
@property (nonatomic, strong) ChangePasswordCoordinatorBridgePresenter *changePasswordBridgePresenter;
|
||||
@property (nonatomic, strong) UserSessionsFlowCoordinatorBridgePresenter *userSessionsFlowCoordinatorBridgePresenter;
|
||||
|
||||
/**
|
||||
Whether or not to check for contacts access after the user accepts the service terms. The value of this property is
|
||||
@@ -499,13 +494,18 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
|
||||
|
||||
Section *sectionSecurity = [Section sectionWithTag:SECTION_TAG_SECURITY];
|
||||
[sectionSecurity addRowWithTag:SECURITY_BUTTON_INDEX];
|
||||
|
||||
|
||||
|
||||
// bwi 2525 - show matomo settings
|
||||
if ([BuildSettings bwiShowMatomoSettings])
|
||||
{
|
||||
[sectionSecurity addRowWithTag:SECURITY_MATOMO_INDEX];
|
||||
}
|
||||
|
||||
if (BuildSettings.deviceManagerEnabled)
|
||||
{
|
||||
// NOTE: Add device manager entry point in the security section atm for debug purpose
|
||||
[sectionSecurity addRowWithTag:DEVICE_MANAGER_INDEX];
|
||||
}
|
||||
|
||||
sectionSecurity.headerTitle = [VectorL10n settingsSecurity];
|
||||
[tmpSections addObject:sectionSecurity];
|
||||
@@ -762,19 +762,6 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
|
||||
}
|
||||
}
|
||||
|
||||
if ([groupsDataSource numberOfSectionsInTableView:self.tableView] && groupsDataSource.joinedGroupsSection != -1)
|
||||
{
|
||||
NSInteger count = [groupsDataSource tableView:self.tableView
|
||||
numberOfRowsInSection:groupsDataSource.joinedGroupsSection];
|
||||
Section *sectionFlair = [Section sectionWithTag:SECTION_TAG_FLAIR];
|
||||
for (NSInteger index = 0; index < count; index++)
|
||||
{
|
||||
[sectionFlair addRowWithTag:index];
|
||||
}
|
||||
sectionFlair.headerTitle = [VectorL10n settingsFlair];
|
||||
[tmpSections addObject:sectionFlair];
|
||||
}
|
||||
|
||||
if (BuildSettings.settingsScreenAllowDeactivatingAccount)
|
||||
{
|
||||
Section *sectionDeactivate = [Section sectionWithTag:SECTION_TAG_DEACTIVATE_ACCOUNT];
|
||||
@@ -803,7 +790,6 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
|
||||
[self.tableView registerClass:MXKTableViewCellWithLabelAndSwitch.class forCellReuseIdentifier:[MXKTableViewCellWithLabelAndSwitch defaultReuseIdentifier]];
|
||||
[self.tableView registerClass:MXKTableViewCellWithLabelAndMXKImageView.class forCellReuseIdentifier:[MXKTableViewCellWithLabelAndMXKImageView defaultReuseIdentifier]];
|
||||
[self.tableView registerClass:TableViewCellWithPhoneNumberTextField.class forCellReuseIdentifier:[TableViewCellWithPhoneNumberTextField defaultReuseIdentifier]];
|
||||
[self.tableView registerClass:GroupTableViewCellWithSwitch.class forCellReuseIdentifier:[GroupTableViewCellWithSwitch defaultReuseIdentifier]];
|
||||
[self.tableView registerNib:MXKTableViewCellWithTextView.nib forCellReuseIdentifier:[MXKTableViewCellWithTextView defaultReuseIdentifier]];
|
||||
[self.tableView registerNib:SectionFooterView.nib forHeaderFooterViewReuseIdentifier:[SectionFooterView defaultReuseIdentifier]];
|
||||
|
||||
@@ -860,10 +846,6 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
|
||||
}
|
||||
|
||||
[self setupDiscoverySection];
|
||||
|
||||
groupsDataSource = [[GroupsDataSource alloc] initWithMatrixSession:self.mainSession];
|
||||
[groupsDataSource finalizeInitialization];
|
||||
groupsDataSource.delegate = self;
|
||||
|
||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(onSave:)];
|
||||
self.navigationItem.rightBarButtonItem.accessibilityIdentifier=@"SettingsVCNavBarSaveButton";
|
||||
@@ -919,13 +901,6 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
|
||||
|
||||
- (void)destroy
|
||||
{
|
||||
if (groupsDataSource)
|
||||
{
|
||||
groupsDataSource.delegate = nil;
|
||||
[groupsDataSource destroy];
|
||||
groupsDataSource = nil;
|
||||
}
|
||||
|
||||
// Release the potential pushed view controller
|
||||
[self releasePushedViewController];
|
||||
|
||||
@@ -2883,50 +2858,33 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
|
||||
cell = [self buildLiveLocationSharingCellForTableView:tableView atIndexPath:indexPath];
|
||||
}
|
||||
}
|
||||
else if (section == SECTION_TAG_FLAIR)
|
||||
{
|
||||
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:groupsDataSource.joinedGroupsSection];
|
||||
cell = [groupsDataSource tableView:tableView cellForRowAtIndexPath:indexPath];
|
||||
|
||||
if ([cell isKindOfClass:GroupTableViewCellWithSwitch.class])
|
||||
{
|
||||
GroupTableViewCellWithSwitch* groupWithSwitchCell = (GroupTableViewCellWithSwitch*)cell;
|
||||
id<MXKGroupCellDataStoring> groupCellData = [groupsDataSource cellDataAtIndex:indexPath];
|
||||
|
||||
// Display the groupId in the description label, except if the group has no name
|
||||
if (![groupWithSwitchCell.groupName.text isEqualToString:groupCellData.group.groupId])
|
||||
{
|
||||
groupWithSwitchCell.groupDescription.hidden = NO;
|
||||
groupWithSwitchCell.groupDescription.text = groupCellData.group.groupId;
|
||||
}
|
||||
|
||||
// Update the toogle button
|
||||
groupWithSwitchCell.toggleButton.on = groupCellData.group.summary.user.isPublicised;
|
||||
groupWithSwitchCell.toggleButton.enabled = YES;
|
||||
groupWithSwitchCell.toggleButton.tag = row;
|
||||
|
||||
[groupWithSwitchCell.toggleButton removeTarget:self action:nil forControlEvents:UIControlEventTouchUpInside];
|
||||
[groupWithSwitchCell.toggleButton addTarget:self action:@selector(toggleCommunityFlair:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
}
|
||||
else if (section == SECTION_TAG_SECURITY)
|
||||
{
|
||||
if (row == SECURITY_BUTTON_INDEX) {
|
||||
cell = [self getDefaultTableViewCell:tableView];
|
||||
|
||||
cell.textLabel.text = [VectorL10n securitySettingsTitle];
|
||||
[cell vc_setAccessoryDisclosureIndicatorWithCurrentTheme];
|
||||
}
|
||||
else if (row == SECURITY_MATOMO_INDEX) {
|
||||
MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
|
||||
|
||||
labelAndSwitchCell.mxkLabel.text = BWIL10n.matomoSettingsSendDiagnosticData;
|
||||
labelAndSwitchCell.mxkSwitch.on = RiotSettings.shared.bwiEnableMatomoTracking;
|
||||
labelAndSwitchCell.mxkSwitch.onTintColor = ThemeService.shared.theme.tintColor;
|
||||
labelAndSwitchCell.mxkSwitch.enabled = YES;
|
||||
[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleEnableMatomoTracking:) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
cell = labelAndSwitchCell;
|
||||
switch (row)
|
||||
{
|
||||
case SECURITY_BUTTON_INDEX:
|
||||
cell = [self getDefaultTableViewCell:tableView];
|
||||
cell.textLabel.text = [VectorL10n securitySettingsTitle];
|
||||
[cell vc_setAccessoryDisclosureIndicatorWithCurrentTheme];
|
||||
break;
|
||||
case DEVICE_MANAGER_INDEX:
|
||||
cell = [self getDefaultTableViewCell:tableView];
|
||||
cell.textLabel.text = [VectorL10n userSessionsSettings];
|
||||
[cell vc_setAccessoryDisclosureIndicatorWithCurrentTheme];
|
||||
break;
|
||||
case SECURITY_MATOMO_INDEX: {
|
||||
MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
|
||||
|
||||
labelAndSwitchCell.mxkLabel.text = BWIL10n.matomoSettingsSendDiagnosticData;
|
||||
labelAndSwitchCell.mxkSwitch.on = RiotSettings.shared.bwiEnableMatomoTracking;
|
||||
labelAndSwitchCell.mxkSwitch.onTintColor = ThemeService.shared.theme.tintColor;
|
||||
labelAndSwitchCell.mxkSwitch.enabled = YES;
|
||||
[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(toggleEnableMatomoTracking:) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
cell = labelAndSwitchCell;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else if (section == SECTION_TAG_DEACTIVATE_ACCOUNT)
|
||||
@@ -3358,6 +3316,11 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
|
||||
[self pushViewController:securityViewController];
|
||||
break;
|
||||
}
|
||||
case DEVICE_MANAGER_INDEX:
|
||||
{
|
||||
[self showUserSessionsFlow];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (section == SECTION_TAG_NOTIFICATIONS)
|
||||
@@ -3765,43 +3728,6 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
|
||||
RiotSettings.shared.pinRoomsWithUnreadMessagesOnHome = sender.on;
|
||||
}
|
||||
|
||||
- (void)toggleCommunityFlair:(UISwitch *)sender
|
||||
{
|
||||
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:sender.tag inSection:groupsDataSource.joinedGroupsSection];
|
||||
id<MXKGroupCellDataStoring> groupCellData = [groupsDataSource cellDataAtIndex:indexPath];
|
||||
MXGroup *group = groupCellData.group;
|
||||
|
||||
if (group)
|
||||
{
|
||||
[self startActivityIndicator];
|
||||
|
||||
__weak typeof(self) weakSelf = self;
|
||||
|
||||
[self.mainSession updateGroupPublicity:group isPublicised:sender.isOn success:^{
|
||||
|
||||
if (weakSelf)
|
||||
{
|
||||
typeof(self) self = weakSelf;
|
||||
[self stopActivityIndicator];
|
||||
}
|
||||
|
||||
} failure:^(NSError *error) {
|
||||
|
||||
if (weakSelf)
|
||||
{
|
||||
typeof(self) self = weakSelf;
|
||||
[self stopActivityIndicator];
|
||||
|
||||
// Come back to previous state button
|
||||
[sender setOn:!sender.isOn animated:YES];
|
||||
|
||||
// Notify user
|
||||
[[AppDelegate theDelegate] showErrorAsAlert:error];
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)toggleUseOnlyLatestUserAvatarAndName:(UISwitch *)sender
|
||||
{
|
||||
RiotSettings.shared.roomScreenUseOnlyLatestUserAvatarAndName = sender.isOn;
|
||||
@@ -4373,6 +4299,10 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
|
||||
// The user wants to select this theme
|
||||
RiotSettings.shared.userInterfaceTheme = newTheme;
|
||||
ThemeService.shared.themeId = newTheme;
|
||||
|
||||
// This is a hack to force the background colour of the container view of the navigation controller
|
||||
// This is needed only for hot theme update as the UIViewControllerWrapperView of the RioNavigationController is not updated
|
||||
self.view.superview.backgroundColor = ThemeService.shared.theme.backgroundColor;
|
||||
|
||||
[self updateSections];
|
||||
}
|
||||
@@ -4637,25 +4567,6 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - MXKDataSourceDelegate
|
||||
|
||||
- (Class<MXKCellRendering>)cellViewClassForCellData:(MXKCellData*)cellData
|
||||
{
|
||||
// Return the class used to display a group with a toogle button
|
||||
return GroupTableViewCellWithSwitch.class;
|
||||
}
|
||||
|
||||
- (NSString *)cellReuseIdentifierForCellData:(MXKCellData*)cellData
|
||||
{
|
||||
return GroupTableViewCellWithSwitch.defaultReuseIdentifier;
|
||||
}
|
||||
|
||||
- (void)dataSource:(MXKDataSource *)dataSource didCellChange:(id)changes
|
||||
{
|
||||
// Group data has been updated. Do a simple full reload
|
||||
[self refreshSettings];
|
||||
}
|
||||
|
||||
#pragma mark - DeactivateAccountViewControllerDelegate
|
||||
|
||||
- (void)deactivateAccountViewControllerDidDeactivateWithSuccess:(DeactivateAccountViewController *)deactivateAccountViewController
|
||||
@@ -4729,19 +4640,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
|
||||
|
||||
- (BOOL)canSetupSecureBackup
|
||||
{
|
||||
// Accept to create a setup only if we have the 3 cross-signing keys
|
||||
// This is the path to have a sane state
|
||||
// TODO: What about missing MSK that was not gossiped before?
|
||||
|
||||
MXRecoveryService *recoveryService = self.mainSession.crypto.recoveryService;
|
||||
|
||||
NSArray *crossSigningServiceSecrets = @[
|
||||
MXSecretId.crossSigningMaster,
|
||||
MXSecretId.crossSigningSelfSigning,
|
||||
MXSecretId.crossSigningUserSigning];
|
||||
|
||||
return ([recoveryService.secretsStoredLocally mx_intersectArray:crossSigningServiceSecrets].count
|
||||
== crossSigningServiceSecrets.count);
|
||||
return [self.mainSession vc_canSetupSecureBackup];
|
||||
}
|
||||
|
||||
#pragma mark - SecureBackupSetupCoordinatorBridgePresenterDelegate
|
||||
@@ -5328,4 +5227,35 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
|
||||
self.changePasswordBridgePresenter = nil;
|
||||
}
|
||||
|
||||
#pragma mark - User sessions management
|
||||
|
||||
- (void)showUserSessionsFlow
|
||||
{
|
||||
if (!self.mainSession)
|
||||
{
|
||||
MXLogError(@"[SettingsViewController] Cannot show user sessions flow, no user session available");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!self.navigationController)
|
||||
{
|
||||
MXLogError(@"[SettingsViewController] Cannot show user sessions flow, no navigation controller available");
|
||||
return;
|
||||
}
|
||||
|
||||
UserSessionsFlowCoordinatorBridgePresenter *userSessionsFlowCoordinatorBridgePresenter = [[UserSessionsFlowCoordinatorBridgePresenter alloc] initWithMxSession:self.mainSession];
|
||||
|
||||
MXWeakify(self);
|
||||
|
||||
userSessionsFlowCoordinatorBridgePresenter.completion = ^{
|
||||
MXStrongifyAndReturnIfNil(self);
|
||||
|
||||
self.userSessionsFlowCoordinatorBridgePresenter = nil;
|
||||
};
|
||||
|
||||
self.userSessionsFlowCoordinatorBridgePresenter = userSessionsFlowCoordinatorBridgePresenter;
|
||||
|
||||
[self.userSessionsFlowCoordinatorBridgePresenter pushFrom:self.navigationController animated:YES];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user