react-native-wakeword 1.0.22 → 1.0.24

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.
Files changed (37) hide show
  1. package/ios/KeyWordDetection.xcframework/Info.plist +44 -0
  2. package/ios/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Headers/KeyWordDetection-Swift.h +358 -0
  3. package/ios/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Headers/KeyWordDetection.h +18 -0
  4. package/ios/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Info.plist +0 -0
  5. package/ios/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/KeyWordDetection +0 -0
  6. package/ios/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  7. package/ios/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.abi.json +1586 -0
  8. package/ios/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.private.swiftinterface +43 -0
  9. package/ios/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  10. package/ios/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios.swiftinterface +43 -0
  11. package/ios/KeyWordDetection.xcframework/ios-arm64/KeyWordDetection.framework/Modules/module.modulemap +11 -0
  12. package/ios/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Headers/KeyWordDetection-Swift.h +712 -0
  13. package/ios/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Headers/KeyWordDetection.h +18 -0
  14. package/ios/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Info.plist +0 -0
  15. package/ios/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/KeyWordDetection +0 -0
  16. package/ios/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  17. package/ios/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  18. package/ios/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.abi.json +1586 -0
  19. package/ios/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +43 -0
  20. package/ios/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  21. package/ios/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftinterface +43 -0
  22. package/ios/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.abi.json +1586 -0
  23. package/ios/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +43 -0
  24. package/ios/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  25. package/ios/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +43 -0
  26. package/ios/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/Modules/module.modulemap +11 -0
  27. package/ios/KeyWordDetection.xcframework/ios-arm64_x86_64-simulator/KeyWordDetection.framework/_CodeSignature/CodeResources +267 -0
  28. package/ios/KeyWordRNBridge.h +18 -0
  29. package/ios/KeyWordRNBridge.mm +197 -0
  30. package/ios/KeyWordRNBridgeSwift.h +5 -0
  31. package/ios/KeyWordRNBridgeSwift.mm +5 -0
  32. package/ios/models/embedding_model.onnx +0 -0
  33. package/ios/models/melspectrogram.onnx +0 -0
  34. package/ios/models/need_help_now.onnx +0 -0
  35. package/ios/react-native-wakeword.podspec +30 -0
  36. package/package.json +3 -1
  37. package/react-native.config.js +3 -0
