Skip to content

Commit

Permalink
Merge pull request #1972 from vector-im/disable_MatrixSDK_SwiftSupport
Browse files Browse the repository at this point in the history
Disable 'MatrixSDK/SwiftSupport' pod
  • Loading branch information
manuroe authored Aug 10, 2018
2 parents 0e43511 + 4daabb5 commit 7b3f2b1
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 22 deletions.
12 changes: 6 additions & 6 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ $matrixKitVersion = '0.7.15'
def import_MatrixKit
if $matrixKitVersion == 'local'
pod 'MatrixSDK', :path => '../matrix-ios-sdk/MatrixSDK.podspec'
pod 'MatrixSDK/SwiftSupport', :path => '../matrix-ios-sdk/MatrixSDK.podspec'
#pod 'MatrixSDK/SwiftSupport', :path => '../matrix-ios-sdk/MatrixSDK.podspec'
pod 'MatrixSDK/JingleCallStack', :path => '../matrix-ios-sdk/MatrixSDK.podspec'
pod 'MatrixKit', :path => '../matrix-ios-kit/MatrixKit.podspec'
else
if $matrixKitVersion == 'develop'
pod 'MatrixSDK', :git => 'https://github.com/matrix-org/matrix-ios-sdk.git', :branch => 'develop'
pod 'MatrixSDK/SwiftSupport', :git => 'https://github.com/matrix-org/matrix-ios-sdk.git', :branch => 'develop'
#pod 'MatrixSDK/SwiftSupport', :git => 'https://github.com/matrix-org/matrix-ios-sdk.git', :branch => 'develop'
pod 'MatrixSDK/JingleCallStack', :git => 'https://github.com/matrix-org/matrix-ios-sdk.git', :branch => 'develop'
pod 'MatrixKit', :git => 'https://github.com/matrix-org/matrix-ios-kit.git', :branch => 'develop'
else
pod 'MatrixKit', $matrixKitVersion
pod 'MatrixSDK/SwiftSupport'
#pod 'MatrixSDK/SwiftSupport'
pod 'MatrixSDK/JingleCallStack'
end
end
Expand All @@ -44,18 +44,18 @@ end
def import_MatrixKitAppExtension
if $matrixKitVersion == 'local'
pod 'MatrixSDK', :path => '../matrix-ios-sdk/MatrixSDK.podspec'
pod 'MatrixSDK/SwiftSupport', :path => '../matrix-ios-sdk/MatrixSDK.podspec'
#pod 'MatrixSDK/SwiftSupport', :path => '../matrix-ios-sdk/MatrixSDK.podspec'
pod 'MatrixSDK/JingleCallStack', :path => '../matrix-ios-sdk/MatrixSDK.podspec'
pod 'MatrixKit/AppExtension', :path => '../matrix-ios-kit/MatrixKit.podspec'
else
if $matrixKitVersion == 'develop'
pod 'MatrixSDK', :git => 'https://github.com/matrix-org/matrix-ios-sdk.git', :branch => 'develop'
pod 'MatrixSDK/SwiftSupport', :git => 'https://github.com/matrix-org/matrix-ios-sdk.git', :branch => 'develop'
#pod 'MatrixSDK/SwiftSupport', :git => 'https://github.com/matrix-org/matrix-ios-sdk.git', :branch => 'develop'
pod 'MatrixSDK/JingleCallStack', :git => 'https://github.com/matrix-org/matrix-ios-sdk.git', :branch => 'develop'
pod 'MatrixKit/AppExtension', :git => 'https://github.com/matrix-org/matrix-ios-kit.git', :branch => 'develop'
else
pod 'MatrixKit/AppExtension', $matrixKitVersion
pod 'MatrixSDK/SwiftSupport'
#pod 'MatrixSDK/SwiftSupport'
pod 'MatrixSDK/JingleCallStack'
end
end
Expand Down
8 changes: 7 additions & 1 deletion Riot.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
3233F7461F3497E2006ACA81 /* JitsiMeet.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3233F7441F3497DA006ACA81 /* JitsiMeet.framework */; };
3233F7471F3497E2006ACA81 /* JitsiMeet.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3233F7441F3497DA006ACA81 /* JitsiMeet.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
3284A35120A07C210044F922 /* postMessageAPI.js in Resources */ = {isa = PBXBuildFile; fileRef = 3284A35020A07C210044F922 /* postMessageAPI.js */; };
32C10340211DD1A100DFFB5D /* MatrixSDK+Swift.m in Sources */ = {isa = PBXBuildFile; fileRef = 32C1033F211DD1A100DFFB5D /* MatrixSDK+Swift.m */; };
68A2327678CA647A9A7739C7 /* Pods_RiotPods_Riot.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B0FAA1A49F76B0CE15C5CBD8 /* Pods_RiotPods_Riot.framework */; };
926FA53F1F4C132000F826C2 /* MXSession+Riot.m in Sources */ = {isa = PBXBuildFile; fileRef = 926FA53E1F4C132000F826C2 /* MXSession+Riot.m */; };
92726A471F58737A004AD26F /* IntentHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 92726A461F58737A004AD26F /* IntentHandler.m */; };
Expand Down Expand Up @@ -383,7 +384,7 @@
24CBEC4E1F0EAD310093EABB /* RiotShareExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = RiotShareExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
3233F7441F3497DA006ACA81 /* JitsiMeet.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JitsiMeet.framework; sourceTree = "<group>"; };
3267EFB320E379FD00FF1CAA /* CHANGES.rst */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CHANGES.rst; sourceTree = "<group>"; };
3267EFB420E379FD00FF1CAA /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; fileEncoding = 4; path = Podfile; sourceTree = "<group>"; };
3267EFB420E379FD00FF1CAA /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; fileEncoding = 4; path = Podfile; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
3267EFB520E379FD00FF1CAA /* AUTHORS.rst */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AUTHORS.rst; sourceTree = "<group>"; };
3267EFB620E379FD00FF1CAA /* README.rst */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.rst; sourceTree = "<group>"; };
3284A35020A07C210044F922 /* postMessageAPI.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = postMessageAPI.js; sourceTree = "<group>"; };
Expand All @@ -393,6 +394,8 @@
32BDC9A4211C34C90064AF51 /* sq */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sq; path = sq.lproj/InfoPlist.strings; sourceTree = "<group>"; };
32BDC9A5211C34C90064AF51 /* sq */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sq; path = sq.lproj/Localizable.strings; sourceTree = "<group>"; };
32BDC9A6211C34C90064AF51 /* sq */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sq; path = sq.lproj/Vector.strings; sourceTree = "<group>"; };
32C1033E211DD1A100DFFB5D /* MatrixSDK+Swift.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MatrixSDK+Swift.h"; sourceTree = "<group>"; };
32C1033F211DD1A100DFFB5D /* MatrixSDK+Swift.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "MatrixSDK+Swift.m"; sourceTree = "<group>"; };
33F966BE1A83B32A2DFE24CA /* Pods-RiotPods-SiriIntents.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RiotPods-SiriIntents.release.xcconfig"; path = "Pods/Target Support Files/Pods-RiotPods-SiriIntents/Pods-RiotPods-SiriIntents.release.xcconfig"; sourceTree = "<group>"; };
397BCA987893439918EBF330 /* Pods-SiriIntents.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SiriIntents.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SiriIntents/Pods-SiriIntents.debug.xcconfig"; sourceTree = "<group>"; };
4D1164C2F07EF74950DCDA7A /* Pods-SiriIntents.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SiriIntents.release.xcconfig"; path = "Pods/Target Support Files/Pods-SiriIntents/Pods-SiriIntents.release.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2463,6 +2466,8 @@
F083BBEC1E7009EC00A9B29C /* UIViewController+RiotSearch.m */,
926FA53D1F4C132000F826C2 /* MXSession+Riot.h */,
926FA53E1F4C132000F826C2 /* MXSession+Riot.m */,
32C1033E211DD1A100DFFB5D /* MatrixSDK+Swift.h */,
32C1033F211DD1A100DFFB5D /* MatrixSDK+Swift.m */,
);
path = Categories;
sourceTree = "<group>";
Expand Down Expand Up @@ -3123,6 +3128,7 @@
B1B5590920EF768F00210D55 /* RoomEmptyBubbleCell.m in Sources */,
B1B5574720EE6C4D00210D55 /* UsersDevicesViewController.m in Sources */,
B1B558D220EF768F00210D55 /* RoomEncryptedDataBubbleCell.m in Sources */,
32C10340211DD1A100DFFB5D /* MatrixSDK+Swift.m in Sources */,
B1B558FA20EF768F00210D55 /* RoomMembershipBubbleCell.m in Sources */,
B1B557BF20EF5B4500210D55 /* DisabledRoomInputToolbarView.m in Sources */,
B1B5578620EF564900210D55 /* GroupTableViewCellWithSwitch.m in Sources */,
Expand Down
47 changes: 47 additions & 0 deletions Riot/Categories/MatrixSDK+Swift.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
Copyright 2018 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 language governing permissions and
limitations under the License.
*/

