Skip to content

Commit

Permalink
Merge branch 'release/0.27.1/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanceriu committed Aug 29, 2023
2 parents e86b0d1 + 5e88f5e commit 8ada89c
Show file tree
Hide file tree
Showing 13 changed files with 191 additions and 6 deletions.
15 changes: 15 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
## Changes in 0.27.1 (2023-08-29)

✨ Features

- Delegate OIDC compatibility flag added. ([#1811](https://github.com/matrix-org/matrix-ios-sdk/pull/1811))
- Added the authentication property to the well known. ([#1812](https://github.com/matrix-org/matrix-ios-sdk/pull/1812))
- Function that allows to generate from the well known authentication, a logout mas URL given the device ID. ([#1813](https://github.com/matrix-org/matrix-ios-sdk/pull/1813))

🐛 Bugfixes

- Fixes power level events force unwrap crash ([#1809](https://github.com/matrix-org/matrix-ios-sdk/pull/1809))
- Prevent keyed archiver encoding crashes when writing read receipts to the file store ([#1810](https://github.com/vector-im/element-ios/issues/1810))
- Fix incoming push notifications not triggering sounds ([#7636](https://github.com/vector-im/element-ios/issues/7636))


## Changes in 0.27.0 (2023-08-15)

✨ Features
Expand Down
2 changes: 1 addition & 1 deletion MatrixSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "MatrixSDK"
s.version = "0.27.0"
s.version = "0.27.1"
s.summary = "The iOS SDK to build apps compatible with Matrix (https://www.matrix.org)"

s.description = <<-DESC
Expand Down
12 changes: 12 additions & 0 deletions MatrixSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,10 @@
A0A2397A295202930001F722 /* MXAggregatedPollsUpdater.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0A23978295202930001F722 /* MXAggregatedPollsUpdater.swift */; };
A0B1217F295306F700E704C2 /* MXAggregatedPollsUpdaterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0B1217E295306F700E704C2 /* MXAggregatedPollsUpdaterTests.swift */; };
A0B12180295306F700E704C2 /* MXAggregatedPollsUpdaterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0B1217E295306F700E704C2 /* MXAggregatedPollsUpdaterTests.swift */; };
A75CAD692A9796DE00F06072 /* MXWellKnownAuthentication.m in Sources */ = {isa = PBXBuildFile; fileRef = A75CAD682A9796DE00F06072 /* MXWellKnownAuthentication.m */; };
A75CAD6A2A9796DE00F06072 /* MXWellKnownAuthentication.m in Sources */ = {isa = PBXBuildFile; fileRef = A75CAD682A9796DE00F06072 /* MXWellKnownAuthentication.m */; };
A75CAD6C2A979AC500F06072 /* MXWellKnownAuthentication.h in Headers */ = {isa = PBXBuildFile; fileRef = A75CAD6B2A97970500F06072 /* MXWellKnownAuthentication.h */; settings = {ATTRIBUTES = (Public, ); }; };
A75CAD6D2A979AC600F06072 /* MXWellKnownAuthentication.h in Headers */ = {isa = PBXBuildFile; fileRef = A75CAD6B2A97970500F06072 /* MXWellKnownAuthentication.h */; settings = {ATTRIBUTES = (Public, ); }; };
A780624E27B2CE74005780C0 /* FileManager+Backup.swift in Sources */ = {isa = PBXBuildFile; fileRef = A780624C27B2CE74005780C0 /* FileManager+Backup.swift */; };
A780624F27B2CE74005780C0 /* FileManager+Backup.swift in Sources */ = {isa = PBXBuildFile; fileRef = A780624C27B2CE74005780C0 /* FileManager+Backup.swift */; };
A780625027B2CE74005780C0 /* FileManager+AppGroupContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = A780624D27B2CE74005780C0 /* FileManager+AppGroupContainer.swift */; };
Expand Down Expand Up @@ -2705,6 +2709,8 @@
9274AFE71EE580240009BEB6 /* MXCallKitAdapter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXCallKitAdapter.m; sourceTree = "<group>"; };
A0A23978295202930001F722 /* MXAggregatedPollsUpdater.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MXAggregatedPollsUpdater.swift; sourceTree = "<group>"; };
A0B1217E295306F700E704C2 /* MXAggregatedPollsUpdaterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MXAggregatedPollsUpdaterTests.swift; sourceTree = "<group>"; };
A75CAD682A9796DE00F06072 /* MXWellKnownAuthentication.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MXWellKnownAuthentication.m; sourceTree = "<group>"; };
A75CAD6B2A97970500F06072 /* MXWellKnownAuthentication.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXWellKnownAuthentication.h; sourceTree = "<group>"; };
A780624C27B2CE74005780C0 /* FileManager+Backup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "FileManager+Backup.swift"; sourceTree = "<group>"; };
A780624D27B2CE74005780C0 /* FileManager+AppGroupContainer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "FileManager+AppGroupContainer.swift"; sourceTree = "<group>"; };
A816247B25F60C7700A46F05 /* MXDeviceListOperationsPoolUnitTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MXDeviceListOperationsPoolUnitTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3608,6 +3614,8 @@
32CF439C2371AF9500907C56 /* MXWellknownIntegrations.m */,
180F858227A2AF3000F4E5A5 /* MXWellKnownTileServerConfig.h */,
180F858327A2AF3000F4E5A5 /* MXWellKnownTileServerConfig.m */,
A75CAD682A9796DE00F06072 /* MXWellKnownAuthentication.m */,
A75CAD6B2A97970500F06072 /* MXWellKnownAuthentication.h */,
);
path = AutoDiscovery;
sourceTree = "<group>";
Expand Down Expand Up @@ -6152,6 +6160,7 @@
3287164F23C4C11F00D720CA /* MXKeyVerificationManager_Private.h in Headers */,
32F634AB1FC5E3480054EF49 /* MXEventDecryptionResult.h in Headers */,
32999DE322DCD1AD004FF987 /* MXPusherData.h in Headers */,
A75CAD6C2A979AC500F06072 /* MXWellKnownAuthentication.h in Headers */,
3284A5A01DB7C00600A09972 /* MXCryptoStore.h in Headers */,
32442FB121EDD21300D2411B /* MXKeyBackupPassword.h in Headers */,
3259CD531DF860C300186944 /* MXRealmCryptoStore.h in Headers */,
Expand Down Expand Up @@ -6518,6 +6527,7 @@
EC8A53DD25B1BCC6004E0802 /* MXThirdPartyProtocol.h in Headers */,
ECF29BDF264195320053E6D6 /* MXAssertedIdentityModel.h in Headers */,
B14EF31A2397E90400758AF0 /* MXScanRealmProvider.h in Headers */,
A75CAD6D2A979AC600F06072 /* MXWellKnownAuthentication.h in Headers */,
32549AFA23F2E2790002576B /* MXKeyVerificationReady.h in Headers */,
B14EF31B2397E90400758AF0 /* MXEventUnsignedData.h in Headers */,
B14EF31C2397E90400758AF0 /* MXEventEditsListener.h in Headers */,
Expand Down Expand Up @@ -7191,6 +7201,7 @@
A780625027B2CE74005780C0 /* FileManager+AppGroupContainer.swift in Sources */,
9274AFE91EE580240009BEB6 /* MXCallKitAdapter.m in Sources */,
3274538C23FD918800438328 /* MXKeyVerificationByToDeviceRequest.m in Sources */,
A75CAD692A9796DE00F06072 /* MXWellKnownAuthentication.m in Sources */,
ED6DAC1828C799E300ECDCB6 /* MXRoomKeyResult.swift in Sources */,
ECB6FA952683811800A941E4 /* MXiOSAudioOutputRouter.swift in Sources */,
EC131B0A2758D56600712964 /* MXThreadNotificationsCount.swift in Sources */,
Expand Down Expand Up @@ -7862,6 +7873,7 @@
A780625127B2CE74005780C0 /* FileManager+AppGroupContainer.swift in Sources */,
B14EF23B2397E90400758AF0 /* MXKeyBackupData.m in Sources */,
B14EF23C2397E90400758AF0 /* MXJSONModels.m in Sources */,
A75CAD6A2A9796DE00F06072 /* MXWellKnownAuthentication.m in Sources */,
EC8A538E25B1BC77004E0802 /* MXCallSessionDescription.m in Sources */,
ED6DAC1928C799E300ECDCB6 /* MXRoomKeyResult.swift in Sources */,
EC131B0B2758D56600712964 /* MXThreadNotificationsCount.swift in Sources */,
Expand Down
8 changes: 6 additions & 2 deletions MatrixSDK/Background/MXBackgroundPushRulesManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ import Foundation
}
}

flatRules = tmpRules
// vector-im/element-ios/issues/7636
// Intentionally disable new backend push rules as they're not handle properly and break notification sounds
flatRules = tmpRules.filter { $0.ruleId != ".m.rule.is_user_mention" && $0.ruleId != ".m.rule.is_room_mention" }
}
}
private var flatRules: [MXPushRule] = []
Expand Down Expand Up @@ -129,7 +131,9 @@ import Foundation
var conditionsOk: Bool = true
var runEquivalent: Bool = false

guard let kind = MXPushRuleKind(identifier: rule.kind) else { continue }
guard let kind = MXPushRuleKind(identifier: rule.kind) else {
continue
}

switch kind {
case .override, .underride:
Expand Down
18 changes: 17 additions & 1 deletion MatrixSDK/Data/Store/MXFileStore/MXFileStore.m
Original file line number Diff line number Diff line change
Expand Up @@ -2209,7 +2209,23 @@ - (void)saveReceipts

// Store new data
[self checkFolderExistenceForRoom:roomId forBackup:NO];
[NSKeyedArchiver archiveRootObject:receiptsStore toFile:file];

NSError *error = nil;
NSData *result = [NSKeyedArchiver archivedDataWithRootObject:receiptsStore requiringSecureCoding:false error:&error];

if (error != nil)
{
MXLogErrorDetails(@"Failed archiving receipts store", error);
continue;
}

[result writeToURL:[NSURL fileURLWithPath:file] options: NSDataWritingAtomic error: &error];

if (error != nil)
{
MXLogErrorDetails(@"Failed writing receipts store to file", error);
continue;
}
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions MatrixSDK/JSONModels/AutoDiscovery/MXWellKnown.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#import "MXWellKnownBaseConfig.h"
#import "MXWellknownIntegrations.h"
#import "MXWellKnownTileServerConfig.h"
#import "MXWellKnownAuthentication.h"

NS_ASSUME_NONNULL_BEGIN

Expand All @@ -45,6 +46,8 @@ NS_ASSUME_NONNULL_BEGIN

@property (nonatomic, nullable) MXWellKnownTileServerConfig *tileServer;

@property (nonatomic, nullable) MXWellKnownAuthentication *authentication;

@end

NS_ASSUME_NONNULL_END
5 changes: 5 additions & 0 deletions MatrixSDK/JSONModels/AutoDiscovery/MXWellKnown.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
static NSString *const kMXTileServerKey = @"m.tile_server";
static NSString *const kMXTileServerMSC3488Key = @"org.matrix.msc3488.tile_server";

static NSString *const kMXAuthenticationKey = @"org.matrix.msc2965.authentication";

@interface MXWellKnown()
{
// The original dictionary to store extented data
Expand All @@ -46,6 +48,7 @@ + (instancetype)modelFromJSON:(NSDictionary *)JSONDictionary

MXJSONModelSetMXJSONModel(wellknown.identityServer, MXWellKnownBaseConfig, JSONDictionary[kMXIdentityServerKey]);
MXJSONModelSetMXJSONModel(wellknown.integrations, MXWellknownIntegrations, JSONDictionary[kMXIntegrationsKey]);
MXJSONModelSetMXJSONModel(wellknown.authentication, MXWellKnownAuthentication, JSONDictionary[kMXAuthenticationKey])

if (JSONDictionary[kMXTileServerKey])
{
Expand Down Expand Up @@ -84,6 +87,7 @@ - (id)initWithCoder:(NSCoder *)aDecoder
_identityServer = [aDecoder decodeObjectForKey:kMXIdentityServerKey];
_integrations = [aDecoder decodeObjectForKey:kMXIntegrationsKey];
_tileServer = [aDecoder decodeObjectForKey:kMXTileServerKey];
_authentication = [aDecoder decodeObjectForKey:kMXAuthenticationKey];
JSONDictionary = [aDecoder decodeObjectForKey:@"JSONDictionary"];
}
return self;
Expand All @@ -95,6 +99,7 @@ - (void)encodeWithCoder:(NSCoder *)aCoder
[aCoder encodeObject:_identityServer forKey:kMXIdentityServerKey];
[aCoder encodeObject:_integrations forKey:kMXIntegrationsKey];
[aCoder encodeObject:_tileServer forKey:kMXTileServerKey];
[aCoder encodeObject:_authentication forKey:kMXAuthenticationKey];
[aCoder encodeObject:JSONDictionary forKey:@"JSONDictionary"];
}

Expand Down
40 changes: 40 additions & 0 deletions MatrixSDK/JSONModels/AutoDiscovery/MXWellKnownAuthentication.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//
// Copyright 2023 The Matrix.org Foundation C.I.C
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

#import <Foundation/Foundation.h>

#import "MXJSONModel.h"

NS_ASSUME_NONNULL_BEGIN

/**
MSC2965: OIDC Authentication
"org.matrix.msc2965.authentication": {
"issuer": "https://example.com/",
"account": "https://example.com/account"
}
*/

@interface MXWellKnownAuthentication : MXJSONModel<NSCoding>

@property (nonatomic, readonly) NSString *issuer;
@property (nonatomic, readonly, nullable) NSString *account;

-(NSURL * _Nullable) getLogoutDeviceURLFromID: (NSString * ) deviceID;

@end

NS_ASSUME_NONNULL_END
82 changes: 82 additions & 0 deletions MatrixSDK/JSONModels/AutoDiscovery/MXWellKnownAuthentication.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
//
// Copyright 2023 The Matrix.org Foundation C.I.C
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

#import "MXWellKnownAuthentication.h"

static NSString *const kMXIssuer = @"issuer";
static NSString *const kMXAccount = @"account";

@interface MXWellKnownAuthentication ()

@property (nonatomic, readwrite) NSString *issuer;
@property (nonatomic, readwrite, nullable) NSString *account;

@end

@implementation MXWellKnownAuthentication

+ (instancetype)modelFromJSON:(NSDictionary *)JSONDictionary
{
MXWellKnownAuthentication *wellKnownAuthentication;

NSString *issuer;
MXJSONModelSetString(issuer, JSONDictionary[kMXIssuer]);

if (issuer)
{
wellKnownAuthentication = [[MXWellKnownAuthentication alloc] init];
wellKnownAuthentication.issuer = issuer;
MXJSONModelSetString(wellKnownAuthentication.account, JSONDictionary[kMXAccount])
}

return wellKnownAuthentication;
}

-(NSURL * _Nullable) getLogoutDeviceURLFromID: (NSString * ) deviceID
{
if (!_account)
{
return nil;
}
NSURLComponents *components = [NSURLComponents componentsWithString:_account];
components.queryItems = @[
[NSURLQueryItem queryItemWithName:@"device_id" value:deviceID],
[NSURLQueryItem queryItemWithName:@"action" value:@"session_end"]
];
return components.URL;
}


#pragma mark - NSCoding

- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
if (self)
{
_issuer = [aDecoder decodeObjectForKey:kMXIssuer];
_account = [aDecoder decodeObjectForKey: kMXAccount];
}
return self;
}

- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_issuer forKey:kMXIssuer];
[aCoder encodeObject:_account forKey:kMXAccount];
}

@end
1 change: 1 addition & 0 deletions MatrixSDK/JSONModels/Login/MXLoginSSOFlow.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ extern NSString *const MXLoginSSOFlowIdentityProvidersKey;
List of all SSO Identity Providers supported
*/
@property (nonatomic, readonly) NSArray<MXLoginSSOIdentityProvider*> *identityProviders;
@property (atomic, readonly) BOOL delegatedOIDCCompatibility;

@end

Expand Down
3 changes: 3 additions & 0 deletions MatrixSDK/JSONModels/Login/MXLoginSSOFlow.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
#import "MXLoginSSOFlow.h"

NSString *const MXLoginSSOFlowIdentityProvidersKey = @"identity_providers";
NSString *const MXLoginSSOFlowDelegatedOIDCCompatibilityKey = @"org.matrix.msc3824.delegated_oidc_compatibility";

@interface MXLoginSSOFlow()

@property (nonatomic, readwrite) NSArray<MXLoginSSOIdentityProvider*> *identityProviders;
@property (atomic, readwrite) BOOL delegatedOIDCCompatibility;

@end

Expand Down Expand Up @@ -50,6 +52,7 @@ + (instancetype)modelFromJSON:(NSDictionary *)JSONDictionary

loginFlow.identityProviders = identityProviders;

MXJSONModelSetBoolean(loginFlow.delegatedOIDCCompatibility, JSONDictionary[MXLoginSSOFlowDelegatedOIDCCompatibilityKey]);
}

return loginFlow;
Expand Down
2 changes: 1 addition & 1 deletion MatrixSDK/MatrixSDKVersion.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@

#import <Foundation/Foundation.h>

NSString *const MatrixSDKVersion = @"0.27.0";
NSString *const MatrixSDKVersion = @"0.27.1";
6 changes: 5 additions & 1 deletion MatrixSDK/Space/MXSpace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,11 @@ public class MXSpace: NSObject {
///
/// - Returns: the mimnimum power level required to add a room to this space
public func minimumPowerLevelForAddingRoom(with powerLevels: MXRoomPowerLevels) -> Int {
return powerLevels.events["m.space.child"] as? Int ?? powerLevels.stateDefault
guard let events = powerLevels.events else {
return powerLevels.stateDefault
}

return events["m.space.child"] as? Int ?? powerLevels.stateDefault
}

// MARK: - Private
Expand Down

0 comments on commit 8ada89c

Please sign in to comment.