Skip to content

Commit

Permalink
Well-known: Expose "m.integrations" according to MSC1957
Browse files Browse the repository at this point in the history
  • Loading branch information
manuroe committed Nov 5, 2019
1 parent a4e11d4 commit 76682f7
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Improvements:
* MX3PidAddManager: Add User-Interactive Auth to /account/3pid/add (vector-im/riot-ios#2744).
* MXSession: On resume, make the first /sync request trigger earlier (vector-im/riot-ios#2793).
* MXCrypto: Do not fail to decrypt when there is nothing to decrypt (redacted events).
* Well-known: Expose "m.integrations" according to [MSC1957](https://github.com/matrix-org/matrix-doc/pull/1957) (vector-im/riot-ios#2815).

Bug fix:
* Room members who left are listed with the actual members (vector-im/riot-ios#2737).
Expand Down
8 changes: 8 additions & 0 deletions MatrixSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@
32CAB10C1A925B41008C5BB9 /* MXHTTPOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 32CAB10A1A925B41008C5BB9 /* MXHTTPOperation.m */; };
32CE6FB81A409B1F00317F1E /* MXFileStoreMetaData.h in Headers */ = {isa = PBXBuildFile; fileRef = 32CE6FB61A409B1F00317F1E /* MXFileStoreMetaData.h */; };
32CE6FB91A409B1F00317F1E /* MXFileStoreMetaData.m in Sources */ = {isa = PBXBuildFile; fileRef = 32CE6FB71A409B1F00317F1E /* MXFileStoreMetaData.m */; };
32CF439D2371AF9500907C56 /* MXWellknownIntegrations.h in Headers */ = {isa = PBXBuildFile; fileRef = 32CF439B2371AF9500907C56 /* MXWellknownIntegrations.h */; settings = {ATTRIBUTES = (Public, ); }; };
32CF439E2371AF9500907C56 /* MXWellknownIntegrations.m in Sources */ = {isa = PBXBuildFile; fileRef = 32CF439C2371AF9500907C56 /* MXWellknownIntegrations.m */; };
32D2CC0323422462002BD8CA /* MX3PidAddSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 32D2CBFF23422462002BD8CA /* MX3PidAddSession.m */; };
32D2CC0423422462002BD8CA /* MX3PidAddManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 32D2CC0023422462002BD8CA /* MX3PidAddManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
32D2CC0523422462002BD8CA /* MX3PidAddSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 32D2CC0123422462002BD8CA /* MX3PidAddSession.h */; settings = {ATTRIBUTES = (Public, ); }; };
Expand Down Expand Up @@ -818,6 +820,8 @@
32CAB10A1A925B41008C5BB9 /* MXHTTPOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXHTTPOperation.m; sourceTree = "<group>"; };
32CE6FB61A409B1F00317F1E /* MXFileStoreMetaData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXFileStoreMetaData.h; sourceTree = "<group>"; };
32CE6FB71A409B1F00317F1E /* MXFileStoreMetaData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXFileStoreMetaData.m; sourceTree = "<group>"; };
32CF439B2371AF9500907C56 /* MXWellknownIntegrations.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXWellknownIntegrations.h; sourceTree = "<group>"; };
32CF439C2371AF9500907C56 /* MXWellknownIntegrations.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MXWellknownIntegrations.m; sourceTree = "<group>"; };
32D2CBFF23422462002BD8CA /* MX3PidAddSession.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MX3PidAddSession.m; sourceTree = "<group>"; };
32D2CC0023422462002BD8CA /* MX3PidAddManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MX3PidAddManager.h; sourceTree = "<group>"; };
32D2CC0123422462002BD8CA /* MX3PidAddSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MX3PidAddSession.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1213,6 +1217,8 @@
children = (
323547D62226D5D600F15F94 /* MXWellKnownBaseConfig.h */,
323547D72226D5D600F15F94 /* MXWellKnownBaseConfig.m */,
32CF439B2371AF9500907C56 /* MXWellknownIntegrations.h */,
32CF439C2371AF9500907C56 /* MXWellknownIntegrations.m */,
323547D32226D3F500F15F94 /* MXWellKnown.h */,
323547D22226D3F500F15F94 /* MXWellKnown.m */,
);
Expand Down Expand Up @@ -2125,6 +2131,7 @@
B146D4FA21A5BF7200D8C2C6 /* MXRealmEventScanStore.h in Headers */,
3291D4D41A68FFEB00C3BA41 /* MXFileRoomStore.h in Headers */,
3252DCC1224D14750032264F /* MXKeyVerificationStart.h in Headers */,
32CF439D2371AF9500907C56 /* MXWellknownIntegrations.h in Headers */,
320BBF431D6C81550079890E /* MXEventsEnumeratorOnArray.h in Headers */,
B11BD44C22CB56E80064D8B0 /* MXReplyEventParts.h in Headers */,
32B76EA320FDE2BE00B095F6 /* MXRoomMembersCount.h in Headers */,
Expand Down Expand Up @@ -2448,6 +2455,7 @@
321B41401E09937E009EEEC7 /* MXRoomSummary.m in Sources */,
32CAB1081A91EA34008C5BB9 /* MXPushRuleRoomMemberCountConditionChecker.m in Sources */,
3245A7511AF7B2930001D8A7 /* MXCall.m in Sources */,
32CF439E2371AF9500907C56 /* MXWellknownIntegrations.m in Sources */,
3275FD9D21A6B60B00B9C13D /* MXLoginPolicy.m in Sources */,
3252DCC2224D14750032264F /* MXKeyVerificationStart.m in Sources */,
327F8DB31C6112BA00581CA3 /* MXRoomThirdPartyInvite.m in Sources */,
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 @@ -18,6 +18,7 @@