@@ -0,0 +1,43 @@
1
+ // swift-interface-format-version: 1.0
2
+ // swift-compiler-version: Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
3
+ // swift-module-flags: -target x86_64-apple-ios13.4-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -enable-bare-slash-regex -module-name KeyWordDetection
4
+ import AVFoundation
5
+ import CommonCrypto
6
+ import Foundation
7
+ @_exported import KeyWordDetection
8
+ import Swift
9
+ import _Concurrency
10
+ import _StringProcessing
11
+ import _SwiftConcurrencyShims
12
+ import ios_voice_processor
13
+ import os.log
14
+ import onnxruntime_objc
15
+ import os
16
+ @_inheritsConvenienceInitializers @_hasMissingDesignatedInitializers @objc public class GlobalVariables : ObjectiveC.NSObject {
17
+ @objc public static let shared: KeyWordDetection.GlobalVariables
18
+ @objc public var keyWordsDetectionInstance: KeyWordDetection.KeyWordsDetection?
19
+ @objc public var modelName: Swift.String?
20
+ @objc public var threshold: Swift.Float
21
+ @objc public var bufferCnt: Swift.Int
22
+ @objc deinit
23
+ }
24
+ @objc public protocol KeywordDetectionRNDelegate {
25
+ @objc func KeywordDetectionDidDetectEvent(_ eventInfo: [Swift.String : Any])
26
+ }
27
+ @objc public class KeyWordsDetection : ObjectiveC.NSObject {
28
+ @objc weak public var delegate: (any KeyWordDetection.KeywordDetectionRNDelegate)?
29
+ @objc public init(modelPath: Swift.String, threshold: Swift.Float, bufferCnt: Swift.Int) throws
30
+ @objc public func replaceKeywordDetectionModel(modelPath: Swift.String, threshold: Swift.Float, bufferCnt: Swift.Int) throws
31
+ @objc public func getKeywordDetectionModel() -> Swift.String
32
+ @objc public func getRecordingWav() -> Swift.String
33
+ @objc public func setKeywordDetectionLicense(licenseKey: Swift.String) -> Swift.Bool
34
+ @objc public func setLicense(licenseKey: Swift.String) -> Swift.Bool
35
+ @objc public func callBack(frame: [Swift.Int16])
36
+ @objc public func startListening() throws
37
+ @objc public func stopListening()
38
+ @objc deinit
39
+ }
40
+ @_inheritsConvenienceInitializers @objc public class LicenseManager : ObjectiveC.NSObject {
41
+ @objc override dynamic public init()
42
+ @objc deinit
43
+ }
@@ -0,0 +1,43 @@
1
+ // swift-interface-format-version: 1.0
2
+ // swift-compiler-version: Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
3
+ // swift-module-flags: -target x86_64-apple-ios13.4-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -enable-bare-slash-regex -module-name KeyWordDetection
4
+ import AVFoundation
5
+ import CommonCrypto
6
+ import Foundation
7
+ @_exported import KeyWordDetection
8
+ import Swift
9
+ import _Concurrency
10
+ import _StringProcessing
11
+ import _SwiftConcurrencyShims
12
+ import ios_voice_processor
13
+ import os.log
14
+ import onnxruntime_objc
15
+ import os
16
+ @_inheritsConvenienceInitializers @_hasMissingDesignatedInitializers @objc public class GlobalVariables : ObjectiveC.NSObject {
17
+ @objc public static let shared: KeyWordDetection.GlobalVariables
18
+ @objc public var keyWordsDetectionInstance: KeyWordDetection.KeyWordsDetection?
19
+ @objc public var modelName: Swift.String?
20
+ @objc public var threshold: Swift.Float
21
+ @objc public var bufferCnt: Swift.Int
22
+ @objc deinit
23
+ }
24
+ @objc public protocol KeywordDetectionRNDelegate {
25
+ @objc func KeywordDetectionDidDetectEvent(_ eventInfo: [Swift.String : Any])
26
+ }
27
+ @objc public class KeyWordsDetection : ObjectiveC.NSObject {
28
+ @objc weak public var delegate: (any KeyWordDetection.KeywordDetectionRNDelegate)?
29
+ @objc public init(modelPath: Swift.String, threshold: Swift.Float, bufferCnt: Swift.Int) throws
30
+ @objc public func replaceKeywordDetectionModel(modelPath: Swift.String, threshold: Swift.Float, bufferCnt: Swift.Int) throws
31
+ @objc public func getKeywordDetectionModel() -> Swift.String
32
+ @objc public func getRecordingWav() -> Swift.String
33
+ @objc public func setKeywordDetectionLicense(licenseKey: Swift.String) -> Swift.Bool
34
+ @objc public func setLicense(licenseKey: Swift.String) -> Swift.Bool
35
+ @objc public func callBack(frame: [Swift.Int16])
36
+ @objc public func startListening() throws
37
+ @objc public func stopListening()
38
+ @objc deinit
39
+ }
40
+ @_inheritsConvenienceInitializers @objc public class LicenseManager : ObjectiveC.NSObject {
41
+ @objc override dynamic public init()
42
+ @objc deinit
43
+ }
@@ -0,0 +1,11 @@
1
+ framework module KeyWordDetection {
2
+ umbrella header "KeyWordDetection.h"
3
+ export *
4
+
5
+ module * { export * }
6
+ }
7
+
8
+ module KeyWordDetection.Swift {
9
+ header "KeyWordDetection-Swift.h"
10
+ requires objc
11
+ }
@@ -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>Headers/KeyWordDetection-Swift.h</key>
8
+ <data>
9
+ +Qjn316hRsB/AeDQlpTK9+IK810=
10
+ </data>
11
+ <key>Headers/KeyWordDetection.h</key>
12
+ <data>
13
+ 3DuDx7NAv+hLr4TmoJr3e+MRiXE=
14
+ </data>
15
+ <key>Info.plist</key>
16
+ <data>
17
+ NMh6GzLbwi6DzHzm81P263iGoWg=
18
+ </data>
19
+ <key>Modules/KeyWordDetection.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo</key>
20
+ <data>
21
+ afEyORsIFY5dRRvfZZuVi0ddYr4=
22
+ </data>
23
+ <key>Modules/KeyWordDetection.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo</key>
24
+ <data>
25
+ VAyI96jCLp7lB+Ed6wI2jibqzQs=
26
+ </data>
27
+ <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
28
+ <data>
29
+ 91smI5AwCNcHAuSlWCWRVLPMXQk=
30
+ </data>
31
+ <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
32
+ <data>
33
+ f5N6RfylkPVzCcRC6XRu59yUOXc=
34
+ </data>
35
+ <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
36
+ <data>
37
+ JyY4kNtCsm1jLvuPp1hgo1VdwWQ=
38
+ </data>
39
+ <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
40
+ <data>
41
+ f5N6RfylkPVzCcRC6XRu59yUOXc=
42
+ </data>
43
+ <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
44
+ <data>
45
+ NyahGMryOebHPQqiGJx6J/IACUg=
46
+ </data>
47
+ <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
48
+ <data>
49
+ 91smI5AwCNcHAuSlWCWRVLPMXQk=
50
+ </data>
51
+ <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
52
+ <data>
53
+ phX2Gmt2zstN/tUyKdHz4yMiURo=
54
+ </data>
55
+ <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
56
+ <data>
57
+ DXF9tBk3BiiE0vvQrTYXtpt9Fw8=
58
+ </data>
59
+ <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
60
+ <data>
61
+ phX2Gmt2zstN/tUyKdHz4yMiURo=
62
+ </data>
63
+ <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
64
+ <data>
65
+ 3Eq/CO4OYicW+ER025O/RVHNgDE=
66
+ </data>
67
+ <key>Modules/module.modulemap</key>
68
+ <data>
69
+ 6yUk0pwbC0K/Z/NW76NKjEwQ6+U=
70
+ </data>
71
+ </dict>
72
+ <key>files2</key>
73
+ <dict>
74
+ <key>Headers/KeyWordDetection-Swift.h</key>
75
+ <dict>
76
+ <key>hash2</key>
77
+ <data>
78
+ 9iJxMqzaGUwv48+kn4a1Fx6ZVvM7DkEhnrp67VmwkJk=
79
+ </data>
80
+ </dict>
81
+ <key>Headers/KeyWordDetection.h</key>
82
+ <dict>
83
+ <key>hash2</key>
84
+ <data>
85
+ Y97DYhcsF/qreCSOkyFyxAaTJIpJC9H/zl4fIXcr1og=
86
+ </data>
87
+ </dict>
88
+ <key>Modules/KeyWordDetection.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo</key>
89
+ <dict>
90
+ <key>hash2</key>
91
+ <data>
92
+ YjES00DOg75S9PuoQa+Hfwr8taq0hib+335+ZI6ZHaU=
93
+ </data>
94
+ </dict>
95
+ <key>Modules/KeyWordDetection.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo</key>
96
+ <dict>
97
+ <key>hash2</key>
98
+ <data>
99
+ NaG+Xe0dtGM/cIQ3JZiua8eHMag9GSZAK0/kpzkLe24=
100
+ </data>
101
+ </dict>
102
+ <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
103
+ <dict>
104
+ <key>hash2</key>
105
+ <data>
106
+ 0Hpf7usPc6wG36yGigo/SFWbEa+O/M0H+lWncIb5+CM=
107
+ </data>
108
+ </dict>
109
+ <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
110
+ <dict>
111
+ <key>hash2</key>
112
+ <data>
113
+ AKmTqxOhutyuB58dzKDCw77kpt+sE8aNsEnMGjnOF2M=
114
+ </data>
115
+ </dict>
116
+ <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
117
+ <dict>
118
+ <key>hash2</key>
119
+ <data>
120
+ 8UD8bZB1G0ZPAbKM3N9UMTU7P8yGtZfjPRV1oA8Rop4=
121
+ </data>
122
+ </dict>
123
+ <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
124
+ <dict>
125
+ <key>hash2</key>
126
+ <data>
127
+ AKmTqxOhutyuB58dzKDCw77kpt+sE8aNsEnMGjnOF2M=
128
+ </data>
129
+ </dict>
130
+ <key>Modules/KeyWordDetection.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
131
+ <dict>
132
+ <key>hash2</key>
133
+ <data>
134
+ juxhBLFcl7T5dCoa5L01Dd+45RZ0rzLSwl3AsQ+02UI=
135
+ </data>
136
+ </dict>
137
+ <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
138
+ <dict>
139
+ <key>hash2</key>
140
+ <data>
141
+ 0Hpf7usPc6wG36yGigo/SFWbEa+O/M0H+lWncIb5+CM=
142
+ </data>
143
+ </dict>
144
+ <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
145
+ <dict>
146
+ <key>hash2</key>
147
+ <data>
148
+ xJI26oAasXaxCwk0Q9XOjypMbCVzbbh7hKa5rN8rm1o=
149
+ </data>
150
+ </dict>
151
+ <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
152
+ <dict>
153
+ <key>hash2</key>
154
+ <data>
155
+ woCPj/82zMpipcih4SkQkh7OMsAxvATnpjLkXZ4SBVI=
156
+ </data>
157
+ </dict>
158
+ <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
159
+ <dict>
160
+ <key>hash2</key>
161
+ <data>
162
+ xJI26oAasXaxCwk0Q9XOjypMbCVzbbh7hKa5rN8rm1o=
163
+ </data>
164
+ </dict>
165
+ <key>Modules/KeyWordDetection.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
166
+ <dict>
167
+ <key>hash2</key>
168
+ <data>
169
+ V4ukU49zk9cNHt9U0ONpXDEEPazn9MFxC3CGv9PR0mE=
170
+ </data>
171
+ </dict>
172
+ <key>Modules/module.modulemap</key>
173
+ <dict>
174
+ <key>hash2</key>
175
+ <data>
176
+ +kbbPsAbGOLlb+yYPmPsc8Sr0d0VTGCn6SyIatROrWI=
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
+ #import <React/RCTBridgeModule.h>
2
+ #import <React/RCTEventEmitter.h>
3
+ //#import "porcuSafe-Swift.h" // Replace with your actual project name
4
+ #import <KeyWordDetection/KeyWordDetection-Swift.h>
5
+
6
+ @interface KeyWordRNBridge : RCTEventEmitter <RCTBridgeModule, KeywordDetectionRNDelegate>
7
+ // @interface KeyWordRNBridge : NSObject <RCTBridgeModule, KeywordDetectionRNDelegate>
8
+ //@interface KeyWordRNBridge : RCTEventEmitter <RCTBridgeModule>
9
+ + (void)sendEventWithName:(NSString *)name body:(id)body;
10
+ @end
11
+
12
+ /*
13
+
14
+ @interface KeyWordRNBridge : RCTEventEmitter <RCTBridgeModule>
15
+ + (instancetype)sharedInstance;
16
+ - (void)KeywordDetectionDidDetectEvent:(NSDictionary *)eventInfo;
17
+ @end
18
+ */
@@ -0,0 +1,197 @@
1
+ #import "KeyWordRNBridge.h"
2
+ #import <React/RCTBridge.h>
3
+ #import <React/RCTLog.h>
4
+ #import <React/RCTEventEmitter.h>
5
+ //#import "KeyWordsDetection.h" // Import your KeyWordsDetection library header
6
+
7
+ // Ensure the protocol is correctly imported or declared
8
+ // Assuming the protocol is named 'KeywordDetectionRNDelegate'
9
+ @interface KeyWordsDetectionWrapper : NSObject <KeywordDetectionRNDelegate>
10
+
11
+ @property (nonatomic, strong) KeyWordsDetection *keyWordsDetection;
12
+ @property (nonatomic, strong) NSString *instanceId;
13
+ @property (nonatomic, weak) KeyWordRNBridge *bridge;
14
+
15
+ - (instancetype)initWithInstanceId:(NSString *)instanceId
16
+ modelName:(NSString *)modelName
17
+ threshold:(float)threshold
18
+ bufferCnt:(NSInteger)bufferCnt
19
+ bridge:(KeyWordRNBridge *)bridge
20
+ error:(NSError **)error;
21
+
22
+ @end
23
+
24
+ @implementation KeyWordsDetectionWrapper
25
+
26
+ - (instancetype)initWithInstanceId:(NSString *)instanceId
27
+ modelName:(NSString *)modelName
28
+ threshold:(float)threshold
29
+ bufferCnt:(NSInteger)bufferCnt
30
+ bridge:(KeyWordRNBridge *)bridge
31
+ error:(NSError **)error
32
+ {
33
+ if (self = [super init]) {
34
+ _instanceId = instanceId;
35
+ _bridge = bridge;
36
+ _keyWordsDetection = [[KeyWordsDetection alloc] initWithModelPath:modelName threshold:threshold bufferCnt:bufferCnt error:error];
37
+ if (*error) {
38
+ return nil;
39
+ }
40
+ _keyWordsDetection.delegate = self;
41
+ }
42
+ return self;
43
+ }
44
+
45
+ // Implement the delegate method
46
+ - (void)KeywordDetectionDidDetectEvent:(NSDictionary *)eventInfo {
47
+ NSMutableDictionary *mutableEventInfo = [eventInfo mutableCopy];
48
+ mutableEventInfo[@"instanceId"] = self.instanceId;
49
+ [_bridge sendEventWithName:@"onKeywordDetectionEvent" body:mutableEventInfo];
50
+ }
51
+
52
+ @end
53
+
54
+ @interface KeyWordRNBridge () <RCTBridgeModule>
55
+
56
+ @property (nonatomic, strong) NSMutableDictionary *instances;
57
+
58
+ @end
59
+
60
+ @implementation KeyWordRNBridge
61
+
62
+ RCT_EXPORT_MODULE();
63
+
64
+ - (instancetype)init {
65
+ if (self = [super init]) {
66
+ _instances = [NSMutableDictionary new];
67
+ }
68
+ return self;
69
+ }
70
+
71
+ + (BOOL)requiresMainQueueSetup
72
+ {
73
+ return YES;
74
+ }
75
+
76
+ - (NSArray<NSString *> *)supportedEvents {
77
+ return @[@"onKeywordDetectionEvent"];
78
+ }
79
+
80
+ RCT_EXPORT_METHOD(createInstance:(NSString *)instanceId modelName:(NSString *)modelName threshold:(float)threshold bufferCnt:(NSInteger)bufferCnt resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
81
+ {
82
+ if (self.instances[instanceId]) {
83
+ reject(@"InstanceExists", [NSString stringWithFormat:@"Instance already exists with ID: %@", instanceId], nil);
84
+ return;
85
+ }
86
+
87
+ NSError *error = nil;
88
+ KeyWordsDetectionWrapper *wrapper = [[KeyWordsDetectionWrapper alloc] initWithInstanceId:instanceId modelName:modelName threshold:threshold bufferCnt:bufferCnt bridge:self error:&error];
89
+ if (error) {
90
+ reject(@"CreateError", [NSString stringWithFormat:@"Failed to create instance: %@", error.localizedDescription], nil);
91
+ } else {
92
+ self.instances[instanceId] = wrapper;
93
+ resolve([NSString stringWithFormat:@"Instance created with ID: %@", instanceId]);
94
+ }
95
+ }
96
+
97
+ RCT_EXPORT_METHOD(setKeywordDetectionLicense:(NSString *)instanceId licenseKey:(NSString *)licenseKey resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
98
+ {
99
+ KeyWordsDetectionWrapper *wrapper = self.instances[instanceId];
100
+ KeyWordsDetection *instance = wrapper.keyWordsDetection;
101
+ BOOL isLicensed = NO;
102
+ if (instance) {
103
+ isLicensed = [instance setLicenseWithLicenseKey:licenseKey];
104
+ NSLog(@"License is valid?: %@", isLicensed ? @"YES" : @"NO");
105
+ resolve(@(isLicensed)); // Wrap BOOL in NSNumber
106
+ } else {
107
+ reject(@"InstanceNotFound", [NSString stringWithFormat:@"No instance found with ID: %@", instanceId], nil);
108
+ }
109
+ }
110
+
111
+ RCT_EXPORT_METHOD(replaceKeywordDetectionModel:(NSString *)instanceId modelName:(NSString *)modelName threshold:(float)threshold bufferCnt:(NSInteger)bufferCnt resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
112
+ {
113
+ KeyWordsDetectionWrapper *wrapper = self.instances[instanceId];
114
+ KeyWordsDetection *instance = wrapper.keyWordsDetection;
115
+ if (instance) {
116
+ NSError *error = nil;
117
+ [instance replaceKeywordDetectionModelWithModelPath:modelName threshold:threshold bufferCnt:bufferCnt error:&error];
118
+ if (error) {
119
+ reject(@"ReplaceError", [NSString stringWithFormat:@"Failed to replace model: %@", error.localizedDescription], nil);
120
+ } else {
121
+ resolve([NSString stringWithFormat:@"Instance ID: %@ changed model to %@", instanceId, modelName]);
122
+ }
123
+ } else {
124
+ reject(@"InstanceNotFound", [NSString stringWithFormat:@"No instance found with ID: %@", instanceId], nil);
125
+ }
126
+ }
127
+
128
+ RCT_EXPORT_METHOD(startKeywordDetection:(NSString *)instanceId threshold:(float)threshold resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
129
+ {
130
+ KeyWordsDetectionWrapper *wrapper = self.instances[instanceId];
131
+ KeyWordsDetection *instance = wrapper.keyWordsDetection;
132
+ if (instance) {
133
+ NSError *error = nil;
134
+ [instance startListeningAndReturnError:&error];
135
+ if (error) {
136
+ reject(@"StartError", [NSString stringWithFormat:@"Failed to start detection: %@", error.localizedDescription], nil);
137
+ } else {
138
+ resolve([NSString stringWithFormat:@"Started detection for instance: %@", instanceId]);
139
+ }
140
+ } else {
141
+ reject(@"InstanceNotFound", [NSString stringWithFormat:@"No instance found with ID: %@", instanceId], nil);
142
+ }
143
+ }
144
+
145
+ RCT_EXPORT_METHOD(stopKeywordDetection:(NSString *)instanceId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
146
+ {
147
+ KeyWordsDetectionWrapper *wrapper = self.instances[instanceId];
148
+ KeyWordsDetection *instance = wrapper.keyWordsDetection;
149
+ if (instance) {
150
+ [instance stopListening];
151
+ resolve([NSString stringWithFormat:@"Stopped detection for instance: %@", instanceId]);
152
+ } else {
153
+ reject(@"InstanceNotFound", [NSString stringWithFormat:@"No instance found with ID: %@", instanceId], nil);
154
+ }
155
+ }
156
+
157
+ RCT_EXPORT_METHOD(destroyInstance:(NSString *)instanceId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
158
+ {
159
+ KeyWordsDetectionWrapper *wrapper = self.instances[instanceId];
160
+ if (wrapper) {
161
+ [wrapper.keyWordsDetection stopListening];
162
+ [self.instances removeObjectForKey:instanceId];
163
+ resolve([NSString stringWithFormat:@"Destroyed instance: %@", instanceId]);
164
+ } else {
165
+ reject(@"InstanceNotFound", [NSString stringWithFormat:@"No instance found with ID: %@", instanceId], nil);
166
+ }
167
+ }
168
+
169
+ // Keeping all APIs even if not called in JS yet
170
+
171
+ RCT_EXPORT_METHOD(getKeywordDetectionModel:(NSString *)instanceId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
172
+ {
173
+ KeyWordsDetectionWrapper *wrapper = self.instances[instanceId];
174
+ KeyWordsDetection *instance = wrapper.keyWordsDetection;
175
+ if (instance) {
176
+ NSString *modelName = [instance getKeywordDetectionModel];
177
+ resolve(modelName);
178
+ } else {
179
+ reject(@"InstanceNotFound", [NSString stringWithFormat:@"No instance found with ID: %@", instanceId], nil);
180
+ }
181
+ }
182
+
183
+ RCT_EXPORT_METHOD(getRecordingWav:(NSString *)instanceId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
184
+ {
185
+ KeyWordsDetectionWrapper *wrapper = self.instances[instanceId];
186
+ KeyWordsDetection *instance = wrapper.keyWordsDetection;
187
+ if (instance) {
188
+ NSString *recWavPath = [instance getRecordingWav];
189
+ resolve(recWavPath);
190
+ } else {
191
+ reject(@"InstanceNotFound", [NSString stringWithFormat:@"No instance found with ID: %@", instanceId], nil);
192
+ }
193
+ }
194
+
195
+ // You can add more methods here as needed, ensuring they use the instanceId
196
+
197
+ @end
@@ -0,0 +1,5 @@
1
+ #import "KeyWordRNBridge.h"
2
+
3
+ @interface KeyWordRNBridge (Swift)
4
+
5
+ @end
@@ -0,0 +1,5 @@
1
+ #import "KeyWordRNBridgeSwift.h"
2
+
3
+ @implementation KeyWordRNBridge (Swift)
4
+
5
+ @end
Binary file
Binary file
Binary file
@@ -0,0 +1,30 @@
1
+ Pod::Spec.new do |s|
2
+ s.name = "react-native-wakeword"
3
+ s.version = "1.0.0" # Update to your package version
4
+ s.summary = "Wake word detection for React Native."
5
+ s.description = <<-DESC
6
+ A React Native module for wake word detection .
7
+ DESC
8
+ s.homepage = "https://github.com/frymanofer/KeywordsDetectionAndroidLibrary.git" # Update with your repo URL
9
+ s.license = { :type => "MIT" } # Update if different
10
+ s.author = { "Your Name" => "ofer@davoice.io" } # Update with your info
11
+ s.platform = :ios, "13.5"
12
+ # s.source = { :git => "https://github.com/frymanofer/KeywordsDetectionAndroidLibrary.git", :tag => s.version.to_s } # Update accordingly
13
+ s.source = { :path => "." }
14
+
15
+ s.source_files = "ios/*.{h,m,mm}"
16
+ s.resources = "ios/models/*"
17
+
18
+ s.vendored_frameworks = "ios/KeyWordDetection.xcframework"
19
+
20
+ s.dependency "React"
21
+ s.dependency "onnxruntime-objc", "~> 1.18.0"
22
+ s.dependency "ios-voice-processor", "~> 1.1.0"
23
+
24
+ s.pod_target_xcconfig = {
25
+ "FRAMEWORK_SEARCH_PATHS" => "\"$(PODS_ROOT)/react-native-wakeword/ios\""
26
+ }
27
+
28
+ s.requires_arc = true
29
+ end
30
+
package/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "name": "react-native-wakeword",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "description": "Voice/Wake-word detection library for React Native",
5
5
  "main": "wakewords/index.js",
6
6
  "types": "wakewords/index.d.ts",
7
7
  "files": [
8
8
  "wakewords/",
9
9
  "android/",
10
+ "ios/",
10
11
  "react-native.config.js"
11
12
  ],
12
13
  "react-native": {
14
+ "ios": "ios",
13
15
  "android": "android"
14
16
  },
15
17
  "scripts": {
@@ -7,6 +7,9 @@ module.exports = {
7
7
  packageImportPath: 'import com.davoice.keywordspotting.KeyWordRNBridgePackage;',
8
8
  packageInstance: 'new KeyWordRNBridgePackage()',
9
9
  },
10
+ ios: {
11
+ podspecPath: './ios/react-native-wakeword.podspec', // Points to your podspec
12
+ },
10
13
  },
11
14
  },
12
15
  },