From 798c1d5a2c9df5babb72b326aa4ede0984579203 Mon Sep 17 00:00:00 2001 From: Mark Vayngrib Date: Sun, 10 May 2015 10:26:29 -0400 Subject: [PATCH] refactor into lib --- .flowconfig | 33 - .gitignore | 30 - .../GCDAsyncUdpSocket.h | 0 .../GCDAsyncUdpSocket.m | 0 LICENSE | 22 - RCTUDP.xcodeproj/project.pbxproj | 1017 ----------------- README.md | 68 -- RCTUDPSocket.js => UdpSocket.ios.js | 15 +- iOS/RCTUDPClient.h => UdpSocketClient.h | 6 +- iOS/RCTUDPClient.m => UdpSocketClient.m | 10 +- UdpSockets.android.js | 17 + iOS/RCTUDP.h => UdpSockets.h | 6 +- dgram.js => UdpSockets.ios.js | 6 +- UdpSockets.m | 118 ++ UdpSockets.xcodeproj/project.pbxproj | 268 +++++ .../contents.xcworkspacedata | 7 + iOS/RCTUDP.m | 118 -- index.ios.js | 4 + package.json | 10 +- 19 files changed, 449 insertions(+), 1306 deletions(-) delete mode 100644 .flowconfig delete mode 100644 .gitignore rename {GCDAsyncSocket => CocoaAsyncSocket}/GCDAsyncUdpSocket.h (100%) rename {GCDAsyncSocket => CocoaAsyncSocket}/GCDAsyncUdpSocket.m (100%) delete mode 100644 LICENSE delete mode 100644 RCTUDP.xcodeproj/project.pbxproj delete mode 100644 README.md rename RCTUDPSocket.js => UdpSocket.ios.js (93%) rename iOS/RCTUDPClient.h => UdpSocketClient.h (92%) rename iOS/RCTUDPClient.m => UdpSocketClient.m (96%) create mode 100644 UdpSockets.android.js rename iOS/RCTUDP.h => UdpSockets.h (67%) rename dgram.js => UdpSockets.ios.js (51%) create mode 100644 UdpSockets.m create mode 100644 UdpSockets.xcodeproj/project.pbxproj create mode 100644 UdpSockets.xcodeproj/project.xcworkspace/contents.xcworkspacedata delete mode 100644 iOS/RCTUDP.m diff --git a/.flowconfig b/.flowconfig deleted file mode 100644 index 9d4fb36..0000000 --- a/.flowconfig +++ /dev/null @@ -1,33 +0,0 @@ -[ignore] - -# We fork some components by platform. -.*/*.web.js -.*/*.android.js - -# Some modules have their own node_modules with overlap -.*/node_modules/node-haste/.* - -# Ignore react-tools where there are overlaps, but don't ignore anything that -# react-native relies on -.*/node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js -.*/node_modules/react-tools/src/browser/eventPlugins/ResponderEventPlugin.js -.*/node_modules/react-tools/src/browser/ui/React.js -.*/node_modules/react-tools/src/core/ReactInstanceHandles.js -.*/node_modules/react-tools/src/event/EventPropagators.js - -# Ignore commoner tests -.*/node_modules/react-tools/node_modules/commoner/test/.* - -# See https://github.com/facebook/flow/issues/442 -.*/react-tools/node_modules/commoner/lib/reader.js - -# Ignore jest -.*/react-native/node_modules/jest-cli/.* - -[include] - -[libs] -node_modules/react-native/Libraries/react-native/react-native-interface.js - -[options] -module.system=haste diff --git a/.gitignore b/.gitignore deleted file mode 100644 index a56c2c8..0000000 --- a/.gitignore +++ /dev/null @@ -1,30 +0,0 @@ -# Logs -logs -*.log - -# Runtime data -pids -*.pid -*.seed - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Dependency directory -# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git -node_modules - -*.xcodeproj/project.xcworkspace/ -*.xcodeproj/xcuserdata/ \ No newline at end of file diff --git a/GCDAsyncSocket/GCDAsyncUdpSocket.h b/CocoaAsyncSocket/GCDAsyncUdpSocket.h similarity index 100% rename from GCDAsyncSocket/GCDAsyncUdpSocket.h rename to CocoaAsyncSocket/GCDAsyncUdpSocket.h diff --git a/GCDAsyncSocket/GCDAsyncUdpSocket.m b/CocoaAsyncSocket/GCDAsyncUdpSocket.m similarity index 100% rename from GCDAsyncSocket/GCDAsyncUdpSocket.m rename to CocoaAsyncSocket/GCDAsyncUdpSocket.m diff --git a/LICENSE b/LICENSE deleted file mode 100644 index edc0e40..0000000 --- a/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Tradle - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - diff --git a/RCTUDP.xcodeproj/project.pbxproj b/RCTUDP.xcodeproj/project.pbxproj deleted file mode 100644 index 5e56c94..0000000 --- a/RCTUDP.xcodeproj/project.pbxproj +++ /dev/null @@ -1,1017 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 00481BE81AC0C86700671115 /* libRCTWebSocketDebugger.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00481BE61AC0C7FA00671115 /* libRCTWebSocketDebugger.a */; }; - 008F07F31AC5B25A0029DE68 /* main.jsbundle in Resources */ = {isa = PBXBuildFile; fileRef = 008F07F21AC5B25A0029DE68 /* main.jsbundle */; }; - 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; - 00C302E61ABCBA2D00DB3ED1 /* libRCTAdSupport.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302B41ABCB8E700DB3ED1 /* libRCTAdSupport.a */; }; - 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; }; - 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; }; - 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; }; - 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; }; - 00E356F31AD99517003FC87E /* RCTUDPTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* RCTUDPTests.m */; }; - 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; }; - 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; }; - 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; - 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; - 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; - 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; - 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; - 7350FFCB1AFEC7BF00ED3C82 /* RCTUDP.m in Sources */ = {isa = PBXBuildFile; fileRef = 7350FFC81AFEC7BF00ED3C82 /* RCTUDP.m */; }; - 7350FFCC1AFEC7BF00ED3C82 /* RCTUDPClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 7350FFCA1AFEC7BF00ED3C82 /* RCTUDPClient.m */; }; - 7350FFDA1AFEC81300ED3C82 /* GCDAsyncUdpSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 7350FFD91AFEC81300ED3C82 /* GCDAsyncUdpSocket.m */; }; - 7350FFE21AFEC85D00ED3C82 /* ReactUDP.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7350FFE11AFEC85D00ED3C82 /* ReactUDP.h */; }; - 7350FFE41AFEC85D00ED3C82 /* ReactUDP.m in Sources */ = {isa = PBXBuildFile; fileRef = 7350FFE31AFEC85D00ED3C82 /* ReactUDP.m */; }; - 7350FFEA1AFEC85D00ED3C82 /* libReactUDP.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7350FFDF1AFEC85D00ED3C82 /* libReactUDP.a */; }; - 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 00481BE51AC0C7FA00671115 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00481BDB1AC0C7FA00671115 /* RCTWebSocketDebugger.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 832C81801AAF6DEF007FA2F7; - remoteInfo = RCTWebSocketDebugger; - }; - 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTActionSheet; - }; - 00C302B31ABCB8E700DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302AF1ABCB8E700DB3ED1 /* RCTAdSupport.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 832C81801AAF6DEF007FA2F7; - remoteInfo = RCTAdSupport; - }; - 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTGeolocation; - }; - 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B5115D1A9E6B3D00147676; - remoteInfo = RCTImage; - }; - 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B511DB1A9E6C8500147676; - remoteInfo = RCTNetwork; - }; - 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 832C81801AAF6DEF007FA2F7; - remoteInfo = RCTVibration; - }; - 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 13B07F861A680F5B00A75B9A; - remoteInfo = RCTUDP; - }; - 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTSettings; - }; - 146834031AC3E56700842450 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; - remoteInfo = React; - }; - 7350FFEB1AFEC85D00ED3C82 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 7350FFDE1AFEC85D00ED3C82; - remoteInfo = ReactUDP; - }; - 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTLinking; - }; - 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B5119B1A9E6C1200147676; - remoteInfo = RCTText; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 7350FFDD1AFEC85D00ED3C82 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = "include/$(PRODUCT_NAME)"; - dstSubfolderSpec = 16; - files = ( - 7350FFE21AFEC85D00ED3C82 /* ReactUDP.h in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 00481BDB1AC0C7FA00671115 /* RCTWebSocketDebugger.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocketDebugger.xcodeproj; path = "node_modules/react-native/Libraries/RCTWebSocketDebugger/RCTWebSocketDebugger.xcodeproj"; sourceTree = ""; }; - 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = main.jsbundle; path = iOS/main.jsbundle; sourceTree = ""; }; - 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = ""; }; - 00C302AF1ABCB8E700DB3ED1 /* RCTAdSupport.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAdSupport.xcodeproj; path = "node_modules/react-native/Libraries/AdSupport/RCTAdSupport.xcodeproj"; sourceTree = ""; }; - 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = "node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj"; sourceTree = ""; }; - 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = ""; }; - 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = ""; }; - 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = ""; }; - 00E356EE1AD99517003FC87E /* RCTUDPTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RCTUDPTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 00E356F21AD99517003FC87E /* RCTUDPTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTUDPTests.m; sourceTree = ""; }; - 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = ""; }; - 13B07F961A680F5B00A75B9A /* RCTUDP.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RCTUDP.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = iOS/AppDelegate.h; sourceTree = ""; }; - 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = iOS/AppDelegate.m; sourceTree = ""; }; - 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; - 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = iOS/Images.xcassets; sourceTree = ""; }; - 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = iOS/Info.plist; sourceTree = ""; }; - 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = iOS/main.m; sourceTree = ""; }; - 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; }; - 7350FFC71AFEC7BF00ED3C82 /* RCTUDP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RCTUDP.h; path = iOS/RCTUDP.h; sourceTree = ""; }; - 7350FFC81AFEC7BF00ED3C82 /* RCTUDP.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RCTUDP.m; path = iOS/RCTUDP.m; sourceTree = ""; }; - 7350FFC91AFEC7BF00ED3C82 /* RCTUDPClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RCTUDPClient.h; path = iOS/RCTUDPClient.h; sourceTree = ""; }; - 7350FFCA1AFEC7BF00ED3C82 /* RCTUDPClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RCTUDPClient.m; path = iOS/RCTUDPClient.m; sourceTree = ""; }; - 7350FFD81AFEC81300ED3C82 /* GCDAsyncUdpSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GCDAsyncUdpSocket.h; path = GCDAsyncSocket/GCDAsyncUdpSocket.h; sourceTree = ""; }; - 7350FFD91AFEC81300ED3C82 /* GCDAsyncUdpSocket.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GCDAsyncUdpSocket.m; path = GCDAsyncSocket/GCDAsyncUdpSocket.m; sourceTree = ""; }; - 7350FFDF1AFEC85D00ED3C82 /* libReactUDP.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libReactUDP.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 7350FFE11AFEC85D00ED3C82 /* ReactUDP.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ReactUDP.h; sourceTree = ""; }; - 7350FFE31AFEC85D00ED3C82 /* ReactUDP.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ReactUDP.m; sourceTree = ""; }; - 7350FFE91AFEC85D00ED3C82 /* ReactUDPTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ReactUDPTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 7350FFEF1AFEC85D00ED3C82 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; }; - 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 00E356EB1AD99517003FC87E /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 146834051AC3E58100842450 /* libReact.a in Frameworks */, - 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */, - 00481BE81AC0C86700671115 /* libRCTWebSocketDebugger.a in Frameworks */, - 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, - 00C302E61ABCBA2D00DB3ED1 /* libRCTAdSupport.a in Frameworks */, - 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */, - 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */, - 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */, - 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */, - 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, - 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 7350FFDC1AFEC85D00ED3C82 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 7350FFE61AFEC85D00ED3C82 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 7350FFEA1AFEC85D00ED3C82 /* libReactUDP.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 00481BDC1AC0C7FA00671115 /* Products */ = { - isa = PBXGroup; - children = ( - 00481BE61AC0C7FA00671115 /* libRCTWebSocketDebugger.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302A81ABCB8CE00DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302B01ABCB8E700DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302B41ABCB8E700DB3ED1 /* libRCTAdSupport.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302B61ABCB90400DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302BC1ABCB91800DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302D41ABCB9D200DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302E01ABCB9EE00DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */, - ); - name = Products; - sourceTree = ""; - }; - 00E356EF1AD99517003FC87E /* RCTUDPTests */ = { - isa = PBXGroup; - children = ( - 00E356F21AD99517003FC87E /* RCTUDPTests.m */, - 00E356F01AD99517003FC87E /* Supporting Files */, - ); - path = RCTUDPTests; - sourceTree = ""; - }; - 00E356F01AD99517003FC87E /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 00E356F11AD99517003FC87E /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 139105B71AF99BAD00B5F7CC /* Products */ = { - isa = PBXGroup; - children = ( - 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */, - ); - name = Products; - sourceTree = ""; - }; - 13B07FAE1A68108700A75B9A /* RCTUDP */ = { - isa = PBXGroup; - children = ( - 7350FFD81AFEC81300ED3C82 /* GCDAsyncUdpSocket.h */, - 7350FFD91AFEC81300ED3C82 /* GCDAsyncUdpSocket.m */, - 7350FFC71AFEC7BF00ED3C82 /* RCTUDP.h */, - 7350FFC81AFEC7BF00ED3C82 /* RCTUDP.m */, - 7350FFC91AFEC7BF00ED3C82 /* RCTUDPClient.h */, - 7350FFCA1AFEC7BF00ED3C82 /* RCTUDPClient.m */, - 008F07F21AC5B25A0029DE68 /* main.jsbundle */, - 13B07FAF1A68108700A75B9A /* AppDelegate.h */, - 13B07FB01A68108700A75B9A /* AppDelegate.m */, - 13B07FB51A68108700A75B9A /* Images.xcassets */, - 13B07FB61A68108700A75B9A /* Info.plist */, - 13B07FB11A68108700A75B9A /* LaunchScreen.xib */, - 13B07FB71A68108700A75B9A /* main.m */, - ); - name = RCTUDP; - sourceTree = ""; - }; - 146834001AC3E56700842450 /* Products */ = { - isa = PBXGroup; - children = ( - 146834041AC3E56700842450 /* libReact.a */, - ); - name = Products; - sourceTree = ""; - }; - 7350FFE01AFEC85D00ED3C82 /* ReactUDP */ = { - isa = PBXGroup; - children = ( - 7350FFE11AFEC85D00ED3C82 /* ReactUDP.h */, - 7350FFE31AFEC85D00ED3C82 /* ReactUDP.m */, - ); - path = ReactUDP; - sourceTree = ""; - }; - 7350FFED1AFEC85D00ED3C82 /* ReactUDPTests */ = { - isa = PBXGroup; - children = ( - 7350FFEE1AFEC85D00ED3C82 /* Supporting Files */, - ); - path = ReactUDPTests; - sourceTree = ""; - }; - 7350FFEE1AFEC85D00ED3C82 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 7350FFEF1AFEC85D00ED3C82 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 78C398B11ACF4ADC00677621 /* Products */ = { - isa = PBXGroup; - children = ( - 78C398B91ACF4ADC00677621 /* libRCTLinking.a */, - ); - name = Products; - sourceTree = ""; - }; - 832341AE1AAA6A7D00B99B32 /* Libraries */ = { - isa = PBXGroup; - children = ( - 146833FF1AC3E56700842450 /* React.xcodeproj */, - 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, - 00C302AF1ABCB8E700DB3ED1 /* RCTAdSupport.xcodeproj */, - 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */, - 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */, - 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */, - 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */, - 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */, - 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, - 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, - 00481BDB1AC0C7FA00671115 /* RCTWebSocketDebugger.xcodeproj */, - ); - name = Libraries; - sourceTree = ""; - }; - 832341B11AAA6A8300B99B32 /* Products */ = { - isa = PBXGroup; - children = ( - 832341B51AAA6A8300B99B32 /* libRCTText.a */, - ); - name = Products; - sourceTree = ""; - }; - 83CBB9F61A601CBA00E9B192 = { - isa = PBXGroup; - children = ( - 13B07FAE1A68108700A75B9A /* RCTUDP */, - 832341AE1AAA6A7D00B99B32 /* Libraries */, - 00E356EF1AD99517003FC87E /* RCTUDPTests */, - 7350FFE01AFEC85D00ED3C82 /* ReactUDP */, - 7350FFED1AFEC85D00ED3C82 /* ReactUDPTests */, - 83CBBA001A601CBA00E9B192 /* Products */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - }; - 83CBBA001A601CBA00E9B192 /* Products */ = { - isa = PBXGroup; - children = ( - 13B07F961A680F5B00A75B9A /* RCTUDP.app */, - 00E356EE1AD99517003FC87E /* RCTUDPTests.xctest */, - 7350FFDF1AFEC85D00ED3C82 /* libReactUDP.a */, - 7350FFE91AFEC85D00ED3C82 /* ReactUDPTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 00E356ED1AD99517003FC87E /* RCTUDPTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "RCTUDPTests" */; - buildPhases = ( - 00E356EA1AD99517003FC87E /* Sources */, - 00E356EB1AD99517003FC87E /* Frameworks */, - 00E356EC1AD99517003FC87E /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 00E356F51AD99517003FC87E /* PBXTargetDependency */, - ); - name = RCTUDPTests; - productName = RCTUDPTests; - productReference = 00E356EE1AD99517003FC87E /* RCTUDPTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 13B07F861A680F5B00A75B9A /* RCTUDP */ = { - isa = PBXNativeTarget; - buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "RCTUDP" */; - buildPhases = ( - 13B07F871A680F5B00A75B9A /* Sources */, - 13B07F8C1A680F5B00A75B9A /* Frameworks */, - 13B07F8E1A680F5B00A75B9A /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RCTUDP; - productName = "Hello World"; - productReference = 13B07F961A680F5B00A75B9A /* RCTUDP.app */; - productType = "com.apple.product-type.application"; - }; - 7350FFDE1AFEC85D00ED3C82 /* ReactUDP */ = { - isa = PBXNativeTarget; - buildConfigurationList = 7350FFF01AFEC85D00ED3C82 /* Build configuration list for PBXNativeTarget "ReactUDP" */; - buildPhases = ( - 7350FFDB1AFEC85D00ED3C82 /* Sources */, - 7350FFDC1AFEC85D00ED3C82 /* Frameworks */, - 7350FFDD1AFEC85D00ED3C82 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = ReactUDP; - productName = ReactUDP; - productReference = 7350FFDF1AFEC85D00ED3C82 /* libReactUDP.a */; - productType = "com.apple.product-type.library.static"; - }; - 7350FFE81AFEC85D00ED3C82 /* ReactUDPTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 7350FFF31AFEC85D00ED3C82 /* Build configuration list for PBXNativeTarget "ReactUDPTests" */; - buildPhases = ( - 7350FFE51AFEC85D00ED3C82 /* Sources */, - 7350FFE61AFEC85D00ED3C82 /* Frameworks */, - 7350FFE71AFEC85D00ED3C82 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 7350FFEC1AFEC85D00ED3C82 /* PBXTargetDependency */, - ); - name = ReactUDPTests; - productName = ReactUDPTests; - productReference = 7350FFE91AFEC85D00ED3C82 /* ReactUDPTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 83CBB9F71A601CBA00E9B192 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0610; - ORGANIZATIONNAME = "Tradle, Inc."; - TargetAttributes = { - 00E356ED1AD99517003FC87E = { - CreatedOnToolsVersion = 6.2; - TestTargetID = 13B07F861A680F5B00A75B9A; - }; - 7350FFDE1AFEC85D00ED3C82 = { - CreatedOnToolsVersion = 6.3.1; - }; - 7350FFE81AFEC85D00ED3C82 = { - CreatedOnToolsVersion = 6.3.1; - }; - }; - }; - buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "RCTUDP" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 83CBB9F61A601CBA00E9B192; - productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; - projectDirPath = ""; - projectReferences = ( - { - ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */; - ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; - }, - { - ProductGroup = 00C302B01ABCB8E700DB3ED1 /* Products */; - ProjectRef = 00C302AF1ABCB8E700DB3ED1 /* RCTAdSupport.xcodeproj */; - }, - { - ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */; - ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; - }, - { - ProductGroup = 00C302BC1ABCB91800DB3ED1 /* Products */; - ProjectRef = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; - }, - { - ProductGroup = 78C398B11ACF4ADC00677621 /* Products */; - ProjectRef = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; - }, - { - ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */; - ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; - }, - { - ProductGroup = 139105B71AF99BAD00B5F7CC /* Products */; - ProjectRef = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; - }, - { - ProductGroup = 832341B11AAA6A8300B99B32 /* Products */; - ProjectRef = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; - }, - { - ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */; - ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; - }, - { - ProductGroup = 00481BDC1AC0C7FA00671115 /* Products */; - ProjectRef = 00481BDB1AC0C7FA00671115 /* RCTWebSocketDebugger.xcodeproj */; - }, - { - ProductGroup = 146834001AC3E56700842450 /* Products */; - ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */; - }, - ); - projectRoot = ""; - targets = ( - 13B07F861A680F5B00A75B9A /* RCTUDP */, - 00E356ED1AD99517003FC87E /* RCTUDPTests */, - 7350FFDE1AFEC85D00ED3C82 /* ReactUDP */, - 7350FFE81AFEC85D00ED3C82 /* ReactUDPTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXReferenceProxy section */ - 00481BE61AC0C7FA00671115 /* libRCTWebSocketDebugger.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTWebSocketDebugger.a; - remoteRef = 00481BE51AC0C7FA00671115 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTActionSheet.a; - remoteRef = 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302B41ABCB8E700DB3ED1 /* libRCTAdSupport.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTAdSupport.a; - remoteRef = 00C302B31ABCB8E700DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTGeolocation.a; - remoteRef = 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTImage.a; - remoteRef = 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTNetwork.a; - remoteRef = 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTVibration.a; - remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTSettings.a; - remoteRef = 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 146834041AC3E56700842450 /* libReact.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libReact.a; - remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTLinking.a; - remoteRef = 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 832341B51AAA6A8300B99B32 /* libRCTText.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTText.a; - remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - -/* Begin PBXResourcesBuildPhase section */ - 00E356EC1AD99517003FC87E /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 13B07F8E1A680F5B00A75B9A /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 008F07F31AC5B25A0029DE68 /* main.jsbundle in Resources */, - 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, - 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 7350FFE71AFEC85D00ED3C82 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 00E356EA1AD99517003FC87E /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 00E356F31AD99517003FC87E /* RCTUDPTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 13B07F871A680F5B00A75B9A /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, - 7350FFDA1AFEC81300ED3C82 /* GCDAsyncUdpSocket.m in Sources */, - 13B07FC11A68108700A75B9A /* main.m in Sources */, - 7350FFCC1AFEC7BF00ED3C82 /* RCTUDPClient.m in Sources */, - 7350FFCB1AFEC7BF00ED3C82 /* RCTUDP.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 7350FFDB1AFEC85D00ED3C82 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 7350FFE41AFEC85D00ED3C82 /* ReactUDP.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 7350FFE51AFEC85D00ED3C82 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 13B07F861A680F5B00A75B9A /* RCTUDP */; - targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; - }; - 7350FFEC1AFEC85D00ED3C82 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 7350FFDE1AFEC85D00ED3C82 /* ReactUDP */; - targetProxy = 7350FFEB1AFEC85D00ED3C82 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = { - isa = PBXVariantGroup; - children = ( - 13B07FB21A68108700A75B9A /* Base */, - ); - name = LaunchScreen.xib; - path = iOS; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 00E356F61AD99517003FC87E /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = RCTUDPTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RCTUDP.app/RCTUDP"; - }; - name = Debug; - }; - 00E356F71AD99517003FC87E /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - COPY_PHASE_STRIP = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); - INFOPLIST_FILE = RCTUDPTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RCTUDP.app/RCTUDP"; - }; - name = Release; - }; - 13B07F941A680F5B00A75B9A /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - "$(SRCROOT)/node_modules/react-native/React/**", - ); - INFOPLIST_FILE = "$(SRCROOT)/iOS/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTUDP; - }; - name = Debug; - }; - 13B07F951A680F5B00A75B9A /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - "$(SRCROOT)/node_modules/react-native/React/**", - ); - INFOPLIST_FILE = "$(SRCROOT)/iOS/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = RCTUDP; - }; - name = Release; - }; - 7350FFF11AFEC85D00ED3C82 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - IPHONEOS_DEPLOYMENT_TARGET = 8.3; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - 7350FFF21AFEC85D00ED3C82 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_NO_COMMON_BLOCKS = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.3; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - }; - name = Release; - }; - 7350FFF41AFEC85D00ED3C82 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = ReactUDPTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.3; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 7350FFF51AFEC85D00ED3C82 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = ReactUDPTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.3; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; - 83CBBA201A601CBA00E9B192 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - "$(SRCROOT)/node_modules/react-native/React/**", - ); - IPHONEOS_DEPLOYMENT_TARGET = 7.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 83CBBA211A601CBA00E9B192 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - "$(SRCROOT)/node_modules/react-native/React/**", - ); - IPHONEOS_DEPLOYMENT_TARGET = 7.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "RCTUDPTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 00E356F61AD99517003FC87E /* Debug */, - 00E356F71AD99517003FC87E /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "RCTUDP" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 13B07F941A680F5B00A75B9A /* Debug */, - 13B07F951A680F5B00A75B9A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 7350FFF01AFEC85D00ED3C82 /* Build configuration list for PBXNativeTarget "ReactUDP" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 7350FFF11AFEC85D00ED3C82 /* Debug */, - 7350FFF21AFEC85D00ED3C82 /* Release */, - ); - defaultConfigurationIsVisible = 0; - }; - 7350FFF31AFEC85D00ED3C82 /* Build configuration list for PBXNativeTarget "ReactUDPTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 7350FFF41AFEC85D00ED3C82 /* Debug */, - 7350FFF51AFEC85D00ED3C82 /* Release */, - ); - defaultConfigurationIsVisible = 0; - }; - 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "RCTUDP" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 83CBBA201A601CBA00E9B192 /* Debug */, - 83CBBA211A601CBA00E9B192 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; -} diff --git a/README.md b/README.md deleted file mode 100644 index 276ea30..0000000 --- a/README.md +++ /dev/null @@ -1,68 +0,0 @@ -# UDP in React Native - -node's [dgram](https://nodejs.org/api/dgram.html) API in React Native - -## This module is used by [Tradle](https://github.com/tradle) - -PR's welcome! - -## Install - -* Create a new react-native project. [Check react-native getting started](http://facebook.github.io/react-native/docs/getting-started.html#content) - -* in PROJECT_DIR/node_modules/react-native, execute: -``` -npm install --save react-native-udp -``` - -* Drag RCTUDP.xcodeproj from node_modules/react-native-udp into your XCode project. Click on the project in XCode, go to Build Phases, then Link Binary With Libraries and add libReactUDP.a - -Buckle up, Dorothy - -## Usage - -### package.json - -_only if you want to write require('dgram') in your javascript_ - -```json -{ - "browser": { - "dgram": "react-native-udp" - } -} -``` - -### JS - -_see/run index.ios.js for a complete example, but basically it's just like dgram_ - -var dgram = require('dgram') -// OR, if not shimming via package.json "browser" field: -// var dgram = require('RCTUDP') -var socket = dgram.createSocket('udp4') -socket.bind(12345) -socket.once('listening', function() { - var buf = toByteArray('excellent!') - socket.send(buf, 0, buf.length, remotePort, remoteHost, function(err) { - if (err) throw err - - console.log('message was sent') - }) -}) - -socket.on('message', function(msg, rinfo) { - console.log('message was received', msg) -}) - -### Note - -If you want to send and receive node Buffer objects, you'll have to "npm install buffer" and set it as a global for RCTUDP to pick it up: - -```js -global.Buffer = global.Buffer || require('buffer').Buffer -``` - -## Contributors - -[Tradle, Inc.](https://github.com/tradle/about/wiki) \ No newline at end of file diff --git a/RCTUDPSocket.js b/UdpSocket.ios.js similarity index 93% rename from RCTUDPSocket.js rename to UdpSocket.ios.js index b1c3919..d15dabd 100644 --- a/RCTUDPSocket.js +++ b/UdpSocket.ios.js @@ -6,7 +6,7 @@ // /** - * @providesModule RCTUDPSocket + * @providesModule UdpSocket * @flow */ @@ -20,7 +20,7 @@ var { var mixInEventEmitter = require('mixInEventEmitter') var DeviceEventEmitter = require('RCTDeviceEventEmitter') var NativeModules = require('NativeModules') -var sockets = NativeModules.UDP // just UDP for now +var sockets = NativeModules.UdpSockets var noop = function () {} var instances = 0 var STATE = { @@ -61,13 +61,19 @@ class RCTSocket extends Component { bind(port, address, callback) { var self = this + + if (this._state !== STATE.UNBOUND) throw new Error('Socket is already bound') + if (typeof address === 'function') { callback = address address = undefined } - // address = address || '0.0.0.0' //'127.0.0.1' - if (callback) this.once('listening', callback) + if (!address) address = '0.0.0.0' + + if (!port) port = 0 + + if (callback) this.once('listening', callback.bind(this)) this._state = STATE.BINDING this._debug('binding, address:', address, 'port:', port) @@ -80,6 +86,7 @@ class RCTSocket extends Component { return self.emit('error', err) } + self._debug('bound to address:', addr.address, 'port:', addr.port) self._address = addr.address self._port = addr.port self._state = STATE.BOUND diff --git a/iOS/RCTUDPClient.h b/UdpSocketClient.h similarity index 92% rename from iOS/RCTUDPClient.h rename to UdpSocketClient.h index c02955a..aab0ac4 100644 --- a/iOS/RCTUDPClient.h +++ b/UdpSocketClient.h @@ -25,15 +25,15 @@ enum RCTUDPError typedef enum RCTUDPError RCTUDPError; -@class RCTUDPClient; +@class UdpSocketClient; @protocol SocketClientDelegate -- (void)onData:(RCTUDPClient*) client data:(NSData *)data host:(NSString*) host port:(uint16_t) port; +- (void)onData:(UdpSocketClient*) client data:(NSData *)data host:(NSString*) host port:(uint16_t) port; @end -@interface RCTUDPClient : NSObject +@interface UdpSocketClient : NSObject @property (nonatomic, retain) NSString* id; @property (nonatomic, retain) NSString* host; diff --git a/iOS/RCTUDPClient.m b/UdpSocketClient.m similarity index 96% rename from iOS/RCTUDPClient.m rename to UdpSocketClient.m index 9d7175c..cb5c9a1 100644 --- a/iOS/RCTUDPClient.m +++ b/UdpSocketClient.m @@ -8,13 +8,13 @@ #import #import -#import "RCTUDPClient.h" +#import "UdpSocketClient.h" #import "RCTBridgeModule.h" #import "GCDAsyncUdpSocket.h" NSString *const RCTUDPErrorDomain = @"RCTUDPErrorDomain"; -@interface RCTUDPClient() +@interface UdpSocketClient() { @private uint16_t _port; @@ -29,7 +29,7 @@ NSString *const RCTUDPErrorDomain = @"RCTUDPErrorDomain"; @end -@implementation RCTUDPClient +@implementation UdpSocketClient + (id)socketClientWithConfig:(id)delegate { @@ -66,14 +66,14 @@ NSString *const RCTUDPErrorDomain = @"RCTUDPErrorDomain"; if (address) { struct sockaddr_in ip; ip.sin_family = AF_INET; - ip.sin_port = htons(6003); + ip.sin_port = htons(_port); inet_pton(AF_INET, [address cStringUsingEncoding:NSASCIIStringEncoding], &ip.sin_addr); NSData * hostAndPort = [NSData dataWithBytes:&ip length:sizeof(ip)]; result = [_udpSocket bindToAddress:hostAndPort error:error]; } else { - result = [_udpSocket bindToPort:port error:error]; + result = [_udpSocket bindToPort:_port error:error]; } return result && [_udpSocket beginReceiving:error]; diff --git a/UdpSockets.android.js b/UdpSockets.android.js new file mode 100644 index 0000000..6f35bd5 --- /dev/null +++ b/UdpSockets.android.js @@ -0,0 +1,17 @@ +/** + * Stub of UdpSockets for Android. + * + * @providesModule UdpSockets + * @flow + */ +'use strict'; + +var warning = require('warning'); + +var UdpSockets = { + test: function() { + warning("Not yet implemented for Android."); + } +}; + +module.exports = UdpSockets; diff --git a/iOS/RCTUDP.h b/UdpSockets.h similarity index 67% rename from iOS/RCTUDP.h rename to UdpSockets.h index 880532b..9a391e7 100644 --- a/iOS/RCTUDP.h +++ b/UdpSockets.h @@ -7,12 +7,14 @@ // #import -#import "RCTUDPClient.h" +#import +#import "GCDAsyncUdpSocket.h" +#import "UdpSocketClient.h" #import "RCTBridgeModule.h" #import "RCTBridge.h" #import "RCTEventDispatcher.h" -@interface RCTUDP : NSObject +@interface UdpSockets : NSObject @property(retain, nonatomic)NSMutableDictionary *clients; diff --git a/dgram.js b/UdpSockets.ios.js similarity index 51% rename from dgram.js rename to UdpSockets.ios.js index 2fc8c14..30ed20c 100644 --- a/dgram.js +++ b/UdpSockets.ios.js @@ -1,14 +1,14 @@ /** - * @providesModule RCTUDP + * @providesModule UdpSockets * @flow */ -var RCTSocket = require('RCTUDPSocket') +var UdpSocket = require('UdpSocket') module.exports = { createSocket: function(type) { - return new RCTSocket({ + return new UdpSocket({ type: type }) } diff --git a/UdpSockets.m b/UdpSockets.m new file mode 100644 index 0000000..2abcc08 --- /dev/null +++ b/UdpSockets.m @@ -0,0 +1,118 @@ +// +// UdpSockets.m +// react-native-udp +// +// Created by Mark Vayngrib on 5/8/15. +// Copyright (c) 2015 Tradle, Inc. All rights reserved. +// + +#import "RCTAssert.h" +#import "RCTBridge.h" +#import "RCTConvert.h" +#import "RCTEventDispatcher.h" +#import "RCTLog.h" +#import "UdpSockets.h" +#import "UdpSocketClient.h" + +@implementation UdpSockets + +RCT_EXPORT_MODULE() + +@synthesize bridge = _bridge; + +RCT_EXPORT_METHOD(createSocket:(NSString*)cId withOptions:(NSDictionary*)options) +{ + if (!_clients) _clients = [[NSMutableDictionary alloc] init]; + + if (!cId) { + RCTLogError(@"%@.createSocket called with nil id parameter.", [self class]); + return; + } + + UdpSocketClient *client = [_clients objectForKey:cId]; + if (client) { + RCTLogError(@"%@.createSocket called twice with the same id.", [self class]); + return; + } + + client = [UdpSocketClient socketClientWithConfig:self]; + [_clients setObject:client forKey:cId]; +} + +RCT_EXPORT_METHOD(bind:(NSString*)cId + port:(int)port + address:(NSString *)address + callback:(RCTResponseSenderBlock)callback) +{ + UdpSocketClient* client = [self findClient:cId callback:callback]; + if (!client) return; + + NSError *error = nil; + if (![client bind:port address:address error:&error]) + { + callback(@[error]); + return; + } + + callback(@[[NSNull null], [client address]]); +} + +RCT_EXPORT_METHOD(send:(NSString*)cId + data:(NSData*)data + port:(int)port + address:(NSString*)address + callback:(RCTResponseSenderBlock)callback) { + UdpSocketClient* client = [self findClient:cId callback:callback]; + if (!client) return; + + [client send:data remotePort:port remoteAddress:address callback:callback]; + if (callback) callback(@[]); +} + +RCT_EXPORT_METHOD(close:(NSString*)cId + callback:(RCTResponseSenderBlock)callback) { + UdpSocketClient* client = [self findClient:cId callback:callback]; + if (!client) return; + + [client close]; + [_clients removeObjectForKey:cId]; + + if (callback) callback(@[]); +} + +- (void) onData:(UdpSocketClient*) client data:(NSData *)data host:(NSString *)host port:(uint16_t)port +{ + NSString *clientID = [[_clients allKeysForObject:client] objectAtIndex:0]; + NSPropertyListFormat format; + NSArray* arr = [NSPropertyListSerialization propertyListFromData:data + mutabilityOption:NSPropertyListMutableContainers + format:&format + errorDescription:NULL]; + + [self.bridge.eventDispatcher sendDeviceEventWithName:[NSString stringWithFormat:@"udp-%@-data", clientID] + body:@{ + @"data": arr, + @"address": host, + @"port": [NSNumber numberWithInt:port] + } + ]; +} + +-(UdpSocketClient*)findClient:(NSString*)cId callback:(RCTResponseSenderBlock)callback +{ + UdpSocketClient *client = [_clients objectForKey:cId]; + if (!client) { + if (!callback) { + RCTLogError(@"%@.missing callback parameter.", [self class]); + } + else { + callback(@[[NSString stringWithFormat:@"no client found with id %@", cId]]); + } + + return nil; + } + + return client; +} + +@end diff --git a/UdpSockets.xcodeproj/project.pbxproj b/UdpSockets.xcodeproj/project.pbxproj new file mode 100644 index 0000000..aaa147a --- /dev/null +++ b/UdpSockets.xcodeproj/project.pbxproj @@ -0,0 +1,268 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 13BE3DEE1AC21097009241FE /* UdpSockets.m in Sources */ = {isa = PBXBuildFile; fileRef = 13BE3DED1AC21097009241FE /* UdpSockets.m */; }; + 7350006B1AFF9AB600ED3C82 /* UdpSocketClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 7350006A1AFF9AB600ED3C82 /* UdpSocketClient.m */; }; + 73D9377D1AFF9EBE00450142 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73D9377C1AFF9EBE00450142 /* CFNetwork.framework */; }; + 73D9377F1AFF9F6E00450142 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73D9377E1AFF9F6E00450142 /* UIKit.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 58B511D91A9E6C8500147676 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/$(PRODUCT_NAME)"; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 134814201AA4EA6300B7C361 /* libUdpSockets.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libUdpSockets.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 13BE3DEC1AC21097009241FE /* UdpSockets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UdpSockets.h; sourceTree = ""; }; + 13BE3DED1AC21097009241FE /* UdpSockets.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UdpSockets.m; sourceTree = ""; }; + 735000681AFF9AB600ED3C82 /* CocoaAsyncSocket */ = {isa = PBXFileReference; lastKnownFileType = folder; path = CocoaAsyncSocket; sourceTree = ""; }; + 735000691AFF9AB600ED3C82 /* UdpSocketClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UdpSocketClient.h; sourceTree = ""; }; + 7350006A1AFF9AB600ED3C82 /* UdpSocketClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UdpSocketClient.m; sourceTree = ""; }; + 73D9377C1AFF9EBE00450142 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; }; + 73D9377E1AFF9F6E00450142 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 58B511D81A9E6C8500147676 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 73D9377F1AFF9F6E00450142 /* UIKit.framework in Frameworks */, + 73D9377D1AFF9EBE00450142 /* CFNetwork.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 134814211AA4EA7D00B7C361 /* Products */ = { + isa = PBXGroup; + children = ( + 134814201AA4EA6300B7C361 /* libUdpSockets.a */, + ); + name = Products; + sourceTree = ""; + }; + 58B511D21A9E6C8500147676 = { + isa = PBXGroup; + children = ( + 73D9377E1AFF9F6E00450142 /* UIKit.framework */, + 73D9377C1AFF9EBE00450142 /* CFNetwork.framework */, + 735000681AFF9AB600ED3C82 /* CocoaAsyncSocket */, + 735000691AFF9AB600ED3C82 /* UdpSocketClient.h */, + 7350006A1AFF9AB600ED3C82 /* UdpSocketClient.m */, + 13BE3DEC1AC21097009241FE /* UdpSockets.h */, + 13BE3DED1AC21097009241FE /* UdpSockets.m */, + 134814211AA4EA7D00B7C361 /* Products */, + ); + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 58B511DA1A9E6C8500147676 /* UdpSockets */ = { + isa = PBXNativeTarget; + buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "UdpSockets" */; + buildPhases = ( + 58B511D71A9E6C8500147676 /* Sources */, + 58B511D81A9E6C8500147676 /* Frameworks */, + 58B511D91A9E6C8500147676 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = UdpSockets; + productName = RCTDataManager; + productReference = 134814201AA4EA6300B7C361 /* libUdpSockets.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 58B511D31A9E6C8500147676 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0610; + ORGANIZATIONNAME = Facebook; + TargetAttributes = { + 58B511DA1A9E6C8500147676 = { + CreatedOnToolsVersion = 6.1.1; + }; + }; + }; + buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "UdpSockets" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 58B511D21A9E6C8500147676; + productRefGroup = 58B511D21A9E6C8500147676; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 58B511DA1A9E6C8500147676 /* UdpSockets */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 58B511D71A9E6C8500147676 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7350006B1AFF9AB600ED3C82 /* UdpSocketClient.m in Sources */, + 13BE3DEE1AC21097009241FE /* UdpSockets.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 58B511ED1A9E6C8500147676 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 58B511EE1A9E6C8500147676 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 58B511F01A9E6C8500147676 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "$(SRCROOT)/../../React/**", + ); + LIBRARY_SEARCH_PATHS = "$(inherited)"; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = UdpSockets; + SKIP_INSTALL = YES; + USER_HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/../../**"; + }; + name = Debug; + }; + 58B511F11A9E6C8500147676 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "$(SRCROOT)/../../React/**", + ); + LIBRARY_SEARCH_PATHS = "$(inherited)"; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = UdpSockets; + SKIP_INSTALL = YES; + USER_HEADER_SEARCH_PATHS = "$(PROJECT_DIR)/../../**"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "UdpSockets" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 58B511ED1A9E6C8500147676 /* Debug */, + 58B511EE1A9E6C8500147676 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "UdpSockets" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 58B511F01A9E6C8500147676 /* Debug */, + 58B511F11A9E6C8500147676 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 58B511D31A9E6C8500147676 /* Project object */; +} diff --git a/UdpSockets.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/UdpSockets.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/UdpSockets.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/iOS/RCTUDP.m b/iOS/RCTUDP.m deleted file mode 100644 index cb33ed1..0000000 --- a/iOS/RCTUDP.m +++ /dev/null @@ -1,118 +0,0 @@ -// -// RCTUDP.m -// react-native-udp -// -// Created by Mark Vayngrib on 5/8/15. -// Copyright (c) 2015 Tradle, Inc. All rights reserved. -// - -#import "RCTAssert.h" -#import "RCTBridge.h" -#import "RCTConvert.h" -#import "RCTEventDispatcher.h" -#import "RCTLog.h" -#import "RCTUDP.h" -#import "RCTUDPClient.h" - -@implementation RCTUDP - -RCT_EXPORT_MODULE() - -@synthesize bridge = _bridge; - -RCT_EXPORT_METHOD(createSocket:(NSString*)cId withOptions:(NSDictionary*)options) -{ - if (!_clients) _clients = [[NSMutableDictionary alloc] init]; - - if (!cId) { - RCTLogError(@"%@.createSocket called with nil id parameter.", [self class]); - return; - } - - RCTUDPClient *client = [_clients objectForKey:cId]; - if (client) { - RCTLogError(@"%@.createSocket called twice with the same id.", [self class]); - return; - } - - client = [RCTUDPClient socketClientWithConfig:self]; - [_clients setObject:client forKey:cId]; -} - -RCT_EXPORT_METHOD(bind:(NSString*)cId - port:(int)port - address:(NSString *)address - callback:(RCTResponseSenderBlock)callback) -{ - RCTUDPClient* client = [self findClient:cId callback:callback]; - if (!client) return; - - NSError *error = nil; - if (![client bind:port address:address error:&error]) - { - callback(@[error]); - return; - } - - callback(@[[NSNull null], [client address]]); -} - -RCT_EXPORT_METHOD(send:(NSString*)cId - data:(NSData*)data - port:(int)port - address:(NSString*)address - callback:(RCTResponseSenderBlock)callback) { - RCTUDPClient* client = [self findClient:cId callback:callback]; - if (!client) return; - - [client send:data remotePort:port remoteAddress:address callback:callback]; - if (callback) callback(@[]); -} - -RCT_EXPORT_METHOD(close:(NSString*)cId - callback:(RCTResponseSenderBlock)callback) { - RCTUDPClient* client = [self findClient:cId callback:callback]; - if (!client) return; - - [client close]; - [_clients removeObjectForKey:cId]; - - if (callback) callback(@[]); -} - -- (void) onData:(RCTUDPClient*) client data:(NSData *)data host:(NSString *)host port:(uint16_t)port -{ - NSString *clientID = [[_clients allKeysForObject:client] objectAtIndex:0]; - NSPropertyListFormat format; - NSArray* arr = [NSPropertyListSerialization propertyListFromData:data - mutabilityOption:NSPropertyListMutableContainers - format:&format - errorDescription:NULL]; - - [self.bridge.eventDispatcher sendDeviceEventWithName:[NSString stringWithFormat:@"udp-%@-data", clientID] - body:@{ - @"data": arr, - @"address": host, - @"port": [NSNumber numberWithInt:port] - } - ]; -} - --(RCTUDPClient*)findClient:(NSString*)cId callback:(RCTResponseSenderBlock)callback -{ - RCTUDPClient *client = [_clients objectForKey:cId]; - if (!client) { - if (!callback) { - RCTLogError(@"%@.missing callback parameter.", [self class]); - } - else { - callback(@[[NSString stringWithFormat:@"no client found with id %@", cId]]); - } - - return nil; - } - - return client; -} - -@end diff --git a/index.ios.js b/index.ios.js index 512a202..7e0de06 100644 --- a/index.ios.js +++ b/index.ios.js @@ -12,6 +12,10 @@ var { View, } = React; +// require('./test/simple/test-dgram-address') +// require('./test/simple/test-dgram-bind-default-address') +// require('./test/simple/test-dgram-bind-shared-ports') + function randomPort() { return Math.random() * 65536 | 0 } diff --git a/package.json b/package.json index 874d456..407b117 100644 --- a/package.json +++ b/package.json @@ -2,10 +2,13 @@ "name": "react-native-udp", "version": "0.0.1", "description": "node's dgram API for react-native", - "main": "./dgram.js", + "main": "./UdpSockets.ios.js", "scripts": { "start": "exit 1" }, + "browser": { + "dgram": "./dgram.js" + }, "repository": { "type": "git", "url": "https://github.com/tradle/react-native-udp.git" @@ -27,5 +30,10 @@ "homepage": "https://github.com/tradle/react-native-udp", "dependencies": { "react-native": "^0.4.2" + }, + "devDependencies": { + "assert": "^1.3.0", + "buffer": "^3.2.2", + "process": "^0.11.0" } }