@survicate/react-native-survicate 4.1.0 → 4.1.1

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/README.md CHANGED
@@ -49,7 +49,7 @@ allprojects {
49
49
  ```javascript
50
50
  import Survicate, {UserTrait} from '@survicate/react-native-survicate';
51
51
 
52
- Survicate.initialize();
52
+ Survicate.initializeSdk();
53
53
  Survicate.invokeEvent("eventName");
54
54
  Survicate.enterScreen("screenName");
55
55
  Survicate.leaveScreen("screenName");
@@ -66,7 +66,7 @@ const listener: SurvicateEventListener = {
66
66
  onSurveyClosed(event: SurveyClosedEvent) {},
67
67
  onSurveyCompleted(event: SurveyCompletedEvent) {},
68
68
  }
69
- Survicate.addSurvicateEventListener(listener);
69
+ const subscription = Survicate.addSurvicateEventListener(listener);
70
70
  Survicate.reset();
71
71
  ```
72
72
 
@@ -46,8 +46,29 @@ if (isNewArchitectureEnabled()) {
46
46
  apply plugin: 'com.facebook.react'
47
47
  }
48
48
 
49
+ def supportsNamespace() {
50
+ def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
51
+ def major = parsed[0].toInteger()
52
+ def minor = parsed[1].toInteger()
53
+
54
+ // Namespace support was added in 7.3.0
55
+ if (major == 7 && minor >= 3) {
56
+ return true
57
+ }
58
+
59
+ return major >= 8
60
+ }
61
+
49
62
  android {
50
- namespace "com.survicate.react"
63
+ if (supportsNamespace()) {
64
+ namespace "com.survicate.react"
65
+
66
+ sourceSets {
67
+ main {
68
+ manifest.srcFile "src/main/AndroidManifestNew.xml"
69
+ }
70
+ }
71
+ }
51
72
  compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
52
73
  buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
53
74
  defaultConfig {
@@ -99,7 +120,7 @@ repositories {
99
120
  dependencies {
100
121
  //noinspection GradleDynamicVersion
101
122
  implementation 'com.facebook.react:react-native:+' // From node_modules
102
- implementation ('com.survicate:survicate-sdk:4.1.0')
123
+ implementation ('com.survicate:survicate-sdk:4.1.1')
103
124
  }
104
125
 
105
126
  if (isNewArchitectureEnabled()) {
@@ -1,3 +1,4 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android">
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ package="com.survicate.react">
2
3
 
3
4
  </manifest>
@@ -0,0 +1,3 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+
3
+ </manifest>
@@ -75,7 +75,7 @@ public class SurvicateModuleImpl extends SurvicateModule {
75
75
  @ReactMethod
76
76
  public void addListener(String eventName) {
77
77
  if (listenerCount == 0) {
78
- Survicate.setEventListener(eventListener);
78
+ Survicate.addEventListener(eventListener);
79
79
  }
80
80
 
81
81
  listenerCount++;
@@ -86,7 +86,7 @@ public class SurvicateModuleImpl extends SurvicateModule {
86
86
  listenerCount -= count;
87
87
 
88
88
  if (listenerCount == 0) {
89
- Survicate.setEventListener(null);
89
+ Survicate.removeEventListener(eventListener);
90
90
  }
91
91
  }
92
92
 
@@ -66,12 +66,12 @@ RCT_EXPORT_METHOD(setWorkspaceKey:(NSString *)workspaceKey)
66
66
 
67
67
  - (void)startObserving {
68
68
  hasListeners = YES;
69
- [[SurvicateSdk shared] setDelegate:self];
69
+ [[SurvicateSdk shared] addListener:self];
70
70
  }
71
71
 
72
72
  - (void)stopObserving {
73
73
  hasListeners = NO;
74
- [[SurvicateSdk shared] setDelegate:nil];
74
+ [[SurvicateSdk shared] removeListener:self];
75
75
  }
76
76
 
77
77
  - (void)surveyDisplayedWithEvent:(SurveyDisplayedEvent * _Nonnull)event {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@survicate/react-native-survicate",
3
3
  "title": "React Native Survicate Bindings",
4
- "version": "4.1.0",
4
+ "version": "4.1.1",
5
5
  "description": "React Native bindings for Survicate Mobile SDK",
6
6
  "main": "lib/commonjs/index.js",
7
7
  "module": "lib/module/index.js",