#import "MXJSONModel.h"
#import "MXWellKnownBaseConfig.h"
#import "MXWellknownIntegrations.h"

NS_ASSUME_NONNULL_BEGIN

Expand All @@ -39,6 +40,8 @@ NS_ASSUME_NONNULL_BEGIN

@property (nonatomic, nullable) MXWellKnownBaseConfig *identityServer;

@property (nonatomic, nullable) MXWellknownIntegrations *integrations;

@end

NS_ASSUME_NONNULL_END
1 change: 1 addition & 0 deletions MatrixSDK/JSONModels/AutoDiscovery/MXWellKnown.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ + (instancetype)modelFromJSON:(NSDictionary *)JSONDictionary
wellknown.homeServer = homeServerBaseConfig;

MXJSONModelSetMXJSONModel(wellknown.identityServer, MXWellKnownBaseConfig, JSONDictionary[@"m.identity_server"]);
MXJSONModelSetMXJSONModel(wellknown.integrations, MXWellknownIntegrations, JSONDictionary[@"m.integrations"]);
}

return wellknown;
Expand Down
54 changes: 54 additions & 0 deletions MatrixSDK/JSONModels/AutoDiscovery/MXWellknownIntegrations.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
Copyright 2019 New Vector Ltd
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 languagMXWellKnowne governing permissions and
limitations under the License.
*/

#import <Foundation/Foundation.h>

#import "MXJSONModel.h"

NS_ASSUME_NONNULL_BEGIN

/**
MSC1957: Integration manager discovery
"m.integrations": {
"managers": [
{
"api_url": "https://integrations.example.org",
"ui_url": "https://integrations.example.org/ui"
},
{
"api_url": "https://bots.example.org"
}
]
}
*/
@class MXWellknownIntegrationsManager;

@interface MXWellknownIntegrations : MXJSONModel

@property (nonatomic) NSArray<MXWellknownIntegrationsManager*> *managers;

@end


@interface MXWellknownIntegrationsManager : MXJSONModel

@property (nonatomic) NSString *apiUrl;
@property (nonatomic, nullable) NSString *uiUrl;

@end

NS_ASSUME_NONNULL_END
59 changes: 59 additions & 0 deletions MatrixSDK/JSONModels/AutoDiscovery/MXWellknownIntegrations.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
Copyright 2019 New Vector Ltd
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 languagMXWellKnowne governing permissions and
limitations under the License.
*/

#import "MXWellknownIntegrations.h"

@implementation MXWellknownIntegrations

+ (instancetype)modelFromJSON:(NSDictionary *)JSONDictionary
{
MXWellknownIntegrations *integrations;

NSArray<MXWellknownIntegrationsManager*> *managers;
MXJSONModelSetMXJSONModelArray(managers, MXWellknownIntegrationsManager.class, JSONDictionary[@"managers"]);
if (managers)
{
integrations = [MXWellknownIntegrations new];
integrations.managers = managers;
}

return integrations;
}

@end

@implementation MXWellknownIntegrationsManager

+ (instancetype)modelFromJSON:(NSDictionary *)JSONDictionary
{
MXWellknownIntegrationsManager *manager;

NSString *apiUrl;
MXJSONModelSetString(apiUrl, JSONDictionary[@"api_url"]);

if (apiUrl)
{
manager = [MXWellknownIntegrationsManager new];
manager.apiUrl = apiUrl;

MXJSONModelSetString(manager.uiUrl, JSONDictionary[@"ui_url"]);
}

return manager;
}

@end

0 comments on commit 76682f7

Please sign in to comment.