Skip to content

Commit bc49a0c

Browse files
author
spoeck
committed
feat: proof of concept for iOS
1 parent 797f844 commit bc49a0c

8 files changed

Lines changed: 9870 additions & 10 deletions

File tree

example/package-lock.json

Lines changed: 6156 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"dependencies": {
1010
"react": "16.0.0-alpha.12",
1111
"react-native": "0.46.4",
12-
"react-native-api-ai": "0.0.1"
12+
"react-native-api-ai": "file:.."
1313
},
1414
"devDependencies": {
1515
"babel-jest": "20.0.3",

ios/ApiAi.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//
2+
// ApiAi.swift
3+
// reactNativeApiAi
4+
//
5+
// Created by admin on 25.07.17.
6+
// Copyright © 2017 Facebook. All rights reserved.
7+
//
8+
9+
import Foundation
10+
import UIKit
11+
12+
@objc(ApiAi)
13+
class ApiAi: NSObject {
14+
15+
@objc func startListening() {
16+
let alert = UIAlertView(title: "alert", message: "startListening", delegate:self, cancelButtonTitle: "OK")
17+
alert.show();
18+
}
19+
}

ios/ApiAiBridge.m

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
#import <Foundation/Foundation.h>
3+
4+
#if __has_include(<React/RCTBridgeModule.h>)
5+
#import <React/RCTBridgeModule.h>
6+
#else
7+
#import "RCTBridgeModule.h"
8+
#endif
9+
10+
11+
@interface RCT_EXTERN_MODULE(ApiAi, NSObject)
12+
13+
RCT_EXTERN_METHOD(startListening);
14+
15+
@end
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//
2+
// Use this file to import your target's public headers that you would like to expose to Swift.
3+
//
4+
5+
#if __has_include(<React/RCTBridgeModule.h>)
6+
#import <React/RCTBridgeModule.h>
7+
#else
8+
#import "RCTBridgeModule.h"
9+
#endif

ios/reactNativeApiAi.xcodeproj/project.pbxproj

Lines changed: 123 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
2626
2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
2727
2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
28-
2D02E4C21E0B4AEC006451C7 /* libRCTAnimation-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation-tvOS.a */; };
28+
2D02E4C21E0B4AEC006451C7 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
2929
2D02E4C31E0B4AEC006451C7 /* libRCTImage-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */; };
3030
2D02E4C41E0B4AEC006451C7 /* libRCTLinking-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E881DF850E9000B6D8A /* libRCTLinking-tvOS.a */; };
3131
2D02E4C51E0B4AEC006451C7 /* libRCTNetwork-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E8C1DF850E9000B6D8A /* libRCTNetwork-tvOS.a */; };
@@ -36,6 +36,8 @@
3636
2DCD954D1E0B4F2C00145EB5 /* reactNativeApiAiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* reactNativeApiAiTests.m */; };
3737
5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
3838
832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
39+
84F4E7181F2765D10040C613 /* ApiAi.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F4E7171F2765D10040C613 /* ApiAi.swift */; };
40+
84F4E71A1F2769000040C613 /* ApiAiBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F4E7191F2769000040C613 /* ApiAiBridge.m */; };
3941
/* End PBXBuildFile section */
4042

