Skip to content

Commit 5a66989

Browse files
authored
Merge pull request #1425 from matrix-org/release/0.23.1/release
Release 0.23.1
2 parents b437f1e + f7d827d commit 5a66989

File tree

12 files changed

+82
-6
lines changed

12 files changed

+82
-6
lines changed

CHANGES.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
## Changes in 0.23.1 (2022-03-28)
2+
3+
🙌 Improvements
4+
5+
- MXRestClient: Use the stable hierarchy endpoint from MSC2946 ([#5144](https://github.com/vector-im/element-ios/issues/5144))
6+
7+
🐛 Bugfixes
8+
9+
- Sync Spaces order with web ([#5134](https://github.com/vector-im/element-ios/issues/5134))
10+
11+
112
## Changes in 0.23.0 (2022-03-22)
213

314
✨ Features

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.23.0"
4+
s.version = "0.23.1"
55
s.summary = "The iOS SDK to build apps compatible with Matrix (https://www.matrix.org)"
66

77
s.description = <<-DESC

MatrixSDK/Contrib/Swift/JSONModels/MXEvent.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public enum MXEventType: Equatable, Hashable {
7373
case keyVerificationDone
7474
case taggedEvents
7575
case spaceChild
76+
case spaceOrder
7677

7778
case pollStart
7879
case pollResponse
@@ -126,6 +127,7 @@ public enum MXEventType: Equatable, Hashable {
126127
case .keyVerificationDone: return kMXEventTypeStringKeyVerificationDone
127128
case .taggedEvents: return kMXEventTypeStringTaggedEvents
128129
case .spaceChild: return kMXEventTypeStringSpaceChild
130+
case .spaceOrder: return kMXEventTypeStringSpaceOrderMSC3230
129131

130132
case .pollStart: return kMXEventTypeStringPollStartMSC3381
131133
case .pollResponse: return kMXEventTypeStringPollResponseMSC3381
@@ -140,7 +142,7 @@ public enum MXEventType: Equatable, Hashable {
140142
}
141143

142144
public init(identifier: String) {
143-
let events: [MXEventType] = [.roomName, .roomTopic, .roomAvatar, .roomMember, .roomCreate, .roomJoinRules, .roomPowerLevels, .roomAliases, .roomCanonicalAlias, .roomEncrypted, .roomEncryption, .roomGuestAccess, .roomHistoryVisibility, .roomKey, .roomForwardedKey, .roomKeyRequest, .roomMessage, .roomMessageFeedback, .roomRedaction, .roomThirdPartyInvite, .roomTag, .presence, .typing, .callInvite, .callCandidates, .callAnswer, .callSelectAnswer, .callHangup, .callReject, .callNegotiate, .callReplaces, .callRejectReplacement, .callAssertedIdentity, .callAssertedIdentityUnstable, .reaction, .receipt, .roomTombStone, .keyVerificationStart, .keyVerificationAccept, .keyVerificationKey, .keyVerificationMac, .keyVerificationCancel, .keyVerificationDone, .taggedEvents, .spaceChild, .pollStart, .pollResponse, .pollEnd]
145+
let events: [MXEventType] = [.roomName, .roomTopic, .roomAvatar, .roomMember, .roomCreate, .roomJoinRules, .roomPowerLevels, .roomAliases, .roomCanonicalAlias, .roomEncrypted, .roomEncryption, .roomGuestAccess, .roomHistoryVisibility, .roomKey, .roomForwardedKey, .roomKeyRequest, .roomMessage, .roomMessageFeedback, .roomRedaction, .roomThirdPartyInvite, .roomTag, .presence, .typing, .callInvite, .callCandidates, .callAnswer, .callSelectAnswer, .callHangup, .callReject, .callNegotiate, .callReplaces, .callRejectReplacement, .callAssertedIdentity, .callAssertedIdentityUnstable, .reaction, .receipt, .roomTombStone, .keyVerificationStart, .keyVerificationAccept, .keyVerificationKey, .keyVerificationMac, .keyVerificationCancel, .keyVerificationDone, .taggedEvents, .spaceChild, .spaceOrder, .pollStart, .pollResponse, .pollEnd]
144146

145147
if let type = events.first(where: { $0.identifier == identifier }) {
146148
self = type
@@ -151,6 +153,8 @@ public enum MXEventType: Equatable, Hashable {
151153
self = .pollResponse
152154
} else if identifier == kMXEventTypeStringPollEnd {
153155
self = .pollEnd
156+
} else if identifier == kMXEventTypeStringSpaceOrder {
157+
self = .spaceOrder
154158
} else {
155159
self = .custom(identifier)
156160
}

MatrixSDK/Data/MXRoomAccountData.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@
4848
*/
4949
@property (nonatomic, readonly) MXVirtualRoomInfo *virtualRoomInfo;
5050

51+
/**
52+
Space as order as per [MSC3230](https://github.com/matrix-org/matrix-spec-proposals/pull/3230)
53+
*/
54+
@property (nonatomic, readonly, nullable) NSString *spaceOrder;
55+
56+
5157
/**
5258
Process an event that modifies room account data (like m.tag event).
5359

MatrixSDK/Data/MXRoomAccountData.m

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ @interface MXRoomAccountData ()
2323

2424
@property (nonatomic, readwrite) MXVirtualRoomInfo *virtualRoomInfo;
2525

26+
@property (nonatomic, readonly) NSDictionary <NSString*, NSDictionary<NSString*, id> * > *customEvents;
27+
2628
@end
2729

2830
@implementation MXRoomAccountData
@@ -50,6 +52,17 @@ - (void)handleEvent:(MXEvent *)event
5052
{
5153
self.virtualRoomInfo = [MXVirtualRoomInfo modelFromJSON:event.content];
5254
}
55+
else
56+
{
57+
if (!_customEvents)
58+
{
59+
_customEvents = [NSDictionary new];
60+
}
61+
62+
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithDictionary:_customEvents];
63+
dict[event.type] = event.content;
64+
_customEvents = dict;
65+
}
5366
break;
5467
}
5568

@@ -71,6 +84,18 @@ - (MXTaggedEventInfo*)getTaggedEventInfo:(NSString*)eventId
7184
return _taggedEvents.tags[tag].allKeys;
7285
}
7386

87+
#pragma mark - Properties
88+
89+
- (NSString *)spaceOrder
90+
{
91+
NSString *spaceOrder = nil;
92+
MXJSONModelSetString(spaceOrder, _customEvents[kMXEventTypeStringSpaceOrder][kMXEventTypeStringSpaceOrderKey])
93+
if (!spaceOrder) {
94+
MXJSONModelSetString(spaceOrder, _customEvents[kMXEventTypeStringSpaceOrderMSC3230][kMXEventTypeStringSpaceOrderKey])
95+
}
96+
return spaceOrder;
97+
}
98+
7499
#pragma mark - NSCoding
75100
- (instancetype)initWithCoder:(NSCoder *)aDecoder
76101
{
@@ -81,6 +106,7 @@ - (instancetype)initWithCoder:(NSCoder *)aDecoder
81106
_readMarkerEventId = [aDecoder decodeObjectForKey:@"readMarkerEventId"];
82107
_taggedEvents = [aDecoder decodeObjectForKey:@"taggedEvents"];
83108
_virtualRoomInfo = [MXVirtualRoomInfo modelFromJSON:[aDecoder decodeObjectForKey:@"virtualRoomInfo"]];
109+
_customEvents = [aDecoder decodeObjectForKey:@"customEvents"];
84110
}
85111
return self;
86112
}
@@ -91,6 +117,10 @@ - (void)encodeWithCoder:(NSCoder *)aCoder
91117
[aCoder encodeObject:_readMarkerEventId forKey:@"readMarkerEventId"];
92118
[aCoder encodeObject:_taggedEvents forKey:@"taggedEvents"];
93119
[aCoder encodeObject:_virtualRoomInfo.JSONDictionary forKey:@"virtualRoomInfo"];
120+
if (_customEvents)
121+
{
122+
[aCoder encodeObject:_customEvents forKey:@"customEvents"];
123+
}
94124
}
95125

96126
@end

MatrixSDK/Data/Store/MXFileStore/MXFileStore.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#import "MatrixSDKSwiftHeader.h"
3030
#import "MXFileRoomSummaryStore.h"
3131

32-
static NSUInteger const kMXFileVersion = 78;
32+
static NSUInteger const kMXFileVersion = 79;
3333

3434
static NSString *const kMXFileStoreFolder = @"MXFileStore";
3535
static NSString *const kMXFileStoreMedaDataFile = @"MXFileStore";

MatrixSDK/JSONModels/MXEvent.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ typedef NS_ENUM(NSInteger, MXEventType)
9696
MXEventTypePollStart,
9797
MXEventTypePollResponse,
9898
MXEventTypePollEnd,
99+
MXEventTypeSpaceOrder,
99100

100101
// The event is a custom event. Refer to its `MXEventTypeString` version
101102
MXEventTypeCustom = 1000
@@ -153,6 +154,9 @@ FOUNDATION_EXPORT NSString *const kMXEventTypeStringSticker;
153154
FOUNDATION_EXPORT NSString *const kMXEventTypeStringRoomTombStone;
154155
FOUNDATION_EXPORT NSString *const kMXEventTypeStringTaggedEvents;
155156
FOUNDATION_EXPORT NSString *const kMXEventTypeStringSpaceChild;
157+
FOUNDATION_EXPORT NSString *const kMXEventTypeStringSpaceOrder;
158+
FOUNDATION_EXPORT NSString *const kMXEventTypeStringSpaceOrderMSC3230;
159+
FOUNDATION_EXPORT NSString *const kMXEventTypeStringSpaceOrderKey;
156160

157161
// Interactive key verification
158162
FOUNDATION_EXPORT NSString *const kMXEventTypeStringKeyVerificationRequest;

MatrixSDK/JSONModels/MXEvent.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@
8484
NSString *const kMXEventTypeStringSecretStorageDefaultKey = @"m.secret_storage.default_key";
8585
NSString *const kMXEventTypeStringTaggedEvents = @"m.tagged_events";
8686
NSString *const kMXEventTypeStringSpaceChild = @"m.space.child";
87+
NSString *const kMXEventTypeStringSpaceOrder = @"m.space_order";
88+
NSString *const kMXEventTypeStringSpaceOrderMSC3230 = @"org.matrix.msc3230.space_order";
89+
NSString *const kMXEventTypeStringSpaceOrderKey = @"order";
8790

8891
NSString *const kMXEventTypeStringAutoJoinKey = @"auto_join";
8992
NSString *const kMXEventTypeStringSuggestedKey = @"suggested";

MatrixSDK/MXRestClient.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5926,8 +5926,8 @@ - (MXHTTPOperation*)getSpaceChildrenForSpaceWithId:(NSString*)spaceId
59265926
NSString *limitParam = limit >= 0 ? [NSString stringWithFormat:@"&limit=%ld", (long)limit] : @"";
59275927
NSString *maxDepthParam = maxDepth >= 0 ? [NSString stringWithFormat:@"&max_depth=%ld", (long)maxDepth] : @"";
59285928
NSString *fromParam = paginationToken != nil ? [NSString stringWithFormat:@"&from=%@", paginationToken] : @"";
5929-
NSString *path = [NSString stringWithFormat:@"%@/org.matrix.msc2946/rooms/%@/hierarchy?suggested_only=%@%@%@%@",
5930-
kMXAPIPrefixPathUnstable, spaceId, suggestedOnly ? @"true": @"false", limitParam, maxDepthParam, fromParam];
5929+
NSString *path = [NSString stringWithFormat:@"%@/rooms/%@/hierarchy?suggested_only=%@%@%@%@",
5930+
kMXAPIPrefixPathV1, spaceId, suggestedOnly ? @"true": @"false", limitParam, maxDepthParam, fromParam];
59315931

59325932
MXWeakify(self);
59335933
return [httpClient requestWithMethod:@"GET"

MatrixSDK/MatrixSDKVersion.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616

1717
#import <Foundation/Foundation.h>
1818

19-
NSString *const MatrixSDKVersion = @"0.23.0";
19+
NSString *const MatrixSDKVersion = @"0.23.1";

0 commit comments

Comments
 (0)