mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-25 11:02:48 +02:00
Merge remote-tracking branch 'origin/develop' into jitsi_widget
# Conflicts: # Riot.xcodeproj/project.pbxproj
This commit is contained in:
@@ -28,12 +28,16 @@
|
||||
#import "MXKEncryptionKeysExportView.h"
|
||||
#import "BugReportViewController.h"
|
||||
|
||||
#import "WebViewViewController.h"
|
||||
|
||||
#import "CountryPickerViewController.h"
|
||||
#import "LanguagePickerViewController.h"
|
||||
#import "TableViewCellWithPhoneNumberTextField.h"
|
||||
|
||||
#import "NBPhoneNumberUtil.h"
|
||||
|
||||
#import "AvatarGenerator.h"
|
||||
|
||||
#import "OLMKit/OLMKit.h"
|
||||
|
||||
|
||||
@@ -73,9 +77,8 @@ enum
|
||||
enum
|
||||
{
|
||||
USER_INTERFACE_LANGUAGE_INDEX = 0,
|
||||
// USER_INTERFACE_THEME_INDEX,
|
||||
USER_INTERFACE_COUNT,
|
||||
USER_INTERFACE_THEME_INDEX
|
||||
USER_INTERFACE_THEME_INDEX,
|
||||
USER_INTERFACE_COUNT
|
||||
};
|
||||
|
||||
enum
|
||||
@@ -201,6 +204,9 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
|
||||
// The user interface theme cell
|
||||
TableViewCellWithCheckBoxes *uiThemeCell;
|
||||
|
||||
// The current pushed view controller
|
||||
UIViewController *pushedViewController;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -237,8 +243,6 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
|
||||
self.navigationItem.title = NSLocalizedStringFromTable(@"settings_title", @"Vector", nil);
|
||||
|
||||
self.tableView.backgroundColor = kRiotColorLightGrey;
|
||||
|
||||
[self.tableView registerClass:MXKTableViewCellWithLabelAndTextField.class forCellReuseIdentifier:[MXKTableViewCellWithLabelAndTextField defaultReuseIdentifier]];
|
||||
[self.tableView registerClass:MXKTableViewCellWithLabelAndSwitch.class forCellReuseIdentifier:[MXKTableViewCellWithLabelAndSwitch defaultReuseIdentifier]];
|
||||
[self.tableView registerClass:MXKTableViewCellWithLabelAndMXKImageView.class forCellReuseIdentifier:[MXKTableViewCellWithLabelAndMXKImageView defaultReuseIdentifier]];
|
||||
@@ -300,13 +304,16 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
- (void)userInterfaceThemeDidChange
|
||||
{
|
||||
self.defaultBarTintColor = kRiotSecondaryBgColor;
|
||||
self.barTitleColor = kRiotPrimaryTextColor;
|
||||
|
||||
// Check the table view style to select its bg color.
|
||||
self.tableView.backgroundColor = ((self.tableView.style == UITableViewStylePlain) ? kRiotPrimaryBgColor : kRiotSecondaryBgColor);
|
||||
self.view.backgroundColor = self.tableView.backgroundColor;
|
||||
|
||||
if (self.tableView.dataSource)
|
||||
{
|
||||
[self refreshSettings];
|
||||
}
|
||||
|
||||
[self setNeedsStatusBarAppearanceUpdate];
|
||||
}
|
||||
|
||||
- (UIStatusBarStyle)preferredStatusBarStyle
|
||||
@@ -322,6 +329,9 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
|
||||
- (void)destroy
|
||||
{
|
||||
// Release the potential pushed view controller
|
||||
[self releasePushedViewController];
|
||||
|
||||
if (documentInteractionController)
|
||||
{
|
||||
[documentInteractionController dismissPreviewAnimated:NO];
|
||||
@@ -385,6 +395,9 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
[tracker send:[[GAIDictionaryBuilder createScreenView] build]];
|
||||
}
|
||||
|
||||
// Release the potential pushed view controller
|
||||
[self releasePushedViewController];
|
||||
|
||||
// Refresh display
|
||||
[self refreshSettings];
|
||||
|
||||
@@ -452,12 +465,39 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
|
||||
- (void)pushViewController:(UIViewController*)viewController
|
||||
{
|
||||
// Keep ref on pushed view controller
|
||||
pushedViewController = viewController;
|
||||
|
||||
// Hide back button title
|
||||
self.navigationItem.backBarButtonItem =[[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];
|
||||
|
||||
[self.navigationController pushViewController:viewController animated:YES];
|
||||
}
|
||||
|
||||
- (void)releasePushedViewController
|
||||
{
|
||||
if (pushedViewController)
|
||||
{
|
||||
if ([pushedViewController isKindOfClass:[UINavigationController class]])
|
||||
{
|
||||
UINavigationController *navigationController = (UINavigationController*)pushedViewController;
|
||||
for (id subViewController in navigationController.viewControllers)
|
||||
{
|
||||
if ([subViewController respondsToSelector:@selector(destroy)])
|
||||
{
|
||||
[subViewController destroy];
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ([pushedViewController respondsToSelector:@selector(destroy)])
|
||||
{
|
||||
[(id)pushedViewController destroy];
|
||||
}
|
||||
|
||||
pushedViewController = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)dismissKeyboard
|
||||
{
|
||||
[currentPasswordTextField resignFirstResponder];
|
||||
@@ -880,30 +920,30 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
// Crypto information
|
||||
NSMutableAttributedString *cryptoInformationString = [[NSMutableAttributedString alloc]
|
||||
initWithString:NSLocalizedStringFromTable(@"settings_crypto_device_name", @"Vector", nil)
|
||||
attributes:@{NSForegroundColorAttributeName : kRiotTextColorBlack,
|
||||
attributes:@{NSForegroundColorAttributeName : kRiotPrimaryTextColor,
|
||||
NSFontAttributeName: [UIFont systemFontOfSize:17]}];
|
||||
[cryptoInformationString appendAttributedString:[[NSMutableAttributedString alloc]
|
||||
initWithString:account.device.displayName ? account.device.displayName : @""
|
||||
attributes:@{NSForegroundColorAttributeName : kRiotTextColorBlack,
|
||||
attributes:@{NSForegroundColorAttributeName : kRiotPrimaryTextColor,
|
||||
NSFontAttributeName: [UIFont systemFontOfSize:17]}]];
|
||||
|
||||
[cryptoInformationString appendAttributedString:[[NSMutableAttributedString alloc]
|
||||
initWithString:NSLocalizedStringFromTable(@"settings_crypto_device_id", @"Vector", nil)
|
||||
attributes:@{NSForegroundColorAttributeName : kRiotTextColorBlack,
|
||||
attributes:@{NSForegroundColorAttributeName : kRiotPrimaryTextColor,
|
||||
NSFontAttributeName: [UIFont systemFontOfSize:17]}]];
|
||||
[cryptoInformationString appendAttributedString:[[NSMutableAttributedString alloc]
|
||||
initWithString:account.device.deviceId ? account.device.deviceId : @""
|
||||
attributes:@{NSForegroundColorAttributeName : kRiotTextColorBlack,
|
||||
attributes:@{NSForegroundColorAttributeName : kRiotPrimaryTextColor,
|
||||
NSFontAttributeName: [UIFont systemFontOfSize:17]}]];
|
||||
|
||||
[cryptoInformationString appendAttributedString:[[NSMutableAttributedString alloc]
|
||||
initWithString:NSLocalizedStringFromTable(@"settings_crypto_device_key", @"Vector", nil)
|
||||
attributes:@{NSForegroundColorAttributeName : kRiotTextColorBlack,
|
||||
attributes:@{NSForegroundColorAttributeName : kRiotPrimaryTextColor,
|
||||
NSFontAttributeName: [UIFont systemFontOfSize:17]}]];
|
||||
NSString *fingerprint = account.mxSession.crypto.deviceEd25519Key;
|
||||
[cryptoInformationString appendAttributedString:[[NSMutableAttributedString alloc]
|
||||
initWithString:fingerprint ? fingerprint : @""
|
||||
attributes:@{NSForegroundColorAttributeName : kRiotTextColorBlack,
|
||||
attributes:@{NSForegroundColorAttributeName : kRiotPrimaryTextColor,
|
||||
NSFontAttributeName: [UIFont boldSystemFontOfSize:17]}]];
|
||||
|
||||
return cryptoInformationString;
|
||||
@@ -1198,12 +1238,12 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
cell.mxkTextFieldLeadingConstraint.constant = 16;
|
||||
cell.mxkTextFieldTrailingConstraint.constant = 15;
|
||||
|
||||
cell.mxkLabel.textColor = kRiotTextColorBlack;
|
||||
cell.mxkLabel.textColor = kRiotPrimaryTextColor;
|
||||
|
||||
cell.mxkTextField.userInteractionEnabled = YES;
|
||||
cell.mxkTextField.borderStyle = UITextBorderStyleNone;
|
||||
cell.mxkTextField.textAlignment = NSTextAlignmentRight;
|
||||
cell.mxkTextField.textColor = kRiotTextColorGray;
|
||||
cell.mxkTextField.textColor = kRiotSecondaryTextColor;
|
||||
cell.mxkTextField.font = [UIFont systemFontOfSize:16];
|
||||
cell.mxkTextField.placeholder = nil;
|
||||
|
||||
@@ -1223,7 +1263,7 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
cell.mxkLabelLeadingConstraint.constant = cell.separatorInset.left;
|
||||
cell.mxkSwitchTrailingConstraint.constant = 15;
|
||||
|
||||
cell.mxkLabel.textColor = kRiotTextColorBlack;
|
||||
cell.mxkLabel.textColor = kRiotPrimaryTextColor;
|
||||
|
||||
return cell;
|
||||
}
|
||||
@@ -1244,7 +1284,7 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
}
|
||||
cell.textLabel.accessibilityIdentifier = nil;
|
||||
cell.textLabel.font = [UIFont systemFontOfSize:17];
|
||||
cell.textLabel.textColor = kRiotTextColorBlack;
|
||||
cell.textLabel.textColor = kRiotPrimaryTextColor;
|
||||
|
||||
return cell;
|
||||
}
|
||||
@@ -1312,7 +1352,7 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
|
||||
profileCell.mxkLabel.text = NSLocalizedStringFromTable(@"settings_profile_picture", @"Vector", nil);
|
||||
profileCell.accessibilityIdentifier=@"SettingsVCProfilPictureStaticText";
|
||||
profileCell.mxkLabel.textColor = kRiotTextColorBlack;
|
||||
profileCell.mxkLabel.textColor = kRiotPrimaryTextColor;
|
||||
|
||||
// if the user defines a new avatar
|
||||
if (newAvatarImage)
|
||||
@@ -1397,6 +1437,12 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
{
|
||||
newEmailCell.mxkLabel.text = nil;
|
||||
newEmailCell.mxkTextField.placeholder = NSLocalizedStringFromTable(@"settings_email_address_placeholder", @"Vector", nil);
|
||||
if (kRiotPlaceholderTextColor)
|
||||
{
|
||||
newEmailCell.mxkTextField.attributedPlaceholder = [[NSAttributedString alloc]
|
||||
initWithString:newEmailCell.mxkTextField.placeholder
|
||||
attributes:@{NSForegroundColorAttributeName: kRiotPlaceholderTextColor}];
|
||||
}
|
||||
newEmailCell.mxkTextField.text = newEmailTextField.text;
|
||||
newEmailCell.mxkTextField.userInteractionEnabled = YES;
|
||||
newEmailCell.mxkTextField.keyboardType = UIKeyboardTypeEmailAddress;
|
||||
@@ -1536,7 +1582,7 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
else if (row == userSettingsNightModeSepIndex)
|
||||
{
|
||||
UITableViewCell *sepCell = [[UITableViewCell alloc] init];
|
||||
sepCell.backgroundColor = kRiotColorLightGrey;
|
||||
sepCell.backgroundColor = kRiotSecondaryBgColor;
|
||||
|
||||
cell = sepCell;
|
||||
}
|
||||
@@ -1624,7 +1670,7 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:language];
|
||||
languageDescription = [languageDescription capitalizedStringWithLocale:locale];
|
||||
|
||||
cell.textLabel.textColor = kRiotTextColorBlack;
|
||||
cell.textLabel.textColor = kRiotPrimaryTextColor;
|
||||
|
||||
cell.textLabel.text = NSLocalizedStringFromTable(@"settings_ui_language", @"Vector", nil);
|
||||
cell.detailTextLabel.text = languageDescription;
|
||||
@@ -1646,8 +1692,10 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
NSArray *labels = uiThemeCell.labels;
|
||||
UILabel *label;
|
||||
label = labels[0];
|
||||
label.textColor = kRiotPrimaryTextColor;
|
||||
label.text = NSLocalizedStringFromTable(@"settings_ui_light_theme", @"Vector", nil);
|
||||
label = labels[1];
|
||||
label.textColor = kRiotPrimaryTextColor;
|
||||
label.text = NSLocalizedStringFromTable(@"settings_ui_dark_theme", @"Vector", nil);
|
||||
|
||||
NSString *selectedTheme = [[NSUserDefaults standardUserDefaults] stringForKey:@"userInterfaceTheme"];
|
||||
@@ -1704,7 +1752,7 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
NSLocale *local = [[NSLocale alloc] initWithLocaleIdentifier:[[[NSBundle mainBundle] preferredLocalizations] objectAtIndex:0]];
|
||||
NSString *countryName = [local displayNameForKey:NSLocaleCountryCode value:countryCode];
|
||||
|
||||
cell.textLabel.textColor = kRiotTextColorBlack;
|
||||
cell.textLabel.textColor = kRiotPrimaryTextColor;
|
||||
|
||||
cell.textLabel.text = NSLocalizedStringFromTable(@"settings_contacts_phonebook_country", @"Vector", nil);
|
||||
cell.detailTextLabel.text = countryName;
|
||||
@@ -2036,7 +2084,7 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
{
|
||||
// Customize label style
|
||||
UITableViewHeaderFooterView *tableViewHeaderFooterView = (UITableViewHeaderFooterView*)view;
|
||||
tableViewHeaderFooterView.textLabel.textColor = kRiotTextColorBlack;
|
||||
tableViewHeaderFooterView.textLabel.textColor = kRiotPrimaryTextColor;
|
||||
tableViewHeaderFooterView.textLabel.font = [UIFont systemFontOfSize:15];
|
||||
}
|
||||
}
|
||||
@@ -2062,6 +2110,32 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
|
||||
#pragma mark - UITableView delegate
|
||||
|
||||
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath;
|
||||
{
|
||||
cell.backgroundColor = kRiotPrimaryBgColor;
|
||||
|
||||
if (cell.selectionStyle != UITableViewCellSelectionStyleNone)
|
||||
{
|
||||
// Update the selected background view
|
||||
if (kRiotSelectedBgColor)
|
||||
{
|
||||
cell.selectedBackgroundView = [[UIView alloc] init];
|
||||
cell.selectedBackgroundView.backgroundColor = kRiotSelectedBgColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tableView.style == UITableViewStylePlain)
|
||||
{
|
||||
cell.selectedBackgroundView = nil;
|
||||
}
|
||||
else
|
||||
{
|
||||
cell.selectedBackgroundView.backgroundColor = nil;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
|
||||
{
|
||||
if (section == SETTINGS_SECTION_IGNORED_USERS_INDEX)
|
||||
@@ -2121,7 +2195,7 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
|
||||
}];
|
||||
|
||||
leaveAction.backgroundColor = [MXKTools convertImageToPatternColor:@"remove_icon_pink" backgroundColor:kRiotColorLightGrey patternSize:CGSizeMake(50, cellHeight) resourceSize:CGSizeMake(20, 18)];
|
||||
leaveAction.backgroundColor = [MXKTools convertImageToPatternColor:@"remove_icon_pink" backgroundColor:kRiotSecondaryBgColor patternSize:CGSizeMake(50, cellHeight) resourceSize:CGSizeMake(20, 18)];
|
||||
[actions insertObject:leaveAction atIndex:0];
|
||||
}
|
||||
}
|
||||
@@ -2216,7 +2290,7 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
{
|
||||
if (row == OTHER_COPYRIGHT_INDEX)
|
||||
{
|
||||
MXKWebViewViewController *webViewViewController = [[MXKWebViewViewController alloc] initWithURL:NSLocalizedStringFromTable(@"settings_copyright_url", @"Vector", nil)];
|
||||
WebViewViewController *webViewViewController = [[WebViewViewController alloc] initWithURL:NSLocalizedStringFromTable(@"settings_copyright_url", @"Vector", nil)];
|
||||
|
||||
webViewViewController.title = NSLocalizedStringFromTable(@"settings_copyright", @"Vector", nil);
|
||||
|
||||
@@ -2224,7 +2298,7 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
}
|
||||
else if (row == OTHER_TERM_CONDITIONS_INDEX)
|
||||
{
|
||||
MXKWebViewViewController *webViewViewController = [[MXKWebViewViewController alloc] initWithURL:NSLocalizedStringFromTable(@"settings_term_conditions_url", @"Vector", nil)];
|
||||
WebViewViewController *webViewViewController = [[WebViewViewController alloc] initWithURL:NSLocalizedStringFromTable(@"settings_term_conditions_url", @"Vector", nil)];
|
||||
|
||||
webViewViewController.title = NSLocalizedStringFromTable(@"settings_term_conditions", @"Vector", nil);
|
||||
|
||||
@@ -2232,7 +2306,7 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
}
|
||||
else if (row == OTHER_PRIVACY_INDEX)
|
||||
{
|
||||
MXKWebViewViewController *webViewViewController = [[MXKWebViewViewController alloc] initWithURL:NSLocalizedStringFromTable(@"settings_privacy_policy_url", @"Vector", nil)];
|
||||
WebViewViewController *webViewViewController = [[WebViewViewController alloc] initWithURL:NSLocalizedStringFromTable(@"settings_privacy_policy_url", @"Vector", nil)];
|
||||
|
||||
webViewViewController.title = NSLocalizedStringFromTable(@"settings_privacy_policy", @"Vector", nil);
|
||||
|
||||
@@ -2242,7 +2316,7 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
{
|
||||
NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"third_party_licenses" ofType:@"html" inDirectory:nil];
|
||||
|
||||
MXKWebViewViewController *webViewViewController = [[MXKWebViewViewController alloc] initWithLocalHTMLFile:htmlFile];
|
||||
WebViewViewController *webViewViewController = [[WebViewViewController alloc] initWithLocalHTMLFile:htmlFile];
|
||||
|
||||
webViewViewController.title = NSLocalizedStringFromTable(@"settings_third_party_notices", @"Vector", nil);
|
||||
|
||||
@@ -3624,6 +3698,9 @@ typedef void (^blockSettingsViewController_onReadyToDestroy)();
|
||||
|
||||
if (!isCurrentlySelected)
|
||||
{
|
||||
// Clear fake Riot Avatars based on the previous theme.
|
||||
[AvatarGenerator clear];
|
||||
|
||||
// The user wants to select this theme
|
||||
[[NSUserDefaults standardUserDefaults] setObject:theme forKey:@"userInterfaceTheme"];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
|
||||
Reference in New Issue
Block a user