4143
/* Begin PBXContainerItemProxy section */
@@ -228,6 +230,41 @@
228230
remoteGlobalIDString = 58B5119B1A9E6C1200147676;
229231
remoteInfo = RCTText;
230232
};
233+
84F4E7431F2772F10040C613 /* PBXContainerItemProxy */ = {
234+
isa = PBXContainerItemProxy;
235+
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
236+
proxyType = 2;
237+
remoteGlobalIDString = 139D7ECE1E25DB7D00323FB7;
238+
remoteInfo = "third-party";
239+
};
240+
84F4E7451F2772F10040C613 /* PBXContainerItemProxy */ = {
241+
isa = PBXContainerItemProxy;
242+
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
243+
proxyType = 2;
244+
remoteGlobalIDString = 3D383D3C1EBD27B6005632C8;
245+
remoteInfo = "third-party-tvOS";
246+
};
247+
84F4E7471F2772F10040C613 /* PBXContainerItemProxy */ = {
248+
isa = PBXContainerItemProxy;
249+
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
250+
proxyType = 2;
251+
remoteGlobalIDString = 139D7E881E25C6D100323FB7;
252+
remoteInfo = "double-conversion";
253+
};
254+
84F4E7491F2772F10040C613 /* PBXContainerItemProxy */ = {
255+
isa = PBXContainerItemProxy;
256+
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
257+
proxyType = 2;
258+
remoteGlobalIDString = 3D383D621EBD27B9005632C8;
259+
remoteInfo = "double-conversion-tvOS";
260+
};
261+
84F4E79B1F2778D10040C613 /* PBXContainerItemProxy */ = {
262+
isa = PBXContainerItemProxy;
263+
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
264+
proxyType = 1;
265+
remoteGlobalIDString = 83CBBA2D1A601D0E00E9B192;
266+
remoteInfo = React;
267+
};
231268
/* End PBXContainerItemProxy section */
232269

233270
/* Begin PBXFileReference section */
@@ -255,6 +292,9 @@
255292
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = "<group>"; };
256293
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
257294
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
295+
84F4E7141F27439E0040C613 /* reactNativeApiAi-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "reactNativeApiAi-Bridging-Header.h"; sourceTree = "<group>"; };
296+
84F4E7171F2765D10040C613 /* ApiAi.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ApiAi.swift; sourceTree = "<group>"; };
297+
84F4E7191F2769000040C613 /* ApiAiBridge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ApiAiBridge.m; sourceTree = "<group>"; };
258298
/* End PBXFileReference section */
259299

