react-native-userleap 3.0.0 → 3.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/android/build.gradle
CHANGED
|
@@ -76,6 +76,6 @@ dependencies {
|
|
|
76
76
|
if (findProject(':userleap-android-sdk') != null) {
|
|
77
77
|
implementation project(':userleap-android-sdk')
|
|
78
78
|
} else {
|
|
79
|
-
implementation ("com.userleap:userleap-android-sdk:2.
|
|
79
|
+
implementation ("com.userleap:userleap-android-sdk:2.24.0") // update this version on android updates
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -20,6 +20,7 @@ import com.userleap.SprigEvent;
|
|
|
20
20
|
import com.userleap.SprigSurveyResult;
|
|
21
21
|
import com.userleap.SurveyState;
|
|
22
22
|
import com.userleap.UserLeap;
|
|
23
|
+
import com.userleap.SprigUserInterfaceMode;
|
|
23
24
|
|
|
24
25
|
import org.json.JSONException;
|
|
25
26
|
import org.json.JSONObject;
|
|
@@ -113,11 +114,7 @@ public class UserLeapModule extends ReactContextBaseJavaModule {
|
|
|
113
114
|
private WritableMap surveyResultToWritableMap(SprigSurveyResult surveyResult) {
|
|
114
115
|
WritableMap resultMap = Arguments.createMap();
|
|
115
116
|
resultMap.putString("surveyState", surveyResult.getSurveyState().name());
|
|
116
|
-
|
|
117
|
-
resultMap.putInt("surveyId", surveyResult.getSurveyId());
|
|
118
|
-
} else {
|
|
119
|
-
resultMap.putInt("surveyId", 0);
|
|
120
|
-
}
|
|
117
|
+
resultMap.putInt("surveyId", surveyResult.getSurveyId());
|
|
121
118
|
return resultMap;
|
|
122
119
|
}
|
|
123
120
|
|
|
@@ -372,6 +369,17 @@ public class UserLeapModule extends ReactContextBaseJavaModule {
|
|
|
372
369
|
UserLeap.INSTANCE.setUserIdentifier(identifier);
|
|
373
370
|
}
|
|
374
371
|
|
|
372
|
+
@ReactMethod
|
|
373
|
+
public void overrideUserInterfaceMode(double mode) {
|
|
374
|
+
int modeInt = (int) mode;
|
|
375
|
+
for (SprigUserInterfaceMode m : SprigUserInterfaceMode.values()) {
|
|
376
|
+
if (m.getValue() == modeInt) {
|
|
377
|
+
UserLeap.INSTANCE.overrideUserInterfaceMode(m);
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
375
383
|
@ReactMethod
|
|
376
384
|
public void logout() {
|
|
377
385
|
UserLeap.INSTANCE.logout();
|
package/index.d.ts
CHANGED
|
@@ -5,6 +5,13 @@ declare namespace UserLeap {
|
|
|
5
5
|
NO_SURVEY: string;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
+
const SprigUserInterfaceMode: {
|
|
9
|
+
unspecified: number;
|
|
10
|
+
light: number;
|
|
11
|
+
dark: number;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
function overrideUserInterfaceMode(mode: SprigUserInterfaceMode): void;
|
|
8
15
|
function visitorIdentifier(): number;
|
|
9
16
|
function visitorIdentifierString(): string;
|
|
10
17
|
function sdkVersion(): string;
|
package/index.js
CHANGED
|
@@ -9,6 +9,13 @@ const SurveyState = {
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
const SprigUserInterfaceMode = {
|
|
13
|
+
unspecified: 0,
|
|
14
|
+
light: 1,
|
|
15
|
+
dark: 2,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
|
|
12
19
|
const stringifyAttributes = (attributes) => {
|
|
13
20
|
if (!(attributes instanceof Object && attributes.constructor === Object))
|
|
14
21
|
return {};
|
|
@@ -257,6 +264,14 @@ const trackIdentifyAndPresent = (event, userId, partnerAnonynmousId) => {
|
|
|
257
264
|
}
|
|
258
265
|
};
|
|
259
266
|
|
|
267
|
+
|
|
268
|
+
const overrideUserInterfaceMode = (mode) => {
|
|
269
|
+
if (isValidPlatform()) {
|
|
270
|
+
NativeModules.UserLeapBindings.overrideUserInterfaceMode(mode);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
|
|
260
275
|
const UserLeap = {
|
|
261
276
|
visitorIdentifier,
|
|
262
277
|
visitorIdentifierString,
|
|
@@ -282,8 +297,10 @@ const UserLeap = {
|
|
|
282
297
|
dismissActiveSurvey,
|
|
283
298
|
pauseDisplayingSurveys,
|
|
284
299
|
unpauseDisplayingSurveys,
|
|
300
|
+
overrideUserInterfaceMode,
|
|
285
301
|
};
|
|
286
302
|
|
|
287
303
|
UserLeap.SurveyState = SurveyState;
|
|
304
|
+
UserLeap.SprigUserInterfaceMode = SprigUserInterfaceMode;
|
|
288
305
|
|
|
289
306
|
export default UserLeap;
|
package/ios/UserLeapBindings.m
CHANGED
|
@@ -279,6 +279,11 @@ RCT_EXPORT_METHOD(unpauseDisplayingSurveys)
|
|
|
279
279
|
[[UserLeap shared] unpauseDisplayingSurveys];
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
+
RCT_EXPORT_METHOD(overrideUserInterfaceMode:(NSInteger)mode)
|
|
283
|
+
{
|
|
284
|
+
[[UserLeap shared] overrideUserInterfaceModeWithMode:mode];
|
|
285
|
+
}
|
|
286
|
+
|
|
282
287
|
- (_SGRNViewProperties * _Nullable)propertiesFromView:(UIView * _Nonnull)passedView {
|
|
283
288
|
if ([passedView isKindOfClass:[RCTView class]]) {
|
|
284
289
|
RCTView *rView = (RCTView *) passedView;
|
package/package.json
CHANGED