Merge branch 'release/1.11.1/master'

This commit is contained in:
Stefan Ceriu
2023-08-29 13:09:52 +03:00
12 changed files with 201 additions and 31 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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' } }

View File

@@ -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)
@@ -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)
@@ -177,7 +177,7 @@ SPEC CHECKSUMS:
FlowCommoniOS: ca92071ab526dc89905495a37844fd7e78d1a7f2
GBDeviceInfo: 5d62fa85bdcce3ed288d83c28789adf1173e4376
GZIP: 416858efbe66b41b206895ac6dfd5493200d95b3
Introspect: b62c4dd2063072327c21d618ef2bedc3c87bc366
Introspect: 4cc1e4c34dd016540c8d86a591c231c09dafbee3
JitsiMeetSDKLite: 895213158cf62342069a10634a41d2f1c00057f7
JitsiWebRTC: 80f62908fcf2a1160e0d14b584323fb6e6be630b
KeychainAccess: c0c4f7f38f6fc7bbe58f5702e25f7bd2f65abf51
@@ -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.11.3

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.";
@@ -964,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

View File

@@ -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")
@@ -7791,6 +7799,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

@@ -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

View File

@@ -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)
}

View File

@@ -655,6 +655,52 @@ enum {
}
- (void)removeDevice
{
MXWellKnownAuthentication *authentication = self.mainSession.homeserverWellknown.authentication;
if (authentication)
{
NSURL *logoutURL = [authentication getLogoutDeviceURLFromID:device.deviceId];
if (logoutURL)
{
[self removeDeviceRedirectWithURL:logoutURL];
}
else
{
[self showRemoveDeviceRedirectError];
}
}
else
{
[self removeDeviceThroughAPI];
}
}
-(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];
self.view.userInteractionEnabled = NO;

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
@@ -365,7 +371,10 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
{
[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];
}
@@ -383,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)
{
@@ -608,7 +627,7 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
}
}
if (BuildSettings.settingsScreenAllowDeactivatingAccount)
if (BuildSettings.settingsScreenAllowDeactivatingAccount && !self.mainSession.homeserverWellknown.authentication)
{
Section *sectionDeactivate = [Section sectionWithTag:SECTION_TAG_DEACTIVATE_ACCOUNT];
[sectionDeactivate addRowWithTag:0];
@@ -2626,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;
}
@@ -2975,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];
}
@@ -3883,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;

View File

@@ -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)
}
}

View File

@@ -120,17 +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 {
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() {
@@ -182,6 +194,26 @@ final class UserSessionsFlowCoordinator: NSObject, Coordinator, Presentable {
return UserOtherSessionsCoordinator(parameters: parameters)
}
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.
private func showLogoutConfirmation(for sessionInfos: [UserSessionInfo]) {
// Use a UIAlertController as we don't have confirmationDialog in SwiftUI on iOS 14.