Merge pull request #7656 from vector-im/mauroromito/account_management_cell_for_oidc

Manage account through MAS if available
This commit is contained in:
Mauro
2023-08-25 13:46:15 +02:00
committed by GitHub
4 changed files with 59 additions and 0 deletions

View File

@@ -748,6 +748,9 @@ Tap the + to start adding people.";
"settings_three_pids_management_information_part1" = "Manage which email addresses or phone numbers you can use to log in or recover your account here. Control who can find you in ";
"settings_three_pids_management_information_part2" = "Discovery";
"settings_three_pids_management_information_part3" = ".";
"settings_manage_account_title" = "Account";
"settings_manage_account_action" = "Manage account";
"settings_manage_account_description" = "Manage your account at %@";
"settings_confirm_media_size" = "Confirm size when sending";
"settings_confirm_media_size_description" = "When this is on, youll be asked to confirm what size images and videos will be sent as.";

View File

@@ -7791,6 +7791,18 @@ public class VectorL10n: NSObject {
public static var settingsLinks: String {
return VectorL10n.tr("Vector", "settings_links")
}
/// Manage account
public static var settingsManageAccountAction: String {
return VectorL10n.tr("Vector", "settings_manage_account_action")
}
/// Manage your account at %@
public static func settingsManageAccountDescription(_ p1: String) -> String {
return VectorL10n.tr("Vector", "settings_manage_account_description", p1)
}
/// Account
public static var settingsManageAccountTitle: String {
return VectorL10n.tr("Vector", "settings_manage_account_title")
}
/// Mark all messages as read
public static var settingsMarkAllAsRead: String {
return VectorL10n.tr("Vector", "settings_mark_all_as_read")

View File

@@ -50,6 +50,7 @@ typedef NS_ENUM(NSUInteger, SECTION_TAG)
{
SECTION_TAG_SIGN_OUT = 0,
SECTION_TAG_USER_SETTINGS,
SECTION_TAG_ACCOUNT,
SECTION_TAG_SENDING_MEDIA,
SECTION_TAG_LINKS,
SECTION_TAG_SECURITY,
@@ -185,6 +186,11 @@ typedef NS_ENUM(NSUInteger, SECURITY)
DEVICE_MANAGER_INDEX
};
typedef NS_ENUM(NSUInteger, ACCOUNT)
{
ACCOUNT_MANAGE_INDEX = 0,
};
typedef void (^blockSettingsViewController_onReadyToDestroy)(void);
#pragma mark - SettingsViewController
@@ -386,6 +392,16 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
sectionUserSettings.headerTitle = [VectorL10n settingsUserSettings];
[tmpSections addObject:sectionUserSettings];
NSString *manageAccountURL = self.mainSession.homeserverWellknown.authentication.account;
if (manageAccountURL)
{
Section *account = [Section sectionWithTag: SECTION_TAG_ACCOUNT];
[account addRowWithTag:ACCOUNT_MANAGE_INDEX];
account.headerTitle = [VectorL10n settingsManageAccountTitle];
account.footerTitle = [VectorL10n settingsManageAccountDescription:manageAccountURL];
[tmpSections addObject:account];
}
if (BuildSettings.settingsScreenShowConfirmMediaSize)
{
@@ -2629,6 +2645,17 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
cell = deactivateAccountBtnCell;
}
else if (section == SECTION_TAG_ACCOUNT)
{
switch (row)
{
case ACCOUNT_MANAGE_INDEX:
cell = [self getDefaultTableViewCell:tableView];
cell.textLabel.text = [VectorL10n settingsManageAccountAction];
[cell vc_setAccessoryDisclosureIndicatorWithCurrentTheme];
break;
}
}
return cell;
}
@@ -2978,6 +3005,14 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
break;
}
}
else if (section == SECTION_TAG_ACCOUNT)
{
switch(row) {
case ACCOUNT_MANAGE_INDEX:
[self onManageAccountTap];
break;
}
}
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
@@ -3886,6 +3921,14 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
}
}
- (void)onManageAccountTap
{
NSURL *url = [NSURL URLWithString: self.mainSession.homeserverWellknown.authentication.account];
if (url) {
[UIApplication.sharedApplication openURL:url options:@{} completionHandler:nil];
}
}
- (void)showThemePicker
{
__weak typeof(self) weakSelf = self;

1
changelog.d/7653.feature Normal file
View File

@@ -0,0 +1 @@
New settings cell to manage your account through MAS if the home server allows it.