#import <MatrixSDK/MatrixSDK.h>

/**
IMPORTANT: This file must be removed once the pod 'MatrixSDK/SwiftSupport' can
be pushed.
Methods are redefined here to skip NS_REFINED_FOR_SWIFT defined in their declaration.
*/

@interface MXSession (Swift)

- (MXHTTPOperation*)createRoomFromSwift:(NSString*)name
visibility:(MXRoomDirectoryVisibility)visibility
roomAlias:(NSString*)roomAlias
topic:(NSString*)topic
invite:(NSArray<NSString*>*)inviteArray
invite3PID:(NSArray<MXInvite3PID*>*)invite3PIDArray
isDirect:(BOOL)isDirect
preset:(MXRoomPreset)preset
success:(void (^)(void))success
failure:(void (^)(NSError *error))failure;

@end


@interface MXRoomSummary (Swift)

@property (nonatomic, readonly) MXMembership membershipFromSwift;

@end

52 changes: 52 additions & 0 deletions Riot/Categories/MatrixSDK+Swift.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
Copyright 2018 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 language governing permissions and
limitations under the License.
*/

#import <Foundation/Foundation.h>

#import "MatrixSDK+Swift.h"

@implementation MXSession (Swift)

- (MXHTTPOperation*)createRoomFromSwift:(NSString*)name
visibility:(MXRoomDirectoryVisibility)visibility
roomAlias:(NSString*)roomAlias
topic:(NSString*)topic
invite:(NSArray<NSString*>*)inviteArray
invite3PID:(NSArray<MXInvite3PID*>*)invite3PIDArray
isDirect:(BOOL)isDirect
preset:(MXRoomPreset)preset
success:(void (^)(void))success
failure:(void (^)(NSError *error))failure
{
return [self createRoom:name visibility:visibility roomAlias:roomAlias topic:topic invite:inviteArray invite3PID:invite3PIDArray isDirect:isDirect preset:preset success:^(MXRoom *room) {

if (success)
{
success();
}
} failure:failure];
}

