Skip to content

Commit b437f1e

Browse files
committed
Merge branch 'release/0.23.0/master'
2 parents 707e703 + e742eac commit b437f1e

File tree

97 files changed

+4002
-686
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+4002
-686
lines changed

CHANGES.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,36 @@
1+
## Changes in 0.23.0 (2022-03-22)
2+
3+
✨ Features
4+
5+
- MXSpace: added canAddRoom() method ([#5230](https://github.com/vector-im/element-ios/issues/5230))
6+
- MXRoomAliasAvailabilityChecker: added extractLocalAliasPart() ([#5233](https://github.com/vector-im/element-ios/issues/5233))
7+
8+
🙌 Improvements
9+
10+
- Space creation: Added home server capabilities, room alias validator, restricted join rule, refined space related API, and added tests ([#5224](https://github.com/vector-im/element-ios/issues/5224))
11+
- Added room upgrade API call and the ability to (un)suggest a room for a space ([#5231](https://github.com/vector-im/element-ios/issues/5231))
12+
- MXSpaceService: added `spaceSummaries` property ([#5401](https://github.com/vector-im/element-ios/issues/5401))
13+
- Threads: Fix deleted thread root & decrypt thread list. ([#5441](https://github.com/vector-im/element-ios/issues/5441))
14+
- Threads: Replace property for in-thread replies. ([#5704](https://github.com/vector-im/element-ios/issues/5704))
15+
- MXRoomEventFilter: Update property names for relation types and senders. ([#5705](https://github.com/vector-im/element-ios/issues/5705))
16+
- MXThreadingService: Use versions instead of capabilities to check threads server support. ([#5744](https://github.com/vector-im/element-ios/issues/5744))
17+
- MXEventContentRelatesTo: Update reply fallback property name and reverse the logic. ([#5790](https://github.com/vector-im/element-ios/issues/5790))
18+
- Threads: Update all properties to stable values. ([#5791](https://github.com/vector-im/element-ios/issues/5791))
19+
- Room: API to ignore the sender of a room invite before the room is joined ([#5807](https://github.com/vector-im/element-ios/issues/5807))
20+
- MXRoom: Do not try to guess threadId for replies, get that as a parameter. ([#5829](https://github.com/vector-im/element-ios/issues/5829))
21+
- MXThreadingService: Fix number of replies & notification/highlight counts for threads. ([#5843](https://github.com/vector-im/element-ios/issues/5843))
22+
23+
🐛 Bugfixes
24+
25+
- MXThreadEventTimeline: Decrypt events fetched from server. ([#5749](https://github.com/vector-im/element-ios/issues/5749))
26+
- MXRoom: Fix retain cycles, in particular between MXRoomOperation and its block. ([#5805](https://github.com/vector-im/element-ios/issues/5805))
27+
- Timeline: Prevent skipping an item between each pagination batch ([#5819](https://github.com/vector-im/element-ios/issues/5819))
28+
- Crypto: Distinguish between original and edit message when preventing replay attacks ([#5835](https://github.com/vector-im/element-ios/issues/5835))
29+
- MXThreadEventTimeline: Fix processing order of thread events & fix empty thread screen issue. ([#5840](https://github.com/vector-im/element-ios/issues/5840))
30+
- Timeline: Paginated events always show the most recent edit ([#5848](https://github.com/vector-im/element-ios/issues/5848))
31+
- MXFileStore: Log when filters cannot be saved or loaded ([#5873](https://github.com/vector-im/element-ios/issues/5873))
32+
33+
134
## Changes in 0.22.6 (2022-03-14)
235

336
🙌 Improvements

MatrixSDK.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22

33
s.name = "MatrixSDK"
4-
s.version = "0.22.6"
4+
s.version = "0.23.0"
55
s.summary = "The iOS SDK to build apps compatible with Matrix (https://www.matrix.org)"
66

77
s.description = <<-DESC

MatrixSDK.xcodeproj/project.pbxproj

Lines changed: 111 additions & 3 deletions
Large diffs are not rendered by default.

MatrixSDK/Aggregations/MXAggregatedEditsUpdater.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@ - (MXHTTPOperation*)replaceTextMessageEvent:(MXEvent*)event
134134

135135
[content addEntriesFromDictionary:compatibilityContent];
136136

137-
content[@"m.new_content"] = newContent;
137+
content[kMXMessageContentKeyNewContent] = newContent;
138138

139139
content[kMXEventRelationRelatesToKey] = @{
140-
@"rel_type" : @"m.replace",
141-
@"event_id": event.eventId
140+
kMXEventContentRelatesToKeyRelationType : MXEventRelationTypeReplace,
141+
kMXEventContentRelatesToKeyEventId: event.eventId
142142
};
143143

144144
MXHTTPOperation *operation;

MatrixSDK/Aggregations/MXAggregatedReactionsUpdater.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -625,9 +625,9 @@ - (MXHTTPOperation*)sendReaction:(NSString*)reaction
625625

626626
NSDictionary *reactionContent = @{
627627
kMXEventRelationRelatesToKey: @{
628-
@"rel_type": @"m.annotation",
629-
@"event_id": eventId,
630-
@"key": reaction
628+
kMXEventContentRelatesToKeyRelationType: MXEventRelationTypeAnnotation,
629+
kMXEventContentRelatesToKeyEventId: eventId,
630+
kMXEventContentRelatesToKeyKey: reaction
631631
}
632632
};
633633

MatrixSDK/Background/MXBackgroundStore.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,11 @@ class MXBackgroundStore: NSObject, MXStore {
165165
}
166166

167167
func messagesEnumerator(forRoom roomId: String) -> MXEventsEnumerator {
168-
return MXEventsEnumeratorOnArray(messages: [])
168+
return MXEventsEnumeratorOnArray(eventIds: [], dataSource: nil)
169169
}
170170

171171
func messagesEnumerator(forRoom roomId: String, withTypeIn types: [Any]?) -> MXEventsEnumerator {
172-
return MXEventsEnumeratorOnArray(messages: [])
172+
return MXEventsEnumeratorOnArray(eventIds: [], dataSource: nil)
173173
}
174174

175175
func relations(forEvent eventId: String, inRoom roomId: String, relationType: String) -> [MXEvent] {
@@ -244,6 +244,10 @@ class MXBackgroundStore: NSObject, MXStore {
244244
var homeserverCapabilities: MXCapabilities?
245245
func storeHomeserverCapabilities(_ homeserverCapabilities: MXCapabilities) {
246246
}
247+
248+
var supportedMatrixVersions: MXMatrixVersions?
249+
func storeSupportedMatrixVersions(_ supportedMatrixVersions: MXMatrixVersions) {
250+
}
247251

248252
func loadRoomMessages(forRoom roomId: String, completion: (() -> Void)? = nil) {
249253
DispatchQueue.main.async {

MatrixSDK/Background/MXBackgroundSyncService.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ public enum MXBackgroundSyncServiceError: Error {
407407
throw MXBackgroundSyncServiceError.unknown
408408
}
409409

410-
let olmResult = try olmDevice.decryptGroupMessage(ciphertext, roomId: event.roomId, inTimeline: nil, sessionId: sessionId, senderKey: senderKey)
410+
let olmResult = try olmDevice.decryptGroupMessage(ciphertext, isEditEvent: event.isEdit(), roomId: event.roomId, inTimeline: nil, sessionId: sessionId, senderKey: senderKey)
411411

412412
let decryptionResult = MXEventDecryptionResult()
413413
decryptionResult.clearEvent = olmResult.payload

MatrixSDK/Contrib/Swift/Data/MXRoom.swift

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,21 @@ public extension MXRoom {
441441
return __setJoinRule(joinRule.identifier, success: currySuccess(completion), failure: curryFailure(completion))
442442
}
443443

444-
444+
/**
445+
Set the join rule of the room.
446+
447+
- parameters:
448+
- joinRule: the join rule to set.
449+
- parentIds: list of allowed parents (for `restricted` join rule only)
450+
- completion: A block object called when the operation completes.
451+
- response: Indicates whether the operation was a success or failure.
452+
453+
- returns: a `MXHTTPOperation` instance.
454+
*/
455+
@nonobjc @discardableResult func setJoinRule(_ joinRule: MXRoomJoinRule, parentIds: [String], completion: @escaping (_ response: MXResponse<Void>) -> Void) -> MXHTTPOperation {
456+
return __setJoinRule(joinRule.identifier, parentIds: parentIds, success: currySuccess(completion), failure: curryFailure(completion))
457+
}
458+
445459
/**
446460
Set the guest access of the room.
447461

@@ -729,6 +743,7 @@ public extension MXRoom {
729743
- textMessage: The text to send.
730744
- formattedTextMessage: The optional HTML formatted string of the text to send.
731745
- stringLocalizer: String localizations used when building reply message.
746+
- threadId: identifier of the thread in which the reply event will reside. Pass nil to use room timeline instead.
732747
- localEcho: a pointer to an MXEvent object.
733748

734749
When the event type is `MXEventType.roomMessage`, this pointer is set to an actual
@@ -748,8 +763,8 @@ public extension MXRoom {
748763

749764
- returns: a `MXHTTPOperation` instance.
750765
*/
751-
@nonobjc @discardableResult func sendReply(to eventToReply: MXEvent, textMessage: String, formattedTextMessage: String?, stringLocalizer: MXSendReplyEventStringLocalizerProtocol?, localEcho: inout MXEvent?, completion: @escaping (_ response: MXResponse<String?>) -> Void) -> MXHTTPOperation {
752-
return __sendReply(to: eventToReply, withTextMessage: textMessage, formattedTextMessage: formattedTextMessage, stringLocalizer: stringLocalizer, localEcho: &localEcho, success: currySuccess(completion), failure: curryFailure(completion))
766+
@nonobjc @discardableResult func sendReply(to eventToReply: MXEvent, textMessage: String, formattedTextMessage: String?, stringLocalizer: MXSendReplyEventStringLocalizerProtocol?, threadId: String?, localEcho: inout MXEvent?, completion: @escaping (_ response: MXResponse<String?>) -> Void) -> MXHTTPOperation {
767+
return __sendReply(to: eventToReply, withTextMessage: textMessage, formattedTextMessage: formattedTextMessage, stringLocalizer: stringLocalizer, threadId: threadId, localEcho: &localEcho, success: currySuccess(completion), failure: curryFailure(completion))
753768
}
754769

755770

MatrixSDK/Contrib/Swift/MXEnumConstants.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ public enum MXRoomJoinRule: Equatable, Hashable {
5151
/// A user who wishes to join the room must first receive an invite to the room from someone already inside of the room.
5252
case invite
5353

54+
/// The room is public to any member of spaces declared as `allowed`. It will be private otherwise.
55+
case restricted
56+
5457
/// Reserved keyword which is not implemented by homeservers.
5558
case `private`, knock
5659

@@ -60,11 +63,12 @@ public enum MXRoomJoinRule: Equatable, Hashable {
6063
case .invite: return kMXRoomJoinRuleInvite
6164
case .private: return kMXRoomJoinRulePrivate
6265
case .knock: return kMXRoomJoinRuleKnock
66+
case .restricted: return kMXRoomJoinRuleRestricted
6367
}
6468
}
6569

6670
public init?(identifier: String?) {
67-
let joinRules: [MXRoomJoinRule] = [.public, .invite, .private, .knock]
71+
let joinRules: [MXRoomJoinRule] = [.public, .invite, .private, .knock, .restricted]
6872
guard let value = joinRules.first(where: { $0.identifier == identifier}) else { return nil }
6973
self = value
7074
}

MatrixSDK/Contrib/Swift/MXRestClient.swift

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,22 @@ public extension MXRestClient {
704704
return __setRoomJoinRule(roomId, joinRule: joinRule.identifier, success: currySuccess(completion), failure: curryFailure(completion))
705705
}
706706

707+
/**
708+
Set the join rule of a room.
709+
710+
- parameters:
711+
- joinRule: the rule to set.
712+
- roomId: the id of the room.
713+
- allowedParentIds: Optional: list of allowedParentIds (required only for `restricted` join rule as per [MSC3083](https://github.com/matrix-org/matrix-doc/pull/3083) )
714+
- completion: A block object called when the operation completes.
715+
- response: Indicates whether the operation was successful.
716+
717+
- returns: a `MXHTTPOperation` instance.
718+
*/
719+
@nonobjc @discardableResult func setRoomJoinRule(_ joinRule: MXRoomJoinRule, forRoomWithId roomId: String, allowedParentIds: [String]?, completion: @escaping (_ response: MXResponse<Void>) -> Void) -> MXHTTPOperation {
720+
return __setRoomJoinRule(joinRule.identifier, forRoomWithId: roomId, allowedParentIds: allowedParentIds, success: currySuccess(completion), failure: curryFailure(completion))
721+
}
722+
707723
/**
708724
Get the join rule of a room.
709725

@@ -718,8 +734,21 @@ public extension MXRestClient {
718734
return __joinRule(ofRoom: roomId, success: currySuccess(transform: MXRoomJoinRule.init, completion), failure: curryFailure(completion))
719735
}
720736

721-
722-
737+
/**
738+
Get the enhanced join rule of a room.
739+
740+
- parameters:
741+
- roomId: the id of the room.
742+
- completion: A block object called when the operation completes. It provides the room enhanced join rule as per [MSC3083](https://github.com/matrix-org/matrix-doc/pull/3083.
743+
- response: Provides the room join rule on success.
744+
745+
- returns: a `MXHTTPOperation` instance.
746+
*/
747+
@nonobjc @discardableResult func joinRule(ofRoomWithId roomId: String, completion: @escaping (_ response: MXResponse<MXRoomJoinRuleResponse>) -> Void) -> MXHTTPOperation {
748+
return __joinRuleOfRoom(withId: roomId, success: currySuccess(completion), failure: curryFailure(completion))
749+
}
750+
751+
723752

724753
/**
725754
Set the guest access of a room.
@@ -1213,6 +1242,21 @@ public extension MXRestClient {
12131242
@nonobjc @discardableResult func roomSummary(with roomIdOrAlias: String, via: [String], completion: @escaping (_ response: MXResponse<MXPublicRoom>) -> Void) -> MXHTTPOperation {
12141243
return __roomSummary(with: roomIdOrAlias, via: via, success: currySuccess(completion), failure: curryFailure(completion))
12151244
}
1245+
1246+
/**
1247+
Upgrade a room to a new version
1248+
1249+
- parameters:
1250+
- roomId: the id of the room.
1251+
- roomVersion: the new room version
1252+
- completion: A block object called when the operation completes.
1253+
- response: Provides the ID of the replacement room on success.
1254+
1255+
- returns: a `MXHTTPOperation` instance.
1256+
*/
1257+
@nonobjc @discardableResult func upgradeRoom(withId roomId: String, to roomVersion: String, completion: @escaping (_ response: MXResponse<String>) -> Void) -> MXHTTPOperation {
1258+
return __upgradeRoom(withId: roomId, to: roomVersion, success: currySuccess(completion), failure: curryFailure(completion))
1259+
}
12161260

12171261
// MARK: - Room tags operations
12181262

@@ -1895,6 +1939,16 @@ public extension MXRestClient {
18951939
return __getSpaceChildrenForSpace(withId: spaceId, suggestedOnly: suggestedOnly, limit: limit ?? -1, maxDepth: maxDepth ?? -1, paginationToken: paginationToken, success: currySuccess(completion), failure: curryFailure(completion))
18961940
}
18971941

1942+
// MARK: - Home server capabilities
1943+
1944+
/// Get the capabilities of the homeserver
1945+
/// - Parameters:
1946+
/// - completion: A closure called when the operation completes.
1947+
/// - Returns: a `MXHTTPOperation` instance.
1948+
@nonobjc @discardableResult func homeServerCapabilities(completion: @escaping (_ response: MXResponse<MXHomeserverCapabilities>) -> Void) -> MXHTTPOperation {
1949+
return __homeServerCapabilities(success: currySuccess(completion), failure: curryFailure(completion))
1950+
}
1951+
18981952
// MARK: - Aggregations
18991953

19001954
/// Get relations for a given event.

0 commit comments

Comments
 (0)