Skip to content

Commit 76682f7

Browse files
committed
Well-known: Expose "m.integrations" according to MSC1957
matrix-org/matrix-spec-proposals#1957 element-hq/element-ios#2815
1 parent a4e11d4 commit 76682f7

File tree

6 files changed

+126
-0
lines changed

6 files changed

+126
-0
lines changed

CHANGES.rst

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Improvements:
55
* MX3PidAddManager: Add User-Interactive Auth to /account/3pid/add (vector-im/riot-ios#2744).
66
* MXSession: On resume, make the first /sync request trigger earlier (vector-im/riot-ios#2793).
77
* MXCrypto: Do not fail to decrypt when there is nothing to decrypt (redacted events).
8+
* Well-known: Expose "m.integrations" according to [MSC1957](https://github.com/matrix-org/matrix-doc/pull/1957) (vector-im/riot-ios#2815).
89

910
Bug fix:
1011
* Room members who left are listed with the actual members (vector-im/riot-ios#2737).

MatrixSDK.xcodeproj/project.pbxproj

+8
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,8 @@
319319
32CAB10C1A925B41008C5BB9 /* MXHTTPOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 32CAB10A1A925B41008C5BB9 /* MXHTTPOperation.m */; };
320320
32CE6FB81A409B1F00317F1E /* MXFileStoreMetaData.h in Headers */ = {isa = PBXBuildFile; fileRef = 32CE6FB61A409B1F00317F1E /* MXFileStoreMetaData.h */; };
321321
32CE6FB91A409B1F00317F1E /* MXFileStoreMetaData.m in Sources */ = {isa = PBXBuildFile; fileRef = 32CE6FB71A409B1F00317F1E /* MXFileStoreMetaData.m */; };
322+
32CF439D2371AF9500907C56 /* MXWellknownIntegrations.h in Headers */ = {isa = PBXBuildFile; fileRef = 32CF439B2371AF9500907C56 /* MXWellknownIntegrations.h */; settings = {ATTRIBUTES = (Public, ); }; };
323+
32CF439E2371AF9500907C56 /* MXWellknownIntegrations.m in Sources */ = {isa = PBXBuildFile; fileRef = 32CF439C2371AF9500907C56 /* MXWellknownIntegrations.m */; };
322324
32D2CC0323422462002BD8CA /* MX3PidAddSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 32D2CBFF23422462002BD8CA /* MX3PidAddSession.m */; };
323325
32D2CC0423422462002BD8CA /* MX3PidAddManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 32D2CC0023422462002BD8CA /* MX3PidAddManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
324326
32D2CC0523422462002BD8CA /* MX3PidAddSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 32D2CC0123422462002BD8CA /* MX3PidAddSession.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -818,6 +820,8 @@
818820
32CAB10A1A925B41008C5BB9 /* MXHTTPOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXHTTPOperation.m; sourceTree = "<group>"; };
819821
32CE6FB61A409B1F00317F1E /* MXFileStoreMetaData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXFileStoreMetaData.h; sourceTree = "<group>"; };
820822
32CE6FB71A409B1F00317F1E /* MXFileStoreMetaData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXFileStoreMetaData.m; sourceTree = "<group>"; };
823+
32CF439B2371AF9500907C56 /* MXWellknownIntegrations.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXWellknownIntegrations.h; sourceTree = "<group>"; };
824+
32CF439C2371AF9500907C56 /* MXWellknownIntegrations.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MXWellknownIntegrations.m; sourceTree = "<group>"; };
821825
32D2CBFF23422462002BD8CA /* MX3PidAddSession.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MX3PidAddSession.m; sourceTree = "<group>"; };
822826
32D2CC0023422462002BD8CA /* MX3PidAddManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MX3PidAddManager.h; sourceTree = "<group>"; };
823827
32D2CC0123422462002BD8CA /* MX3PidAddSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MX3PidAddSession.h; sourceTree = "<group>"; };
@@ -1213,6 +1217,8 @@
12131217
children = (
12141218
323547D62226D5D600F15F94 /* MXWellKnownBaseConfig.h */,
12151219
323547D72226D5D600F15F94 /* MXWellKnownBaseConfig.m */,
1220+
32CF439B2371AF9500907C56 /* MXWellknownIntegrations.h */,
1221+
32CF439C2371AF9500907C56 /* MXWellknownIntegrations.m */,
12161222
323547D32226D3F500F15F94 /* MXWellKnown.h */,
12171223
323547D22226D3F500F15F94 /* MXWellKnown.m */,
12181224
);
@@ -2125,6 +2131,7 @@
21252131
B146D4FA21A5BF7200D8C2C6 /* MXRealmEventScanStore.h in Headers */,
21262132
3291D4D41A68FFEB00C3BA41 /* MXFileRoomStore.h in Headers */,
21272133
3252DCC1224D14750032264F /* MXKeyVerificationStart.h in Headers */,
2134+
32CF439D2371AF9500907C56 /* MXWellknownIntegrations.h in Headers */,
21282135
320BBF431D6C81550079890E /* MXEventsEnumeratorOnArray.h in Headers */,
21292136
B11BD44C22CB56E80064D8B0 /* MXReplyEventParts.h in Headers */,
21302137
32B76EA320FDE2BE00B095F6 /* MXRoomMembersCount.h in Headers */,
@@ -2448,6 +2455,7 @@
24482455
321B41401E09937E009EEEC7 /* MXRoomSummary.m in Sources */,
24492456
32CAB1081A91EA34008C5BB9 /* MXPushRuleRoomMemberCountConditionChecker.m in Sources */,
24502457
3245A7511AF7B2930001D8A7 /* MXCall.m in Sources */,
2458+
32CF439E2371AF9500907C56 /* MXWellknownIntegrations.m in Sources */,
24512459
3275FD9D21A6B60B00B9C13D /* MXLoginPolicy.m in Sources */,
24522460
3252DCC2224D14750032264F /* MXKeyVerificationStart.m in Sources */,
24532461
327F8DB31C6112BA00581CA3 /* MXRoomThirdPartyInvite.m in Sources */,

MatrixSDK/JSONModels/AutoDiscovery/MXWellKnown.h

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#import "MXJSONModel.h"
2020
#import "MXWellKnownBaseConfig.h"
21+
#import "MXWellknownIntegrations.h"
2122

2223
NS_ASSUME_NONNULL_BEGIN
2324

@@ -39,6 +40,8 @@ NS_ASSUME_NONNULL_BEGIN
3940

4041
@property (nonatomic, nullable) MXWellKnownBaseConfig *identityServer;
4142

43+
@property (nonatomic, nullable) MXWellknownIntegrations *integrations;
44+
4245
@end
4346

4447
NS_ASSUME_NONNULL_END

MatrixSDK/JSONModels/AutoDiscovery/MXWellKnown.m

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ + (instancetype)modelFromJSON:(NSDictionary *)JSONDictionary
3030
wellknown.homeServer = homeServerBaseConfig;
3131

3232
MXJSONModelSetMXJSONModel(wellknown.identityServer, MXWellKnownBaseConfig, JSONDictionary[@"m.identity_server"]);
33+
MXJSONModelSetMXJSONModel(wellknown.integrations, MXWellknownIntegrations, JSONDictionary[@"m.integrations"]);
3334
}
3435

