Skip to content

Commit

Permalink
Merge branch 'release/0.23.0/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanceriu committed Mar 22, 2022
2 parents 707e703 + e742eac commit b437f1e
Show file tree
Hide file tree
Showing 97 changed files with 4,002 additions and 686 deletions.
33 changes: 33 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
## Changes in 0.23.0 (2022-03-22)

✨ Features

- MXSpace: added canAddRoom() method ([#5230](https://github.com/vector-im/element-ios/issues/5230))
- MXRoomAliasAvailabilityChecker: added extractLocalAliasPart() ([#5233](https://github.com/vector-im/element-ios/issues/5233))

🙌 Improvements

- 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))
- 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))
- MXSpaceService: added `spaceSummaries` property ([#5401](https://github.com/vector-im/element-ios/issues/5401))
- Threads: Fix deleted thread root & decrypt thread list. ([#5441](https://github.com/vector-im/element-ios/issues/5441))
- Threads: Replace property for in-thread replies. ([#5704](https://github.com/vector-im/element-ios/issues/5704))
- MXRoomEventFilter: Update property names for relation types and senders. ([#5705](https://github.com/vector-im/element-ios/issues/5705))
- MXThreadingService: Use versions instead of capabilities to check threads server support. ([#5744](https://github.com/vector-im/element-ios/issues/5744))
- MXEventContentRelatesTo: Update reply fallback property name and reverse the logic. ([#5790](https://github.com/vector-im/element-ios/issues/5790))
- Threads: Update all properties to stable values. ([#5791](https://github.com/vector-im/element-ios/issues/5791))
- 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))
- MXRoom: Do not try to guess threadId for replies, get that as a parameter. ([#5829](https://github.com/vector-im/element-ios/issues/5829))
- MXThreadingService: Fix number of replies & notification/highlight counts for threads. ([#5843](https://github.com/vector-im/element-ios/issues/5843))

🐛 Bugfixes

- MXThreadEventTimeline: Decrypt events fetched from server. ([#5749](https://github.com/vector-im/element-ios/issues/5749))
- MXRoom: Fix retain cycles, in particular between MXRoomOperation and its block. ([#5805](https://github.com/vector-im/element-ios/issues/5805))
- Timeline: Prevent skipping an item between each pagination batch ([#5819](https://github.com/vector-im/element-ios/issues/5819))
- Crypto: Distinguish between original and edit message when preventing replay attacks ([#5835](https://github.com/vector-im/element-ios/issues/5835))
- MXThreadEventTimeline: Fix processing order of thread events & fix empty thread screen issue. ([#5840](https://github.com/vector-im/element-ios/issues/5840))
- Timeline: Paginated events always show the most recent edit ([#5848](https://github.com/vector-im/element-ios/issues/5848))
- MXFileStore: Log when filters cannot be saved or loaded ([#5873](https://github.com/vector-im/element-ios/issues/5873))


## Changes in 0.22.6 (2022-03-14)

🙌 Improvements
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.22.6"
s.version = "0.23.0"
s.summary = "The iOS SDK to build apps compatible with Matrix (https://www.matrix.org)"

s.description = <<-DESC
Expand Down
114 changes: 111 additions & 3 deletions MatrixSDK.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions MatrixSDK/Aggregations/MXAggregatedEditsUpdater.m
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ - (MXHTTPOperation*)replaceTextMessageEvent:(MXEvent*)event

[content addEntriesFromDictionary:compatibilityContent];

content[@"m.new_content"] = newContent;
content[kMXMessageContentKeyNewContent] = newContent;

content[kMXEventRelationRelatesToKey] = @{
@"rel_type" : @"m.replace",
@"event_id": event.eventId
kMXEventContentRelatesToKeyRelationType : MXEventRelationTypeReplace,
kMXEventContentRelatesToKeyEventId: event.eventId
};

MXHTTPOperation *operation;
Expand Down
6 changes: 3 additions & 3 deletions MatrixSDK/Aggregations/MXAggregatedReactionsUpdater.m
Original file line number Diff line number Diff line change
Expand Up @@ -625,9 +625,9 @@ - (MXHTTPOperation*)sendReaction:(NSString*)reaction

NSDictionary *reactionContent = @{
kMXEventRelationRelatesToKey: @{
@"rel_type": @"m.annotation",
@"event_id": eventId,
@"key": reaction
kMXEventContentRelatesToKeyRelationType: MXEventRelationTypeAnnotation,
kMXEventContentRelatesToKeyEventId: eventId,
kMXEventContentRelatesToKeyKey: reaction
}
};

Expand Down
8 changes: 6 additions & 2 deletions MatrixSDK/Background/MXBackgroundStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@ class MXBackgroundStore: NSObject, MXStore {
}

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

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

func relations(forEvent eventId: String, inRoom roomId: String, relationType: String) -> [MXEvent] {
Expand Down Expand Up @@ -244,6 +244,10 @@ class MXBackgroundStore: NSObject, MXStore {
var homeserverCapabilities: MXCapabilities?
func storeHomeserverCapabilities(_ homeserverCapabilities: MXCapabilities) {
}

var supportedMatrixVersions: MXMatrixVersions?
func storeSupportedMatrixVersions(_ supportedMatrixVersions: MXMatrixVersions) {
}

func loadRoomMessages(forRoom roomId: String, completion: (() -> Void)? = nil) {
DispatchQueue.main.async {
Expand Down
2 changes: 1 addition & 1 deletion MatrixSDK/Background/MXBackgroundSyncService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ public enum MXBackgroundSyncServiceError: Error {
throw MXBackgroundSyncServiceError.unknown
}

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

let decryptionResult = MXEventDecryptionResult()
decryptionResult.clearEvent = olmResult.payload
Expand Down
21 changes: 18 additions & 3 deletions MatrixSDK/Contrib/Swift/Data/MXRoom.swift
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,21 @@ public extension MXRoom {
return __setJoinRule(joinRule.identifier, success: currySuccess(completion), failure: curryFailure(completion))
}


/**
Set the join rule of the room.

- parameters:
- joinRule: the join rule to set.
- parentIds: list of allowed parents (for `restricted` join rule only)
- completion: A block object called when the operation completes.
- response: Indicates whether the operation was a success or failure.

- returns: a `MXHTTPOperation` instance.
*/
@nonobjc @discardableResult func setJoinRule(_ joinRule: MXRoomJoinRule, parentIds: [String], completion: @escaping (_ response: MXResponse<Void>) -> Void) -> MXHTTPOperation {
return __setJoinRule(joinRule.identifier, parentIds: parentIds, success: currySuccess(completion), failure: curryFailure(completion))
}

/**
Set the guest access of the room.

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

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

- returns: a `MXHTTPOperation` instance.
*/
@nonobjc @discardableResult func sendReply(to eventToReply: MXEvent, textMessage: String, formattedTextMessage: String?, stringLocalizer: MXSendReplyEventStringLocalizerProtocol?, localEcho: inout MXEvent?, completion: @escaping (_ response: MXResponse<String?>) -> Void) -> MXHTTPOperation {
return __sendReply(to: eventToReply, withTextMessage: textMessage, formattedTextMessage: formattedTextMessage, stringLocalizer: stringLocalizer, localEcho: &localEcho, success: currySuccess(completion), failure: curryFailure(completion))
@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 {
return __sendReply(to: eventToReply, withTextMessage: textMessage, formattedTextMessage: formattedTextMessage, stringLocalizer: stringLocalizer, threadId: threadId, localEcho: &localEcho, success: currySuccess(completion), failure: curryFailure(completion))
}


Expand Down
6 changes: 5 additions & 1 deletion MatrixSDK/Contrib/Swift/MXEnumConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public enum MXRoomJoinRule: Equatable, Hashable {
/// A user who wishes to join the room must first receive an invite to the room from someone already inside of the room.
case invite

/// The room is public to any member of spaces declared as `allowed`. It will be private otherwise.
case restricted

/// Reserved keyword which is not implemented by homeservers.
case `private`, knock

Expand All @@ -60,11 +63,12 @@ public enum MXRoomJoinRule: Equatable, Hashable {
case .invite: return kMXRoomJoinRuleInvite
case .private: return kMXRoomJoinRulePrivate
case .knock: return kMXRoomJoinRuleKnock
case .restricted: return kMXRoomJoinRuleRestricted
}
}

public init?(identifier: String?) {
let joinRules: [MXRoomJoinRule] = [.public, .invite, .private, .knock]
let joinRules: [MXRoomJoinRule] = [.public, .invite, .private, .knock, .restricted]
guard let value = joinRules.first(where: { $0.identifier == identifier}) else { return nil }
self = value
}
Expand Down
58 changes: 56 additions & 2 deletions MatrixSDK/Contrib/Swift/MXRestClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,22 @@ public extension MXRestClient {
return __setRoomJoinRule(roomId, joinRule: joinRule.identifier, success: currySuccess(completion), failure: curryFailure(completion))
}

/**
Set the join rule of a room.

- parameters:
- joinRule: the rule to set.
- roomId: the id of the room.
- allowedParentIds: Optional: list of allowedParentIds (required only for `restricted` join rule as per [MSC3083](https://github.com/matrix-org/matrix-doc/pull/3083) )
- completion: A block object called when the operation completes.
- response: Indicates whether the operation was successful.

- returns: a `MXHTTPOperation` instance.
*/
@nonobjc @discardableResult func setRoomJoinRule(_ joinRule: MXRoomJoinRule, forRoomWithId roomId: String, allowedParentIds: [String]?, completion: @escaping (_ response: MXResponse<Void>) -> Void) -> MXHTTPOperation {
return __setRoomJoinRule(joinRule.identifier, forRoomWithId: roomId, allowedParentIds: allowedParentIds, success: currySuccess(completion), failure: curryFailure(completion))
}

/**
Get the join rule of a room.

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



/**
Get the enhanced join rule of a room.

- parameters:
- roomId: the id of the room.
- 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.
- response: Provides the room join rule on success.

- returns: a `MXHTTPOperation` instance.
*/
@nonobjc @discardableResult func joinRule(ofRoomWithId roomId: String, completion: @escaping (_ response: MXResponse<MXRoomJoinRuleResponse>) -> Void) -> MXHTTPOperation {
return __joinRuleOfRoom(withId: roomId, success: currySuccess(completion), failure: curryFailure(completion))
}



/**
Set the guest access of a room.
Expand Down Expand Up @@ -1213,6 +1242,21 @@ public extension MXRestClient {
@nonobjc @discardableResult func roomSummary(with roomIdOrAlias: String, via: [String], completion: @escaping (_ response: MXResponse<MXPublicRoom>) -> Void) -> MXHTTPOperation {
return __roomSummary(with: roomIdOrAlias, via: via, success: currySuccess(completion), failure: curryFailure(completion))
}

/**
Upgrade a room to a new version

- parameters:
- roomId: the id of the room.
- roomVersion: the new room version
- completion: A block object called when the operation completes.
- response: Provides the ID of the replacement room on success.

- returns: a `MXHTTPOperation` instance.
*/
@nonobjc @discardableResult func upgradeRoom(withId roomId: String, to roomVersion: String, completion: @escaping (_ response: MXResponse<String>) -> Void) -> MXHTTPOperation {
return __upgradeRoom(withId: roomId, to: roomVersion, success: currySuccess(completion), failure: curryFailure(completion))
}

// MARK: - Room tags operations

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

// MARK: - Home server capabilities

/// Get the capabilities of the homeserver
/// - Parameters:
/// - completion: A closure called when the operation completes.
/// - Returns: a `MXHTTPOperation` instance.
@nonobjc @discardableResult func homeServerCapabilities(completion: @escaping (_ response: MXResponse<MXHomeserverCapabilities>) -> Void) -> MXHTTPOperation {
return __homeServerCapabilities(success: currySuccess(completion), failure: curryFailure(completion))
}

// MARK: - Aggregations

/// Get relations for a given event.
Expand Down
Loading

0 comments on commit b437f1e

Please sign in to comment.