react-native-insider 6.4.1-nh → 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 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, '10.0'
12
- s.source = {:http => 'https://mobilesdk.useinsider.com/iOS/13.4.0/InsiderMobileIOSFramework.zip'}
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.0'
18
- s.dependency 'InsiderGeofence', '1.1.0'
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
@@ -0,0 +1,7 @@
1
+ # Security Policy
2
+
3
+ ## Reporting a Vulnerability
4
+
5
+ To securely report a vulnerability, please [Contact us!](mailto:security@useinsider.com?subject=[GitHub]_Vulnerability!).
6
+
7
+ <!-- E26CADE3-DF7C-4FF8-A30A-4DD2F28E06BF -->
@@ -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.2-nh')
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'
@@ -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;
@@ -767,4 +772,42 @@ public class RNInsiderModule extends ReactContextBaseJavaModule {
767
772
 
768
773
  @ReactMethod
769
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
+ }
770
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 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-insider",
3
- "version": "6.4.1-nh",
3
+ "version": "6.4.2-nh",
4
4
  "description": "React Native Insider SDK",
5
5
  "main": "index.js",
6
6
  "keywords": [