Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions android/src/main/java/com/reactlibrary/RNWootricModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ private static HashMap<String, String> toHashMap(ReadableMap readableMap) {
ReadableType type = readableMap.getType(key);

switch (type) {
case Null:
map.put(key, null);
break;
case Boolean:
map.put(key, Boolean.toString(readableMap.getBoolean(key)));
break;
case Number:
map.put(key, Double.toString(readableMap.getDouble(key)));
break;
case String:
map.put(key, readableMap.getString(key));
break;
case Null:
map.put(key, null);
break;
case Boolean:
map.put(key, Boolean.toString(readableMap.getBoolean(key)));
break;
case Number:
map.put(key, Double.toString(readableMap.getDouble(key)));
break;
case String:
map.put(key, readableMap.getString(key));
break;
}
}

Expand Down Expand Up @@ -112,6 +112,12 @@ public void setCustomAudience(String audience) {
wootric.setRecommendTarget(audience);
}

@ReactMethod
public void forceSurvey(boolean force) {
// Workaround for Android
this.setSurveyImmediately(force);
}

@ReactMethod
public void showSurvey() {
wootric.survey();
Expand Down
9 changes: 7 additions & 2 deletions ios/RNWootric.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ @implementation RNWootric

- (dispatch_queue_t)methodQueue
{
return dispatch_get_main_queue();
return dispatch_get_main_queue();
}

RCT_EXPORT_MODULE();
Expand Down Expand Up @@ -58,8 +58,13 @@ - (dispatch_queue_t)methodQueue
[Wootric setCustomAudience:audience];
}

RCT_EXPORT_METHOD(forceSurvey:(BOOL)force) {
[Wootric forceSurvey:force];
}

RCT_EXPORT_METHOD(showSurvey) {
[Wootric showSurveyInViewController:[UIApplication sharedApplication].delegate.window.rootViewController];
}

@end