@end

@implementation MXRoomSummary (Swift)

- (MXMembership)membershipFromSwift
{
return self.membership;
}

@end
40 changes: 25 additions & 15 deletions Riot/Managers/OnBoarding/OnBoardingManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,30 @@ final public class OnBoardingManager: NSObject {
return
}

// Create DM room with Riot-bot

let httpOperation = self.session.createRoom(name: nil, visibility: .private, alias: nil, topic: nil, invite: [Constants.riotBotMatrixId], invite3PID: nil, isDirect: true, preset: .trustedPrivateChat) { (response) in

switch response {
case .success(_):
success?()
case .failure(let error):
NSLog("[OnBoardingManager] Create chat with riot-bot failed");
failure?(error)
}
}
// // Create DM room with Riot-bot
//
// let httpOperation = self.session.createRoom(name: nil, visibility: .private, alias: nil, topic: nil, invite: [Constants.riotBotMatrixId], invite3PID: nil, isDirect: true, preset: .trustedPrivateChat) { (response) in
//
// switch response {
// case .success(_):
// success?()
// case .failure(let error):
// NSLog("[OnBoardingManager] Create chat with riot-bot failed");
// failure?(error)
// }
// }
//
// // Make multipe tries, until we get a response
// httpOperation.maxNumberOfTries = Constants.createRiotBotDMRequestMaxNumberOfTries


// Create DM room with Riot-bot

let httpOperation = self.session.createRoom(fromSwift: nil, visibility: kMXRoomDirectoryVisibilityPrivate, roomAlias: nil, topic: nil, invite: [Constants.riotBotMatrixId], invite3PID: nil, isDirect: true, preset: kMXRoomPresetTrustedPrivateChat, success: success, failure: nil)


// Make multipe tries, until we get a response
httpOperation.maxNumberOfTries = Constants.createRiotBotDMRequestMaxNumberOfTries
httpOperation?.maxNumberOfTries = Constants.createRiotBotDMRequestMaxNumberOfTries
}

// MARK: - Private
Expand All @@ -76,12 +85,13 @@ final public class OnBoardingManager: NSObject {
var isUSerJoinedARoom = false

for roomSummary in roomSummaries {
if case .join = roomSummary.membership {
// if case .join = roomSummary.membership {
if case __MXMembershipJoin = roomSummary.membershipFromSwift {
isUSerJoinedARoom = true
break
}
}

return isUSerJoinedARoom
}
}
1 change: 1 addition & 0 deletions Riot/SupportingFiles/Riot-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@

@import MatrixSDK;
#import "WebViewViewController.h"
#import "MatrixSDK+Swift.h"

0 comments on commit 7b3f2b1

Please sign in to comment.