react-native-repro 3.24.0 → 4.0.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/React-Repro.podspec +2 -2
- package/android/build.gradle +28 -1
- package/android/src/main/java/io/repro/android/reactbridge/{ReproReactBridgeModule.java → ReproReactBridgeModuleImpl.java} +262 -70
- package/android/src/main/java/io/repro/android/reactbridge/{ReproRemoteConfigBridge.java → ReproRemoteConfigBridgeModuleImpl.java} +19 -34
- package/android/src/newarch/java/io/repro/android/reactbridge/ReproEventEmitterOpenUrlModule.java +54 -0
- package/android/src/newarch/java/io/repro/android/reactbridge/ReproReactBridgeModule.java +367 -0
- package/android/src/newarch/java/io/repro/android/reactbridge/ReproReactBridgePackage.java +78 -0
- package/android/src/newarch/java/io/repro/android/reactbridge/ReproRemoteConfigBridgeModule.java +79 -0
- package/android/src/{main/java/io/repro/android/reactbridge/ReproEventEmitterOpenUrl.java → oldarch/java/io/repro/android/reactbridge/ReproEventEmitterOpenUrlModule.java} +4 -4
- package/android/src/oldarch/java/io/repro/android/reactbridge/ReproReactBridgeModule.java +365 -0
- package/android/src/oldarch/java/io/repro/android/reactbridge/ReproReactBridgePackage.java +29 -0
- package/android/src/oldarch/java/io/repro/android/reactbridge/ReproRemoteConfigBridgeModule.java +77 -0
- package/index.js +44 -232
- package/ios/RPRReproReactBridge.h +19 -4
- package/ios/{RPRReproReactBridge.m → RPRReproReactBridge.mm} +660 -193
- package/ios/RPRReproReactBridgeImpl.h +111 -0
- package/ios/RPRReproReactBridgeImpl.m +713 -0
- package/package.json +22 -1
- package/sdk-android/io/repro/repro-android-sdk/5.20.0/repro-android-sdk-5.20.0.aar +0 -0
- package/sdk-android/io/repro/repro-android-sdk/5.20.0/repro-android-sdk-5.20.0.aar.md5 +1 -0
- package/sdk-android/io/repro/repro-android-sdk/5.20.0/repro-android-sdk-5.20.0.aar.sha1 +1 -0
- package/sdk-android/io/repro/repro-android-sdk/5.20.0/repro-android-sdk-5.20.0.pom +24 -0
- package/sdk-android/io/repro/repro-android-sdk/5.20.0/repro-android-sdk-5.20.0.pom.md5 +1 -0
- package/sdk-android/io/repro/repro-android-sdk/5.20.0/repro-android-sdk-5.20.0.pom.sha1 +1 -0
- package/sdk-android/io/repro/repro-android-sdk/maven-metadata.xml +3 -3
- package/sdk-android/io/repro/repro-android-sdk/maven-metadata.xml.md5 +1 -1
- package/sdk-android/io/repro/repro-android-sdk/maven-metadata.xml.sha1 +1 -1
- package/sdk-ios/Repro.xcframework/_CodeSignature/CodeDirectory +0 -0
- package/sdk-ios/Repro.xcframework/_CodeSignature/CodeRequirements-1 +0 -0
- package/sdk-ios/Repro.xcframework/_CodeSignature/CodeResources +18 -18
- package/sdk-ios/Repro.xcframework/_CodeSignature/CodeSignature +0 -0
- package/sdk-ios/Repro.xcframework/ios-arm64_armv7_armv7s/Repro.framework/Headers/Repro.h +63 -0
- package/sdk-ios/Repro.xcframework/ios-arm64_armv7_armv7s/Repro.framework/Info.plist +0 -0
- package/sdk-ios/Repro.xcframework/ios-arm64_armv7_armv7s/Repro.framework/Repro +0 -0
- package/sdk-ios/Repro.xcframework/ios-arm64_i386_x86_64-simulator/Repro.framework/Headers/Repro.h +63 -0
- package/sdk-ios/Repro.xcframework/ios-arm64_i386_x86_64-simulator/Repro.framework/Info.plist +0 -0
- package/sdk-ios/Repro.xcframework/ios-arm64_i386_x86_64-simulator/Repro.framework/Repro +0 -0
- package/src/EventEmitterOpenUrl.js +24 -0
- package/src/NativeReproEventEmitterOpenUrl.ts +9 -0
- package/src/NativeReproReactBridge.ts +134 -0
- package/src/NativeReproRemoteConfigBridge.ts +26 -0
- package/src/NewsFeedManager.js +149 -0
- package/android/src/main/java/io/repro/android/reactbridge/ReproReactBridgePackage.java +0 -36
- package/repro-version.json +0 -5
- package/sdk-android/io/repro/repro-android-sdk/5.19.0/repro-android-sdk-5.19.0.aar +0 -0
- package/sdk-android/io/repro/repro-android-sdk/5.19.0/repro-android-sdk-5.19.0.aar.md5 +0 -1
- package/sdk-android/io/repro/repro-android-sdk/5.19.0/repro-android-sdk-5.19.0.aar.sha1 +0 -1
- package/sdk-android/io/repro/repro-android-sdk/5.19.0/repro-android-sdk-5.19.0.pom +0 -9
- package/sdk-android/io/repro/repro-android-sdk/5.19.0/repro-android-sdk-5.19.0.pom.md5 +0 -1
- package/sdk-android/io/repro/repro-android-sdk/5.19.0/repro-android-sdk-5.19.0.pom.sha1 +0 -1
package/React-Repro.podspec
CHANGED
|
@@ -13,12 +13,12 @@ Pod::Spec.new do |s|
|
|
|
13
13
|
s.platforms = { :ios => "10.0" }
|
|
14
14
|
s.source = { :git => "https://github.com/reproio/repro-ios-sdk", :tag => "local_link_only" }
|
|
15
15
|
|
|
16
|
-
s.source_files = "ios/*.{h,m}"
|
|
16
|
+
s.source_files = "ios/*.{h,m,mm}"
|
|
17
17
|
|
|
18
18
|
s.vendored_frameworks = "sdk-ios/Repro.xcframework"
|
|
19
19
|
|
|
20
20
|
s.frameworks = 'UIKit', 'CoreGraphics', 'QuartzCore', 'SystemConfiguration', 'WebKit', 'UserNotifications'
|
|
21
21
|
|
|
22
|
-
s
|
|
22
|
+
install_modules_dependencies(s)
|
|
23
23
|
end
|
|
24
24
|
|
package/android/build.gradle
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
|
+
def isNewArchitectureEnabled() {
|
|
2
|
+
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
|
|
3
|
+
}
|
|
1
4
|
|
|
2
5
|
apply plugin: 'com.android.library'
|
|
3
6
|
|
|
7
|
+
if (isNewArchitectureEnabled()) {
|
|
8
|
+
apply plugin: "com.facebook.react"
|
|
9
|
+
react {
|
|
10
|
+
jsRootDir = file("../../")
|
|
11
|
+
libraryName = "react-native-repro"
|
|
12
|
+
codegenJavaPackageName = "io.repro.android.reactbridge"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
4
16
|
def getMainProp(property, fallback) {
|
|
5
17
|
return rootProject.ext.has(property) ? rootProject.ext.get(property) : fallback
|
|
6
18
|
}
|
|
@@ -10,20 +22,35 @@ android {
|
|
|
10
22
|
compileSdkVersion getMainProp('compileSdkVersion', 26)
|
|
11
23
|
buildToolsVersion getMainProp('buildToolsVersion', '26.0.3')
|
|
12
24
|
|
|
25
|
+
namespace "io.repro.android.reactbridge"
|
|
26
|
+
|
|
13
27
|
defaultConfig {
|
|
14
28
|
minSdkVersion getMainProp('minSdkVersion', 16)
|
|
15
29
|
// targetSdkVersion 26
|
|
16
30
|
versionCode 1
|
|
17
31
|
versionName "1.0.0"
|
|
32
|
+
buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString())
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
sourceSets {
|
|
36
|
+
main {
|
|
37
|
+
java.srcDirs += ['src/main/java']
|
|
38
|
+
if (isNewArchitectureEnabled()) {
|
|
39
|
+
java.srcDirs += ['src/newarch']
|
|
40
|
+
} else {
|
|
41
|
+
java.srcDirs += ['src/oldarch']
|
|
42
|
+
}
|
|
43
|
+
}
|
|
18
44
|
}
|
|
19
45
|
}
|
|
20
46
|
|
|
21
47
|
repositories {
|
|
22
48
|
mavenCentral()
|
|
49
|
+
google()
|
|
23
50
|
}
|
|
24
51
|
|
|
25
52
|
dependencies {
|
|
26
|
-
|
|
53
|
+
compileOnly "com.facebook.react:react-native:${getMainProp('reactNativeVersion', '+')}"
|
|
27
54
|
|
|
28
55
|
api "io.repro:repro-android-sdk:+"
|
|
29
56
|
}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
1
|
package io.repro.android.reactbridge;
|
|
3
2
|
|
|
4
3
|
import android.util.Log;
|
|
4
|
+
import android.app.Activity;
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
8
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
9
|
-
import com.facebook.react.bridge.ReactMethod;
|
|
10
6
|
import com.facebook.react.bridge.Callback;
|
|
11
7
|
import com.facebook.react.bridge.ReadableMap;
|
|
12
8
|
import com.facebook.react.bridge.WritableMap;
|
|
@@ -43,8 +39,7 @@ import io.repro.android.user.UserProfileGender;
|
|
|
43
39
|
import io.repro.android.user.UserProfilePrefecture;
|
|
44
40
|
import io.repro.android.newsfeed.NewsFeedEntry;
|
|
45
41
|
|
|
46
|
-
|
|
47
|
-
public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
|
|
42
|
+
public class ReproReactBridgeModuleImpl {
|
|
48
43
|
|
|
49
44
|
public static final int GENDER_OTHER = 0;
|
|
50
45
|
public static final int GENDER_MALE = 1;
|
|
@@ -56,15 +51,9 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
|
|
|
56
51
|
public static final int CAMPAIGN_TYPE_WEB_MESSAGE = (1 << 2);
|
|
57
52
|
public static final int CAMPAIGN_TYPE_ALL = (1 << 3);
|
|
58
53
|
|
|
59
|
-
private final
|
|
54
|
+
private static final String REPRO_REACT_NATIVE_BRIDGE_VERSION = "4.0.0";
|
|
60
55
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
public ReproReactBridgeModule(ReactApplicationContext reactContext) {
|
|
64
|
-
super(reactContext);
|
|
65
|
-
this.reactContext = reactContext;
|
|
66
|
-
this.versionPassing();
|
|
67
|
-
}
|
|
56
|
+
public static final String NAME = "ReproReactBridgeModule";
|
|
68
57
|
|
|
69
58
|
private String getReactNativeVersion() {
|
|
70
59
|
try {
|
|
@@ -78,7 +67,7 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
|
|
|
78
67
|
}
|
|
79
68
|
}
|
|
80
69
|
|
|
81
|
-
|
|
70
|
+
public void versionPassing() {
|
|
82
71
|
final Map<String, Object> platformValues = new HashMap<>();
|
|
83
72
|
platformValues.put("sub_sdk_platform", "react_native");
|
|
84
73
|
platformValues.put("sub_sdk_bridge_version", REPRO_REACT_NATIVE_BRIDGE_VERSION);
|
|
@@ -97,12 +86,6 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
|
|
|
97
86
|
}
|
|
98
87
|
}
|
|
99
88
|
|
|
100
|
-
@Override
|
|
101
|
-
public String getName() {
|
|
102
|
-
return "Repro";
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
@Override
|
|
106
89
|
public Map<String, Object> getConstants() {
|
|
107
90
|
final Map<String, Object> constants = new HashMap<>();
|
|
108
91
|
|
|
@@ -129,52 +112,42 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
|
|
|
129
112
|
return constants;
|
|
130
113
|
}
|
|
131
114
|
|
|
132
|
-
@ReactMethod
|
|
133
115
|
public void optIn(boolean endUserOptedIn) {
|
|
134
116
|
Repro.optIn(endUserOptedIn);
|
|
135
117
|
}
|
|
136
118
|
|
|
137
|
-
@ReactMethod
|
|
138
119
|
public void setUserID(final String userId) {
|
|
139
120
|
Repro.setUserID(userId);
|
|
140
121
|
}
|
|
141
122
|
|
|
142
|
-
@ReactMethod
|
|
143
123
|
public void getUserID(Callback callback) {
|
|
144
124
|
callback.invoke(null, Repro.getUserID());
|
|
145
125
|
}
|
|
146
126
|
|
|
147
|
-
@ReactMethod
|
|
148
127
|
public void setSilverEggCookie(final String cookie) {
|
|
149
128
|
Repro.setSilverEggCookie(cookie);
|
|
150
129
|
}
|
|
151
130
|
|
|
152
|
-
@ReactMethod
|
|
153
131
|
public void setSilverEggProdKey(final String prodKey) {
|
|
154
132
|
Repro.setSilverEggProdKey(prodKey);
|
|
155
133
|
}
|
|
156
134
|
|
|
157
|
-
@ReactMethod
|
|
158
135
|
public void setLogLevel(final int logLevel) {
|
|
159
136
|
Repro.setLogLevel(logLevel);
|
|
160
137
|
}
|
|
161
138
|
|
|
162
|
-
@ReactMethod
|
|
163
139
|
public void setStringUserProfile(final String key, final String value) {
|
|
164
140
|
Repro.setStringUserProfile(key, value);
|
|
165
141
|
}
|
|
166
142
|
|
|
167
|
-
@ReactMethod
|
|
168
143
|
public void setIntUserProfile(final String key, final int value) {
|
|
169
144
|
Repro.setIntUserProfile(key, value);
|
|
170
145
|
}
|
|
171
146
|
|
|
172
|
-
@ReactMethod
|
|
173
147
|
public void setDoubleUserProfile(final String key, final double value) {
|
|
174
148
|
Repro.setDoubleUserProfile(key, value);
|
|
175
149
|
}
|
|
176
150
|
|
|
177
|
-
@ReactMethod
|
|
178
151
|
public void setDateUserProfile(final String key, final String value) {
|
|
179
152
|
try{
|
|
180
153
|
String isoTime = value.replace("Z", "+00:00");
|
|
@@ -186,12 +159,10 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
|
|
|
186
159
|
}
|
|
187
160
|
}
|
|
188
161
|
|
|
189
|
-
@ReactMethod
|
|
190
162
|
public void setUserEmailAddress(final String mailAddr) {
|
|
191
163
|
Repro.setUserEmailAddress(mailAddr);
|
|
192
164
|
}
|
|
193
165
|
|
|
194
|
-
@ReactMethod
|
|
195
166
|
public void setUserGender(final int gender) {
|
|
196
167
|
if (BuildConfig.DEBUG) {
|
|
197
168
|
Repro.setUserGender(UserProfileGender.values()[gender]);
|
|
@@ -206,7 +177,6 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
|
|
|
206
177
|
}
|
|
207
178
|
}
|
|
208
179
|
|
|
209
|
-
@ReactMethod
|
|
210
180
|
public void setUserResidencePrefecture(final int prefecture) {
|
|
211
181
|
if (BuildConfig.DEBUG) {
|
|
212
182
|
Repro.setUserResidencePrefecture(UserProfilePrefecture.values()[prefecture - 1]);
|
|
@@ -220,7 +190,6 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
|
|
|
220
190
|
}
|
|
221
191
|
}
|
|
222
192
|
|
|
223
|
-
@ReactMethod
|
|
224
193
|
public void setUserDateOfBirth(final String value) {
|
|
225
194
|
try{
|
|
226
195
|
String isoTime = value.replace("Z", "+00:00");
|
|
@@ -232,58 +201,166 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
|
|
|
232
201
|
}
|
|
233
202
|
}
|
|
234
203
|
|
|
235
|
-
@ReactMethod
|
|
236
204
|
public void setUserAge(int age) {
|
|
237
205
|
Repro.setUserAge(age);
|
|
238
206
|
}
|
|
239
207
|
|
|
240
|
-
|
|
208
|
+
public void onlySetIfAbsentStringUserProfile(String key, String value) {
|
|
209
|
+
Repro.onlySetIfAbsentStringUserProfile(key, value);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
public void onlySetIfAbsentIntUserProfile(String key, int value) {
|
|
213
|
+
Repro.onlySetIfAbsentIntUserProfile(key, value);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
public void onlySetIfAbsentDoubleUserProfile(String key, double value) {
|
|
217
|
+
Repro.onlySetIfAbsentDoubleUserProfile(key, value);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
public void onlySetIfAbsentDateUserProfile(String key, String value) {
|
|
221
|
+
try{
|
|
222
|
+
String isoTime = value.replace("Z", "+00:00");
|
|
223
|
+
Date date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").parse(isoTime);
|
|
224
|
+
Repro.onlySetIfAbsentDateUserProfile(key, date);
|
|
225
|
+
}
|
|
226
|
+
catch(Exception e) {
|
|
227
|
+
Log.e("Repro", "Wrong formatted date String: " + value);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
public void incrementIntUserProfileBy(String key, int value) {
|
|
232
|
+
Repro.incrementIntUserProfileBy(key, value);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
public void decrementIntUserProfileBy(String key, int value) {
|
|
236
|
+
Repro.decrementIntUserProfileBy(key, value);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
public void incrementDoubleUserProfileBy(String key, double value) {
|
|
240
|
+
Repro.incrementDoubleUserProfileBy(key, value);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
public void decrementDoubleUserProfileBy(String key, double value) {
|
|
244
|
+
Repro.decrementDoubleUserProfileBy(key, value);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
public void onlySetIfAbsentUserGender(final int gender) {
|
|
248
|
+
if (BuildConfig.DEBUG) {
|
|
249
|
+
Repro.onlySetIfAbsentUserGender(UserProfileGender.values()[gender]);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
try {
|
|
253
|
+
Repro.onlySetIfAbsentUserGender(UserProfileGender.values()[gender]);
|
|
254
|
+
}
|
|
255
|
+
catch(ArrayIndexOutOfBoundsException exception) {
|
|
256
|
+
Log.e("Repro", "Wrong gender selected. Allowed values are GENDER_MALE, GENDER_FEMALE and GENDER_OTHER.");
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
public void onlySetIfAbsentUserEmailAddress(String email) {
|
|
261
|
+
Repro.onlySetIfAbsentUserEmailAddress(email);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
public void onlySetIfAbsentUserResidencePrefecture(final int prefecture) {
|
|
265
|
+
if (BuildConfig.DEBUG) {
|
|
266
|
+
Repro.onlySetIfAbsentUserResidencePrefecture(UserProfilePrefecture.values()[prefecture - 1]);
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
try {
|
|
270
|
+
Repro.onlySetIfAbsentUserResidencePrefecture(UserProfilePrefecture.values()[prefecture - 1]);
|
|
271
|
+
}
|
|
272
|
+
catch (ArrayIndexOutOfBoundsException exception) {
|
|
273
|
+
Log.e("Repro", "Wrong prefecture selected.");
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
public void onlySetIfAbsentUserDateOfBirth(final String value) {
|
|
278
|
+
try{
|
|
279
|
+
String isoTime = value.replace("Z", "+00:00");
|
|
280
|
+
Date date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").parse(isoTime);
|
|
281
|
+
Repro.onlySetIfAbsentUserDateOfBirth(date);
|
|
282
|
+
}
|
|
283
|
+
catch(Exception e) {
|
|
284
|
+
Log.e("Repro", "onlySetIfAbsentUserDateOfBirth: Wrong formatted date String: " + value);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
public void onlySetIfAbsentUserAge(int age) {
|
|
289
|
+
Repro.onlySetIfAbsentUserAge(age);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
public void incrementUserAgeBy(int value) {
|
|
293
|
+
Repro.incrementUserAgeBy(value);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
public void decrementUserAgeBy(int value) {
|
|
297
|
+
Repro.decrementUserAgeBy(value);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
public void deleteUserProfile(String key) {
|
|
301
|
+
Repro.deleteUserProfile(key);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
public void deleteUserGender() {
|
|
305
|
+
Repro.deleteUserGender();
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
public void deleteUserEmailAddress() {
|
|
309
|
+
Repro.deleteUserEmailAddress();
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
public void deleteUserResidencePrefecture() {
|
|
313
|
+
Repro.deleteUserResidencePrefecture();
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
public void deleteUserDateOfBirth() {
|
|
317
|
+
Repro.deleteUserDateOfBirth();
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
public void deleteUserAge() {
|
|
321
|
+
Repro.deleteUserAge();
|
|
322
|
+
}
|
|
323
|
+
|
|
241
324
|
public void getDeviceID(Callback callback) {
|
|
242
325
|
callback.invoke(null, Repro.getDeviceID());
|
|
243
326
|
}
|
|
244
327
|
|
|
245
|
-
@ReactMethod
|
|
246
328
|
public void disableInAppMessagesOnForegroundTransition() {
|
|
247
329
|
Repro.disableInAppMessagesOnForegroundTransition();
|
|
248
330
|
}
|
|
249
331
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
332
|
+
public void enableInAppMessagesOnForegroundTransition(Activity activity) {
|
|
333
|
+
Repro.enableInAppMessagesOnForegroundTransition(activity);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
public void setPushDeviceTokenString(final String deviceTokenHexString) {
|
|
337
|
+
Repro.setPushRegistrationID(deviceTokenHexString);
|
|
253
338
|
}
|
|
254
339
|
|
|
255
|
-
@ReactMethod
|
|
256
340
|
public void setPushRegistrationID(final String pushRegId) {
|
|
257
341
|
Repro.setPushRegistrationID(pushRegId);
|
|
258
342
|
}
|
|
259
343
|
|
|
260
|
-
@ReactMethod
|
|
261
344
|
public void setPushToken(final String token) {
|
|
262
345
|
Repro.setPushRegistrationID(token);
|
|
263
346
|
}
|
|
264
347
|
|
|
265
|
-
@ReactMethod
|
|
266
348
|
public void enablePushNotification() {
|
|
267
349
|
Repro.enablePushNotification();
|
|
268
350
|
}
|
|
269
351
|
|
|
270
|
-
@ReactMethod
|
|
271
352
|
public void linkLineID(final String lineUserId, final String lineChannelId) {
|
|
272
353
|
Repro.linkLineID(lineUserId, lineChannelId);
|
|
273
354
|
}
|
|
274
355
|
|
|
275
|
-
@ReactMethod
|
|
276
356
|
public void unlinkLineID(final String lineUserId, final String lineChannelId) {
|
|
277
357
|
Repro.unlinkLineID(lineUserId, lineChannelId);
|
|
278
358
|
}
|
|
279
359
|
|
|
280
|
-
|
|
281
|
-
public void _handleWebViewUrl(String requestUrl) {
|
|
282
|
-
// NOTE: use bool return value when changing to new react native arch
|
|
360
|
+
public void _webviewJavaScriptOpenUrlHandler(String requestUrl) {
|
|
283
361
|
Repro._webviewJavaScriptOpenUrlHandler(requestUrl);
|
|
284
362
|
}
|
|
285
363
|
|
|
286
|
-
@ReactMethod
|
|
287
364
|
public void track(final String name, final ReadableMap properties) {
|
|
288
365
|
if (properties == null) {
|
|
289
366
|
Repro.track(name);
|
|
@@ -292,7 +369,6 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
|
|
|
292
369
|
}
|
|
293
370
|
}
|
|
294
371
|
|
|
295
|
-
@ReactMethod
|
|
296
372
|
public void trackViewContent(final String contentId, final ReadableMap props) {
|
|
297
373
|
ViewContentProperties properties = new ViewContentProperties();
|
|
298
374
|
|
|
@@ -305,7 +381,6 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
|
|
|
305
381
|
Repro.trackViewContent(contentId, properties);
|
|
306
382
|
}
|
|
307
383
|
|
|
308
|
-
@ReactMethod
|
|
309
384
|
public void trackSearch(final ReadableMap props) {
|
|
310
385
|
SearchProperties properties = new SearchProperties();
|
|
311
386
|
|
|
@@ -319,7 +394,6 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
|
|
|
319
394
|
Repro.trackSearch(properties);
|
|
320
395
|
}
|
|
321
396
|
|
|
322
|
-
@ReactMethod
|
|
323
397
|
public void trackAddToWishlist(final ReadableMap props) {
|
|
324
398
|
AddToWishlistProperties properties = new AddToWishlistProperties();
|
|
325
399
|
|
|
@@ -333,7 +407,6 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
|
|
|
333
407
|
Repro.trackAddToWishlist(properties);
|
|
334
408
|
}
|
|
335
409
|
|
|
336
|
-
@ReactMethod
|
|
337
410
|
public void trackAddToCart(final String contentId, final ReadableMap props) {
|
|
338
411
|
AddToCartProperties properties = new AddToCartProperties();
|
|
339
412
|
|
|
@@ -346,7 +419,6 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
|
|
|
346
419
|
Repro.trackAddToCart(contentId, properties);
|
|
347
420
|
}
|
|
348
421
|
|
|
349
|
-
@ReactMethod
|
|
350
422
|
public void trackInitiateCheckout(final ReadableMap props) {
|
|
351
423
|
InitiateCheckoutProperties properties = new InitiateCheckoutProperties();
|
|
352
424
|
|
|
@@ -361,7 +433,6 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
|
|
|
361
433
|
Repro.trackInitiateCheckout(properties);
|
|
362
434
|
}
|
|
363
435
|
|
|
364
|
-
@ReactMethod
|
|
365
436
|
public void trackAddPaymentInfo(final ReadableMap props) {
|
|
366
437
|
AddPaymentInfoProperties properties = new AddPaymentInfoProperties();
|
|
367
438
|
|
|
@@ -374,7 +445,6 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
|
|
|
374
445
|
Repro.trackAddPaymentInfo(properties);
|
|
375
446
|
}
|
|
376
447
|
|
|
377
|
-
@ReactMethod
|
|
378
448
|
public void trackPurchase(final String contentId, final double value, final String currency, final ReadableMap props) {
|
|
379
449
|
PurchaseProperties properties = new PurchaseProperties();
|
|
380
450
|
|
|
@@ -386,7 +456,6 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
|
|
|
386
456
|
Repro.trackPurchase(contentId, value, currency, properties);
|
|
387
457
|
}
|
|
388
458
|
|
|
389
|
-
@ReactMethod
|
|
390
459
|
public void trackShare(final ReadableMap props) {
|
|
391
460
|
ShareProperties properties = new ShareProperties();
|
|
392
461
|
|
|
@@ -399,7 +468,6 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
|
|
|
399
468
|
Repro.trackShare(properties);
|
|
400
469
|
}
|
|
401
470
|
|
|
402
|
-
@ReactMethod
|
|
403
471
|
public void trackCompleteRegistration(final ReadableMap props) {
|
|
404
472
|
CompleteRegistrationProperties properties = new CompleteRegistrationProperties();
|
|
405
473
|
|
|
@@ -412,7 +480,6 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
|
|
|
412
480
|
Repro.trackCompleteRegistration(properties);
|
|
413
481
|
}
|
|
414
482
|
|
|
415
|
-
@ReactMethod
|
|
416
483
|
public void trackLead(final ReadableMap props) {
|
|
417
484
|
LeadProperties properties = new LeadProperties();
|
|
418
485
|
|
|
@@ -425,7 +492,6 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
|
|
|
425
492
|
Repro.trackLead(properties);
|
|
426
493
|
}
|
|
427
494
|
|
|
428
|
-
@ReactMethod
|
|
429
495
|
public void trackNotificationOpened(final String notificationId) {
|
|
430
496
|
Repro.trackNotificationOpened(notificationId);
|
|
431
497
|
}
|
|
@@ -476,8 +542,83 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
|
|
|
476
542
|
return array;
|
|
477
543
|
}
|
|
478
544
|
|
|
479
|
-
|
|
480
|
-
|
|
545
|
+
private WritableArray toWritableArrayForNewArchitecture(List<NewsFeedEntry> entries) {
|
|
546
|
+
WritableArray array = new WritableNativeArray();
|
|
547
|
+
|
|
548
|
+
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.US);
|
|
549
|
+
format.setTimeZone(TimeZone.getTimeZone("gmt"));
|
|
550
|
+
|
|
551
|
+
for (NewsFeedEntry entry : entries) {
|
|
552
|
+
WritableMap entryMap = Arguments.createMap();
|
|
553
|
+
|
|
554
|
+
String linkUrl;
|
|
555
|
+
if (entry.linkUrl == null) {
|
|
556
|
+
linkUrl = "";
|
|
557
|
+
} else {
|
|
558
|
+
linkUrl = entry.linkUrl.toString().equals("null") ? "" : entry.linkUrl.toString();
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
String imageUrl;
|
|
562
|
+
if (entry.imageUrl == null) {
|
|
563
|
+
imageUrl = "";
|
|
564
|
+
} else {
|
|
565
|
+
imageUrl = entry.imageUrl.toString().equals("null") ? "" : entry.imageUrl.toString();
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
entryMap.putDouble("id", entry.id);
|
|
569
|
+
entryMap.putString("deviceID", entry.deviceID);
|
|
570
|
+
entryMap.putString("title", entry.title.equals("null") ? null : entry.title);
|
|
571
|
+
entryMap.putString("summary", entry.summary.equals("null") ? null : entry.summary);
|
|
572
|
+
entryMap.putString("body", entry.body.equals("null") ? null : entry.body);
|
|
573
|
+
entryMap.putInt("campaignType", convertCampaignTypeToInt(entry.campaignType));
|
|
574
|
+
|
|
575
|
+
entryMap.putBoolean("shown", entry.shown);
|
|
576
|
+
entryMap.putBoolean("read", entry.read);
|
|
577
|
+
|
|
578
|
+
entryMap.putString("deliveredAt", format.format(entry.deliveredAt));
|
|
579
|
+
|
|
580
|
+
entryMap.putString("linkUrl", linkUrl);
|
|
581
|
+
entryMap.putString("linkUrlString", entry.linkUrlString);
|
|
582
|
+
entryMap.putString("imageUrl", imageUrl);
|
|
583
|
+
entryMap.putString("imageUrlString", entry.imageUrlString);
|
|
584
|
+
|
|
585
|
+
array.pushMap(entryMap);
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
return array;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
private JSONObject toNewsFeedEntryJsonObject(Map<String, Object> map) {
|
|
592
|
+
Map<String, Object> newsFeedEntryMap = new HashMap<>();
|
|
593
|
+
|
|
594
|
+
newsFeedEntryMap.put("newsfeed_id", map.get("id"));
|
|
595
|
+
newsFeedEntryMap.put("device_id", map.get("deviceID"));
|
|
596
|
+
newsFeedEntryMap.put("title", map.get("title"));
|
|
597
|
+
newsFeedEntryMap.put("summary", map.get("summary"));
|
|
598
|
+
newsFeedEntryMap.put("body", map.get("body"));
|
|
599
|
+
newsFeedEntryMap.put("shown", map.get("shown"));
|
|
600
|
+
newsFeedEntryMap.put("read", map.get("read"));
|
|
601
|
+
newsFeedEntryMap.put("delivered_at", map.get("deliveredAt"));
|
|
602
|
+
newsFeedEntryMap.put("campaign_type", map.get("campaignType"));
|
|
603
|
+
newsFeedEntryMap.put("link_url", map.get("linkUrl"));
|
|
604
|
+
newsFeedEntryMap.put("image_url", map.get("imageUrl"));
|
|
605
|
+
|
|
606
|
+
return new JSONObject(newsFeedEntryMap);
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
public void getNewsFeeds(final int limit, Callback callback) {
|
|
610
|
+
NewsFeedCampaignType type = NewsFeedCampaignType.PushNotification;
|
|
611
|
+
|
|
612
|
+
try {
|
|
613
|
+
callback.invoke(null, toWritableArrayForNewArchitecture(Repro.getNewsFeeds(limit, type)));
|
|
614
|
+
} catch (Exception e) {
|
|
615
|
+
WritableMap entryMap = Arguments.createMap();
|
|
616
|
+
entryMap.putString("message", e.getMessage());
|
|
617
|
+
callback.invoke(entryMap, null);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
public void oldArchGetNewsFeeds(final int limit, final int campaignType, Callback callback) {
|
|
481
622
|
NewsFeedCampaignType type = convertCampaignTypeFromInt(campaignType);
|
|
482
623
|
|
|
483
624
|
try {
|
|
@@ -489,8 +630,19 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
|
|
|
489
630
|
}
|
|
490
631
|
}
|
|
491
632
|
|
|
492
|
-
|
|
493
|
-
|
|
633
|
+
public void getNewsFeedsFor(final int limit, final int offsetID, Callback callback) {
|
|
634
|
+
NewsFeedCampaignType type = NewsFeedCampaignType.PushNotification;
|
|
635
|
+
|
|
636
|
+
try {
|
|
637
|
+
callback.invoke(null, toWritableArrayForNewArchitecture(Repro.getNewsFeeds(limit, offsetID, type)));
|
|
638
|
+
} catch (Exception e) {
|
|
639
|
+
WritableMap entryMap = Arguments.createMap();
|
|
640
|
+
entryMap.putString("message", e.getMessage());
|
|
641
|
+
callback.invoke(entryMap, null);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
public void oldArchGetNewsFeedsFor(final int limit, final int offsetID, final int campaignType, Callback callback) {
|
|
494
646
|
NewsFeedCampaignType type = convertCampaignTypeFromInt(campaignType);
|
|
495
647
|
|
|
496
648
|
try {
|
|
@@ -502,10 +654,52 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
|
|
|
502
654
|
}
|
|
503
655
|
}
|
|
504
656
|
|
|
505
|
-
|
|
657
|
+
public void getNewsFeedsWithCampaignType(final int limit, final int campaignType, Callback callback) {
|
|
658
|
+
NewsFeedCampaignType type = convertCampaignTypeFromInt(campaignType);
|
|
659
|
+
|
|
660
|
+
try {
|
|
661
|
+
callback.invoke(null, toWritableArrayForNewArchitecture(Repro.getNewsFeeds(limit, type)));
|
|
662
|
+
} catch (Exception e) {
|
|
663
|
+
WritableMap entryMap = Arguments.createMap();
|
|
664
|
+
entryMap.putString("message", e.getMessage());
|
|
665
|
+
callback.invoke(entryMap, null);
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
public void getNewsFeedsWithCampaignTypeFor(final int limit, final int offsetID, final int campaignType, Callback callback) {
|
|
670
|
+
NewsFeedCampaignType type = convertCampaignTypeFromInt(campaignType);
|
|
671
|
+
|
|
672
|
+
try {
|
|
673
|
+
callback.invoke(null, toWritableArrayForNewArchitecture(Repro.getNewsFeeds(limit, offsetID, type)));
|
|
674
|
+
} catch (Exception e) {
|
|
675
|
+
WritableMap entryMap = Arguments.createMap();
|
|
676
|
+
entryMap.putString("message", e.getMessage());
|
|
677
|
+
callback.invoke(entryMap, null);
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
|
|
506
681
|
public void updateNewsFeeds(ReadableArray array, Callback callback) {
|
|
507
682
|
List<NewsFeedEntry> entries = new ArrayList<>();
|
|
508
683
|
|
|
684
|
+
for (int i = 0; i < array.size() ; i++) {
|
|
685
|
+
Map<String, Object> map = array.getMap(i).toHashMap();
|
|
686
|
+
JSONObject json = toNewsFeedEntryJsonObject(map);
|
|
687
|
+
entries.add(new NewsFeedEntry(json));
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
try {
|
|
691
|
+
Repro.updateNewsFeeds(entries);
|
|
692
|
+
callback.invoke(null, null);
|
|
693
|
+
} catch(Exception e) {
|
|
694
|
+
WritableMap error = Arguments.createMap();
|
|
695
|
+
error.putString("message", e.getMessage());
|
|
696
|
+
callback.invoke(error);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
public void oldArchUpdateNewsFeeds(ReadableArray array, Callback callback) {
|
|
701
|
+
List<NewsFeedEntry> entries = new ArrayList<>();
|
|
702
|
+
|
|
509
703
|
for (int i = 0; i < array.size() ; i++) {
|
|
510
704
|
Map<String, Object> map = array.getMap(i).toHashMap();
|
|
511
705
|
JSONObject json = new JSONObject(map);
|
|
@@ -514,6 +708,7 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
|
|
|
514
708
|
|
|
515
709
|
try {
|
|
516
710
|
Repro.updateNewsFeeds(entries);
|
|
711
|
+
callback.invoke(null, null);
|
|
517
712
|
} catch(Exception e) {
|
|
518
713
|
WritableMap error = Arguments.createMap();
|
|
519
714
|
error.putString("message", e.getMessage());
|
|
@@ -550,6 +745,3 @@ public class ReproReactBridgeModule extends ReactContextBaseJavaModule {
|
|
|
550
745
|
return CAMPAIGN_TYPE_UNKNOWN;
|
|
551
746
|
}
|
|
552
747
|
}
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|