3536
return wellknown;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
Copyright 2019 New Vector Ltd
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific languagMXWellKnowne governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
#import <Foundation/Foundation.h>
18+
19+
#import "MXJSONModel.h"
20+
21+
NS_ASSUME_NONNULL_BEGIN
22+
23+
/**
24+
MSC1957: Integration manager discovery
25+
26+
"m.integrations": {
27+
"managers": [
28+
{
29+
"api_url": "https://integrations.example.org",
30+
"ui_url": "https://integrations.example.org/ui"
31+
},
32+
{
33+
"api_url": "https://bots.example.org"
34+
}
35+
]
36+
}
37+
*/
38+
@class MXWellknownIntegrationsManager;
39+
40+
@interface MXWellknownIntegrations : MXJSONModel
41+
42+
@property (nonatomic) NSArray<MXWellknownIntegrationsManager*> *managers;
43+
44+
@end
45+
46+
47+
@interface MXWellknownIntegrationsManager : MXJSONModel
48+
49+
@property (nonatomic) NSString *apiUrl;
50+
@property (nonatomic, nullable) NSString *uiUrl;
51+
52+
@end
53+
54+
NS_ASSUME_NONNULL_END
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
Copyright 2019 New Vector Ltd
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific languagMXWellKnowne governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
#import "MXWellknownIntegrations.h"
18+
19+
@implementation MXWellknownIntegrations
20+
21+
+ (instancetype)modelFromJSON:(NSDictionary *)JSONDictionary
22+
{
23+
MXWellknownIntegrations *integrations;
24+
25+
NSArray<MXWellknownIntegrationsManager*> *managers;
26+
MXJSONModelSetMXJSONModelArray(managers, MXWellknownIntegrationsManager.class, JSONDictionary[@"managers"]);
27+
if (managers)
28+
{
29+
integrations = [MXWellknownIntegrations new];
30+
integrations.managers = managers;
31+
}
32+
33+
return integrations;
34+
}
35+
36+
@end
37+
38+
@implementation MXWellknownIntegrationsManager
39+
40+
+ (instancetype)modelFromJSON:(NSDictionary *)JSONDictionary
41+
{
42+
MXWellknownIntegrationsManager *manager;
43+
44+
NSString *apiUrl;
45+
MXJSONModelSetString(apiUrl, JSONDictionary[@"api_url"]);
46+
47+
if (apiUrl)
48+
{
49+
manager = [MXWellknownIntegrationsManager new];
50+
manager.apiUrl = apiUrl;
51+
52+
MXJSONModelSetString(manager.uiUrl, JSONDictionary[@"ui_url"]);
53+
}
54+
55+
return manager;
56+
}
57+
58+
@end
59+

0 commit comments

Comments
 (0)