diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index cc67319..dba7308 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -17,19 +17,19 @@ jobs: env: CCACHE_DIR: ${{ github.workspace }}/.ccache USE_CCACHE: 1 - SDK_VERSION: 11.0.0.GA + SDK_VERSION: 13.4.1.GA MODULE_ID: ti.socketio steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v7 - - name: Use Node.js 14.x - uses: actions/setup-node@v2 + - name: Use Node.js 22.x + uses: actions/setup-node@v7 with: - node-version: '14.x' + node-version: '22.x' - name: Cache Node.js modules id: node-cache - uses: actions/cache@v2 + uses: actions/cache@v6 with: path: node_modules key: ${{ runner.OS }}-node-modules-${{ hashFiles('package-lock.json') }} @@ -38,17 +38,17 @@ jobs: ${{ runner.OS }}- - name: Setup Java - uses: actions/setup-java@v2 + uses: actions/setup-java@v6 with: - distribution: 'adopt' - java-version: 11 + distribution: 'temurin' + java-version: 18 - run: npm ci name: Install dependencies if: steps.node-cache.outputs.cache-hit != 'true' - name: Cache Gradle packages - uses: actions/cache@v2 + uses: actions/cache@v6 with: path: | ~/.gradle/caches @@ -71,20 +71,23 @@ jobs: run: brew install ccache - name: Retrieve ccache - uses: actions/cache@v2 + uses: actions/cache@v6 with: path: ${{ env.CCACHE_DIR }} key: ${{ runner.os }}-ccache-${{ github.sha }} restore-keys: | ${{ runner.os }}-ccache- - - name: Build and Test - uses: reactivecircus/android-emulator-runner@v2 - with: - api-level: 29 - target: playstore - script: npm run test:android -- --sdkVersion ${{ env.SDK_VERSION }} - disable-animations: false # defaulting to true, the commands sent to emulator to do this sometimes run too quickly after boot and cause "adb: device offline" failures + - name: Build module + run: ti build -p android --build-only -d android --sdk ${{ env.SDK_VERSION }} + +# - name: Build and Test +# uses: reactivecircus/android-emulator-runner@v2 +# with: +# api-level: 29 +# target: playstore +# script: npm run test:android -- --sdkVersion ${{ env.SDK_VERSION }} +# disable-animations: false # defaulting to true, the commands sent to emulator to do this sometimes run too quickly after boot and cause "adb: device offline" failures - name: Show summary of ccache configuration and statistics counters run: ccache --show-stats @@ -92,7 +95,7 @@ jobs: # TODO: Grab the version so zip file name can contain it - name: Archive Android zip - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v7 with: name: ${{ env.MODULE_ID }}-android path: | diff --git a/.github/workflows/cla.yaml b/.github/workflows/cla.yaml index ac0fe23..bbfcc73 100644 --- a/.github/workflows/cla.yaml +++ b/.github/workflows/cla.yaml @@ -8,6 +8,6 @@ jobs: name: Verify contributor steps: - - uses: tidev/tidev-cla-action@v1 + - uses: tidev/tidev-cla-action@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index e2ae480..a43e5bd 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -12,12 +12,12 @@ jobs: runs-on: ubuntu-latest name: Docs steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v7 - - name: Use Node.js 14.x - uses: actions/setup-node@v2 + - name: Use Node.js 22.x + uses: actions/setup-node@v7 with: - node-version: '14.x' + node-version: '22.x' - run: npm ci name: Install dependencies diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index 8bbca89..4da8025 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -15,19 +15,19 @@ jobs: runs-on: macos-latest name: iOS env: - SDK_VERSION: 11.0.0.GA + SDK_VERSION: 13.4.1.GA MODULE_ID: ti.socketio steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v7 - - name: Use Node.js 14.x - uses: actions/setup-node@v2 + - name: Use Node.js 22.x + uses: actions/setup-node@v7 with: - node-version: '14.x' + node-version: '22.x' - name: Cache Node.js modules id: node-cache - uses: actions/cache@v2 + uses: actions/cache@v6 with: path: node_modules key: ${{ runner.OS }}-node-modules-${{ hashFiles('package-lock.json') }} @@ -53,11 +53,14 @@ jobs: - run: sed -i .bak 's/TITANIUM_SDK_VERSION = .*/TITANIUM_SDK_VERSION = ${{ env.SDK_VERSION }}/' ios/titanium.xcconfig name: Set to Build with newly installed SDK - - run: npm run test:ios -- --sdkVersion ${{ env.SDK_VERSION }} - name: Build and Test + - name: Build module + run: ti build -p ios --build-only -d ios --sdk ${{ env.SDK_VERSION }} + +# - run: npm run test:ios -- --sdkVersion ${{ env.SDK_VERSION }} +# name: Build and Test - name: Archive iOS artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v7 with: name: ${{ env.MODULE_ID }}-ios path: | diff --git a/.github/workflows/js.yml b/.github/workflows/js.yml index a4bdaa8..4b9b874 100644 --- a/.github/workflows/js.yml +++ b/.github/workflows/js.yml @@ -17,16 +17,16 @@ jobs: runs-on: ubuntu-latest name: JavaScript steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v7 - - name: Use Node.js 14.x - uses: actions/setup-node@v2 + - name: Use Node.js 22.x + uses: actions/setup-node@v7 with: - node-version: '14.x' + node-version: '22.x' - name: Cache Node.js modules id: node-cache - uses: actions/cache@v2 + uses: actions/cache@v6 with: path: node_modules key: ${{ runner.OS }}-node-modules-${{ hashFiles('package-lock.json') }} diff --git a/.gitignore b/.gitignore index e17236a..e12f2f8 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,7 @@ node_modules/ # Test reports TESTS-*.xml + +# Ignored, see the README.md in platform/ for details +/ios/platform/Starscream.xcframework +/ios/platform/SocketIO.xcframework diff --git a/README.md b/README.md index 85d7ae3..6f9be68 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ ## Requirements - [x] Android: Titanium SDK 9.0.0+ -- [x] iOS: Titanium SDK 7.4.0+ / Xcode 10.2 / Swift 5.0+ +- [x] iOS: Titanium SDK 13.1.0+ / Xcode 15+ -> 💡 The iOS module is built with Swift 5.0 and you need to have the same Swift version installed to be able to use this module. You can check your current Swift version by using swift -v from the terminal. +> 💡 The iOS module version 4.x supports Socket.io Server 3.x/4.x. The native client is a Swift package, so Titanium SDK 13.1.0 or later is required. > 💡 The Android module version 4.x will support Socket.io Server 3.x/4.x diff --git a/ios/CHANGELOG.md b/ios/CHANGELOG.md index 847e808..6f40872 100644 --- a/ios/CHANGELOG.md +++ b/ios/CHANGELOG.md @@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Changed + +- Rewrote the module in Swift. +- Updated the native client to socket.io-client-swift 16.1.1. The module now speaks the socket.io v3 and v4 protocol. Servers that run socket.io v2 are no longer supported. +- The native client is resolved with Swift Package Manager through `spm.json`. The module needs Titanium SDK 13.1.0.GA or later. +- The `path` option is passed to the native client instead of being ignored. + +### Fixed + +- Sockets connect automatically again unless `autoConnect: false` is set. +- The connect timeout defaults to 20 seconds, same as the web client. +- `emit()` sends each argument as a separate argument and calls the ack callback. +- `once()` is available again. +- `connect_timeout` fires to the handlers that were registered with `on()`. +- Query parameters of the connect URL are passed as `connectParams`. + ## [2.0.0] - 2019-02-06 ### Added diff --git a/ios/Cartfile b/ios/Cartfile deleted file mode 100644 index b837c3b..0000000 --- a/ios/Cartfile +++ /dev/null @@ -1 +0,0 @@ -github "appcelerator-modules/socket.io-client-swift" "xcframework" \ No newline at end of file diff --git a/ios/Cartfile.resolved b/ios/Cartfile.resolved deleted file mode 100644 index 26110ed..0000000 --- a/ios/Cartfile.resolved +++ /dev/null @@ -1,2 +0,0 @@ -github "appcelerator-modules/socket.io-client-swift" "ebc20ec8d82063f709ec31ec697e58a4e1e4802c" -github "daltoniam/Starscream" "3.1.1" diff --git a/ios/Classes/ComAppcTitaniumSocketioModuleAssets.m b/ios/Classes/ComAppcTitaniumSocketioModuleAssets.m deleted file mode 100644 index bf5181b..0000000 --- a/ios/Classes/ComAppcTitaniumSocketioModuleAssets.m +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This is a generated file. Do not edit or your changes will be lost - */ -#import "ComAppcTitaniumSocketioModuleAssets.h" - -extern NSData *filterDataInRange(NSData *thedata, NSRange range); - -@implementation ComAppcTitaniumSocketioModuleAssets - -- (NSData *)moduleAsset -{ - - return nil; -} - -- (NSData *)resolveModuleAsset:(NSString *)path -{ - - return nil; -} - -@end diff --git a/ios/Classes/SocketIOClientProxy.h b/ios/Classes/SocketIOClientProxy.h deleted file mode 100644 index 3d1afc1..0000000 --- a/ios/Classes/SocketIOClientProxy.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// SocketIOClientProxy.h -// ti.socketio -// -// Created by Jan Vennemann on 20.05.18. -// - -#import "TiProxy.h" - -@class SocketIOClient; -@class SocketManagerProxy; - -@interface SocketIOClientProxy : TiProxy - -@property (nonatomic, strong, readonly) NSString *id; -@property (nonatomic, strong, readonly) NSNumber *connected; -@property (nonatomic, strong, readonly) NSNumber *disconnected; -@property (nonatomic, strong, readonly) SocketManagerProxy *io; - -- (instancetype)initWithContext:(id)context socket:(SocketIOClient *)socket manager:(SocketManagerProxy *)manager; - -- (void)open:(id)args; -- (void)connect:(id)args; -- (SocketIOClientProxy *)on:(id)args; -- (SocketIOClientProxy *)once:(id)args; -- (SocketIOClientProxy *)off:(id)args; -- (SocketIOClientProxy *)emit:(id)args; -- (void)close:(id)args; -- (void)disconnect:(id)args; - -- (void)fireClientEvent:(NSString *)eventName data:(NSArray *)data; - -@end diff --git a/ios/Classes/SocketIOClientProxy.m b/ios/Classes/SocketIOClientProxy.m deleted file mode 100644 index 9efc97e..0000000 --- a/ios/Classes/SocketIOClientProxy.m +++ /dev/null @@ -1,285 +0,0 @@ -// -// SocketIOClientProxy.m -// ti.socketio -// -// Created by Jan Vennemann on 20.05.18. -// - -#import "SocketIOClientProxy.h" -#import "SocketManagerProxy.h" -#import "TiUtils.h" - -#import - -@interface SocketIOClientProxy () - -@property (nonatomic, strong) SocketIOClient *socket; -@property (nonatomic, strong) NSMapTable *handlerIdentifiers; -@property (nonatomic, strong) NSMutableDictionary *eventHandlers; -@property (nonatomic, strong) NSDictionary *eventRenamingMap; - -@end - -@implementation SocketIOClientProxy - -- (instancetype)initWithContext:(id)context socket:(SocketIOClient *)socket manager:(SocketManagerProxy *)manager -{ - if (self = [self _initWithPageContext:context]) { - _io = manager; - self.socket = socket; - self.handlerIdentifiers = [NSMapTable strongToStrongObjectsMapTable]; - self.eventHandlers = [NSMutableDictionary new]; - self.eventRenamingMap = @{ - @"connect_error" : @"error", - @"reconnect_attempt" : @"reconnectAttempt", - @"reconnecting" : @"reconnectAttempt" - }; - } - - return self; -} - -#pragma mark - Public JS properties - -- (NSString *)id -{ - return self.socket.status == SocketIOStatusConnected ? self.socket.sid : nil; -} - -- (NSNumber *)connected -{ - return @(self.socket.status == SocketIOStatusConnected); -} - -- (NSNumber *)disconnected -{ - return @(self.socket.status == SocketIOStatusDisconnected); -} - -#pragma mark - Public JS methods - -- (void)open:(id)args -{ - [self connect:args]; -} - -- (void)connect:(id)args -{ - [self.socket connect]; -} - -- (SocketIOClientProxy *)on:(id)args -{ - ENSURE_TYPE(args, NSArray); - ENSURE_ARG_COUNT(args, 2); - - NSString *eventName = [TiUtils stringValue:[args objectAtIndex:0]]; - if (self.eventRenamingMap[eventName] != nil) { - eventName = self.eventRenamingMap[eventName]; - } - KrollCallback *callback = [args objectAtIndex:1]; - NSUUID *handlerId = [self.socket on:eventName - callback:^(NSArray *data, SocketAckEmitter *ack) { - // TODO: Handle ack callback - //KrollCallback *ackCallback = [KrollCallback alloc] initWithCallback:nil thisObject:nil context:[callback context]] - [callback call:data thisObject:nil]; - }]; - [self.handlerIdentifiers setObject:handlerId forKey:callback]; - [self storeEventHandler:callback forEvent:eventName]; - - return self; -} - -- (SocketIOClientProxy *)once:(id)args -{ - ENSURE_TYPE(args, NSArray); - ENSURE_ARG_COUNT(args, 2); - - NSString *eventName = [TiUtils stringValue:[args objectAtIndex:0]]; - if (self.eventRenamingMap[eventName] != nil) { - eventName = self.eventRenamingMap[eventName]; - } - KrollCallback *callback = [args objectAtIndex:1]; - NSUUID *handlerId = [self.socket once:eventName - callback:^(NSArray *data, SocketAckEmitter *ack) { - // TODO: Handle ack callback - [callback call:data thisObject:nil]; - [self removeEventHandler:callback forEvent:eventName]; - }]; - [self.handlerIdentifiers setObject:handlerId forKey:callback]; - [self storeEventHandler:callback forEvent:eventName]; - - return self; -} - -- (SocketIOClientProxy *)off:(id)args -{ - ENSURE_TYPE_OR_NIL(args, NSArray); - - if (args == nil) { - [self.socket removeAllHandlers]; - [self removeAllEventHandlers]; - } else if ([args count] == 1) { - NSString *eventName = [TiUtils stringValue:[args objectAtIndex:0]]; - if (self.eventRenamingMap[eventName] != nil) { - eventName = self.eventRenamingMap[eventName]; - } - [self.socket off:eventName]; - [self removeAllEventHandlersForEvent:eventName]; - } else if ([args count] == 2) { - NSString *eventName = [TiUtils stringValue:[args objectAtIndex:0]]; - if (self.eventRenamingMap[eventName] != nil) { - eventName = self.eventRenamingMap[eventName]; - } - KrollCallback *handler = [args objectAtIndex:1]; - NSUUID *handlerId = [self findHandlerId:handler]; - if (handlerId != nil) { - [self.socket offWithId:handlerId]; - [self removeEventHandler:handler forEvent:eventName]; - } - } - - return self; -} - -- (SocketIOClientProxy *)emit:(id)args -{ - ENSURE_TYPE(args, NSArray); - ENSURE_ARG_COUNT(args, 1); - - NSString *eventName = [TiUtils stringValue:[args objectAtIndex:0]]; - NSMutableArray *data = [NSMutableArray new]; - KrollCallback *ackCallback = nil; - - if ([args count] > 1) { - NSUInteger lastArgumentIndex = [args count] - 1; - - if ([[args objectAtIndex:lastArgumentIndex] isKindOfClass:KrollCallback.class]) { - ackCallback = [args objectAtIndex:lastArgumentIndex]; - lastArgumentIndex -= 1; - } - - // Exclude the first argument to only map the data between the second and penultimate index - NSArray *metaArguments = [args subarrayWithRange:NSMakeRange(1, lastArgumentIndex)]; - [metaArguments enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL *_Nonnull stop) { - [data addObject:obj]; - }]; - - data = [self sanitizeValue:data]; - } - - if (ackCallback != nil) { - [[self.socket emitWithAck:eventName with:data] timingOutAfter:0 - callback:^(NSArray *ackData) { - [ackCallback call:ackData thisObject:nil]; - }]; - } else { - [self.socket emit:eventName with:data]; - } - - return self; -} - -- (void)close:(id)args -{ - [self disconnect:args]; -} - -- (void)disconnect:(id)args -{ - [self.socket disconnect]; -} - -#pragma mark - Public methods - -- (void)fireClientEvent:(NSString *)eventName data:(NSArray *)data -{ - NSMutableSet *handlers = self.eventHandlers[eventName]; - for (KrollCallback *callback in handlers) { - [callback call:data thisObject:nil]; - } -} - -#pragma mark - Private methods - -- (id)sanitizeValue:(id)value -{ - if (![NSJSONSerialization isValidJSONObject:value]) { - // [TiUtils stripInvalidJSONPayload] is private, so invoke it indirectly - NSString *stringyfiedValue = [TiUtils jsonStringify:value]; - return [TiUtils jsonParse:stringyfiedValue]; - } else { - return value; - } -} - -/** -Stores an event handler for the given event name. - -For compatibility with the web client we expose the method on, once and off. -This delegates to our internal event handling using addEventListener to take -care of safely storing the handler function and protecting it against GC. - */ -- (void)storeEventHandler:(KrollCallback *)callback forEvent:(NSString *)eventName -{ - [self addEventListener:@[ eventName, callback ]]; - - NSMutableSet *handlers = self.eventHandlers[eventName]; - if (handlers == nil) { - handlers = [NSMutableSet new]; - } - [handlers addObject:callback]; -} - -- (void)removeEventHandler:(KrollCallback *)callback forEvent:(NSString *)eventName -{ - NSMutableSet *handlers = self.eventHandlers[eventName]; - if (handlers != nil) { - [handlers removeObject:callback]; - } - - [self removeEventListener:@[ eventName, callback ]]; - [self removeHandlerId:callback]; -} - -- (void)removeAllEventHandlersForEvent:(NSString *)eventName -{ - NSMutableSet *handlers = self.eventHandlers[eventName]; - if (handlers == nil) { - return; - } - for (KrollCallback *callback in handlers) { - [self removeEventHandler:callback forEvent:eventName]; - } - [self.eventHandlers removeObjectForKey:eventName]; -} - -- (void)removeAllEventHandlers -{ - for (NSString *eventName in self.eventHandlers.allKeys) { - [self removeAllEventHandlersForEvent:eventName]; - } -} - -- (NSUUID *)findHandlerId:(KrollCallback *)handler -{ - for (KrollCallback *storedCallback in self.handlerIdentifiers.keyEnumerator) { - if ([storedCallback isEqual:handler]) { - return [self.handlerIdentifiers objectForKey:storedCallback]; - } - } - - return nil; -} - -- (void)removeHandlerId:(KrollCallback *)handler -{ - for (KrollCallback *storedCallback in self.handlerIdentifiers.keyEnumerator) { - if ([storedCallback isEqual:handler]) { - [self.handlerIdentifiers removeObjectForKey:storedCallback]; - return; - } - } -} - -@end diff --git a/ios/Classes/SocketIOClientProxy.swift b/ios/Classes/SocketIOClientProxy.swift new file mode 100644 index 0000000..4446ad9 --- /dev/null +++ b/ios/Classes/SocketIOClientProxy.swift @@ -0,0 +1,257 @@ +// +// SocketIOClientProxy.swift +// ti.socketio +// +// Created by Hans Knöchel +// Copyright (c) 2022-present TiDev. All rights reserved. +// + +import UIKit +import TitaniumKit +import SocketIO + +@objc(SocketIOClientProxy) +class SocketIOClientProxy: TiProxy { + + @objc private(set) var io: SocketManagerProxy! + + private var socket: SocketIOClient! + + /// Native handler ids by JS callback. Kroll creates a new callback object for each call, + /// so callbacks are compared with isEqual() and not used as dictionary keys. + private var handlerIdentifiers: [(callback: KrollCallback, id: UUID)] = [] + + private var eventHandlers: [String: [KrollCallback]] = [:] + + private let eventRenamingMap: [String: String] = [ + "connect_error": "error", + "reconnect_attempt": "reconnectAttempt", + "reconnecting": "reconnectAttempt" + ] + + func _init(withPageContext context: TiEvaluator!, socket: SocketIOClient, manager: SocketManagerProxy) -> Self? { + super._init(withPageContext: context) + + self.io = manager + self.socket = socket + + return self + } + + // MARK: Public JS properties + + @objc var id: String? { + return socket.status == .connected ? socket.sid : nil + } + + @objc var connected: Bool { + return socket.status == .connected + } + + @objc var disconnected: Bool { + return socket.status == .disconnected + } + + // MARK: Public JS methods + + @objc(open:) + func open(args: [Any]?) { + connect(args: args) + } + + @objc(connect:) + func connect(args: [Any]?) { + socket.connect() + } + + @objc(close:) + func close(args: [Any]?) { + disconnect(args: args) + } + + @objc(disconnect:) + func disconnect(args: [Any]?) { + socket.disconnect() + } + + @objc(on:) + func on(args: [Any]) -> SocketIOClientProxy { + guard args.count >= 2, let name = args[0] as? String, let callback = args[1] as? KrollCallback else { + throwException("Invalid arguments", subreason: "on() expects an event name and a callback function", location: "\(#file):\(#line)") + return self + } + + let eventName = nativeEventName(name) + let handlerId = socket.on(eventName) { data, _ in + // TODO: Handle ack callback + callback.call(data, thisObject: nil) + } + + handlerIdentifiers.append((callback: callback, id: handlerId)) + storeEventHandler(callback, for: eventName) + + return self + } + + @objc(once:) + func once(args: [Any]) -> SocketIOClientProxy { + guard args.count >= 2, let name = args[0] as? String, let callback = args[1] as? KrollCallback else { + throwException("Invalid arguments", subreason: "once() expects an event name and a callback function", location: "\(#file):\(#line)") + return self + } + + let eventName = nativeEventName(name) + let handlerId = socket.once(eventName) { [weak self] data, _ in + // TODO: Handle ack callback + callback.call(data, thisObject: nil) + self?.removeEventHandler(callback, for: eventName) + } + + handlerIdentifiers.append((callback: callback, id: handlerId)) + storeEventHandler(callback, for: eventName) + + return self + } + + @objc(off:) + func off(args: [Any]?) -> SocketIOClientProxy { + guard let args = args, !args.isEmpty else { + socket.removeAllHandlers() + removeAllEventHandlers() + return self + } + + guard let name = args[0] as? String else { + throwException("Invalid arguments", subreason: "off() expects an event name as first argument", location: "\(#file):\(#line)") + return self + } + let eventName = nativeEventName(name) + + if args.count == 1 { + socket.off(eventName) + removeAllEventHandlersForEvent(eventName) + } else if let handler = args[1] as? KrollCallback, let handlerId = findHandlerId(handler) { + socket.off(id: handlerId) + removeEventHandler(handler, for: eventName) + } + + return self + } + + @objc(emit:) + func emit(args: [Any]) -> SocketIOClientProxy { + guard let eventName = args.first as? String else { + throwException("Invalid arguments", subreason: "emit() expects an event name as first argument", location: "\(#file):\(#line)") + return self + } + + // everything between the event name and an optional trailing ack callback is payload + var payload = Array(args.dropFirst()) + var ackCallback: KrollCallback? + if let callback = payload.last as? KrollCallback { + ackCallback = callback + payload.removeLast() + } + + let data = toSocketData(sanitizeValue(payload)) + + if let ackCallback = ackCallback { + socket.emitWithAck(eventName, with: data).timingOut(after: 0) { ackData in + ackCallback.call(ackData, thisObject: nil) + } + } else { + socket.emit(eventName, with: data, completion: nil) + } + + return self + } + + // MARK: Public methods + + /// Fires an event to the handlers registered via on() / once(), used for emulated events. + func fireClientEvent(_ eventName: String, data: [Any]) { + for callback in eventHandlers[eventName] ?? [] { + callback.call(data, thisObject: nil) + } + } + + // MARK: Private methods + + private func nativeEventName(_ eventName: String) -> String { + return eventRenamingMap[eventName] ?? eventName + } + + /// Makes sure that the payload only contains JSON compatible values. + private func sanitizeValue(_ value: [Any]) -> [Any] { + if JSONSerialization.isValidJSONObject(value) { + return value + } + // [TiUtils stripInvalidJSONPayload] is private, so invoke it indirectly + let stringifiedValue = TiUtils.jsonStringify(value) + return TiUtils.jsonParse(stringifiedValue) as? [Any] ?? [] + } + + /// The native client only accepts values that conform to SocketData. Numbers arrive from + /// JS as NSNumber, which does not conform, so they are unboxed here. + private func toSocketData(_ values: [Any]) -> [SocketData] { + return values.map { value -> SocketData in + if let number = value as? NSNumber { + if CFGetTypeID(number) == CFBooleanGetTypeID() { + return number.boolValue + } + let doubleValue = number.doubleValue + if doubleValue == doubleValue.rounded() && abs(doubleValue) < 9007199254740992 { + return Int(doubleValue) + } + return doubleValue + } + if let socketData = value as? SocketData { + return socketData + } + return NSNull() + } + } + + private func findHandlerId(_ handler: KrollCallback) -> UUID? { + return handlerIdentifiers.first { $0.callback.isEqual(handler) }?.id + } + + private func removeHandlerId(_ handler: KrollCallback) { + handlerIdentifiers.removeAll { $0.callback.isEqual(handler) } + } + + /** + Stores an event handler for the given event name. + + For compatibility with the web client we expose the methods on, once and off. + This delegates to our internal event handling using addEventListener to take + care of safely storing the handler function and protecting it against GC. + */ + private func storeEventHandler(_ callback: KrollCallback, for eventName: String) { + addEventListener([eventName, callback]) + eventHandlers[eventName, default: []].append(callback) + } + + private func removeEventHandler(_ callback: KrollCallback, for eventName: String) { + eventHandlers[eventName]?.removeAll { $0.isEqual(callback) } + if eventHandlers[eventName]?.isEmpty == true { + eventHandlers.removeValue(forKey: eventName) + } + + removeEventListener([eventName, callback]) + removeHandlerId(callback) + } + + private func removeAllEventHandlersForEvent(_ eventName: String) { + for callback in eventHandlers[eventName] ?? [] { + removeEventHandler(callback, for: eventName) + } + eventHandlers.removeValue(forKey: eventName) + } + + private func removeAllEventHandlers() { + for eventName in Array(eventHandlers.keys) { + removeAllEventHandlersForEvent(eventName) + } + } +} diff --git a/ios/Classes/SocketManagerProxy.h b/ios/Classes/SocketManagerProxy.h deleted file mode 100644 index 5f86131..0000000 --- a/ios/Classes/SocketManagerProxy.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// SocketManagerProxy.h -// ti.socketio -// -// Created by Jan Vennemann on 14.12.18. -// - -#import "TiProxy.h" - -@class SocketIOClientProxy; -@class SocketManager; - -@interface SocketManagerProxy : TiProxy - -@property (nonatomic, strong) SocketManager *manager; - -- (instancetype)initWithContext:(id)context url:(NSURL *)url options:(NSDictionary *)options; -- (SocketIOClientProxy *)socket:(id)args; -- (void)open:(id)args; -- (void)connect:(id)args; -- (void)close:(id)args; -- (void)disconnect:(id)args; - -@end diff --git a/ios/Classes/SocketManagerProxy.m b/ios/Classes/SocketManagerProxy.m deleted file mode 100644 index ea2e106..0000000 --- a/ios/Classes/SocketManagerProxy.m +++ /dev/null @@ -1,145 +0,0 @@ -// -// SocketManagerProxy.m -// ti.socketio -// -// Created by Jan Vennemann on 14.12.18. -// - -#import "SocketManagerProxy.h" -#import "SocketIOClientProxy.h" -#import "TiUtils.h" - -#import - -@interface SocketManagerProxy () - -@property BOOL autoConnect; -@property double timeout; - -@end - -@implementation SocketManagerProxy - -- (instancetype)initWithContext:(id)context url:(NSURL *)url options:(NSDictionary *)options; -{ - self = [self _initWithPageContext:context]; - if (self == nil) { - return nil; - } - - self.autoConnect = [TiUtils boolValue:@"autoConnect" properties:options def:YES]; - self.timeout = [TiUtils doubleValue:@"timeout" properties:options def:20000.f]; - - NSDictionary *nativeOptions = [self convertOptions:options]; - self.manager = [[SocketManager alloc] initWithSocketURL:url config:nativeOptions]; - - return self; -} - -#pragma mark - Public JS methods - -- (SocketIOClientProxy *)socket:(id)args -{ - ENSURE_ARG_COUNT(args, 1); - NSString *path = [TiUtils stringValue:[args objectAtIndex:0]]; - - SocketIOClient *socket; - if ([path isEqualToString:@"/"]) { - socket = self.manager.defaultSocket; - } else { - socket = [self.manager socketForNamespace:path]; - } - SocketIOClientProxy *socketProxy = [[SocketIOClientProxy alloc] initWithContext:self.pageContext socket:socket manager:self]; - if (self.autoConnect) { - if (fabs(self.timeout - 0.0f) < DBL_EPSILON) { - [socket connect]; - } else { - [socket connectWithTimeoutAfter:self.timeout / 1000.f - withHandler:^(void) { - [socketProxy fireClientEvent:@"connect_timeout" data:nil]; - }]; - } - } - return socketProxy; -} - -- (void)open:(id)args -{ - [self connect:args]; -} - -- (void)connect:(id)args -{ - [self.manager connect]; -} - -- (void)close:(id)args -{ - [self disconnect:args]; -} - -- (void)disconnect:(id)args -{ - [self.manager disconnect]; -} - -- (id)toString:(id)args -{ - return [NSString stringWithFormat:@"SocketManager (%p) %@", self, self.manager]; -} - -#pragma mark - Private methods - -- (NSMutableDictionary *)convertOptions:(NSDictionary *)jsOptions -{ - NSMutableDictionary *options = [NSMutableDictionary dictionaryWithDictionary:jsOptions]; - - [self options:options removeUnsupported:@"path" silent:false]; - [self options:options rename:@"reconnection" to:@"reconnects"]; - [self options:options rename:@"reconnectionAttempts" to:@"reconnectAttempts"]; - [self options:options rename:@"reconnectionDelay" to:@"reconnectWait"]; - if (options[@"reconnectWait"] != nil) { - options[@"reconnectWait"] = @([TiUtils doubleValue:@"reconnectWait" properties:options def:1000.f] / 1000); - } - [self options:options rename:@"reconnectionDelayMax" to:@"reconnectWaitMax"]; - if (options[@"reconnectWaitMax"] != nil) { - options[@"reconnectWaitMax"] = @([TiUtils doubleValue:@"reconnectWaitMax" properties:options def:5000.f] / 1000); - } - [self options:options removeUnsupported:@"timeout" silent:true]; - [self options:options removeUnsupported:@"autoConnect" silent:true]; - [self options:options removeUnsupported:@"parser" silent:false]; - - NSDictionary *queryParams = [options objectForKey:@"query"]; - if (queryParams != nil) { - [options setObject:queryParams forKey:@"connectParams"]; - [options removeObjectForKey:@"query"]; - } - - return options; -} - -- (void)options:(NSMutableDictionary *)options rename:(NSString *)fromName to:(NSString *)toName -{ - id optionValue = [options objectForKey:fromName]; - if (optionValue == nil) { - return; - } - - [options removeObjectForKey:fromName]; - [options setObject:optionValue forKey:toName]; -} - -- (void)options:(NSMutableDictionary *)options removeUnsupported:(NSString *)optionName silent:(BOOL)silent -{ - id optionValue = [options objectForKey:optionName]; - if (optionValue == nil) { - return; - } - - if (!silent) { - NSLog(@"[WARN] The option %@ is not supported on the iOS client and will be ignored.", optionName); - } - [options removeObjectForKey:optionName]; -} - -@end diff --git a/ios/Classes/SocketManagerProxy.swift b/ios/Classes/SocketManagerProxy.swift new file mode 100644 index 0000000..531a175 --- /dev/null +++ b/ios/Classes/SocketManagerProxy.swift @@ -0,0 +1,133 @@ +// +// SocketManagerProxy.swift +// ti.socketio +// +// Created by Hans Knöchel +// Copyright (c) 2022-present TiDev. All rights reserved. +// + +import UIKit +import TitaniumKit +import SocketIO + +@objc(SocketManagerProxy) +class SocketManagerProxy: TiProxy { + + private(set) var manager: SocketManager! + + /// The web client connects automatically. The native client does not, so we emulate it. + private var autoConnect = true + + /// Connection timeout in milliseconds, same default as the web client. + private var timeout: Double = 20000 + + func _init(withPageContext context: TiEvaluator!, url: URL, options: [String: Any]) -> Self! { + super._init(withPageContext: context) + + autoConnect = TiUtils.boolValue("autoConnect", properties: options, def: true) + timeout = TiUtils.doubleValue("timeout", properties: options, def: 20000) + + manager = SocketManager(socketURL: url, config: convertOptions(options)) + + return self + } + + // MARK: Public API's + + @objc(socket:) + func socket(_ args: [Any]) -> SocketIOClientProxy? { + guard let path = args.first as? String else { + throwException("Invalid arguments", subreason: "socket() expects a namespace string as first argument", location: "\(#file):\(#line)") + return nil + } + + let socket = path == "/" ? manager.defaultSocket : manager.socket(forNamespace: path) + + guard let socketProxy = SocketIOClientProxy()._init(withPageContext: pageContext, socket: socket, manager: self) else { + return nil + } + + if autoConnect { + if abs(timeout) < Double.ulpOfOne { + socket.connect() + } else { + socket.connect(timeoutAfter: timeout / 1000.0) { [weak socketProxy] in + socketProxy?.fireClientEvent("connect_timeout", data: []) + } + } + } + + return socketProxy + } + + @objc(open:) + func open(args: [Any]?) { + connect(args: args) + } + + @objc(connect:) + func connect(args: [Any]?) { + manager.connect() + } + + @objc(close:) + func close(args: [Any]?) { + disconnect(args: args) + } + + @objc(disconnect:) + func disconnect(args: [Any]?) { + manager.disconnect() + } + + @objc(toString:) + override func toString(_ args: Any!) -> Any! { + return "SocketManager (\(Unmanaged.passUnretained(self).toOpaque())) \(manager!)" + } + + // MARK: Private API's + + /// Maps the option names of the web client to the ones of the native client. + private func convertOptions(_ jsOptions: [String: Any]) -> [String: Any] { + var options = jsOptions + + rename(&options, "reconnection", to: "reconnects") + rename(&options, "reconnectionAttempts", to: "reconnectAttempts") + rename(&options, "reconnectionDelay", to: "reconnectWait") + rename(&options, "reconnectionDelayMax", to: "reconnectWaitMax") + + // the web client uses milliseconds, the native client whole seconds + for key in ["reconnectWait", "reconnectWaitMax"] where options[key] != nil { + let milliseconds = TiUtils.doubleValue(key, properties: options, def: 0) + options[key] = max(1, Int((milliseconds / 1000).rounded())) + } + + // handled by this proxy, not by the native client + removeUnsupported(&options, "timeout", silent: true) + removeUnsupported(&options, "autoConnect", silent: true) + + removeUnsupported(&options, "parser", silent: false) + + if let queryParams = options.removeValue(forKey: "query") { + options["connectParams"] = queryParams + } + + return options + } + + private func rename(_ options: inout [String: Any], _ fromName: String, to toName: String) { + guard let optionValue = options.removeValue(forKey: fromName) else { + return + } + options[toName] = optionValue + } + + private func removeUnsupported(_ options: inout [String: Any], _ optionName: String, silent: Bool) { + guard options.removeValue(forKey: optionName) != nil else { + return + } + if !silent { + NSLog("[WARN] The option \(optionName) is not supported on the iOS client and will be ignored.") + } + } +} diff --git a/ios/Classes/TiSocketio.h b/ios/Classes/TiSocketio.h new file mode 100644 index 0000000..eef26c1 --- /dev/null +++ b/ios/Classes/TiSocketio.h @@ -0,0 +1,17 @@ +// +// TiSocketio.h +// ti.socketio +// +// Created by Your Name +// Copyright (c) 2022 Your Company. All rights reserved. +// + +#import + +//! Project version number for TiSocketio. +FOUNDATION_EXPORT double TiSocketioVersionNumber; + +//! Project version string for TiSocketio. +FOUNDATION_EXPORT const unsigned char TiSocketioVersionString[]; + +#import "TiSocketioModuleAssets.h" diff --git a/ios/Classes/TiSocketioModule.h b/ios/Classes/TiSocketioModule.h deleted file mode 100644 index ef88b8a..0000000 --- a/ios/Classes/TiSocketioModule.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - * ti.socketio - * - * Created by Jan Vennemann - * Copyright (c) 2018-Present Axway Appcelerator. All rights reserved. - */ - -#import "TiModule.h" - -@class SocketIOClientProxy; -@class SocketManagerProxy; - -@interface TiSocketioModule : TiModule - -- (SocketIOClientProxy *)connect:(id)args; -- (SocketManagerProxy *)Manager:(id)args; - -@end diff --git a/ios/Classes/TiSocketioModule.m b/ios/Classes/TiSocketioModule.m deleted file mode 100644 index 50bebe3..0000000 --- a/ios/Classes/TiSocketioModule.m +++ /dev/null @@ -1,132 +0,0 @@ -/** - * ti.socketio - * - * Created by Jan Vennemann - * Copyright (c) 2018-Present Axway Appcelerator. All rights reserved. - */ - -#import "TiSocketioModule.h" -#import "SocketIOClientProxy.h" -#import "SocketManagerProxy.h" -#import "TiBase.h" -#import "TiHost.h" -#import "TiUtils.h" - -#import - -@interface TiSocketioModule () - -@property (nonatomic, strong) NSMutableDictionary *managers; - -@end - -@implementation TiSocketioModule - -#pragma mark - Internal - -// This is generated for your module, please do not change it -- (id)moduleGUID -{ - return @"65fbdc59-432f-40d8-8ea9-02799887db3c"; -} - -// This is generated for your module, please do not change it -- (NSString *)moduleId -{ - return @"ti.socketio"; -} - -#pragma mark - Lifecycle - -- (void)startup -{ - // This method is called when the module is first loaded - // You *must* call the superclass - [super startup]; - - self.managers = [NSMutableDictionary new]; - - DebugLog(@"[DEBUG] %@ loaded", self); -} - -#pragma mark - Public APIs - -- (SocketIOClientProxy *)connect:(id)args -{ - ENSURE_TYPE(args, NSArray); - NSURL *url = [[NSURL alloc] initWithString:[TiUtils stringValue:[args objectAtIndex:0]]]; - NSMutableDictionary *options = [NSMutableDictionary new]; - if ([args count] == 2) { - ENSURE_ARG_AT_INDEX(options, args, 1, NSMutableDictionary); - } - - return [self lookupClientForUrl:url options:options]; -} - -- (SocketManagerProxy *)Manager:(id)args -{ - ENSURE_TYPE(args, NSArray); - ENSURE_ARG_COUNT(args, 1) - NSString *urlString = nil; - ENSURE_ARG_AT_INDEX(urlString, args, 0, NSString) - NSURL *url = [[NSURL alloc] initWithString:urlString]; - NSDictionary *options = [NSDictionary new]; - if ([args count] == 2) { - ENSURE_ARG_AT_INDEX(options, args, 1, NSDictionary); - } - return [[SocketManagerProxy alloc] initWithContext:self.pageContext url:url options:options]; -} - -#pragma mark - Private methods - -- (SocketIOClientProxy *)lookupClientForUrl:(NSURL *)url options:(NSMutableDictionary *)options -{ - NSURLComponents *urlComponents = [[NSURLComponents alloc] initWithURL:url resolvingAgainstBaseURL:NO]; - - // make sure we always have a scheme and port - if (urlComponents.scheme == nil) { - urlComponents.scheme = @"https"; - } - if (urlComponents.port == nil) { - if ([urlComponents.scheme isEqualToString:@"http"] || [urlComponents.scheme isEqualToString:@"ws"]) { - urlComponents.port = @(80); - } else if ([urlComponents.scheme isEqualToString:@"https"] || [urlComponents.scheme isEqualToString:@"wss"]) { - urlComponents.port = @(443); - } - } - - NSString *path = urlComponents.path != nil && urlComponents.path.length > 0 ? urlComponents.path : @"/"; - urlComponents.path = nil; - - // assign parameters from query string - if (urlComponents.queryItems != nil && options[@"connectParams"] == nil) { - NSMutableDictionary *connectParams = [NSMutableDictionary new]; - for (NSURLQueryItem *queryItem in urlComponents.queryItems) { - connectParams[queryItem.name] = queryItem.value; - } - options[@"connectParams"] = connectParams; - } - urlComponents.query = nil; - - NSString *cacheIdentifier = urlComponents.string; - - BOOL forceNew = [TiUtils boolValue:@"forceNew" properties:options def:NO]; - [options removeObjectForKey:@"forceNew"]; - BOOL sameNamespace = self.managers[cacheIdentifier].manager.nsps[path] != nil; - BOOL newConnection = sameNamespace || forceNew; - - SocketManagerProxy *manager; - if (newConnection) { - manager = [[SocketManagerProxy alloc] initWithContext:self.pageContext url:urlComponents.URL options:options]; - } else { - if (self.managers[cacheIdentifier] == nil) { - manager = [[SocketManagerProxy alloc] initWithContext:self.pageContext url:urlComponents.URL options:options]; - self.managers[cacheIdentifier] = manager; - } - manager = self.managers[cacheIdentifier]; - } - - return [manager socket:@[ path, options ]]; -} - -@end diff --git a/ios/Classes/TiSocketioModule.swift b/ios/Classes/TiSocketioModule.swift new file mode 100644 index 0000000..f7598fc --- /dev/null +++ b/ios/Classes/TiSocketioModule.swift @@ -0,0 +1,120 @@ +// +// TiSocketioModule.swift +// ti.socketio +// +// Created by Hans Knöchel +// Copyright (c) 2022-present TiDev. All rights reserved. +// + +import UIKit +import TitaniumKit +import SocketIO + +@objc(TiSocketioModule) +class TiSocketioModule: TiModule { + + private var managers: [String: SocketManagerProxy] = [:] + + func moduleGUID() -> String { + return "65fbdc59-432f-40d8-8ea9-02799887db3c" + } + + override func moduleId() -> String! { + return "ti.socketio" + } + + // MARK: Public API's + + @objc(connect:) + func connect(args: [Any]) -> SocketIOClientProxy? { + guard let urlString = args.first as? String, let url = URL(string: urlString) else { + throwException("Invalid arguments", subreason: "connect() expects a URL string as first argument", location: "\(#file):\(#line)") + return nil + } + + var options: [String: Any] = [:] + if args.count > 1, let customOptions = args[1] as? [String: Any] { + options = customOptions + } + + return lookupClient(for: url, options: options) + } + + @objc(Manager:) + func Manager(args: [Any]) -> SocketManagerProxy? { + guard let urlString = args.first as? String, let url = URL(string: urlString) else { + throwException("Invalid arguments", subreason: "Manager() expects a URL string as first argument", location: "\(#file):\(#line)") + return nil + } + + var options: [String: Any] = [:] + if args.count > 1, let customOptions = args[1] as? [String: Any] { + options = customOptions + } + + return SocketManagerProxy()._init(withPageContext: pageContext, url: url, options: options) + } + + // MARK: Private API's + + /// Mirrors the lookup of the web client: one manager per host, the URL path is the namespace. + private func lookupClient(for url: URL, options jsOptions: [String: Any]) -> SocketIOClientProxy? { + guard var urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false) else { + throwException("Invalid arguments", subreason: "Cannot parse the URL \(url)", location: "\(#file):\(#line)") + return nil + } + + var options = jsOptions + + // make sure we always have a scheme and port + if urlComponents.scheme == nil { + urlComponents.scheme = "https" + } + if urlComponents.port == nil { + switch urlComponents.scheme ?? "" { + case "http", "ws": + urlComponents.port = 80 + case "https", "wss": + urlComponents.port = 443 + default: + break + } + } + + // the path is the namespace and not part of the manager URL + let path = urlComponents.path.isEmpty ? "/" : urlComponents.path + urlComponents.path = "" + + // assign parameters from the query string + if let queryItems = urlComponents.queryItems, options["connectParams"] == nil { + var connectParams: [String: Any] = [:] + for queryItem in queryItems { + connectParams[queryItem.name] = queryItem.value ?? "" + } + options["connectParams"] = connectParams + } + urlComponents.query = nil + + guard let managerURL = urlComponents.url, let cacheIdentifier = urlComponents.string else { + throwException("Invalid arguments", subreason: "Cannot construct the manager URL from \(url)", location: "\(#file):\(#line)") + return nil + } + + let forceNew = TiUtils.boolValue("forceNew", properties: options, def: false) + options.removeValue(forKey: "forceNew") + let sameNamespace = managers[cacheIdentifier]?.manager.nsps[path] != nil + let newConnection = sameNamespace || forceNew + + let manager: SocketManagerProxy + if newConnection { + manager = SocketManagerProxy()._init(withPageContext: pageContext, url: managerURL, options: options) + } else if let cachedManager = managers[cacheIdentifier] { + manager = cachedManager + } else { + manager = SocketManagerProxy()._init(withPageContext: pageContext, url: managerURL, options: options) + managers[cacheIdentifier] = manager + } + + return manager.socket([path]) + } +} diff --git a/ios/Info.plist b/ios/Info.plist new file mode 100644 index 0000000..fbe1e6b --- /dev/null +++ b/ios/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSPrincipalClass + + + diff --git a/ios/README.md b/ios/README.md index 21bd0fa..0ca28c5 100644 --- a/ios/README.md +++ b/ios/README.md @@ -1,12 +1,30 @@ # Socket.io iOS module -This is the iOS part of the ti.socketio module. +This is the iOS part of the ti.socketio module. It is a Swift module and wraps the [socket.io-client-swift](https://github.com/socketio/socket.io-client-swift) library. + +## Requirements + +The module needs Titanium SDK 13.1.0.GA or later. That version added Swift Package Manager (SPM) support for native modules. An app that uses an older SDK cannot link the module. ## Development guide -This module uses [Carthage](https://github.com/Carthage/Carthage) to manage native dependencies. You might notice that no frameworks are checked in to the `platform` folder of this repository. Before you can build the project run `carthage bootstrap` in this directory to checkout and build the reuired [SocketIO.framework](https://github.com/socketio/socket.io-client-swift) and its dependencies. Now copy all built frameworks from the `Carthage/Build/iOS` folder to `platform`. +The native dependency is a Swift package. There are no frameworks in the `platform` folder and no Carthage step. Xcode resolves the package when you build the module, so the first build needs network access. + +The package is declared in two places: + +1. `ti.socketio.xcodeproj` contains the package reference, so that the module compiles. +2. `spm.json` next to the `manifest` declares the same package for the Titanium CLI. The CLI stores it in the `metadata.json` of the module zip. The linkage is `embedded`, so the package is compiled into the module framework and the app project is not changed. + +To build the module, run this command in the `ios` directory: + +```sh +ti build -p ios --build-only +``` -You are responsible to manually integrate any dependency changes into the module. After you modified the Cartfile run the `carthage update` command. After that make sure to copy the built frameworks to the platform folder again. **Do not check-in the frameworks from the platform folder** +The zip file is written to the `dist` folder. -> ⚠️ Make sure the frameworks in `Carthage/Build/iOS` and `platform` are in sync before you build to avoid unexepcted behavior. +## Update the native library +1. Open `ti.socketio.xcodeproj` in Xcode and change the version rule of the `socket.io-client-swift` package. +2. Set the same version in `spm.json` under `requirementMinimumVersion`. +3. Rebuild the module. The CLI only reads `spm.json` when it packages the module. diff --git a/ios/TiSocketio_Prefix.pch b/ios/TiSocketio_Prefix.pch index 186d246..2fb3c7f 100644 --- a/ios/TiSocketio_Prefix.pch +++ b/ios/TiSocketio_Prefix.pch @@ -1,5 +1,5 @@ #ifdef __OBJC__ #import - #import #endif + diff --git a/ios/hooks/carthage.js b/ios/hooks/carthage.js deleted file mode 100644 index 972abc9..0000000 --- a/ios/hooks/carthage.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Carthage build hook - * - * Copyright (c) 2019-present by Axway Appcelerator - * All Rights Reserved. - */ - -'use strict'; - -const spawn = require('child_process').spawn; -const path = require('path'); - -exports.id = 'ti.socketio.carthage'; -exports.cliVersion = '>=3.2'; -exports.init = init; - -/** - * Main entry point for our plugin which looks for the platform specific - * plugin to invoke - */ -function init (logger, config, cli, appc) { - cli.on('build.module.pre.compile', { - pre: function (builder, done) { - logger.info('Running carthage...'); - - const p = spawn('carthage', [ 'bootstrap', '--platform', 'ios', '--cache-builds', '--use-xcframeworks' ], { cwd: builder.projectDir }); - p.stderr.on('data', data => logger.error(data.toString().trim())); - p.stdout.on('data', data => logger.trace(data.toString().trim())); - p.on('close', function (code) { - if (code !== 0) { - return done(new Error(`Failed to run carthage properly, exited with code: ${code}`)); - } - - const fs = require('fs-extra'); - const subdirs = fs.readdirSync(path.join(builder.projectDir, 'Carthage/Build')); - const frameworkDirs = subdirs.filter(dir => dir.endsWith('.xcframework')); - for (const frameworkDir of frameworkDirs) { - fs.copySync(path.join(builder.projectDir, 'Carthage/Build', frameworkDir), path.join(builder.projectDir, 'platform', frameworkDir)); - } - done(); - }); - } - }); -} diff --git a/ios/hooks/ti.swiftsupport.js b/ios/hooks/ti.swiftsupport.js index e344e1d..9994003 100644 --- a/ios/hooks/ti.swiftsupport.js +++ b/ios/hooks/ti.swiftsupport.js @@ -1,24 +1,28 @@ /** * Ti.SwiftSupport - * Copyright (c) 2017-present by Axway Appcelerator + * Copyright (c) 2018-present by Axway Appcelerator. * All Rights Reserved. */ 'use strict'; -exports.id = 'ti.socketio.swiftsupport'; +exports.id = 'ti.swiftsupport'; exports.cliVersion = '>=3.2'; exports.init = init; /** * Main entry point for our plugin which looks for the platform specific - * plugin to invoke + * plugin to invoke. + * + * @param {Object} logger The logger instance. + * @param {Object} config The hook config. + * @param {Object} cli The Titanium CLI instance. + * @param {Object} appc The Appcelerator CLI instance. */ +// eslint-disable-next-line no-unused-vars function init(logger, config, cli, appc) { cli.on('build.ios.xcodeproject', { - pre: function(data) { - logger.info('Enabling Swift support ...'); - + pre: function (data) { var xobjs = data.args[0].hash.project.objects; Object.keys(xobjs.PBXNativeTarget).forEach(function (targetUuid) { diff --git a/ios/manifest b/ios/manifest index 997de42..c23bd20 100644 --- a/ios/manifest +++ b/ios/manifest @@ -2,9 +2,9 @@ # this is your module manifest and used by Titanium # during compilation, packaging, distribution, etc. # -version: 3.0.0 +version: 4.0.0 apiversion: 2 -architectures: armv7 arm64 i386 x86_64 +architectures: arm64 x86_64 description: Socket.io client for Titanium author: Axway Appcelerator license: Apache-2.0 @@ -15,5 +15,5 @@ name: ti.socketio moduleid: ti.socketio guid: 65fbdc59-432f-40d8-8ea9-02799887db3c platform: iphone -minsdk: 9.2.0 +minsdk: 13.1.0.GA mac: false diff --git a/ios/platform/README.md b/ios/platform/README.md deleted file mode 100644 index de84f9b..0000000 --- a/ios/platform/README.md +++ /dev/null @@ -1,3 +0,0 @@ -## Where are my dependencies? - -Use `carthage bootstrap` to generate the dependencies and copy them here. See the readme in the `ios/` directory for details. diff --git a/ios/spm.json b/ios/spm.json new file mode 100644 index 0000000..df58e1f --- /dev/null +++ b/ios/spm.json @@ -0,0 +1,17 @@ +{ + "dependencies": [ + { + "remotePackageReference": "socket.io-client-swift", + "repositoryURL": "https://github.com/socketio/socket.io-client-swift", + "requirementKind": "upToNextMajorVersion", + "requirementMinimumVersion": "16.1.1", + "products": [ + { + "productName": "SocketIO", + "frameworkName": "SocketIO", + "linkage": "embedded" + } + ] + } + ] +} diff --git a/ios/ti.socketio.xcodeproj/project.pbxproj b/ios/ti.socketio.xcodeproj/project.pbxproj index b7e027c..0519629 100644 --- a/ios/ti.socketio.xcodeproj/project.pbxproj +++ b/ios/ti.socketio.xcodeproj/project.pbxproj @@ -3,343 +3,233 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 52; objects = { -/* Begin PBXAggregateTarget section */ - 24416B8111C4CA220047AFDD /* Build & Test */ = { - isa = PBXAggregateTarget; - buildConfigurationList = 24416B8A11C4CA520047AFDD /* Build configuration list for PBXAggregateTarget "Build & Test" */; - buildPhases = ( - 24416B8011C4CA220047AFDD /* ShellScript */, - ); - dependencies = ( - 24416B8511C4CA280047AFDD /* PBXTargetDependency */, - ); - name = "Build & Test"; - productName = "Build & test"; - }; -/* End PBXAggregateTarget section */ - /* Begin PBXBuildFile section */ - 24DD6CF91134B3F500162E58 /* TiSocketioModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 24DD6CF71134B3F500162E58 /* TiSocketioModule.h */; }; - 24DD6CFA1134B3F500162E58 /* TiSocketioModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 24DD6CF81134B3F500162E58 /* TiSocketioModule.m */; }; - 24DE9E1111C5FE74003F90F6 /* TiSocketioModuleAssets.h in Headers */ = {isa = PBXBuildFile; fileRef = 24DE9E0F11C5FE74003F90F6 /* TiSocketioModuleAssets.h */; }; - 24DE9E1211C5FE74003F90F6 /* TiSocketioModuleAssets.m in Sources */ = {isa = PBXBuildFile; fileRef = 24DE9E1011C5FE74003F90F6 /* TiSocketioModuleAssets.m */; }; - 4A2196D422529C8C00DD6DEA /* Starscream.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4AB2678320B1AAE000E4E3DD /* Starscream.xcframework */; }; - 4A2196D522529C9500DD6DEA /* SocketIO.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4AB2678220B1AAE000E4E3DD /* SocketIO.xcframework */; }; - 4AA6A17D21C3E22200AE770E /* SocketManagerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 4AA6A17B21C3E22200AE770E /* SocketManagerProxy.h */; }; - 4AA6A17E21C3E22200AE770E /* SocketManagerProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AA6A17C21C3E22200AE770E /* SocketManagerProxy.m */; }; - 4AB2678820B1B13500E4E3DD /* SocketIOClientProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 4AB2678620B1B13500E4E3DD /* SocketIOClientProxy.h */; }; - 4AB2678920B1B13500E4E3DD /* SocketIOClientProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 4AB2678720B1B13500E4E3DD /* SocketIOClientProxy.m */; }; - AA747D9F0F9514B9006C5449 /* TiSocketio_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = AA747D9E0F9514B9006C5449 /* TiSocketio_Prefix.pch */; }; - AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; }; + 3A01312B282C37EF003C6E8A /* SocketManagerProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A01312A282C37EF003C6E8A /* SocketManagerProxy.swift */; }; + B1E00E65241D179500C384C1 /* TitaniumKit.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = B1E00E64241D179500C384C1 /* TitaniumKit.xcframework */; }; + DB24E03C20766AC90033B2B1 /* SocketIOClientProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB24E03B20766AC90033B2B1 /* SocketIOClientProxy.swift */; }; + DB34CDE0207B998A005F8E8C /* TiSocketioModuleAssets.m in Sources */ = {isa = PBXBuildFile; fileRef = DB34CDDE207B998A005F8E8C /* TiSocketioModuleAssets.m */; }; + DB34CDE1207B998A005F8E8C /* TiSocketioModuleAssets.h in Headers */ = {isa = PBXBuildFile; fileRef = DB34CDDF207B998A005F8E8C /* TiSocketioModuleAssets.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DB34CDE6207B9EBD005F8E8C /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DB34CDE5207B9EBD005F8E8C /* Foundation.framework */; }; + 4C5B0A012CF1000100A1B2C3 /* SocketIO in Frameworks */ = {isa = PBXBuildFile; productRef = 4C5B0A022CF1000100A1B2C3 /* SocketIO */; }; + DB52E2401E9CCF8D00AAAEE0 /* TiSocketio_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = DB52E23F1E9CCF8D00AAAEE0 /* TiSocketio_Prefix.pch */; }; + DB52E2431E9CD0F800AAAEE0 /* TiSocketioModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB52E2421E9CD0F800AAAEE0 /* TiSocketioModule.swift */; }; + DB75E5161E9CD59000809B2D /* TiSocketio.h in Headers */ = {isa = PBXBuildFile; fileRef = DB75E5151E9CD58100809B2D /* TiSocketio.h */; settings = {ATTRIBUTES = (Public, ); }; }; /* End PBXBuildFile section */ -/* Begin PBXContainerItemProxy section */ - 24416B8411C4CA280047AFDD /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = D2AAC07D0554694100DB518D; - remoteInfo = "ti-socketio"; - }; -/* End PBXContainerItemProxy section */ - /* Begin PBXFileReference section */ - 24DD6CF71134B3F500162E58 /* TiSocketioModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TiSocketioModule.h; path = Classes/TiSocketioModule.h; sourceTree = ""; }; - 24DD6CF81134B3F500162E58 /* TiSocketioModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TiSocketioModule.m; path = Classes/TiSocketioModule.m; sourceTree = ""; }; - 24DD6D1B1134B66800162E58 /* titanium.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = titanium.xcconfig; sourceTree = ""; }; - 24DE9E0F11C5FE74003F90F6 /* TiSocketioModuleAssets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TiSocketioModuleAssets.h; path = Classes/TiSocketioModuleAssets.h; sourceTree = ""; }; - 24DE9E1011C5FE74003F90F6 /* TiSocketioModuleAssets.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TiSocketioModuleAssets.m; path = Classes/TiSocketioModuleAssets.m; sourceTree = ""; }; - 4AA6A17B21C3E22200AE770E /* SocketManagerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SocketManagerProxy.h; path = Classes/SocketManagerProxy.h; sourceTree = ""; }; - 4AA6A17C21C3E22200AE770E /* SocketManagerProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SocketManagerProxy.m; path = Classes/SocketManagerProxy.m; sourceTree = ""; }; - 4AB2678220B1AAE000E4E3DD /* SocketIO.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = SocketIO.xcframework; path = platform/SocketIO.xcframework; sourceTree = ""; }; - 4AB2678320B1AAE000E4E3DD /* Starscream.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Starscream.xcframework; path = platform/Starscream.xcframework; sourceTree = ""; }; - 4AB2678620B1B13500E4E3DD /* SocketIOClientProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SocketIOClientProxy.h; path = Classes/SocketIOClientProxy.h; sourceTree = ""; }; - 4AB2678720B1B13500E4E3DD /* SocketIOClientProxy.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SocketIOClientProxy.m; path = Classes/SocketIOClientProxy.m; sourceTree = ""; }; - AA747D9E0F9514B9006C5449 /* TiSocketio_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TiSocketio_Prefix.pch; sourceTree = SOURCE_ROOT; }; - AACBBE490F95108600F1A2B1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - D2AAC07E0554694100DB518D /* libtisocketio.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libtisocketio.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 3A01312A282C37EF003C6E8A /* SocketManagerProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketManagerProxy.swift; path = Classes/SocketManagerProxy.swift; sourceTree = ""; }; + B1E00E64241D179500C384C1 /* TitaniumKit.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = TitaniumKit.xcframework; path = "$(TITANIUM_SDK)/iphone/Frameworks/TitaniumKit.xcframework"; sourceTree = ""; }; + DB24E03B20766AC90033B2B1 /* SocketIOClientProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SocketIOClientProxy.swift; path = Classes/SocketIOClientProxy.swift; sourceTree = ""; }; + DB34CDDE207B998A005F8E8C /* TiSocketioModuleAssets.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TiSocketioModuleAssets.m; path = Classes/TiSocketioModuleAssets.m; sourceTree = SOURCE_ROOT; }; + DB34CDDF207B998A005F8E8C /* TiSocketioModuleAssets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TiSocketioModuleAssets.h; path = Classes/TiSocketioModuleAssets.h; sourceTree = SOURCE_ROOT; }; + DB34CDE5207B9EBD005F8E8C /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + DB52E22A1E9CCD7000AAAEE0 /* TiSocketio.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TiSocketio.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + DB52E22E1E9CCD7000AAAEE0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; + DB52E23F1E9CCF8D00AAAEE0 /* TiSocketio_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TiSocketio_Prefix.pch; sourceTree = SOURCE_ROOT; }; + DB52E2411E9CD09900AAAEE0 /* titanium.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = titanium.xcconfig; sourceTree = ""; }; + DB52E2421E9CD0F800AAAEE0 /* TiSocketioModule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TiSocketioModule.swift; path = Classes/TiSocketioModule.swift; sourceTree = ""; }; + DB75E5151E9CD58100809B2D /* TiSocketio.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TiSocketio.h; path = Classes/TiSocketio.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - D2AAC07C0554694100DB518D /* Frameworks */ = { + DB52E2261E9CCD7000AAAEE0 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4A2196D522529C9500DD6DEA /* SocketIO.framework in Frameworks */, - 4A2196D422529C8C00DD6DEA /* Starscream.xcframework in Frameworks */, - AACBBE4A0F95108600F1A2B1 /* Foundation.xcframework in Frameworks */, + DB34CDE6207B9EBD005F8E8C /* Foundation.framework in Frameworks */, + 4C5B0A012CF1000100A1B2C3 /* SocketIO in Frameworks */, + B1E00E65241D179500C384C1 /* TitaniumKit.xcframework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 034768DFFF38A50411DB9C8B /* Products */ = { + DB258CA41F0964DE000D0D8D /* Misc */ = { isa = PBXGroup; children = ( - D2AAC07E0554694100DB518D /* libtisocketio.a */, + DB52E2411E9CD09900AAAEE0 /* titanium.xcconfig */, + DB34CDDF207B998A005F8E8C /* TiSocketioModuleAssets.h */, + DB34CDDE207B998A005F8E8C /* TiSocketioModuleAssets.m */, + DB75E5151E9CD58100809B2D /* TiSocketio.h */, + DB52E23F1E9CCF8D00AAAEE0 /* TiSocketio_Prefix.pch */, + DB52E22E1E9CCD7000AAAEE0 /* Info.plist */, ); - name = Products; + name = Misc; sourceTree = ""; }; - 0867D691FE84028FC02AAC07 /* ti-socketio */ = { + DB258CA51F0964F6000D0D8D /* Sources */ = { isa = PBXGroup; children = ( - 08FB77AEFE84172EC02AAC07 /* Classes */, - 32C88DFF0371C24200C91783 /* Other Sources */, - 0867D69AFE84028FC02AAC07 /* Frameworks */, - 034768DFFF38A50411DB9C8B /* Products */, + DB52E2421E9CD0F800AAAEE0 /* TiSocketioModule.swift */, + DB24E03B20766AC90033B2B1 /* SocketIOClientProxy.swift */, + 3A01312A282C37EF003C6E8A /* SocketManagerProxy.swift */, ); - name = "ti-socketio"; + name = Sources; sourceTree = ""; }; - 0867D69AFE84028FC02AAC07 /* Frameworks */ = { + DB34CDE2207B9D6A005F8E8C /* Frameworks */ = { isa = PBXGroup; children = ( - 4AB2678220B1AAE000E4E3DD /* SocketIO.framework */, - 4AB2678320B1AAE000E4E3DD /* Starscream.xcframework */, - AACBBE490F95108600F1A2B1 /* Foundation.xcframework */, + B1E00E64241D179500C384C1 /* TitaniumKit.xcframework */, + DB34CDE5207B9EBD005F8E8C /* Foundation.framework */, ); name = Frameworks; sourceTree = ""; }; - 08FB77AEFE84172EC02AAC07 /* Classes */ = { + DB52E2201E9CCD7000AAAEE0 = { + isa = PBXGroup; + children = ( + DB52E22C1E9CCD7000AAAEE0 /* TiSocketio */, + DB52E22B1E9CCD7000AAAEE0 /* Products */, + DB34CDE2207B9D6A005F8E8C /* Frameworks */, + ); + sourceTree = ""; + }; + DB52E22B1E9CCD7000AAAEE0 /* Products */ = { isa = PBXGroup; children = ( - 4AB2678620B1B13500E4E3DD /* SocketIOClientProxy.h */, - 4AB2678720B1B13500E4E3DD /* SocketIOClientProxy.m */, - 4AA6A17B21C3E22200AE770E /* SocketManagerProxy.h */, - 4AA6A17C21C3E22200AE770E /* SocketManagerProxy.m */, - 24DD6CF71134B3F500162E58 /* TiSocketioModule.h */, - 24DD6CF81134B3F500162E58 /* TiSocketioModule.m */, - 24DE9E0F11C5FE74003F90F6 /* TiSocketioModuleAssets.h */, - 24DE9E1011C5FE74003F90F6 /* TiSocketioModuleAssets.m */, + DB52E22A1E9CCD7000AAAEE0 /* TiSocketio.framework */, ); - name = Classes; + name = Products; sourceTree = ""; }; - 32C88DFF0371C24200C91783 /* Other Sources */ = { + DB52E22C1E9CCD7000AAAEE0 /* TiSocketio */ = { isa = PBXGroup; children = ( - AA747D9E0F9514B9006C5449 /* TiSocketio_Prefix.pch */, - 24DD6D1B1134B66800162E58 /* titanium.xcconfig */, + DB258CA51F0964F6000D0D8D /* Sources */, + DB258CA41F0964DE000D0D8D /* Misc */, ); - name = "Other Sources"; + name = TiSocketio; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ - D2AAC07A0554694100DB518D /* Headers */ = { + DB52E2271E9CCD7000AAAEE0 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - AA747D9F0F9514B9006C5449 /* TiSocketio_Prefix.pch in Headers */, - 4AB2678820B1B13500E4E3DD /* SocketIOClientProxy.h in Headers */, - 4AA6A17D21C3E22200AE770E /* SocketManagerProxy.h in Headers */, - 24DD6CF91134B3F500162E58 /* TiSocketioModule.h in Headers */, - 24DE9E1111C5FE74003F90F6 /* TiSocketioModuleAssets.h in Headers */, + DB75E5161E9CD59000809B2D /* TiSocketio.h in Headers */, + DB34CDE1207B998A005F8E8C /* TiSocketioModuleAssets.h in Headers */, + DB52E2401E9CCF8D00AAAEE0 /* TiSocketio_Prefix.pch in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - D2AAC07D0554694100DB518D /* ti.socketio */ = { + DB52E2291E9CCD7000AAAEE0 /* TiSocketio */ = { isa = PBXNativeTarget; - buildConfigurationList = 1DEB921E08733DC00010E9CD /* Build configuration list for PBXNativeTarget "ti.socketio" */; + buildConfigurationList = DB52E2321E9CCD7000AAAEE0 /* Build configuration list for PBXNativeTarget "TiSocketio" */; buildPhases = ( - D2AAC07A0554694100DB518D /* Headers */, - D2AAC07B0554694100DB518D /* Sources */, - D2AAC07C0554694100DB518D /* Frameworks */, + DB52E2251E9CCD7000AAAEE0 /* Sources */, + DB52E2261E9CCD7000AAAEE0 /* Frameworks */, + DB52E2271E9CCD7000AAAEE0 /* Headers */, + DB52E2281E9CCD7000AAAEE0 /* Resources */, ); buildRules = ( ); dependencies = ( + DBB66220208481A400EAD6D9 /* PBXTargetDependency */, + ); + name = TiSocketio; + productName = TiSocketio; + packageProductDependencies = ( + 4C5B0A022CF1000100A1B2C3 /* SocketIO */, ); - name = ti.socketio; - productName = "ti-socketio"; - productReference = D2AAC07E0554694100DB518D /* libtisocketio.a */; - productType = "com.apple.product-type.library.static"; + productReference = DB52E22A1E9CCD7000AAAEE0 /* TiSocketio.framework */; + productType = "com.apple.product-type.framework"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ - 0867D690FE84028FC02AAC07 /* Project object */ = { + DB52E2211E9CCD7000AAAEE0 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1000; + LastUpgradeCheck = 1330; + TargetAttributes = { + DB52E2291E9CCD7000AAAEE0 = { + CreatedOnToolsVersion = 8.3; + LastSwiftMigration = 0940; + ProvisioningStyle = Automatic; + }; + }; }; - buildConfigurationList = 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "ti.socketio" */; - compatibilityVersion = "Xcode 9.3"; - developmentRegion = English; - hasScannedForEncodings = 1; + buildConfigurationList = DB52E2241E9CCD7000AAAEE0 /* Build configuration list for PBXProject "ti.socketio" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = en; + hasScannedForEncodings = 0; knownRegions = ( - English, - Japanese, - French, - German, + en, + Base, ); - mainGroup = 0867D691FE84028FC02AAC07 /* ti-socketio */; - productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; + mainGroup = DB52E2201E9CCD7000AAAEE0; + packageReferences = ( + 4C5B0A032CF1000100A1B2C3 /* XCRemoteSwiftPackageReference "socket.io-client-swift" */, + ); + productRefGroup = DB52E22B1E9CCD7000AAAEE0 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( - D2AAC07D0554694100DB518D /* ti.socketio */, - 24416B8111C4CA220047AFDD /* Build & Test */, + DB52E2291E9CCD7000AAAEE0 /* TiSocketio */, ); }; /* End PBXProject section */ -/* Begin PBXShellScriptBuildPhase section */ - 24416B8011C4CA220047AFDD /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; +/* Begin PBXResourcesBuildPhase section */ + DB52E2281E9CCD7000AAAEE0 /* Resources */ = { + isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); - inputPaths = ( - ); - outputPaths = ( - ); runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "# shell script goes here\n\nappc run --project-dir \"${PROJECT_DIR}\"\nexit $?\n"; }; -/* End PBXShellScriptBuildPhase section */ +/* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - D2AAC07B0554694100DB518D /* Sources */ = { + DB52E2251E9CCD7000AAAEE0 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 24DD6CFA1134B3F500162E58 /* TiSocketioModule.m in Sources */, - 4AA6A17E21C3E22200AE770E /* SocketManagerProxy.m in Sources */, - 4AB2678920B1B13500E4E3DD /* SocketIOClientProxy.m in Sources */, - 24DE9E1211C5FE74003F90F6 /* TiSocketioModuleAssets.m in Sources */, + DB24E03C20766AC90033B2B1 /* SocketIOClientProxy.swift in Sources */, + 3A01312B282C37EF003C6E8A /* SocketManagerProxy.swift in Sources */, + DB34CDE0207B998A005F8E8C /* TiSocketioModuleAssets.m in Sources */, + DB52E2431E9CD0F800AAAEE0 /* TiSocketioModule.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 24416B8511C4CA280047AFDD /* PBXTargetDependency */ = { + DBB66220208481A400EAD6D9 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = D2AAC07D0554694100DB518D /* ti.socketio */; - targetProxy = 24416B8411C4CA280047AFDD /* PBXContainerItemProxy */; + name = TitaniumKit; }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ - 1DEB921F08733DC00010E9CD /* Debug */ = { + DB52E2301E9CCD7000AAAEE0 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 24DD6D1B1134B66800162E58 /* titanium.xcconfig */; + baseConfigurationReference = DB52E2411E9CD09900AAAEE0 /* titanium.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ENABLE_MODULE_DEBUGGING = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEFINES_MODULE = YES; - DSTROOT = /tmp/TiSocketio.dst; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/platform", - "$(PROJECT_DIR)/Carthage/Build/iOS", - ); - GCC_C_LANGUAGE_STANDARD = c99; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = TiSocketio_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS = "TI_VERSION=$(TI_VERSION)"; - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - GCC_VERSION = ""; - GCC_WARN_ABOUT_RETURN_TYPE = NO; - GCC_WARN_MISSING_PARENTHESES = NO; - GCC_WARN_SHADOW = NO; - GCC_WARN_STRICT_SELECTOR_MATCH = NO; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_PARAMETER = NO; - GCC_WARN_UNUSED_VALUE = NO; - GCC_WARN_UNUSED_VARIABLE = NO; - INSTALL_PATH = /usr/local/lib; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LIBRARY_SEARCH_PATHS = ""; - OTHER_CFLAGS = ( - "-DDEBUG", - "-DTI_POST_1_2", - ); - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = tisocketio; - PROVISIONING_PROFILE = ""; - "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; - RUN_CLANG_STATIC_ANALYZER = NO; - SDKROOT = iphoneos; - USER_HEADER_SEARCH_PATHS = ""; - WARNING_CFLAGS = "-Wno-arc-performSelector-leaks"; - }; - name = Debug; - }; - 1DEB922008733DC00010E9CD /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 24DD6D1B1134B66800162E58 /* titanium.xcconfig */; - buildSettings = { - CLANG_ENABLE_MODULE_DEBUGGING = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; - COPY_PHASE_STRIP = NO; - DEFINES_MODULE = YES; - DEPLOYMENT_POSTPROCESSING = YES; - DSTROOT = /tmp/TiSocketio.dst; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/platform", - "$(PROJECT_DIR)/Carthage/Build/iOS", - ); - GCC_C_LANGUAGE_STANDARD = c99; - GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = TiSocketio_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS = ( - "TI_VERSION=$(TI_VERSION)", - NDEBUG, - ); - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - GCC_VERSION = ""; - GCC_WARN_ABOUT_RETURN_TYPE = NO; - GCC_WARN_MISSING_PARENTHESES = NO; - GCC_WARN_SHADOW = NO; - GCC_WARN_STRICT_SELECTOR_MATCH = NO; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_PARAMETER = NO; - GCC_WARN_UNUSED_VALUE = NO; - GCC_WARN_UNUSED_VARIABLE = NO; - INSTALL_PATH = /usr/local/lib; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LIBRARY_SEARCH_PATHS = ""; - OTHER_CFLAGS = "-DTI_POST_1_2"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = tisocketio; - RUN_CLANG_STATIC_ANALYZER = NO; - SDKROOT = iphoneos; - USER_HEADER_SEARCH_PATHS = ""; - WARNING_CFLAGS = "-Wno-arc-performSelector-leaks"; - }; - name = Release; - }; - 1DEB922308733DC00010E9CD /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 24DD6D1B1134B66800162E58 /* titanium.xcconfig */; - buildSettings = { - CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_CXX_LIBRARY = "compiler-default"; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; @@ -347,63 +237,66 @@ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = NO; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - DSTROOT = /tmp/TiSocketio.dst; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + DEFINES_MODULE = YES; + ENABLE_BITCODE = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = c99; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = TiSocketio_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS = "TI_VERSION=$(TI_VERSION)"; - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - GCC_VERSION = ""; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = NO; - GCC_WARN_MISSING_PARENTHESES = NO; - GCC_WARN_SHADOW = NO; - GCC_WARN_STRICT_SELECTOR_MATCH = NO; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_PARAMETER = NO; - GCC_WARN_UNUSED_VALUE = NO; - GCC_WARN_UNUSED_VARIABLE = NO; - INSTALL_PATH = /usr/local/lib; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; - OTHER_CFLAGS = ( - "-DDEBUG", - "-DTI_POST_1_2", - ); - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = tisocketio; - PROVISIONING_PROFILE = ""; - "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; - RUN_CLANG_STATIC_ANALYZER = NO; SDKROOT = iphoneos; - USER_HEADER_SEARCH_PATHS = ""; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALID_ARCHS = "$(ARCHS_STANDARD)"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; }; name = Debug; }; - 1DEB922408733DC00010E9CD /* Release */ = { + DB52E2311E9CCD7000AAAEE0 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 24DD6D1B1134B66800162E58 /* titanium.xcconfig */; + baseConfigurationReference = DB52E2411E9CD09900AAAEE0 /* titanium.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_CXX_LIBRARY = "compiler-default"; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; @@ -411,98 +304,178 @@ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = NO; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - DSTROOT = /tmp/TiSocketio.dst; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEFINES_MODULE = YES; + ENABLE_BITCODE = NO; + ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_MODEL_TUNING = G5; + GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = TiSocketio_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS = "TI_VERSION=$(TI_VERSION)"; - GCC_TREAT_WARNINGS_AS_ERRORS = NO; - GCC_VERSION = ""; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = NO; - GCC_WARN_MISSING_PARENTHESES = NO; - GCC_WARN_SHADOW = NO; - GCC_WARN_STRICT_SELECTOR_MATCH = NO; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_PARAMETER = NO; - GCC_WARN_UNUSED_VALUE = NO; - GCC_WARN_UNUSED_VARIABLE = NO; - INSTALL_PATH = /usr/local/lib; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - OTHER_CFLAGS = "-DTI_POST_1_2"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = tisocketio; - RUN_CLANG_STATIC_ANALYZER = NO; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; - USER_HEADER_SEARCH_PATHS = ""; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VALID_ARCHS = "$(ARCHS_STANDARD)"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; }; name = Release; }; - 24416B8211C4CA220047AFDD /* Debug */ = { + DB52E2331E9CCD7000AAAEE0 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 24DD6D1B1134B66800162E58 /* titanium.xcconfig */; + baseConfigurationReference = DB52E2411E9CD09900AAAEE0 /* titanium.xcconfig */; buildSettings = { - CLANG_ENABLE_OBJC_WEAK = YES; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - PRODUCT_NAME = "Build & test"; + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = TiSocketio_Prefix.pch; + GCC_PREPROCESSOR_DEFINITIONS = "TI_VERSION=$(TI_VERSION)"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = ""; + OTHER_CFLAGS = ( + "-DDEBUG", + "-DTI_POST_1_2", + ); + OTHER_LDFLAGS = ( + "-ObjC", + "$(inherited)", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.appcelerator.ti.socketio; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_INCLUDE_PATHS = "$(SRCROOT)/Titanium"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VALID_ARCHS = "$(ARCHS_STANDARD)"; }; name = Debug; }; - 24416B8311C4CA220047AFDD /* Release */ = { + DB52E2341E9CCD7000AAAEE0 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 24DD6D1B1134B66800162E58 /* titanium.xcconfig */; + baseConfigurationReference = DB52E2411E9CD09900AAAEE0 /* titanium.xcconfig */; buildSettings = { - CLANG_ENABLE_OBJC_WEAK = YES; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - PRODUCT_NAME = "Build & test"; - ZERO_LINK = NO; + CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; + CODE_SIGN_STYLE = Manual; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = ""; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = TiSocketio_Prefix.pch; + GCC_PREPROCESSOR_DEFINITIONS = "TI_VERSION=$(TI_VERSION)"; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + LIBRARY_SEARCH_PATHS = ""; + OTHER_CFLAGS = "-DTI_POST_1_2"; + OTHER_LDFLAGS = ( + "-ObjC", + "$(inherited)", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.appcelerator.ti.socketio; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_INCLUDE_PATHS = "$(SRCROOT)/Titanium"; + SWIFT_VERSION = 5.0; + VALID_ARCHS = "$(ARCHS_STANDARD)"; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 1DEB921E08733DC00010E9CD /* Build configuration list for PBXNativeTarget "ti.socketio" */ = { + DB52E2241E9CCD7000AAAEE0 /* Build configuration list for PBXProject "ti.socketio" */ = { isa = XCConfigurationList; buildConfigurations = ( - 1DEB921F08733DC00010E9CD /* Debug */, - 1DEB922008733DC00010E9CD /* Release */, + DB52E2301E9CCD7000AAAEE0 /* Debug */, + DB52E2311E9CCD7000AAAEE0 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "ti.socketio" */ = { + DB52E2321E9CCD7000AAAEE0 /* Build configuration list for PBXNativeTarget "TiSocketio" */ = { isa = XCConfigurationList; buildConfigurations = ( - 1DEB922308733DC00010E9CD /* Debug */, - 1DEB922408733DC00010E9CD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 24416B8A11C4CA520047AFDD /* Build configuration list for PBXAggregateTarget "Build & Test" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 24416B8211C4CA220047AFDD /* Debug */, - 24416B8311C4CA220047AFDD /* Release */, + DB52E2331E9CCD7000AAAEE0 /* Debug */, + DB52E2341E9CCD7000AAAEE0 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + 4C5B0A032CF1000100A1B2C3 /* XCRemoteSwiftPackageReference "socket.io-client-swift" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/socketio/socket.io-client-swift"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 16.1.1; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 4C5B0A022CF1000100A1B2C3 /* SocketIO */ = { + isa = XCSwiftPackageProductDependency; + package = 4C5B0A032CF1000100A1B2C3 /* XCRemoteSwiftPackageReference "socket.io-client-swift" */; + productName = SocketIO; + }; +/* End XCSwiftPackageProductDependency section */ }; - rootObject = 0867D690FE84028FC02AAC07 /* Project object */; + rootObject = DB52E2211E9CCD7000AAAEE0 /* Project object */; } diff --git a/ios/timodule.xml b/ios/timodule.xml index ae31597..85bc571 100644 --- a/ios/timodule.xml +++ b/ios/timodule.xml @@ -1,9 +1,5 @@ - diff --git a/ios/titanium.xcconfig b/ios/titanium.xcconfig index 27ff8c2..12ea1ae 100644 --- a/ios/titanium.xcconfig +++ b/ios/titanium.xcconfig @@ -4,7 +4,7 @@ // OF YOUR TITANIUM SDK YOU'RE BUILDING FOR // // -TITANIUM_SDK_VERSION = 9.3.2.GA +TITANIUM_SDK_VERSION = 13.4.1.GA // // THESE SHOULD BE OK GENERALLY AS-IS @@ -12,4 +12,3 @@ TITANIUM_SDK_VERSION = 9.3.2.GA TITANIUM_SDK = /Users/$(USER)/Library/Application Support/Titanium/mobilesdk/osx/$(TITANIUM_SDK_VERSION) HEADER_SEARCH_PATHS = $(inherited) "$(TITANIUM_SDK)/iphone/include" FRAMEWORK_SEARCH_PATHS = $(inherited) "$(TITANIUM_SDK)/iphone/Frameworks/**" -