260300
/* Begin PBXFrameworksBuildPhase section */
@@ -289,7 +329,7 @@
289329
buildActionMask = 2147483647;
290330
files = (
291331
2D02E4C91E0B4AEC006451C7 /* libReact.a in Frameworks */,
292-
2D02E4C21E0B4AEC006451C7 /* libRCTAnimation-tvOS.a in Frameworks */,
332+
2D02E4C21E0B4AEC006451C7 /* libRCTAnimation.a in Frameworks */,
293333
2D02E4C31E0B4AEC006451C7 /* libRCTImage-tvOS.a in Frameworks */,
294334
2D02E4C41E0B4AEC006451C7 /* libRCTLinking-tvOS.a in Frameworks */,
295335
2D02E4C51E0B4AEC006451C7 /* libRCTNetwork-tvOS.a in Frameworks */,
@@ -396,6 +436,9 @@
396436
13B07FB61A68108700A75B9A /* Info.plist */,
397437
13B07FB11A68108700A75B9A /* LaunchScreen.xib */,
398438
13B07FB71A68108700A75B9A /* main.m */,
439+
84F4E7141F27439E0040C613 /* reactNativeApiAi-Bridging-Header.h */,
440+
84F4E7171F2765D10040C613 /* ApiAi.swift */,
441+
84F4E7191F2769000040C613 /* ApiAiBridge.m */,
399442
);
400443
name = reactNativeApiAi;
401444
sourceTree = "<group>";
@@ -411,6 +454,10 @@
411454
3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */,
412455
3DAD3EAD1DF850E9000B6D8A /* libjschelpers.a */,
413456
3DAD3EAF1DF850E9000B6D8A /* libjschelpers.a */,
457+
84F4E7441F2772F10040C613 /* libthird-party.a */,
458+
84F4E7461F2772F10040C613 /* libthird-party.a */,
459+
84F4E7481F2772F10040C613 /* libdouble-conversion.a */,
460+
84F4E74A1F2772F10040C613 /* libdouble-conversion.a */,
414461
);
415462
name = Products;
416463
sourceTree = "<group>";
@@ -419,7 +466,7 @@
419466
isa = PBXGroup;
420467
children = (
421468
5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */,
422-
5E9157351DD0AC6500FF2AA8 /* libRCTAnimation-tvOS.a */,
469+
5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */,
423470
);
424471
name = Products;
425472
sourceTree = "<group>";
@@ -516,6 +563,7 @@
516563
buildRules = (
517564
);
518565
dependencies = (
566+
84F4E79C1F2778D10040C613 /* PBXTargetDependency */,
519567
);
520568
name = reactNativeApiAi;
521569
productName = "Hello World";
@@ -571,6 +619,10 @@
571619
CreatedOnToolsVersion = 6.2;
572620
TestTargetID = 13B07F861A680F5B00A75B9A;
573621
};
622+
13B07F861A680F5B00A75B9A = {
623+
DevelopmentTeam = 9Q67564RV9;
624+
LastSwiftMigration = 0830;
625+
};
574626
2D02E47A1E0B4A5D006451C7 = {
575627
CreatedOnToolsVersion = 8.2.1;
576628
ProvisioningStyle = Automatic;
@@ -804,10 +856,10 @@
804856
remoteRef = 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */;
805857
sourceTree = BUILT_PRODUCTS_DIR;
806858
};
807-
5E9157351DD0AC6500FF2AA8 /* libRCTAnimation-tvOS.a */ = {
859+
5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */ = {
808860
isa = PBXReferenceProxy;
809861
fileType = archive.ar;
810-
path = "libRCTAnimation-tvOS.a";
862+
path = libRCTAnimation.a;
811863
remoteRef = 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */;
812864
sourceTree = BUILT_PRODUCTS_DIR;
813865
};
@@ -825,6 +877,34 @@
825877
remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */;
826878
sourceTree = BUILT_PRODUCTS_DIR;
827879
};
880+
84F4E7441F2772F10040C613 /* libthird-party.a */ = {
881+
isa = PBXReferenceProxy;
882+
fileType = archive.ar;
883+
path = "libthird-party.a";
884+
remoteRef = 84F4E7431F2772F10040C613 /* PBXContainerItemProxy */;
885+
sourceTree = BUILT_PRODUCTS_DIR;
886+
};
887+
84F4E7461F2772F10040C613 /* libthird-party.a */ = {
888+
isa = PBXReferenceProxy;
889+
fileType = archive.ar;
890+
path = "libthird-party.a";
891+
remoteRef = 84F4E7451F2772F10040C613 /* PBXContainerItemProxy */;
892+
sourceTree = BUILT_PRODUCTS_DIR;
893+
};
894+
84F4E7481F2772F10040C613 /* libdouble-conversion.a */ = {
895+
isa = PBXReferenceProxy;
896+
fileType = archive.ar;
897+
path = "libdouble-conversion.a";
898+
remoteRef = 84F4E7471F2772F10040C613 /* PBXContainerItemProxy */;
899+
sourceTree = BUILT_PRODUCTS_DIR;
900+
};
901+
84F4E74A1F2772F10040C613 /* libdouble-conversion.a */ = {
902+
isa = PBXReferenceProxy;
903+
fileType = archive.ar;
904+
path = "libdouble-conversion.a";
905+
remoteRef = 84F4E7491F2772F10040C613 /* PBXContainerItemProxy */;
906+
sourceTree = BUILT_PRODUCTS_DIR;
907+
};
828908
/* End PBXReferenceProxy section */
829909

830910
/* Begin PBXResourcesBuildPhase section */
@@ -905,6 +985,8 @@
905985
isa = PBXSourcesBuildPhase;
906986
buildActionMask = 2147483647;
907987
files = (
988+
84F4E7181F2765D10040C613 /* ApiAi.swift in Sources */,
989+
84F4E71A1F2769000040C613 /* ApiAiBridge.m in Sources */,
908990
13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */,
909991
13B07FC11A68108700A75B9A /* main.m in Sources */,
910992
);
@@ -940,6 +1022,11 @@
9401022
target = 2D02E47A1E0B4A5D006451C7 /* reactNativeApiAi-tvOS */;
9411023
targetProxy = 2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */;
9421024
};
1025+
84F4E79C1F2778D10040C613 /* PBXTargetDependency */ = {
1026+
isa = PBXTargetDependency;
1027+
name = React;
1028+
targetProxy = 84F4E79B1F2778D10040C613 /* PBXContainerItemProxy */;
1029+
};
9431030
/* End PBXTargetDependency section */
9441031

