@sentiance-react-native/core 6.4.0-rc.2 → 6.4.0-rc.3
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/android/src/main/java/com/sentiance/react/bridge/core/SentianceModule.java +6 -2
- package/android/src/main/java/com/sentiance/react/bridge/core/base/AbstractSentianceModule.java +4 -2
- package/ios/RNSentianceCore.podspec +1 -1
- package/lib/SentianceEventEmitter.js +3 -27
- package/package.json +1 -1
|
@@ -565,16 +565,20 @@ public class SentianceModule extends AbstractSentianceModule {
|
|
|
565
565
|
|
|
566
566
|
@Override
|
|
567
567
|
@ReactMethod
|
|
568
|
-
protected void
|
|
568
|
+
protected void addNativeListener(String eventName, int subscriptionId, Promise promise) {
|
|
569
569
|
|
|
570
570
|
}
|
|
571
571
|
|
|
572
572
|
@Override
|
|
573
573
|
@ReactMethod
|
|
574
|
-
protected void
|
|
574
|
+
protected void removeNativeListener(String eventName, int subscriptionId, Promise promise) {
|
|
575
575
|
|
|
576
576
|
}
|
|
577
577
|
|
|
578
|
+
@Override
|
|
579
|
+
@ReactMethod
|
|
580
|
+
protected void addListener(String eventName) {}
|
|
581
|
+
|
|
578
582
|
@Override
|
|
579
583
|
@ReactMethod
|
|
580
584
|
public void removeListeners(Integer count) {}
|
package/android/src/main/java/com/sentiance/react/bridge/core/base/AbstractSentianceModule.java
CHANGED
|
@@ -54,9 +54,11 @@ public abstract class AbstractSentianceModule extends ReactContextBaseJavaModule
|
|
|
54
54
|
subscriptionsManager.removeSubscription(subscriptionId, eventType);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
protected abstract void
|
|
57
|
+
protected abstract void removeNativeListener(String eventName, int subscriptionId, Promise promise);
|
|
58
58
|
|
|
59
|
-
protected abstract void
|
|
59
|
+
protected abstract void addNativeListener(String eventName, int subscriptionId, Promise promise);
|
|
60
|
+
|
|
61
|
+
protected abstract void addListener(String eventName);
|
|
60
62
|
|
|
61
63
|
protected abstract void removeListeners(Integer count);
|
|
62
64
|
}
|
|
@@ -14,39 +14,15 @@ class SentianceEventEmitter extends NativeEventEmitter {
|
|
|
14
14
|
if (!nativeModule) {
|
|
15
15
|
throw new Error('Native module cannot have a null value.');
|
|
16
16
|
}
|
|
17
|
-
if (Platform.OS === 'android') {
|
|
18
|
-
return this.requireAndroidBindings(nativeModule);
|
|
19
|
-
} else {
|
|
20
|
-
return this.requireIosBindings(nativeModule);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
requireAndroidBindings(nativeModule) {
|
|
25
|
-
const hasAddListener = typeof nativeModule.addListener === 'function';
|
|
26
|
-
const hasRemoveListener = typeof nativeModule.removeListener === 'function';
|
|
27
|
-
|
|
28
|
-
if (!hasAddListener) {
|
|
29
|
-
throw new Error('Native Android module does not expose an addListener function');
|
|
30
|
-
}
|
|
31
|
-
if (!hasRemoveListener) {
|
|
32
|
-
throw new Error('Native Android module does not expose a removeListener function');
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
addNativeListener: nativeModule.addListener,
|
|
37
|
-
removeNativeListener: nativeModule.removeListener
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
17
|
|
|
41
|
-
requireIosBindings(nativeModule) {
|
|
42
18
|
const hasAddListener = typeof nativeModule.addNativeListener === 'function';
|
|
43
19
|
const hasRemoveListener = typeof nativeModule.removeNativeListener === 'function';
|
|
44
20
|
|
|
45
21
|
if (!hasAddListener) {
|
|
46
|
-
throw new Error('Native
|
|
22
|
+
throw new Error('Native module does not expose an addNativeListener function');
|
|
47
23
|
}
|
|
48
24
|
if (!hasRemoveListener) {
|
|
49
|
-
throw new Error('Native
|
|
25
|
+
throw new Error('Native module does not expose a removeNativeListener function');
|
|
50
26
|
}
|
|
51
27
|
|
|
52
28
|
return {
|
|
@@ -72,4 +48,4 @@ class SentianceEventEmitter extends NativeEventEmitter {
|
|
|
72
48
|
}
|
|
73
49
|
}
|
|
74
50
|
|
|
75
|
-
module.exports = SentianceEventEmitter;
|
|
51
|
+
module.exports = SentianceEventEmitter;
|