@kindly-ai/react-native 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/KindlyReactNative.podspec +36 -0
- package/LICENSE +20 -0
- package/README.md +127 -0
- package/android/build.gradle +113 -0
- package/android/maven-repo/ai/kindly/sdk/1.0.93/sdk-1.0.93.aar +0 -0
- package/android/maven-repo/ai/kindly/sdk/1.0.93/sdk-1.0.93.pom +125 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/kindlyai/reactnative/KindlyReactNativeModule.kt +445 -0
- package/android/src/main/java/com/kindlyai/reactnative/KindlyReactNativePackage.kt +38 -0
- package/ios/Frameworks/Kindly.xcframework/Info.plist +44 -0
- package/ios/Frameworks/Kindly.xcframework/_CodeSignature/CodeDirectory +0 -0
- package/ios/Frameworks/Kindly.xcframework/_CodeSignature/CodeRequirements +0 -0
- package/ios/Frameworks/Kindly.xcframework/_CodeSignature/CodeRequirements-1 +0 -0
- package/ios/Frameworks/Kindly.xcframework/_CodeSignature/CodeResources +578 -0
- package/ios/Frameworks/Kindly.xcframework/_CodeSignature/CodeSignature +0 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64/Kindly.framework/Assets.car +0 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64/Kindly.framework/Config.plist +0 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64/Kindly.framework/ConfirmationWindow.nib +0 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64/Kindly.framework/Headers/Kindly-Swift.h +331 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64/Kindly.framework/Headers/Kindly.h +18 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64/Kindly.framework/Info.plist +0 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64/Kindly.framework/Kindly +0 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64/Kindly.framework/Modules/Kindly.swiftmodule/arm64-apple-ios.abi.json +28769 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64/Kindly.framework/Modules/Kindly.swiftmodule/arm64-apple-ios.private.swiftinterface +547 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64/Kindly.framework/Modules/Kindly.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64/Kindly.framework/Modules/Kindly.swiftmodule/arm64-apple-ios.swiftinterface +543 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64/Kindly.framework/Modules/module.modulemap +11 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64/Kindly.framework/PrivacyInfo.xcprivacy +83 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64/Kindly.framework/_CodeSignature/CodeResources +223 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64_x86_64-simulator/Kindly.framework/Assets.car +0 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64_x86_64-simulator/Kindly.framework/Config.plist +0 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64_x86_64-simulator/Kindly.framework/ConfirmationWindow.nib +0 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64_x86_64-simulator/Kindly.framework/Headers/Kindly-Swift.h +658 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64_x86_64-simulator/Kindly.framework/Headers/Kindly.h +18 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64_x86_64-simulator/Kindly.framework/Info.plist +0 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64_x86_64-simulator/Kindly.framework/Kindly +0 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64_x86_64-simulator/Kindly.framework/Modules/Kindly.swiftmodule/arm64-apple-ios-simulator.abi.json +28769 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64_x86_64-simulator/Kindly.framework/Modules/Kindly.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +547 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64_x86_64-simulator/Kindly.framework/Modules/Kindly.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64_x86_64-simulator/Kindly.framework/Modules/Kindly.swiftmodule/arm64-apple-ios-simulator.swiftinterface +543 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64_x86_64-simulator/Kindly.framework/Modules/Kindly.swiftmodule/x86_64-apple-ios-simulator.abi.json +28769 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64_x86_64-simulator/Kindly.framework/Modules/Kindly.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +547 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64_x86_64-simulator/Kindly.framework/Modules/Kindly.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64_x86_64-simulator/Kindly.framework/Modules/Kindly.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +543 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64_x86_64-simulator/Kindly.framework/Modules/module.modulemap +11 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64_x86_64-simulator/Kindly.framework/PrivacyInfo.xcprivacy +83 -0
- package/ios/Frameworks/Kindly.xcframework/ios-arm64_x86_64-simulator/Kindly.framework/_CodeSignature/CodeResources +267 -0
- package/ios/KindlyReactNative.h +18 -0
- package/ios/KindlyReactNative.mm +234 -0
- package/ios/KindlyReactNativeImpl.swift +410 -0
- package/lib/module/NativeKindlyReactNative.js +22 -0
- package/lib/module/NativeKindlyReactNative.js.map +1 -0
- package/lib/module/index.js +280 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeKindlyReactNative.d.ts +47 -0
- package/lib/typescript/src/NativeKindlyReactNative.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +150 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +121 -0
- package/src/NativeKindlyReactNative.ts +80 -0
- package/src/index.tsx +353 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>files</key>
|
|
6
|
+
<dict>
|
|
7
|
+
<key>Assets.car</key>
|
|
8
|
+
<data>
|
|
9
|
+
MufwF5oHL1bh1MrM3uAziWyQ7ik=
|
|
10
|
+
</data>
|
|
11
|
+
<key>Config.plist</key>
|
|
12
|
+
<data>
|
|
13
|
+
r2EMqhVvzr47VmcIqySVHWiT9ko=
|
|
14
|
+
</data>
|
|
15
|
+
<key>ConfirmationWindow.nib</key>
|
|
16
|
+
<data>
|
|
17
|
+
qc7GhQ7vYvtJdoLZtd3CgyXcyTs=
|
|
18
|
+
</data>
|
|
19
|
+
<key>Headers/Kindly-Swift.h</key>
|
|
20
|
+
<data>
|
|
21
|
+
7FFuw4YghYU8YVkyIBUAXzbnj8w=
|
|
22
|
+
</data>
|
|
23
|
+
<key>Headers/Kindly.h</key>
|
|
24
|
+
<data>
|
|
25
|
+
jM0i9mp7oB0n4GI2DE19SoA/rdg=
|
|
26
|
+
</data>
|
|
27
|
+
<key>Info.plist</key>
|
|
28
|
+
<data>
|
|
29
|
+
0kMILz853tN8gI0Op3bDaEK97R4=
|
|
30
|
+
</data>
|
|
31
|
+
<key>Modules/Kindly.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
|
|
32
|
+
<data>
|
|
33
|
+
HX/ULNwHVkQtlDhvc5LDLC0cOQY=
|
|
34
|
+
</data>
|
|
35
|
+
<key>Modules/Kindly.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
|
|
36
|
+
<data>
|
|
37
|
+
XumgRS3ygpjTpN3B0bwVz+igQrE=
|
|
38
|
+
</data>
|
|
39
|
+
<key>Modules/Kindly.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
|
|
40
|
+
<data>
|
|
41
|
+
QFq7iR3ae2xHDskbpcVK0CndwRU=
|
|
42
|
+
</data>
|
|
43
|
+
<key>Modules/Kindly.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
|
|
44
|
+
<data>
|
|
45
|
+
Mm59TI50+qwjEdqBXbC7KPnAxxE=
|
|
46
|
+
</data>
|
|
47
|
+
<key>Modules/Kindly.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
|
|
48
|
+
<data>
|
|
49
|
+
HX/ULNwHVkQtlDhvc5LDLC0cOQY=
|
|
50
|
+
</data>
|
|
51
|
+
<key>Modules/Kindly.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
|
|
52
|
+
<data>
|
|
53
|
+
Zy2dT2vJpL/MGuWuEINHKYCL6c4=
|
|
54
|
+
</data>
|
|
55
|
+
<key>Modules/Kindly.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
|
|
56
|
+
<data>
|
|
57
|
+
e4kTgUDUB+oQq2ji25j53vB3lTQ=
|
|
58
|
+
</data>
|
|
59
|
+
<key>Modules/Kindly.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
|
|
60
|
+
<data>
|
|
61
|
+
rh1G65WK2IrHyGrTO6mfDtKE+8I=
|
|
62
|
+
</data>
|
|
63
|
+
<key>Modules/module.modulemap</key>
|
|
64
|
+
<data>
|
|
65
|
+
8wpvHQzJ7L135Ykf+l3/zIu7ip4=
|
|
66
|
+
</data>
|
|
67
|
+
<key>PrivacyInfo.xcprivacy</key>
|
|
68
|
+
<data>
|
|
69
|
+
CexZICe8cDp2OSVDwoeuB2FtkEw=
|
|
70
|
+
</data>
|
|
71
|
+
</dict>
|
|
72
|
+
<key>files2</key>
|
|
73
|
+
<dict>
|
|
74
|
+
<key>Assets.car</key>
|
|
75
|
+
<dict>
|
|
76
|
+
<key>hash2</key>
|
|
77
|
+
<data>
|
|
78
|
+
xZnIoRtfgPb61v9BpCGQDurq14rtIRZ7Fdf44pAZi10=
|
|
79
|
+
</data>
|
|
80
|
+
</dict>
|
|
81
|
+
<key>Config.plist</key>
|
|
82
|
+
<dict>
|
|
83
|
+
<key>hash2</key>
|
|
84
|
+
<data>
|
|
85
|
+
Tiw+XsnTLLJYc5pnjizz/uBNuEqUXfzBliJCCdXZ8lc=
|
|
86
|
+
</data>
|
|
87
|
+
</dict>
|
|
88
|
+
<key>ConfirmationWindow.nib</key>
|
|
89
|
+
<dict>
|
|
90
|
+
<key>hash2</key>
|
|
91
|
+
<data>
|
|
92
|
+
q2vjji3bD/A3jgsSkK9ikB8++4YogezyLcv/Wg/bpgk=
|
|
93
|
+
</data>
|
|
94
|
+
</dict>
|
|
95
|
+
<key>Headers/Kindly-Swift.h</key>
|
|
96
|
+
<dict>
|
|
97
|
+
<key>hash2</key>
|
|
98
|
+
<data>
|
|
99
|
+
yNeu6FnpfnjRh7e8SsgJ+RFBN2xVbAUNK+EKfKWkDa4=
|
|
100
|
+
</data>
|
|
101
|
+
</dict>
|
|
102
|
+
<key>Headers/Kindly.h</key>
|
|
103
|
+
<dict>
|
|
104
|
+
<key>hash2</key>
|
|
105
|
+
<data>
|
|
106
|
+
r/8dymxaHfrRsJDnGxvYqOD9Db0og/ieC/UlqWb2vaM=
|
|
107
|
+
</data>
|
|
108
|
+
</dict>
|
|
109
|
+
<key>Modules/Kindly.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
|
|
110
|
+
<dict>
|
|
111
|
+
<key>hash2</key>
|
|
112
|
+
<data>
|
|
113
|
+
BMcH9K6gPWh9bwO7+rSAd07/bSM+eWRQnxnMaxMv1vk=
|
|
114
|
+
</data>
|
|
115
|
+
</dict>
|
|
116
|
+
<key>Modules/Kindly.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
|
|
117
|
+
<dict>
|
|
118
|
+
<key>hash2</key>
|
|
119
|
+
<data>
|
|
120
|
+
5Gm0POXBPpUlE6h94sMFc2Xb0fK1AOpaJo4tTs5jFSs=
|
|
121
|
+
</data>
|
|
122
|
+
</dict>
|
|
123
|
+
<key>Modules/Kindly.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
|
|
124
|
+
<dict>
|
|
125
|
+
<key>hash2</key>
|
|
126
|
+
<data>
|
|
127
|
+
7Sy55O1HQkTXYn1kRlGA5/IQFAyMNepyUfzKruVybV4=
|
|
128
|
+
</data>
|
|
129
|
+
</dict>
|
|
130
|
+
<key>Modules/Kindly.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
|
|
131
|
+
<dict>
|
|
132
|
+
<key>hash2</key>
|
|
133
|
+
<data>
|
|
134
|
+
2BYG+wc2faTTmYsc+a6RTNf5w6t5cu/LfciW5CbnhCA=
|
|
135
|
+
</data>
|
|
136
|
+
</dict>
|
|
137
|
+
<key>Modules/Kindly.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
|
|
138
|
+
<dict>
|
|
139
|
+
<key>hash2</key>
|
|
140
|
+
<data>
|
|
141
|
+
BMcH9K6gPWh9bwO7+rSAd07/bSM+eWRQnxnMaxMv1vk=
|
|
142
|
+
</data>
|
|
143
|
+
</dict>
|
|
144
|
+
<key>Modules/Kindly.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
|
|
145
|
+
<dict>
|
|
146
|
+
<key>hash2</key>
|
|
147
|
+
<data>
|
|
148
|
+
X+hQQQiwfYv5klj4F/PPZC5L+USuxJ2EqD9R5lEcAGk=
|
|
149
|
+
</data>
|
|
150
|
+
</dict>
|
|
151
|
+
<key>Modules/Kindly.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
|
|
152
|
+
<dict>
|
|
153
|
+
<key>hash2</key>
|
|
154
|
+
<data>
|
|
155
|
+
2L931EOdUegkkvbscmT/+AvxO8apR8zy2clNgCjZF9s=
|
|
156
|
+
</data>
|
|
157
|
+
</dict>
|
|
158
|
+
<key>Modules/Kindly.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
|
|
159
|
+
<dict>
|
|
160
|
+
<key>hash2</key>
|
|
161
|
+
<data>
|
|
162
|
+
3WKv8xrbtUDomrQcgIMCZJ/zBtzUUE0YyC4HISixO0Q=
|
|
163
|
+
</data>
|
|
164
|
+
</dict>
|
|
165
|
+
<key>Modules/module.modulemap</key>
|
|
166
|
+
<dict>
|
|
167
|
+
<key>hash2</key>
|
|
168
|
+
<data>
|
|
169
|
+
efu4SiaswlW+CgXLX2a45z0925+R8uafvANMbXxP8wo=
|
|
170
|
+
</data>
|
|
171
|
+
</dict>
|
|
172
|
+
<key>PrivacyInfo.xcprivacy</key>
|
|
173
|
+
<dict>
|
|
174
|
+
<key>hash2</key>
|
|
175
|
+
<data>
|
|
176
|
+
YyEakOUJCThKZwvRUA61DEobh2QFzqiTu2pPsFSzIjY=
|
|
177
|
+
</data>
|
|
178
|
+
</dict>
|
|
179
|
+
</dict>
|
|
180
|
+
<key>rules</key>
|
|
181
|
+
<dict>
|
|
182
|
+
<key>^.*</key>
|
|
183
|
+
<true/>
|
|
184
|
+
<key>^.*\.lproj/</key>
|
|
185
|
+
<dict>
|
|
186
|
+
<key>optional</key>
|
|
187
|
+
<true/>
|
|
188
|
+
<key>weight</key>
|
|
189
|
+
<real>1000</real>
|
|
190
|
+
</dict>
|
|
191
|
+
<key>^.*\.lproj/locversion.plist$</key>
|
|
192
|
+
<dict>
|
|
193
|
+
<key>omit</key>
|
|
194
|
+
<true/>
|
|
195
|
+
<key>weight</key>
|
|
196
|
+
<real>1100</real>
|
|
197
|
+
</dict>
|
|
198
|
+
<key>^Base\.lproj/</key>
|
|
199
|
+
<dict>
|
|
200
|
+
<key>weight</key>
|
|
201
|
+
<real>1010</real>
|
|
202
|
+
</dict>
|
|
203
|
+
<key>^version.plist$</key>
|
|
204
|
+
<true/>
|
|
205
|
+
</dict>
|
|
206
|
+
<key>rules2</key>
|
|
207
|
+
<dict>
|
|
208
|
+
<key>.*\.dSYM($|/)</key>
|
|
209
|
+
<dict>
|
|
210
|
+
<key>weight</key>
|
|
211
|
+
<real>11</real>
|
|
212
|
+
</dict>
|
|
213
|
+
<key>^(.*/)?\.DS_Store$</key>
|
|
214
|
+
<dict>
|
|
215
|
+
<key>omit</key>
|
|
216
|
+
<true/>
|
|
217
|
+
<key>weight</key>
|
|
218
|
+
<real>2000</real>
|
|
219
|
+
</dict>
|
|
220
|
+
<key>^.*</key>
|
|
221
|
+
<true/>
|
|
222
|
+
<key>^.*\.lproj/</key>
|
|
223
|
+
<dict>
|
|
224
|
+
<key>optional</key>
|
|
225
|
+
<true/>
|
|
226
|
+
<key>weight</key>
|
|
227
|
+
<real>1000</real>
|
|
228
|
+
</dict>
|
|
229
|
+
<key>^.*\.lproj/locversion.plist$</key>
|
|
230
|
+
<dict>
|
|
231
|
+
<key>omit</key>
|
|
232
|
+
<true/>
|
|
233
|
+
<key>weight</key>
|
|
234
|
+
<real>1100</real>
|
|
235
|
+
</dict>
|
|
236
|
+
<key>^Base\.lproj/</key>
|
|
237
|
+
<dict>
|
|
238
|
+
<key>weight</key>
|
|
239
|
+
<real>1010</real>
|
|
240
|
+
</dict>
|
|
241
|
+
<key>^Info\.plist$</key>
|
|
242
|
+
<dict>
|
|
243
|
+
<key>omit</key>
|
|
244
|
+
<true/>
|
|
245
|
+
<key>weight</key>
|
|
246
|
+
<real>20</real>
|
|
247
|
+
</dict>
|
|
248
|
+
<key>^PkgInfo$</key>
|
|
249
|
+
<dict>
|
|
250
|
+
<key>omit</key>
|
|
251
|
+
<true/>
|
|
252
|
+
<key>weight</key>
|
|
253
|
+
<real>20</real>
|
|
254
|
+
</dict>
|
|
255
|
+
<key>^embedded\.provisionprofile$</key>
|
|
256
|
+
<dict>
|
|
257
|
+
<key>weight</key>
|
|
258
|
+
<real>20</real>
|
|
259
|
+
</dict>
|
|
260
|
+
<key>^version\.plist$</key>
|
|
261
|
+
<dict>
|
|
262
|
+
<key>weight</key>
|
|
263
|
+
<real>20</real>
|
|
264
|
+
</dict>
|
|
265
|
+
</dict>
|
|
266
|
+
</dict>
|
|
267
|
+
</plist>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Codegen-driven Obj-C++ TurboModule glue for the @kindly-ai/react-native
|
|
2
|
+
// package. The generated `<NativeKindlyReactNativeSpec>` protocol comes from
|
|
3
|
+
// the spec file `src/NativeKindlyReactNative.ts`. The actual implementation
|
|
4
|
+
// of every method lives in `KindlyReactNativeImpl.swift` — this Obj-C++
|
|
5
|
+
// class only forwards calls into the Swift class via the auto-generated
|
|
6
|
+
// bridging header.
|
|
7
|
+
#import <KindlyReactNativeSpec/KindlyReactNativeSpec.h>
|
|
8
|
+
|
|
9
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
10
|
+
|
|
11
|
+
@interface KindlyReactNative : RCTEventEmitter <NativeKindlyReactNativeSpec>
|
|
12
|
+
|
|
13
|
+
// Static accessor used by the Swift impl class to fire events back to JS.
|
|
14
|
+
+ (instancetype _Nullable)sharedInstance;
|
|
15
|
+
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
// Obj-C++ TurboModule glue for the @kindly-ai/react-native package.
|
|
2
|
+
//
|
|
3
|
+
// Responsibilities:
|
|
4
|
+
// 1. Implement every method declared by the codegen-generated
|
|
5
|
+
// `NativeKindlyReactNativeSpec` protocol.
|
|
6
|
+
// 2. Forward each call into the Swift impl class `KindlyReactNativeImpl`,
|
|
7
|
+
// which owns the actual KindlyChatClient state.
|
|
8
|
+
// 3. Provide the JSI<->ObjC TurboModule bridge via `getTurboModule:`.
|
|
9
|
+
// 4. Inherit from RCTEventEmitter so we can fire events to JS for the
|
|
10
|
+
// auth-token + delegate round-trips.
|
|
11
|
+
//
|
|
12
|
+
// Why a thin Obj-C++ glue + Swift impl: TurboModules require Obj-C++ for
|
|
13
|
+
// the JSI interop (the codegen header includes <jsi/jsi.h>). Splitting
|
|
14
|
+
// the impl into Swift keeps actual KindlyChatClient calls in the language
|
|
15
|
+
// the Kindly iOS SDK was designed for.
|
|
16
|
+
//
|
|
17
|
+
// Spec methods use FLAT primitive params throughout (matching the
|
|
18
|
+
// `multiply()` scaffold style) so the codegen-derived Obj-C signatures
|
|
19
|
+
// are predictable: object args become NSDictionary*, sync returns are
|
|
20
|
+
// NSNumber* / BOOL, Promises are resolve+reject blocks. We deliberately
|
|
21
|
+
// avoid struct args to skip the JS::Native...::Spec*Args fragility.
|
|
22
|
+
#import "KindlyReactNative.h"
|
|
23
|
+
|
|
24
|
+
// Auto-generated header that exposes Swift classes to ObjC. Filename derives
|
|
25
|
+
// from the pod name (KindlyReactNative.podspec → KindlyReactNative-Swift.h).
|
|
26
|
+
#import "KindlyReactNative-Swift.h"
|
|
27
|
+
|
|
28
|
+
@interface KindlyReactNative ()
|
|
29
|
+
@property(nonatomic, strong) KindlyReactNativeImpl *impl;
|
|
30
|
+
@end
|
|
31
|
+
|
|
32
|
+
@implementation KindlyReactNative {
|
|
33
|
+
// Tracks whether RN has called startObserving — gates event emission.
|
|
34
|
+
BOOL _hasListeners;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
RCT_EXPORT_MODULE(KindlyReactNative)
|
|
38
|
+
|
|
39
|
+
static __weak KindlyReactNative *_sharedInstance;
|
|
40
|
+
+ (instancetype _Nullable)sharedInstance {
|
|
41
|
+
return _sharedInstance;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
- (instancetype)init {
|
|
45
|
+
if ((self = [super init])) {
|
|
46
|
+
_impl = [[KindlyReactNativeImpl alloc] initWithEmitter:self];
|
|
47
|
+
_sharedInstance = self;
|
|
48
|
+
}
|
|
49
|
+
return self;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
+ (BOOL)requiresMainQueueSetup {
|
|
53
|
+
return YES;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
- (NSArray<NSString *> *)supportedEvents {
|
|
57
|
+
return @[
|
|
58
|
+
@"KindlyGetAuthToken",
|
|
59
|
+
@"KindlyOnHandover",
|
|
60
|
+
@"KindlyOnButtonPressed",
|
|
61
|
+
@"KindlyShouldHandleLink",
|
|
62
|
+
@"KindlyShouldHandleNotification",
|
|
63
|
+
];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
- (void)startObserving { _hasListeners = YES; }
|
|
67
|
+
- (void)stopObserving { _hasListeners = NO; }
|
|
68
|
+
|
|
69
|
+
// Public emit helper for the Swift impl. RN's RCTEventEmitter -sendEventWithName
|
|
70
|
+
// drops events when no listeners are attached — emit only when active.
|
|
71
|
+
- (void)emitEvent:(NSString *)name body:(id _Nullable)body {
|
|
72
|
+
if (_hasListeners) {
|
|
73
|
+
[self sendEventWithName:name body:body];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
#pragma mark - Lifecycle
|
|
78
|
+
|
|
79
|
+
- (void)start:(NSString *)botKey
|
|
80
|
+
languageCode:(NSString *_Nullable)languageCode
|
|
81
|
+
hasAuthCallback:(BOOL)hasAuthCallback {
|
|
82
|
+
[_impl startWithBotKey:botKey
|
|
83
|
+
languageCode:languageCode
|
|
84
|
+
hasAuthCallback:hasAuthCallback];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
- (void)displayChat:(NSString *_Nullable)languageCode
|
|
88
|
+
triggerDialogueId:(NSString *_Nullable)triggerDialogueId {
|
|
89
|
+
[_impl displayChatWithLanguageCode:languageCode
|
|
90
|
+
triggerDialogueId:triggerDialogueId];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
- (void)launchChat:(NSString *_Nullable)triggerDialogueId {
|
|
94
|
+
[_impl launchChatWithTriggerDialogueId:triggerDialogueId];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
- (void)closeChat {
|
|
98
|
+
[_impl closeChat];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
- (void)endChat:(RCTPromiseResolveBlock)resolve
|
|
102
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
103
|
+
[_impl endChatWithResolve:resolve reject:reject];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
- (void)kill:(RCTPromiseResolveBlock)resolve
|
|
107
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
108
|
+
[_impl killWithResolve:resolve reject:reject];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
- (void)setLanguage:(NSString *)languageCode
|
|
112
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
113
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
114
|
+
[_impl setLanguageWithCode:languageCode resolve:resolve reject:reject];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
#pragma mark - Messaging
|
|
118
|
+
|
|
119
|
+
- (void)sendMessage:(NSString *)message
|
|
120
|
+
newContext:(NSDictionary *_Nullable)newContext
|
|
121
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
122
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
123
|
+
[_impl sendMessageWithText:message
|
|
124
|
+
newContext:newContext
|
|
125
|
+
resolve:resolve
|
|
126
|
+
reject:reject];
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
- (void)setNewContext:(NSDictionary *)context {
|
|
130
|
+
[_impl setNewContext:context];
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
- (void)clearNewContext {
|
|
134
|
+
[_impl clearNewContext];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
- (void)triggerDialogue:(NSString *)dialogueId {
|
|
138
|
+
[_impl triggerDialogue:dialogueId];
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
- (void)clearTriggerDialogue {
|
|
142
|
+
// iOS-only no-op; Android has the equivalent.
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
- (void)handleUrl:(NSString *)url
|
|
146
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
147
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
148
|
+
resolve(@([_impl handleUrl:url]));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
#pragma mark - Theme
|
|
152
|
+
|
|
153
|
+
- (void)setCustomTheme:(NSDictionary *)colors {
|
|
154
|
+
[_impl setCustomTheme:colors];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
- (void)clearCustomTheme {
|
|
158
|
+
[_impl clearCustomTheme];
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
#pragma mark - Push
|
|
162
|
+
|
|
163
|
+
- (void)setAPNSDeviceToken:(NSString *)token {
|
|
164
|
+
[_impl setAPNSDeviceToken:token];
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
- (void)saveNotificationToken:(NSString *)token {
|
|
168
|
+
// Android-only — accept silently for surface symmetry.
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
- (void)handleNotification:(NSDictionary *)data {
|
|
172
|
+
[_impl handleNotification:data];
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
- (NSNumber *)isKindlyNotification:(NSDictionary *)data {
|
|
176
|
+
return @([_impl isKindlyNotification:data]);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
#pragma mark - State / settings
|
|
180
|
+
|
|
181
|
+
- (void)saveAuthToken:(NSString *)token
|
|
182
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
183
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
184
|
+
resolve(@([_impl saveAuthToken:token]));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
- (void)isChatDisplayed:(RCTPromiseResolveBlock)resolve
|
|
188
|
+
reject:(RCTPromiseRejectBlock)reject {
|
|
189
|
+
resolve(@([_impl isChatDisplayed]));
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
- (void)setVerboseLogging:(BOOL)enabled {
|
|
193
|
+
[_impl setVerboseLogging:enabled];
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
- (void)setCrashReporting:(BOOL)enabled {
|
|
197
|
+
[_impl setCrashReporting:enabled];
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
#pragma mark - Auth + delegate round-trips
|
|
201
|
+
|
|
202
|
+
- (void)respondToAuthToken:(NSString *)requestId
|
|
203
|
+
token:(NSString *_Nullable)token {
|
|
204
|
+
[_impl respondToAuthToken:requestId token:token];
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
- (void)setDelegate:(BOOL)onButtonPressed
|
|
208
|
+
shouldHandleLink:(BOOL)shouldHandleLink
|
|
209
|
+
shouldHandleNotification:(BOOL)shouldHandleNotification
|
|
210
|
+
onHandover:(BOOL)onHandover {
|
|
211
|
+
[_impl setDelegateWithButtonPressed:onButtonPressed
|
|
212
|
+
shouldHandleLink:shouldHandleLink
|
|
213
|
+
shouldHandleNotification:shouldHandleNotification
|
|
214
|
+
onHandover:onHandover];
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
- (void)respondToShouldHandle:(NSString *)requestId
|
|
218
|
+
value:(BOOL)value {
|
|
219
|
+
[_impl respondToShouldHandle:requestId value:value];
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
- (void)callHandover {
|
|
223
|
+
// No-op on iOS — handover is signalled via the events publisher in the
|
|
224
|
+
// native Kindly SDK; the Flutter SDK kept this as a stub for symmetry.
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
#pragma mark - TurboModule binding
|
|
228
|
+
|
|
229
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
230
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params {
|
|
231
|
+
return std::make_shared<facebook::react::NativeKindlyReactNativeSpecJSI>(params);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
@end
|