From b7ffeda0164a2bfdbfefaf5983cc8c773ac66f2b Mon Sep 17 00:00:00 2001 From: Doug Date: Tue, 15 Aug 2023 11:10:01 +0100 Subject: [PATCH 01/16] Prepare for new sprint --- Config/AppVersion.xcconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Config/AppVersion.xcconfig b/Config/AppVersion.xcconfig index ec41e80dc0..37b603c0b6 100644 --- a/Config/AppVersion.xcconfig +++ b/Config/AppVersion.xcconfig @@ -15,5 +15,5 @@ // // Version -MARKETING_VERSION = 1.11.0 -CURRENT_PROJECT_VERSION = 1.11.0 +MARKETING_VERSION = 1.11.1 +CURRENT_PROJECT_VERSION = 1.11.1 From 51337cafb23390090d26f651c71e04a62dbaf872 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Mon, 21 Aug 2023 09:58:50 +0300 Subject: [PATCH 02/16] Update introspect to the latest version, remove now duplicate `introspectCollectionView` --- Podfile.lock | 6 +++--- RiotSwiftUI/Modules/Common/Util/ListBackground.swift | 6 ------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/Podfile.lock b/Podfile.lock index 9884244884..561af4bce5 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -26,7 +26,7 @@ PODS: - GBDeviceInfo/Core (= 7.1.0) - GBDeviceInfo/Core (7.1.0) - GZIP (1.3.0) - - Introspect (0.1.4) + - Introspect (0.11.0) - JitsiMeetSDKLite (8.1.2-lite): - JitsiWebRTC (~> 111.0) - JitsiWebRTC (111.0.2) @@ -177,7 +177,7 @@ SPEC CHECKSUMS: FlowCommoniOS: ca92071ab526dc89905495a37844fd7e78d1a7f2 GBDeviceInfo: 5d62fa85bdcce3ed288d83c28789adf1173e4376 GZIP: 416858efbe66b41b206895ac6dfd5493200d95b3 - Introspect: b62c4dd2063072327c21d618ef2bedc3c87bc366 + Introspect: 4cc1e4c34dd016540c8d86a591c231c09dafbee3 JitsiMeetSDKLite: 895213158cf62342069a10634a41d2f1c00057f7 JitsiWebRTC: 80f62908fcf2a1160e0d14b584323fb6e6be630b KeychainAccess: c0c4f7f38f6fc7bbe58f5702e25f7bd2f65abf51 @@ -210,4 +210,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: f8f66ce4fa24937192a493d3a0a5c2c2e429c8fc -COCOAPODS: 1.11.3 +COCOAPODS: 1.12.1 diff --git a/RiotSwiftUI/Modules/Common/Util/ListBackground.swift b/RiotSwiftUI/Modules/Common/Util/ListBackground.swift index d4e087da88..ddfc362c2c 100644 --- a/RiotSwiftUI/Modules/Common/Util/ListBackground.swift +++ b/RiotSwiftUI/Modules/Common/Util/ListBackground.swift @@ -49,10 +49,4 @@ extension View { func listBackgroundColor(_ color: Color) -> some View { modifier(ListBackgroundModifier(color: color)) } - - /// Finds a `UICollectionView` from a `SwiftUI.List`, or `SwiftUI.List` child. - /// Stop gap until https://github.com/siteline/SwiftUI-Introspect/pull/169 - func introspectCollectionView(customize: @escaping (UICollectionView) -> Void) -> some View { - introspect(selector: TargetViewSelector.ancestorOrSiblingContaining, customize: customize) - } } From 6faf14da695ce1fd57efaa77951be872dd633e57 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Mon, 21 Aug 2023 10:03:23 +0300 Subject: [PATCH 03/16] Prevent pill crashes when room members are missing display names (objc interop) --- Riot/Modules/Pills/PillsFormatter.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Riot/Modules/Pills/PillsFormatter.swift b/Riot/Modules/Pills/PillsFormatter.swift index 1b6256835a..ecdfac5fed 100644 --- a/Riot/Modules/Pills/PillsFormatter.swift +++ b/Riot/Modules/Pills/PillsFormatter.swift @@ -197,12 +197,14 @@ class PillsFormatter: NSObject { guard let roomMember = roomState.members.member(withUserId: userId) else { return } + + let displayName = roomMember.displayname ?? userId pill.data?.items = [ .avatar(url: roomMember.avatarUrl, - string: roomMember.displayname, - matrixId: roomMember.userId), - .text(roomMember.displayname) + string: displayName, + matrixId: userId), + .text(displayName) ] default: break From 0464ded37721aa7c8912842b4a20f29ce8a8016a Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Mon, 21 Aug 2023 14:46:09 +0300 Subject: [PATCH 04/16] Prevent mention crashes when room members are missing display names (objc interop) --- .../WYSIWYGInputToolbar/WysiwygInputToolbarView.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Riot/Modules/Room/Views/WYSIWYGInputToolbar/WysiwygInputToolbarView.swift b/Riot/Modules/Room/Views/WYSIWYGInputToolbar/WysiwygInputToolbarView.swift index edd951fd64..60b6edf943 100644 --- a/Riot/Modules/Room/Views/WYSIWYGInputToolbar/WysiwygInputToolbarView.swift +++ b/Riot/Modules/Room/Views/WYSIWYGInputToolbar/WysiwygInputToolbarView.swift @@ -207,8 +207,14 @@ class WysiwygInputToolbarView: MXKRoomInputToolbarView, NibLoadable, HtmlRoomInp } func mention(_ member: MXRoomMember) { - self.wysiwygViewModel.setMention(url: MXTools.permalinkToUser(withUserId: member.userId), - name: member.displayname, + guard let userId = member.userId else { + return + } + + let displayName = member.displayname ?? userId + + self.wysiwygViewModel.setMention(url: MXTools.permalinkToUser(withUserId: userId), + name: displayName, mentionType: .user) } From 021af0567b85de9c6cb61bd7a5f5c045daab35d9 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Wed, 23 Aug 2023 16:02:04 +0300 Subject: [PATCH 05/16] Add changelogs --- changelog.d/7651.bugfix | 1 + changelog.d/pr-7649.bugfix | 1 + 2 files changed, 2 insertions(+) create mode 100644 changelog.d/7651.bugfix create mode 100644 changelog.d/pr-7649.bugfix diff --git a/changelog.d/7651.bugfix b/changelog.d/7651.bugfix new file mode 100644 index 0000000000..4f97c24a7f --- /dev/null +++ b/changelog.d/7651.bugfix @@ -0,0 +1 @@ +Prevent pill crashes when room members are missing display names (objc interop) \ No newline at end of file diff --git a/changelog.d/pr-7649.bugfix b/changelog.d/pr-7649.bugfix new file mode 100644 index 0000000000..08e9bebec0 --- /dev/null +++ b/changelog.d/pr-7649.bugfix @@ -0,0 +1 @@ +Prevent mention crashes when room members are missing display names (objc interop) \ No newline at end of file From 76c26879d418960218a07d58cd844d0ee1ae3ec3 Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Thu, 24 Aug 2023 17:18:13 +0200 Subject: [PATCH 06/16] Hide deactivate account if the auth property is present on the WK. --- Riot/Modules/Settings/SettingsViewController.m | 2 +- changelog.d/7648.bugfix | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog.d/7648.bugfix diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index be87bea3b8..c50bc3c357 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -608,7 +608,7 @@ - (void)updateSections } } - if (BuildSettings.settingsScreenAllowDeactivatingAccount) + if (BuildSettings.settingsScreenAllowDeactivatingAccount && !self.mainSession.homeserverWellknown.authentication) { Section *sectionDeactivate = [Section sectionWithTag:SECTION_TAG_DEACTIVATE_ACCOUNT]; [sectionDeactivate addRowWithTag:0]; diff --git a/changelog.d/7648.bugfix b/changelog.d/7648.bugfix new file mode 100644 index 0000000000..c8f48546c1 --- /dev/null +++ b/changelog.d/7648.bugfix @@ -0,0 +1 @@ +Deactivate account is hidden for servers with OIDC auth. \ No newline at end of file From 91b6d27bc6729f87cecce041799a570390992cea Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Thu, 24 Aug 2023 17:53:48 +0200 Subject: [PATCH 07/16] completed --- Riot/Modules/Settings/SettingsViewController.m | 5 ++++- changelog.d/7645.bugfix | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelog.d/7645.bugfix diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index be87bea3b8..9f818a988e 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -365,7 +365,10 @@ - (void)updateSections { [sectionUserSettings addRowWithTag: USER_SETTINGS_PHONENUMBERS_OFFSET + index]; } - if (BuildSettings.settingsScreenAllowAddingEmailThreepids) + if (BuildSettings.settingsScreenAllowAddingEmailThreepids && + // If the threePidChanges is nil we assume the capability to be true + (!self.mainSession.homeserverCapabilities.threePidChanges || + self.mainSession.homeserverCapabilities.threePidChanges.enabled)) { [sectionUserSettings addRowWithTag:USER_SETTINGS_ADD_EMAIL_INDEX]; } diff --git a/changelog.d/7645.bugfix b/changelog.d/7645.bugfix new file mode 100644 index 0000000000..b546db4f9e --- /dev/null +++ b/changelog.d/7645.bugfix @@ -0,0 +1 @@ +Add email UI is hidden if the 3 pid changes capability is disabled. \ No newline at end of file From 00e19ab683273758373fbe7919e27c845d83d7ed Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Thu, 24 Aug 2023 19:15:12 +0200 Subject: [PATCH 08/16] added the cell, now I just need to implement the navigation to the web view --- Riot/Assets/en.lproj/Vector.strings | 3 ++ Riot/Generated/Strings.swift | 12 ++++++ .../Modules/Settings/SettingsViewController.m | 41 +++++++++++++++++++ 3 files changed, 56 insertions(+) diff --git a/Riot/Assets/en.lproj/Vector.strings b/Riot/Assets/en.lproj/Vector.strings index 132e5dd259..1856fdb9fa 100644 --- a/Riot/Assets/en.lproj/Vector.strings +++ b/Riot/Assets/en.lproj/Vector.strings @@ -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"; +"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, you’ll be asked to confirm what size images and videos will be sent as."; diff --git a/Riot/Generated/Strings.swift b/Riot/Generated/Strings.swift index 1c2516fe9d..cc34c01bbe 100644 --- a/Riot/Generated/Strings.swift +++ b/Riot/Generated/Strings.swift @@ -7791,6 +7791,18 @@ public class VectorL10n: NSObject { public static var settingsLinks: String { return VectorL10n.tr("Vector", "settings_links") } + /// Manage + 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") diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index be87bea3b8..86aec19e8f 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -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 @@ -383,6 +389,16 @@ - (void)updateSections 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) { @@ -2626,6 +2642,17 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N 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; } @@ -2975,6 +3002,14 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath break; } } + else if (section == SECTION_TAG_ACCOUNT) + { + switch(row) { + case ACCOUNT_MANAGE_INDEX: + [self onManageAccountTap]; + break; + } + } [tableView deselectRowAtIndexPath:indexPath animated:YES]; } @@ -3883,6 +3918,12 @@ - (void)onProfileAvatarTap:(UITapGestureRecognizer *)recognizer } } +- (void)onManageAccountTap +{ + // TODO + // Open a web view with the account url +} + - (void)showThemePicker { __weak typeof(self) weakSelf = self; From 015ee924a1abdb73f4a4b8a11066cd043e81da63 Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Fri, 25 Aug 2023 12:21:38 +0200 Subject: [PATCH 09/16] web view opened on tap + changelog --- Riot/Assets/en.lproj/Vector.strings | 2 +- Riot/Modules/Settings/SettingsViewController.m | 7 +++++-- changelog.d/7653.feature | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 changelog.d/7653.feature diff --git a/Riot/Assets/en.lproj/Vector.strings b/Riot/Assets/en.lproj/Vector.strings index 1856fdb9fa..89d86d3368 100644 --- a/Riot/Assets/en.lproj/Vector.strings +++ b/Riot/Assets/en.lproj/Vector.strings @@ -749,7 +749,7 @@ Tap the + to start adding people."; "settings_three_pids_management_information_part2" = "Discovery"; "settings_three_pids_management_information_part3" = "."; "settings_manage_account_title" = "Account"; -"settings_manage_account_action" = "Manage"; +"settings_manage_account_action" = "Manage account"; "settings_manage_account_description" = "Manage your account at %@"; "settings_confirm_media_size" = "Confirm size when sending"; diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index 86aec19e8f..6a29ddf6b8 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -3920,8 +3920,11 @@ - (void)onProfileAvatarTap:(UITapGestureRecognizer *)recognizer - (void)onManageAccountTap { - // TODO - // Open a web view with the account url + NSURL *url = [NSURL URLWithString: self.mainSession.homeserverWellknown.authentication.account]; + if (url) { + SFSafariViewController *accountVC = [[SFSafariViewController alloc] initWithURL: url]; + [self presentViewController:accountVC animated:YES completion:nil]; + } } - (void)showThemePicker diff --git a/changelog.d/7653.feature b/changelog.d/7653.feature new file mode 100644 index 0000000000..cabf7402b4 --- /dev/null +++ b/changelog.d/7653.feature @@ -0,0 +1 @@ +New settings cell to manage your account through MAS if the home server allows it. \ No newline at end of file From cf7efe4b6c7841d2580bc99c7bb1da591e78b730 Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Fri, 25 Aug 2023 13:02:06 +0200 Subject: [PATCH 10/16] opening the safari web view externally so that it will be able to share the cookies --- Riot/Generated/Strings.swift | 2 +- Riot/Modules/Settings/SettingsViewController.m | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Riot/Generated/Strings.swift b/Riot/Generated/Strings.swift index cc34c01bbe..373f65fbd6 100644 --- a/Riot/Generated/Strings.swift +++ b/Riot/Generated/Strings.swift @@ -7791,7 +7791,7 @@ public class VectorL10n: NSObject { public static var settingsLinks: String { return VectorL10n.tr("Vector", "settings_links") } - /// Manage + /// Manage account public static var settingsManageAccountAction: String { return VectorL10n.tr("Vector", "settings_manage_account_action") } diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index 6a29ddf6b8..bbacd49803 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -3922,8 +3922,7 @@ - (void)onManageAccountTap { NSURL *url = [NSURL URLWithString: self.mainSession.homeserverWellknown.authentication.account]; if (url) { - SFSafariViewController *accountVC = [[SFSafariViewController alloc] initWithURL: url]; - [self presentViewController:accountVC animated:YES completion:nil]; + [UIApplication.sharedApplication openURL:url options:@{} completionHandler:nil]; } } From c454a29512a38d06b966d1f313347646f321260b Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Fri, 25 Aug 2023 17:22:11 +0200 Subject: [PATCH 11/16] fix 7646 --- .../ManageSession/ManageSessionViewController.m | 14 ++++++++++++++ .../Coordinator/UserSessionsFlowCoordinator.swift | 11 ++++++++++- changelog.d/7646.bugfix | 1 + 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 changelog.d/7646.bugfix diff --git a/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m b/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m index 806e10cffc..fa44c70500 100644 --- a/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m +++ b/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m @@ -655,6 +655,20 @@ - (void)showTrustForDevice:(MXDevice *)device } - (void)removeDevice +{ + NSURL *logoutURL = [self.mainSession.homeserverWellknown.authentication getMasLogoutDeviceURLFromDeviceID:device.deviceId]; + if (logoutURL) + { + [UIApplication.sharedApplication openURL:logoutURL options:@{} completionHandler:nil]; + [self withdrawViewControllerAnimated:YES completion:nil]; + } + else + { + [self removeDeviceThroughAPI]; + } +} + +-(void) removeDeviceThroughAPI { [self startActivityIndicator]; self.view.userInteractionEnabled = NO; diff --git a/RiotSwiftUI/Modules/UserSessions/Coordinator/UserSessionsFlowCoordinator.swift b/RiotSwiftUI/Modules/UserSessions/Coordinator/UserSessionsFlowCoordinator.swift index 79fd9e5738..a3fc8e212d 100644 --- a/RiotSwiftUI/Modules/UserSessions/Coordinator/UserSessionsFlowCoordinator.swift +++ b/RiotSwiftUI/Modules/UserSessions/Coordinator/UserSessionsFlowCoordinator.swift @@ -123,7 +123,11 @@ final class UserSessionsFlowCoordinator: NSObject, Coordinator, Presentable { if sessionInfo.isCurrent { self.showLogoutConfirmationForCurrentSession() } else { - self.showLogoutConfirmation(for: [sessionInfo]) + if let logoutURL = self.parameters.session.homeserverWellknown.authentication?.getMasLogoutDeviceURL(fromDeviceID: sessionInfo.id) { + self.openMasLogoutURL(logoutURL) + } else { + self.showLogoutConfirmation(for: [sessionInfo]) + } } case let .showSessionStateInfo(sessionInfo): self.showInfoSheet(parameters: .init(userSessionInfo: sessionInfo, parentSize: self.toPresentable().view.bounds.size)) @@ -182,6 +186,11 @@ final class UserSessionsFlowCoordinator: NSObject, Coordinator, Presentable { return UserOtherSessionsCoordinator(parameters: parameters) } + private func openMasLogoutURL(_ url: URL) { + UIApplication.shared.open(url) + popToSessionsOverview() + } + /// Shows a confirmation dialog to the user to sign out of a session. private func showLogoutConfirmation(for sessionInfos: [UserSessionInfo]) { // Use a UIAlertController as we don't have confirmationDialog in SwiftUI on iOS 14. diff --git a/changelog.d/7646.bugfix b/changelog.d/7646.bugfix new file mode 100644 index 0000000000..aaae87297a --- /dev/null +++ b/changelog.d/7646.bugfix @@ -0,0 +1 @@ +You can now log out from other sessions using MAS on supported OIDC home servers. \ No newline at end of file From e0659dd93aac185fb170f0f931e21025406b5596 Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Fri, 25 Aug 2023 19:39:55 +0200 Subject: [PATCH 12/16] code improvement --- .../Security/ManageSession/ManageSessionViewController.m | 2 +- .../UserSessions/Coordinator/UserSessionsFlowCoordinator.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m b/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m index fa44c70500..a3c1e431e7 100644 --- a/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m +++ b/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m @@ -656,7 +656,7 @@ - (void)showTrustForDevice:(MXDevice *)device - (void)removeDevice { - NSURL *logoutURL = [self.mainSession.homeserverWellknown.authentication getMasLogoutDeviceURLFromDeviceID:device.deviceId]; + NSURL *logoutURL = [self.mainSession.homeserverWellknown.authentication getLogoutDeviceURLFromID:device.deviceId]; if (logoutURL) { [UIApplication.sharedApplication openURL:logoutURL options:@{} completionHandler:nil]; diff --git a/RiotSwiftUI/Modules/UserSessions/Coordinator/UserSessionsFlowCoordinator.swift b/RiotSwiftUI/Modules/UserSessions/Coordinator/UserSessionsFlowCoordinator.swift index a3fc8e212d..acf6a30837 100644 --- a/RiotSwiftUI/Modules/UserSessions/Coordinator/UserSessionsFlowCoordinator.swift +++ b/RiotSwiftUI/Modules/UserSessions/Coordinator/UserSessionsFlowCoordinator.swift @@ -123,7 +123,7 @@ final class UserSessionsFlowCoordinator: NSObject, Coordinator, Presentable { if sessionInfo.isCurrent { self.showLogoutConfirmationForCurrentSession() } else { - if let logoutURL = self.parameters.session.homeserverWellknown.authentication?.getMasLogoutDeviceURL(fromDeviceID: sessionInfo.id) { + if let logoutURL = self.parameters.session.homeserverWellknown.authentication?.getLogoutDeviceURL(fromID: sessionInfo.id) { self.openMasLogoutURL(logoutURL) } else { self.showLogoutConfirmation(for: [sessionInfo]) From 15bb73fcbef26f8564077c406ea4a1867249101b Mon Sep 17 00:00:00 2001 From: Mauro Romito Date: Mon, 28 Aug 2023 12:20:26 +0200 Subject: [PATCH 13/16] completed --- Riot/Assets/en.lproj/Vector.strings | 2 + Riot/Generated/Strings.swift | 8 ++++ .../ManageSessionViewController.m | 40 ++++++++++++++-- .../UserSessionsFlowCoordinator.swift | 47 ++++++++++++++----- 4 files changed, 81 insertions(+), 16 deletions(-) diff --git a/Riot/Assets/en.lproj/Vector.strings b/Riot/Assets/en.lproj/Vector.strings index 89d86d3368..e1244e81ef 100644 --- a/Riot/Assets/en.lproj/Vector.strings +++ b/Riot/Assets/en.lproj/Vector.strings @@ -967,6 +967,8 @@ Tap the + to start adding people."; "manage_session_trusted" = "Trusted by you"; "manage_session_not_trusted" = "Not trusted"; "manage_session_sign_out" = "Sign out of this session"; +"manage_session_redirect" = "You will be redirected to your server's authentication provider to complete sign out."; +"manage_session_redirect_error" = "Functionality currently unavailable. Please contact your homeserver admin"; "manage_session_rename" = "Rename session"; "manage_session_sign_out_other_sessions" = "Sign out of all other sessions"; // User sessions management diff --git a/Riot/Generated/Strings.swift b/Riot/Generated/Strings.swift index 373f65fbd6..aa3ca9d725 100644 --- a/Riot/Generated/Strings.swift +++ b/Riot/Generated/Strings.swift @@ -3667,6 +3667,14 @@ public class VectorL10n: NSObject { public static var manageSessionNotTrusted: String { return VectorL10n.tr("Vector", "manage_session_not_trusted") } + /// You will be redirected to your server's authentication provider to complete sign out. + public static var manageSessionRedirect: String { + return VectorL10n.tr("Vector", "manage_session_redirect") + } + /// Functionality currently unavailable. Please contact your homeserver admin + public static var manageSessionRedirectError: String { + return VectorL10n.tr("Vector", "manage_session_redirect_error") + } /// Rename session public static var manageSessionRename: String { return VectorL10n.tr("Vector", "manage_session_rename") diff --git a/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m b/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m index a3c1e431e7..e1fd5c5e82 100644 --- a/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m +++ b/Riot/Modules/Settings/Security/ManageSession/ManageSessionViewController.m @@ -656,11 +656,18 @@ - (void)showTrustForDevice:(MXDevice *)device - (void)removeDevice { - NSURL *logoutURL = [self.mainSession.homeserverWellknown.authentication getLogoutDeviceURLFromID:device.deviceId]; - if (logoutURL) + MXWellKnownAuthentication *authentication = self.mainSession.homeserverWellknown.authentication; + if (authentication) { - [UIApplication.sharedApplication openURL:logoutURL options:@{} completionHandler:nil]; - [self withdrawViewControllerAnimated:YES completion:nil]; + NSURL *logoutURL = [authentication getLogoutDeviceURLFromID:device.deviceId]; + if (logoutURL) + { + [self removeDeviceRedirectWithURL:logoutURL]; + } + else + { + [self showRemoveDeviceRedirectError]; + } } else { @@ -668,6 +675,31 @@ - (void)removeDevice } } +-(void) removeDeviceRedirectWithURL: (NSURL * _Nonnull) url +{ + UIAlertController *alert = [UIAlertController alertControllerWithTitle: [VectorL10n manageSessionRedirect] message: nil preferredStyle:UIAlertControllerStyleAlert]; + + __weak typeof(self) weakSelf = self; + UIAlertAction *action = [UIAlertAction actionWithTitle:[VectorL10n ok] + style:UIAlertActionStyleDefault + handler: ^(UIAlertAction * action) { + [UIApplication.sharedApplication openURL:url options:@{} completionHandler:^(BOOL success) { + if (success && weakSelf) + { + [weakSelf withdrawViewControllerAnimated:YES completion:nil]; + } + }]; + }]; + [alert addAction: action]; + [self presentViewController:alert animated:YES completion:nil]; +} + +-(void) showRemoveDeviceRedirectError +{ + UIAlertController *alert = [UIAlertController alertControllerWithTitle: [VectorL10n manageSessionRedirectError] message: nil preferredStyle:UIAlertControllerStyleAlert]; + [self presentViewController:alert animated:YES completion:nil]; +} + -(void) removeDeviceThroughAPI { [self startActivityIndicator]; diff --git a/RiotSwiftUI/Modules/UserSessions/Coordinator/UserSessionsFlowCoordinator.swift b/RiotSwiftUI/Modules/UserSessions/Coordinator/UserSessionsFlowCoordinator.swift index acf6a30837..041f5a1ae0 100644 --- a/RiotSwiftUI/Modules/UserSessions/Coordinator/UserSessionsFlowCoordinator.swift +++ b/RiotSwiftUI/Modules/UserSessions/Coordinator/UserSessionsFlowCoordinator.swift @@ -120,21 +120,29 @@ final class UserSessionsFlowCoordinator: NSObject, Coordinator, Presentable { case let .renameSession(sessionInfo): self.showRenameSessionScreen(for: sessionInfo) case let .logoutOfSession(sessionInfo): - if sessionInfo.isCurrent { - self.showLogoutConfirmationForCurrentSession() - } else { - if let logoutURL = self.parameters.session.homeserverWellknown.authentication?.getLogoutDeviceURL(fromID: sessionInfo.id) { - self.openMasLogoutURL(logoutURL) - } else { - self.showLogoutConfirmation(for: [sessionInfo]) - } - } + self.handleLogoutOfSession(sessionInfo: sessionInfo) case let .showSessionStateInfo(sessionInfo): self.showInfoSheet(parameters: .init(userSessionInfo: sessionInfo, parentSize: self.toPresentable().view.bounds.size)) } } pushScreen(with: coordinator) } + + private func handleLogoutOfSession(sessionInfo: UserSessionInfo) { + if sessionInfo.isCurrent { + self.showLogoutConfirmationForCurrentSession() + } else { + if let authentication = self.parameters.session.homeserverWellknown.authentication { + if let logoutURL = authentication.getLogoutDeviceURL(fromID: sessionInfo.id) { + self.openDeviceLogoutRedirectURL(logoutURL) + } else { + self.showDeviceLogoutRedirectError() + } + } else { + self.showLogoutConfirmation(for: [sessionInfo]) + } + } + } /// Shows the QR login screen. private func openQRLoginScreen() { @@ -186,9 +194,24 @@ final class UserSessionsFlowCoordinator: NSObject, Coordinator, Presentable { return UserOtherSessionsCoordinator(parameters: parameters) } - private func openMasLogoutURL(_ url: URL) { - UIApplication.shared.open(url) - popToSessionsOverview() + private func openDeviceLogoutRedirectURL(_ url: URL) { + let alert = UIAlertController(title: VectorL10n.manageSessionRedirect, message: nil, preferredStyle: .alert) + alert.addAction(UIAlertAction(title: VectorL10n.ok, style: .default) { [weak self] _ in + UIApplication.shared.open(url) { [weak self] success in + guard success else { + return + } + self?.popToSessionsOverview() + } + }) + alert.popoverPresentationController?.sourceView = toPresentable().view + navigationRouter.present(alert, animated: true) + } + + private func showDeviceLogoutRedirectError() { + let alert = UIAlertController(title: VectorL10n.manageSessionRedirectError, message: nil, preferredStyle: .alert) + alert.popoverPresentationController?.sourceView = toPresentable().view + navigationRouter.present(alert, animated: true) } /// Shows a confirmation dialog to the user to sign out of a session. From 5c649b8689e09489aa5bf336120a24398ab6f207 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Tue, 29 Aug 2023 12:20:33 +0300 Subject: [PATCH 14/16] changelog.d: Upgrade MatrixSDK version ([v0.27.1](https://github.com/matrix-org/matrix-ios-sdk/releases/tag/v0.27.1)). --- Podfile | 2 +- changelog.d/x-nolink-0.change | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog.d/x-nolink-0.change diff --git a/Podfile b/Podfile index 581fc76b0b..6891bc511c 100644 --- a/Podfile +++ b/Podfile @@ -16,7 +16,7 @@ use_frameworks! # - `{ :specHash => {sdk spec hash}` to depend on specific pod options (:git => …, :podspec => …) for MatrixSDK repo. Used by Fastfile during CI # # Warning: our internal tooling depends on the name of this variable name, so be sure not to change it -$matrixSDKVersion = '= 0.27.0' +$matrixSDKVersion = '= 0.27.1' # $matrixSDKVersion = :local # $matrixSDKVersion = { :branch => 'develop'} # $matrixSDKVersion = { :specHash => { git: 'https://git.io/fork123', branch: 'fix' } } diff --git a/changelog.d/x-nolink-0.change b/changelog.d/x-nolink-0.change new file mode 100644 index 0000000000..379f8c3fcf --- /dev/null +++ b/changelog.d/x-nolink-0.change @@ -0,0 +1 @@ +Upgrade MatrixSDK version ([v0.27.1](https://github.com/matrix-org/matrix-ios-sdk/releases/tag/v0.27.1)). \ No newline at end of file From 8789b11f43fedf9ddd249d0881567a4b496c7d97 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Tue, 29 Aug 2023 12:20:34 +0300 Subject: [PATCH 15/16] version++ --- CHANGES.md | 19 +++++++++++++++++++ changelog.d/7645.bugfix | 1 - changelog.d/7646.bugfix | 1 - changelog.d/7648.bugfix | 1 - changelog.d/7651.bugfix | 1 - changelog.d/7653.feature | 1 - changelog.d/pr-7649.bugfix | 1 - changelog.d/x-nolink-0.change | 1 - 8 files changed, 19 insertions(+), 7 deletions(-) delete mode 100644 changelog.d/7645.bugfix delete mode 100644 changelog.d/7646.bugfix delete mode 100644 changelog.d/7648.bugfix delete mode 100644 changelog.d/7651.bugfix delete mode 100644 changelog.d/7653.feature delete mode 100644 changelog.d/pr-7649.bugfix delete mode 100644 changelog.d/x-nolink-0.change diff --git a/CHANGES.md b/CHANGES.md index ee4133fae7..25f3abef4c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,22 @@ +## Changes in 1.11.1 (2023-08-29) + +✨ Features + +- New settings cell to manage your account through MAS if the home server allows it. ([#7653](https://github.com/vector-im/element-ios/issues/7653)) + +🙌 Improvements + +- Upgrade MatrixSDK version ([v0.27.1](https://github.com/matrix-org/matrix-ios-sdk/releases/tag/v0.27.1)). + +🐛 Bugfixes + +- Prevent mention crashes when room members are missing display names (objc interop) ([#7649](https://github.com/vector-im/element-ios/pull/7649)) +- Add email UI is hidden if the 3 pid changes capability is disabled. ([#7645](https://github.com/vector-im/element-ios/issues/7645)) +- You can now log out from other sessions using MAS on supported OIDC home servers. ([#7646](https://github.com/vector-im/element-ios/issues/7646)) +- Deactivate account is hidden for servers with OIDC auth. ([#7648](https://github.com/vector-im/element-ios/issues/7648)) +- Prevent pill crashes when room members are missing display names (objc interop) ([#7651](https://github.com/vector-im/element-ios/issues/7651)) + + ## Changes in 1.11.0 (2023-08-15) ✨ Features diff --git a/changelog.d/7645.bugfix b/changelog.d/7645.bugfix deleted file mode 100644 index b546db4f9e..0000000000 --- a/changelog.d/7645.bugfix +++ /dev/null @@ -1 +0,0 @@ -Add email UI is hidden if the 3 pid changes capability is disabled. \ No newline at end of file diff --git a/changelog.d/7646.bugfix b/changelog.d/7646.bugfix deleted file mode 100644 index aaae87297a..0000000000 --- a/changelog.d/7646.bugfix +++ /dev/null @@ -1 +0,0 @@ -You can now log out from other sessions using MAS on supported OIDC home servers. \ No newline at end of file diff --git a/changelog.d/7648.bugfix b/changelog.d/7648.bugfix deleted file mode 100644 index c8f48546c1..0000000000 --- a/changelog.d/7648.bugfix +++ /dev/null @@ -1 +0,0 @@ -Deactivate account is hidden for servers with OIDC auth. \ No newline at end of file diff --git a/changelog.d/7651.bugfix b/changelog.d/7651.bugfix deleted file mode 100644 index 4f97c24a7f..0000000000 --- a/changelog.d/7651.bugfix +++ /dev/null @@ -1 +0,0 @@ -Prevent pill crashes when room members are missing display names (objc interop) \ No newline at end of file diff --git a/changelog.d/7653.feature b/changelog.d/7653.feature deleted file mode 100644 index cabf7402b4..0000000000 --- a/changelog.d/7653.feature +++ /dev/null @@ -1 +0,0 @@ -New settings cell to manage your account through MAS if the home server allows it. \ No newline at end of file diff --git a/changelog.d/pr-7649.bugfix b/changelog.d/pr-7649.bugfix deleted file mode 100644 index 08e9bebec0..0000000000 --- a/changelog.d/pr-7649.bugfix +++ /dev/null @@ -1 +0,0 @@ -Prevent mention crashes when room members are missing display names (objc interop) \ No newline at end of file diff --git a/changelog.d/x-nolink-0.change b/changelog.d/x-nolink-0.change deleted file mode 100644 index 379f8c3fcf..0000000000 --- a/changelog.d/x-nolink-0.change +++ /dev/null @@ -1 +0,0 @@ -Upgrade MatrixSDK version ([v0.27.1](https://github.com/matrix-org/matrix-ios-sdk/releases/tag/v0.27.1)). \ No newline at end of file From 0ef02efe304205028eadfc50a9a8db4b928b584f Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Tue, 29 Aug 2023 13:09:52 +0300 Subject: [PATCH 16/16] finish version++ --- Podfile.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Podfile.lock b/Podfile.lock index 561af4bce5..2a6591aa6b 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -39,9 +39,9 @@ PODS: - LoggerAPI (1.9.200): - Logging (~> 1.1) - Logging (1.4.0) - - MatrixSDK (0.27.0): - - MatrixSDK/Core (= 0.27.0) - - MatrixSDK/Core (0.27.0): + - MatrixSDK (0.27.1): + - MatrixSDK/Core (= 0.27.1) + - MatrixSDK/Core (0.27.1): - AFNetworking (~> 4.0.0) - GZIP (~> 1.3.0) - libbase58 (~> 0.1.4) @@ -49,7 +49,7 @@ PODS: - OLMKit (~> 3.2.5) - Realm (= 10.27.0) - SwiftyBeaver (= 1.9.5) - - MatrixSDK/JingleCallStack (0.27.0): + - MatrixSDK/JingleCallStack (0.27.1): - JitsiMeetSDKLite (= 8.1.2-lite) - MatrixSDK/Core - MatrixSDKCrypto (0.3.12) @@ -102,8 +102,8 @@ DEPENDENCIES: - KeychainAccess (~> 4.2.2) - KTCenterFlowLayout (~> 1.3.1) - libPhoneNumber-iOS (~> 0.9.13) - - MatrixSDK (= 0.27.0) - - MatrixSDK/JingleCallStack (= 0.27.0) + - MatrixSDK (= 0.27.1) + - MatrixSDK/JingleCallStack (= 0.27.1) - OLMKit - PostHog (~> 2.0.0) - ReadMoreTextView (~> 3.0.1) @@ -187,7 +187,7 @@ SPEC CHECKSUMS: libPhoneNumber-iOS: 0a32a9525cf8744fe02c5206eb30d571e38f7d75 LoggerAPI: ad9c4a6f1e32f518fdb43a1347ac14d765ab5e3d Logging: beeb016c9c80cf77042d62e83495816847ef108b - MatrixSDK: 981c0e6abd40f0882e1316923edb2b3966d29513 + MatrixSDK: f6c197ca06aab29ff69d1105965a57d277dfcd9d MatrixSDKCrypto: 25929a40733b4ab54f659aaf6a730552a0a06504 OLMKit: da115f16582e47626616874e20f7bb92222c7a51 PostHog: 660ec6c9d80cec17b685e148f17f6785a88b597d @@ -208,6 +208,6 @@ SPEC CHECKSUMS: zxcvbn-ios: fef98b7c80f1512ff0eec47ac1fa399fc00f7e3c ZXingObjC: fdbb269f25dd2032da343e06f10224d62f537bdb -PODFILE CHECKSUM: f8f66ce4fa24937192a493d3a0a5c2c2e429c8fc +PODFILE CHECKSUM: ce6afe3dea7ea9b073a7ad0406b2cc5615646746 -COCOAPODS: 1.12.1 +COCOAPODS: 1.11.3