react-native-insider 6.4.1 → 6.4.2-nh
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/RNInsider.podspec +4 -4
- package/SECURITY.MD +7 -0
- package/android/build.gradle +1 -5
- package/android/src/main/java/com/useinsider/react/RNInsiderModule.java +43 -4
- package/index.js +25 -0
- package/ios/RNInsider/RNInsider.m +30 -0
- package/ios/RNInsider/RNNotificationHandler.h +1 -0
- package/ios/RNInsider/RNNotificationHandler.m +2 -1
- package/package.json +1 -1
package/RNInsider.podspec
CHANGED
|
@@ -8,13 +8,13 @@ Pod::Spec.new do |s|
|
|
|
8
8
|
s.homepage = package_json['homepage']
|
|
9
9
|
s.authors = package_json['author']
|
|
10
10
|
s.license = 'MIT'
|
|
11
|
-
s.platform = :ios, '
|
|
12
|
-
s.source = {:http => 'https://mobilesdk.useinsider.com/iOS/13.4.
|
|
11
|
+
s.platform = :ios, '12.0'
|
|
12
|
+
s.source = {:http => 'https://mobilesdk.useinsider.com/iOS/13.4.1/InsiderMobileIOSFramework.zip'}
|
|
13
13
|
s.source_files = 'ios/RNInsider/*.{h,m}'
|
|
14
14
|
s.requires_arc = true
|
|
15
15
|
s.static_framework = true
|
|
16
16
|
s.dependency 'React'
|
|
17
|
-
s.dependency 'InsiderMobile', '13.4.
|
|
18
|
-
s.dependency 'InsiderGeofence', '1.1.
|
|
17
|
+
s.dependency 'InsiderMobile', '13.4.1'
|
|
18
|
+
s.dependency 'InsiderGeofence', '1.1.1'
|
|
19
19
|
s.dependency 'InsiderHybrid', '1.4.0'
|
|
20
20
|
end
|
package/SECURITY.MD
ADDED
package/android/build.gradle
CHANGED
|
@@ -35,7 +35,7 @@ repositories {
|
|
|
35
35
|
|
|
36
36
|
dependencies {
|
|
37
37
|
implementation "com.facebook.react:react-native:${getVersionFromPartner('reactNativeVersion', '+')}"
|
|
38
|
-
implementation ('com.useinsider:insider:14.2.
|
|
38
|
+
implementation ('com.useinsider:insider:14.2.3-nh')
|
|
39
39
|
implementation ('com.useinsider:insiderhybrid:1.1.5')
|
|
40
40
|
|
|
41
41
|
implementation 'androidx.security:security-crypto:1.1.0-alpha06'
|
|
@@ -45,8 +45,4 @@ dependencies {
|
|
|
45
45
|
implementation 'com.google.android.gms:play-services-location:21.0.1'
|
|
46
46
|
implementation 'com.google.android.play:review:2.0.1'
|
|
47
47
|
implementation 'com.google.firebase:firebase-messaging:23.0.5'
|
|
48
|
-
|
|
49
|
-
implementation 'com.huawei.hms:push:6.5.0.300'
|
|
50
|
-
implementation 'com.huawei.hms:ads-identifier:3.4.39.302'
|
|
51
|
-
implementation 'com.huawei.hms:location:6.4.0.300'
|
|
52
48
|
}
|
|
@@ -26,6 +26,7 @@ import com.useinsider.insider.MessageCenterData;
|
|
|
26
26
|
import com.useinsider.insider.RecommendationEngine;
|
|
27
27
|
import com.useinsider.insiderhybrid.InsiderHybrid;
|
|
28
28
|
import com.useinsider.insiderhybrid.constants.InsiderHybridMethods;
|
|
29
|
+
import com.useinsider.insider.InsiderIDListener;
|
|
29
30
|
|
|
30
31
|
import org.json.JSONArray;
|
|
31
32
|
import org.json.JSONObject;
|
|
@@ -34,11 +35,15 @@ import java.util.ArrayList;
|
|
|
34
35
|
import java.util.HashMap;
|
|
35
36
|
import java.util.Map;
|
|
36
37
|
|
|
38
|
+
import com.facebook.react.bridge.Promise;
|
|
39
|
+
|
|
37
40
|
public class RNInsiderModule extends ReactContextBaseJavaModule {
|
|
38
41
|
|
|
39
42
|
private final ReactApplicationContext reactContext;
|
|
40
43
|
private boolean isCoreInited = false;
|
|
41
44
|
|
|
45
|
+
private InsiderIDListener insiderIDListener;
|
|
46
|
+
|
|
42
47
|
public RNInsiderModule(ReactApplicationContext reactContext) {
|
|
43
48
|
super(reactContext);
|
|
44
49
|
this.reactContext = reactContext;
|
|
@@ -651,10 +656,6 @@ public class RNInsiderModule extends ReactContextBaseJavaModule {
|
|
|
651
656
|
}
|
|
652
657
|
String provider = Insider.Instance.getCurrentProvider(reactContext);
|
|
653
658
|
switch (provider) {
|
|
654
|
-
case "huawei":
|
|
655
|
-
com.huawei.hms.push.RemoteMessage hmsRemoteMessage = new com.huawei.hms.push.RemoteMessage.Builder("insider").setData(remoteMessageStringMap).build();
|
|
656
|
-
Insider.Instance.handleHMSNotification(reactContext, hmsRemoteMessage);
|
|
657
|
-
break;
|
|
658
659
|
case "other":
|
|
659
660
|
case "google":
|
|
660
661
|
RemoteMessage fcmRemoteMessage = new RemoteMessage.Builder("insider").setData(remoteMessageStringMap).build();
|
|
@@ -771,4 +772,42 @@ public class RNInsiderModule extends ReactContextBaseJavaModule {
|
|
|
771
772
|
|
|
772
773
|
@ReactMethod
|
|
773
774
|
public void setForegroundPushCallback() {}
|
|
775
|
+
|
|
776
|
+
@ReactMethod
|
|
777
|
+
public void getInsiderID(final Promise promise) {
|
|
778
|
+
try {
|
|
779
|
+
promise.resolve(Insider.Instance.getInsiderID());
|
|
780
|
+
} catch (Exception e) {
|
|
781
|
+
Insider.Instance.putException(e);
|
|
782
|
+
|
|
783
|
+
promise.resolve(null);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
@ReactMethod
|
|
788
|
+
public void registerInsiderIDListener() {
|
|
789
|
+
try {
|
|
790
|
+
if (insiderIDListener == null) {
|
|
791
|
+
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
|
792
|
+
@Override
|
|
793
|
+
public void run() {
|
|
794
|
+
insiderIDListener = new InsiderIDListener() {
|
|
795
|
+
DeviceEventManagerModule.RCTDeviceEventEmitter emitter = getReactApplicationContext()
|
|
796
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class);
|
|
797
|
+
|
|
798
|
+
@Override
|
|
799
|
+
public void onUpdated(String insiderID) {
|
|
800
|
+
emitter.emit("INSIDER_ID_LISTENER", insiderID);
|
|
801
|
+
}
|
|
802
|
+
};
|
|
803
|
+
|
|
804
|
+
|
|
805
|
+
Insider.Instance.registerInsiderIDListener(insiderIDListener);
|
|
806
|
+
}
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
} catch (Exception e) {
|
|
810
|
+
Insider.Instance.putException(e);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
774
813
|
}
|
package/index.js
CHANGED
|
@@ -18,6 +18,7 @@ const TEMP_STORE_ADDED_TO_CART = 'TEMP_STORE_ADDED_TO_CART';
|
|
|
18
18
|
const TEMP_STORE_CUSTOM_ACTION = 'TEMP_STORE_CUSTOM_ACTION';
|
|
19
19
|
const FOREGROUND_PUSH = 'FOREGROUND_PUSH';
|
|
20
20
|
const INAPP_SEEN = 'INAPP_SEEN';
|
|
21
|
+
const INSIDER_ID_LISTENER = 'INSIDER_ID_LISTENER';
|
|
21
22
|
|
|
22
23
|
const platformType = {
|
|
23
24
|
ios: "ios",
|
|
@@ -463,4 +464,28 @@ export default class RNInsider {
|
|
|
463
464
|
Insider.putErrorLog(generateJSONErrorString(error));
|
|
464
465
|
}
|
|
465
466
|
}
|
|
467
|
+
|
|
468
|
+
static getInsiderID() {
|
|
469
|
+
try {
|
|
470
|
+
if (shouldNotProceed()) return;
|
|
471
|
+
|
|
472
|
+
return Insider.getInsiderID();
|
|
473
|
+
} catch (error) {
|
|
474
|
+
Insider.putErrorLog(generateJSONErrorString(error));
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
static insiderIDListener(callback) {
|
|
479
|
+
if (shouldNotProceed() || callback == undefined) return;
|
|
480
|
+
|
|
481
|
+
try {
|
|
482
|
+
Insider.registerInsiderIDListener();
|
|
483
|
+
|
|
484
|
+
eventHandler.addListener(INSIDER_ID_LISTENER, insiderID => {
|
|
485
|
+
callback(insiderID);
|
|
486
|
+
});
|
|
487
|
+
} catch (error) {
|
|
488
|
+
Insider.putErrorLog(generateJSONErrorString(error));
|
|
489
|
+
}
|
|
490
|
+
}
|
|
466
491
|
}
|
|
@@ -574,6 +574,36 @@ RCT_EXPORT_METHOD(reenableTemplates:(NSString *)value) {
|
|
|
574
574
|
}
|
|
575
575
|
}
|
|
576
576
|
|
|
577
|
+
RCT_EXPORT_METHOD(getInsiderID:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
|
|
578
|
+
@try {
|
|
579
|
+
resolve([Insider getInsiderID]);
|
|
580
|
+
} @catch (NSException *exception) {
|
|
581
|
+
[Insider sendError:exception desc:[NSString stringWithFormat:@"%s:%d", __func__, __LINE__]];
|
|
582
|
+
|
|
583
|
+
resolve(nil);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
RCT_EXPORT_METHOD(registerInsiderIDListener) {
|
|
588
|
+
@try {
|
|
589
|
+
[Insider registerInsiderIDListenerWithSelector:@selector(insiderIDChangeListener:) sender:self];
|
|
590
|
+
} @catch (NSException *e) {
|
|
591
|
+
[Insider sendError:e desc:[NSString stringWithFormat:@"%s:%d", __func__, __LINE__]];
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
-(void)insiderIDChangeListener:(NSString *) insiderID {
|
|
596
|
+
@try {
|
|
597
|
+
if (insiderID == nil) return;
|
|
598
|
+
|
|
599
|
+
RNNotificationHandler *handler = [[RNNotificationHandler alloc] init];
|
|
600
|
+
|
|
601
|
+
[handler sendDataToJS:INSIDER_ID_LISTENER data:insiderID];
|
|
602
|
+
} @catch (NSException *e){
|
|
603
|
+
[Insider sendError:e desc:[NSString stringWithFormat:@"%s:%d", __func__, __LINE__]];
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
|
|
577
607
|
-(void)foregroundPushCallback:(UNNotification *) notification {
|
|
578
608
|
@try {
|
|
579
609
|
if (notification == nil) return;
|
|
@@ -22,6 +22,7 @@ extern NSString * const TEMP_STORE_ADDED_TO_CART;
|
|
|
22
22
|
extern NSString * const TEMP_STORE_CUSTOM_ACTION;
|
|
23
23
|
extern NSString * const INAPP_SEEN;
|
|
24
24
|
extern NSString * const FOREGROUND_PUSH;
|
|
25
|
+
extern NSString * const INSIDER_ID_LISTENER;
|
|
25
26
|
|
|
26
27
|
-(void)sendDataToJS:(NSString *)eventName data:(NSDictionary *)data;
|
|
27
28
|
@end
|
|
@@ -22,6 +22,7 @@ NSString * const TEMP_STORE_ADDED_TO_CART = @"TEMP_STORE_ADDED_TO_CART";
|
|
|
22
22
|
NSString * const TEMP_STORE_CUSTOM_ACTION = @"TEMP_STORE_CUSTOM_ACTION";
|
|
23
23
|
NSString * const INAPP_SEEN = @"INAPP_SEEN";
|
|
24
24
|
NSString * const FOREGROUND_PUSH = @"FOREGROUND_PUSH";
|
|
25
|
+
NSString * const INSIDER_ID_LISTENER = @"INSIDER_ID_LISTENER";
|
|
25
26
|
|
|
26
27
|
static RNNotificationHandler *notificationHandler;
|
|
27
28
|
|
|
@@ -40,7 +41,7 @@ static RNNotificationHandler *notificationHandler;
|
|
|
40
41
|
RCT_EXPORT_MODULE();
|
|
41
42
|
|
|
42
43
|
-(NSArray<NSString *> *)supportedEvents{
|
|
43
|
-
return @[NOTIFICATION_OPEN, INAPP_BUTTON_CLICK, TEMP_STORE_PURCHASE, TEMP_STORE_ADDED_TO_CART, TEMP_STORE_CUSTOM_ACTION, INAPP_SEEN, FOREGROUND_PUSH];
|
|
44
|
+
return @[NOTIFICATION_OPEN, INAPP_BUTTON_CLICK, TEMP_STORE_PURCHASE, TEMP_STORE_ADDED_TO_CART, TEMP_STORE_CUSTOM_ACTION, INAPP_SEEN, FOREGROUND_PUSH, INSIDER_ID_LISTENER];
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
-(void)sendDataToJS:(NSString *)eventName data:(NSDictionary *)data {
|