9451032
/* Begin PBXVariantGroup section */
@@ -958,6 +1045,7 @@
9581045
00E356F61AD99517003FC87E /* Debug */ = {
9591046
isa = XCBuildConfiguration;
9601047
buildSettings = {
1048+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
9611049
BUNDLE_LOADER = "$(TEST_HOST)";
9621050
GCC_PREPROCESSOR_DEFINITIONS = (
9631051
"DEBUG=1",
@@ -978,6 +1066,7 @@
9781066
00E356F71AD99517003FC87E /* Release */ = {
9791067
isa = XCBuildConfiguration;
9801068
buildSettings = {
1069+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
9811070
BUNDLE_LOADER = "$(TEST_HOST)";
9821071
COPY_PHASE_STRIP = NO;
9831072
INFOPLIST_FILE = reactNativeApiAiTests/Info.plist;
@@ -996,8 +1085,20 @@
9961085
isa = XCBuildConfiguration;
9971086
buildSettings = {
9981087
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
1088+
CLANG_ENABLE_MODULES = YES;
9991089
CURRENT_PROJECT_VERSION = 1;
10001090
DEAD_CODE_STRIPPING = NO;
1091+
DEVELOPMENT_TEAM = 9Q67564RV9;
1092+
HEADER_SEARCH_PATHS = (
1093+
"$(SRCROOT)/../../React/**",
1094+
"$(SRCROOT)/../../react-native/Libraries/**",
1095+
"$(SRCROOT)/../../react-native/React/**",
1096+
"$(SRCROOT)/node_modules/react-native/React/**",
1097+
"$(SRCROOT)/../react-native/React/**",
1098+
"$(SRCROOT)/../node_modules/react-native/React/**",
1099+
"$(inherited)",
1100+
"/Users/admin/Documents/github/react-native-api-ai/node_modules/react-native/React/**",
1101+
);
10011102
INFOPLIST_FILE = reactNativeApiAi/Info.plist;
10021103
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
10031104
OTHER_LDFLAGS = (
@@ -1006,6 +1107,9 @@
10061107
"-lc++",
10071108
);
10081109
PRODUCT_NAME = reactNativeApiAi;
1110+
SWIFT_OBJC_BRIDGING_HEADER = "reactNativeApiAi-Bridging-Header.h";
1111+
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
1112+
SWIFT_VERSION = 3.0;
10091113
VERSIONING_SYSTEM = "apple-generic";
10101114
};
10111115
name = Debug;
@@ -1014,7 +1118,19 @@
10141118
isa = XCBuildConfiguration;
10151119
buildSettings = {
10161120
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
1121+
CLANG_ENABLE_MODULES = YES;
10171122
CURRENT_PROJECT_VERSION = 1;
1123+
DEVELOPMENT_TEAM = 9Q67564RV9;
1124+
HEADER_SEARCH_PATHS = (
1125+
"$(SRCROOT)/../../React/**",
1126+
"$(SRCROOT)/../../react-native/Libraries/**",
1127+
"$(SRCROOT)/../../react-native/React/**",
1128+
"$(SRCROOT)/node_modules/react-native/React/**",
1129+
"$(SRCROOT)/../react-native/React/**",
1130+
"$(SRCROOT)/../node_modules/react-native/React/**",
1131+
"$(inherited)",
1132+
"/Users/admin/Documents/github/react-native-api-ai/node_modules/react-native/React/**",
1133+
);
10181134
INFOPLIST_FILE = reactNativeApiAi/Info.plist;
10191135
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
10201136
OTHER_LDFLAGS = (
@@ -1023,6 +1139,8 @@
10231139
"-lc++",
10241140
);
10251141
PRODUCT_NAME = reactNativeApiAi;
1142+
SWIFT_OBJC_BRIDGING_HEADER = "reactNativeApiAi-Bridging-Header.h";
1143+
SWIFT_VERSION = 3.0;
10261144
VERSIONING_SYSTEM = "apple-generic";
10271145
};
10281146
name = Release;

0 commit comments

Comments
 (0)