react-native-firework-sdk 1.2.0 → 1.2.1

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.
@@ -7,4 +7,5 @@ interface FWNavigatorInterface {
7
7
 
8
8
  fun pushNativeContainer(props: ReadableMap?, promise: Promise)
9
9
  fun popNativeContainer(promise: Promise)
10
+ fun canPopNativeContainer(promise: Promise)
10
11
  }
@@ -1,9 +1,9 @@
1
1
  package com.fireworksdk.bridge.reactnative.module
2
2
 
3
+ import android.app.Activity
3
4
  import com.facebook.react.bridge.*
4
5
  import com.fireworksdk.bridge.reactnative.FWInitializationProvider
5
6
  import com.fireworksdk.bridge.reactnative.models.FWNavigatorInterface
6
- import com.fireworksdk.bridge.reactnative.pages.FWContainerActivity
7
7
  import com.fireworksdk.bridge.reactnative.utils.FWEventUtils
8
8
  import com.fireworksdk.bridge.utils.FWLogUtils
9
9
 
@@ -27,7 +27,7 @@ class FWNavigatorModule(
27
27
  return
28
28
  }
29
29
 
30
- if (activity !is FWContainerActivity) {
30
+ if (isTaskRoot(activity)) {
31
31
  promise.resolve(false)
32
32
  return
33
33
  }
@@ -38,6 +38,16 @@ class FWNavigatorModule(
38
38
  promise.resolve(true)
39
39
  }
40
40
 
41
+ @ReactMethod
42
+ override fun canPopNativeContainer(promise: Promise) {
43
+ val activity = FWInitializationProvider.INSTANCE.resumedActivity
44
+ if (activity == null) {
45
+ promise.resolve(false)
46
+ return
47
+ }
48
+ promise.resolve(!isTaskRoot(activity))
49
+ }
50
+
41
51
  @ReactMethod
42
52
  fun addListener(eventName: String?, promise: Promise) {
43
53
  // Set up any upstream listeners or background tasks as necessary
@@ -52,6 +62,13 @@ class FWNavigatorModule(
52
62
  promise.resolve(Arguments.createMap())
53
63
  }
54
64
 
65
+ private fun isTaskRoot(activity: Activity):Boolean {
66
+ if (activity.isTaskRoot) {
67
+ return true
68
+ }
69
+ return false
70
+ }
71
+
55
72
  override fun getName(): String {
56
73
  return "FWNavigatorModule"
57
74
  }
@@ -13,5 +13,6 @@
13
13
 
14
14
  RCT_EXTERN_METHOD(pushNativeContainer:(NSDictionary *)props resolver:(RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter)
15
15
  RCT_EXTERN_METHOD(popNativeContainer:(RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter)
16
+ RCT_EXTERN_METHOD(canPopNativeContainer:(RCTPromiseResolveBlock)resolver rejecter:(RCTPromiseRejectBlock)rejecter)
16
17
 
17
18
  @end
@@ -70,16 +70,44 @@ class FWNavigatorModule: RCTEventEmitter, FWNavigator {
70
70
  }
71
71
 
72
72
  @objc(popNativeContainer:rejecter:)
73
- func popNativeContainer(resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock) {
73
+ func popNativeContainer(_ resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock) {
74
74
  DispatchQueue.main.async {
75
- if let presentedVC = RCTPresentedViewController() as? FWNavigatorContainerViewController {
76
- presentedVC.dismiss(animated: true) {
75
+ if let navigatorContainerVC = RCTPresentedViewController() as? FWNavigatorContainerViewController,
76
+ navigatorContainerVC.presentingViewController != nil {
77
+ navigatorContainerVC.dismiss(animated: true) {
77
78
  resolver(true)
78
79
  }
79
80
  } else if let cartViewController = gCartViewController {
80
81
  cartViewController.navigationController?.popViewController(animated: true)
81
82
  gCartViewController = nil
82
83
  resolver(true)
84
+ } else if let presentedVC = RCTPresentedViewController(),
85
+ let presentingVC = presentedVC.presentingViewController {
86
+ if presentedVC.modalPresentationStyle == .custom,
87
+ presentingVC is FireworkVideo.PlayerViewController {
88
+ // For consistency with Android SDK behavior
89
+ (presentingVC.presentingViewController ?? presentingVC).dismiss(animated: true) {
90
+ resolver(true)
91
+ }
92
+ } else {
93
+ presentedVC.dismiss(animated: true) {
94
+ resolver(true)
95
+ }
96
+ }
97
+ } else {
98
+ resolver(false)
99
+ }
100
+ }
101
+ }
102
+
103
+ @objc(canPopNativeContainer:rejecter:)
104
+ func canPopNativeContainer(_ resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock) {
105
+ DispatchQueue.main.async {
106
+ if let presentedVC = RCTPresentedViewController(),
107
+ presentedVC.presentingViewController != nil {
108
+ resolver(true)
109
+ } else if let _ = gCartViewController {
110
+ resolver(true)
83
111
  } else {
84
112
  resolver(false)
85
113
  }
@@ -9,5 +9,6 @@ import Foundation
9
9
 
10
10
  protocol FWNavigator {
11
11
  func pushNativeContainer(_ props: NSDictionary?, resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock)
12
- func popNativeContainer(resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock)
12
+ func popNativeContainer(_ resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock)
13
+ func canPopNativeContainer(_ resolver: @escaping RCTPromiseResolveBlock, rejecter: @escaping RCTPromiseRejectBlock)
13
14
  }
@@ -48,7 +48,7 @@ class FWNavigator {
48
48
  return _FWNavigatorModule.default.pushNativeContainer(props);
49
49
  }
50
50
  /**
51
- * Pop top-most native container. The native container embed the RN page.
51
+ * Pop top-most native container.
52
52
  * @returns {Promise<boolean>} The result of poping top-most native container.
53
53
  */
54
54
 
@@ -56,6 +56,15 @@ class FWNavigator {
56
56
  popNativeContainer() {
57
57
  return _FWNavigatorModule.default.popNativeContainer();
58
58
  }
59
+ /**
60
+ * Indicate if we can pop top-most native container.
61
+ * @returns {Promise<boolean>} If the result is true, we could call popNativeContainer to pop top-most native container.
62
+ */
63
+
64
+
65
+ canPopNativeContainer() {
66
+ return _FWNavigatorModule.default.canPopNativeContainer();
67
+ }
59
68
 
60
69
  }
61
70
 
@@ -1 +1 @@
1
- {"version":3,"sources":["FWNavigator.tsx"],"names":["FWNavigator","getInstance","_instance","constructor","FWNavigatorModuleEventEmitter","addListener","FWEventName","LogMessage","pushNativeContainer","props","FWLoggerUtil","log","FWNavigatorModule","popNativeContainer"],"mappings":";;;;;;;AAAA;;AACA;;AAGA;;;;;;;;;;AAMA;AACA;AACA;AACA,MAAMA,WAAN,CAAkB;AAGS,SAAXC,WAAW,GAAgB;AACvC,QAAI,CAACD,WAAW,CAACE,SAAjB,EAA4B;AAC1BF,MAAAA,WAAW,CAACE,SAAZ,GAAwB,IAAIF,WAAJ,EAAxB;AACD;;AACD,WAAOA,WAAW,CAACE,SAAnB;AACD;;AAEOC,EAAAA,WAAW,GAAG;AACpBC,qDAA8BC,WAA9B,CAA0CC,yBAAYC,UAAtD,EAAkE,MAAM,CAAE,CAA1E;AACD;AAED;AACF;AACA;AACA;AACA;AACA;;;AACSC,EAAAA,mBAAmB,CAACC,KAAD,EAAkD;AAC1EC,0BAAaC,GAAb,CAAkB,8BAAlB;;AAEA,WAAOC,2BAAkBJ,mBAAlB,CAAsCC,KAAtC,CAAP;AACD;AAED;AACF;AACA;AACA;;;AACSI,EAAAA,kBAAkB,GAAqB;AAC5C,WAAOD,2BAAkBC,kBAAlB,EAAP;AACD;;AAhCe;;gBAAZb,W;;eAmCSA,W","sourcesContent":["import { FWEventName } from './models/FWEventName';\nimport FWNavigatorModule, {\n FWNavigatorModuleEventEmitter,\n} from './modules/FWNavigatorModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\n\ntype FWNativeContainerProps = {\n [key: string]: any;\n};\n\n/**\n * You can use this class for pushing RN page from the native page.\n */\nclass FWNavigator {\n private static _instance?: FWNavigator;\n\n public static getInstance(): FWNavigator {\n if (!FWNavigator._instance) {\n FWNavigator._instance = new FWNavigator();\n }\n return FWNavigator._instance!;\n }\n\n private constructor() {\n FWNavigatorModuleEventEmitter.addListener(FWEventName.LogMessage, () => {});\n }\n\n /**\n * Push a new native container. We will render your app component in new native container.\n * Please set your app component name through FireworkSDK.getInstance().appComponentName before calling this method\n * @param {FWNativeContainerProps} props We will pass the props to your app component.\n * @returns {Promise<boolean>} The result of pushing RN page from native page.\n */\n public pushNativeContainer(props: FWNativeContainerProps): Promise<boolean> {\n FWLoggerUtil.log(`Enter pushNewNativeContainer`);\n\n return FWNavigatorModule.pushNativeContainer(props);\n }\n\n /**\n * Pop top-most native container. The native container embed the RN page.\n * @returns {Promise<boolean>} The result of poping top-most native container.\n */\n public popNativeContainer(): Promise<boolean> {\n return FWNavigatorModule.popNativeContainer();\n }\n}\n\nexport default FWNavigator;\n"]}
1
+ {"version":3,"sources":["FWNavigator.tsx"],"names":["FWNavigator","getInstance","_instance","constructor","FWNavigatorModuleEventEmitter","addListener","FWEventName","LogMessage","pushNativeContainer","props","FWLoggerUtil","log","FWNavigatorModule","popNativeContainer","canPopNativeContainer"],"mappings":";;;;;;;AAAA;;AACA;;AAGA;;;;;;;;;;AAMA;AACA;AACA;AACA,MAAMA,WAAN,CAAkB;AAGS,SAAXC,WAAW,GAAgB;AACvC,QAAI,CAACD,WAAW,CAACE,SAAjB,EAA4B;AAC1BF,MAAAA,WAAW,CAACE,SAAZ,GAAwB,IAAIF,WAAJ,EAAxB;AACD;;AACD,WAAOA,WAAW,CAACE,SAAnB;AACD;;AAEOC,EAAAA,WAAW,GAAG;AACpBC,qDAA8BC,WAA9B,CAA0CC,yBAAYC,UAAtD,EAAkE,MAAM,CAAE,CAA1E;AACD;AAED;AACF;AACA;AACA;AACA;AACA;;;AACSC,EAAAA,mBAAmB,CAACC,KAAD,EAAkD;AAC1EC,0BAAaC,GAAb,CAAkB,8BAAlB;;AAEA,WAAOC,2BAAkBJ,mBAAlB,CAAsCC,KAAtC,CAAP;AACD;AAED;AACF;AACA;AACA;;;AACSI,EAAAA,kBAAkB,GAAqB;AAC5C,WAAOD,2BAAkBC,kBAAlB,EAAP;AACD;AAED;AACF;AACA;AACA;;;AACSC,EAAAA,qBAAqB,GAAqB;AAC/C,WAAOF,2BAAkBE,qBAAlB,EAAP;AACD;;AAxCe;;gBAAZd,W;;eA2CSA,W","sourcesContent":["import { FWEventName } from './models/FWEventName';\nimport FWNavigatorModule, {\n FWNavigatorModuleEventEmitter,\n} from './modules/FWNavigatorModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\n\ntype FWNativeContainerProps = {\n [key: string]: any;\n};\n\n/**\n * You can use this class for pushing RN page from the native page.\n */\nclass FWNavigator {\n private static _instance?: FWNavigator;\n\n public static getInstance(): FWNavigator {\n if (!FWNavigator._instance) {\n FWNavigator._instance = new FWNavigator();\n }\n return FWNavigator._instance!;\n }\n\n private constructor() {\n FWNavigatorModuleEventEmitter.addListener(FWEventName.LogMessage, () => {});\n }\n\n /**\n * Push a new native container. We will render your app component in new native container.\n * Please set your app component name through FireworkSDK.getInstance().appComponentName before calling this method\n * @param {FWNativeContainerProps} props We will pass the props to your app component.\n * @returns {Promise<boolean>} The result of pushing RN page from native page.\n */\n public pushNativeContainer(props: FWNativeContainerProps): Promise<boolean> {\n FWLoggerUtil.log(`Enter pushNewNativeContainer`);\n\n return FWNavigatorModule.pushNativeContainer(props);\n }\n\n /**\n * Pop top-most native container.\n * @returns {Promise<boolean>} The result of poping top-most native container.\n */\n public popNativeContainer(): Promise<boolean> {\n return FWNavigatorModule.popNativeContainer();\n }\n\n /**\n * Indicate if we can pop top-most native container.\n * @returns {Promise<boolean>} If the result is true, we could call popNativeContainer to pop top-most native container.\n */\n public canPopNativeContainer(): Promise<boolean> {\n return FWNavigatorModule.canPopNativeContainer();\n }\n}\n\nexport default FWNavigator;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["FWNavigatorModule.ts"],"names":["FWNavigatorModule","NativeModules","Proxy","get","Error","LINKING_ERROR","FWNavigatorModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA,MAAMA,iBAAiB,GAAGC,2BAAcD,iBAAd,GACtBC,2BAAcD,iBADQ,GAEtB,IAAIE,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUC,6BAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAeA,MAAMC,6BAA6B,GAAG,IAAIC,+BAAJ,CAAuBP,iBAAvB,CAAtC;;eAEeA,iB","sourcesContent":["import { NativeEventEmitter, NativeModule } from 'react-native';\nimport { NativeModules } from 'react-native';\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\n\nconst FWNavigatorModule = NativeModules.FWNavigatorModule\n ? NativeModules.FWNavigatorModule\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\ninterface IFWNavigatorModule extends NativeModule {\n pushNativeContainer(props: { [key: string]: any }): Promise<boolean>;\n popNativeContainer(): Promise<boolean>;\n}\n\nconst FWNavigatorModuleEventEmitter = new NativeEventEmitter(FWNavigatorModule);\nexport { FWNavigatorModuleEventEmitter };\nexport default FWNavigatorModule as IFWNavigatorModule;\n"]}
1
+ {"version":3,"sources":["FWNavigatorModule.ts"],"names":["FWNavigatorModule","NativeModules","Proxy","get","Error","LINKING_ERROR","FWNavigatorModuleEventEmitter","NativeEventEmitter"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA,MAAMA,iBAAiB,GAAGC,2BAAcD,iBAAd,GACtBC,2BAAcD,iBADQ,GAEtB,IAAIE,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUC,6BAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAgBA,MAAMC,6BAA6B,GAAG,IAAIC,+BAAJ,CAAuBP,iBAAvB,CAAtC;;eAEeA,iB","sourcesContent":["import { NativeEventEmitter, NativeModule } from 'react-native';\nimport { NativeModules } from 'react-native';\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\n\nconst FWNavigatorModule = NativeModules.FWNavigatorModule\n ? NativeModules.FWNavigatorModule\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\ninterface IFWNavigatorModule extends NativeModule {\n pushNativeContainer(props: { [key: string]: any }): Promise<boolean>;\n popNativeContainer(): Promise<boolean>;\n canPopNativeContainer(): Promise<boolean>;\n}\n\nconst FWNavigatorModuleEventEmitter = new NativeEventEmitter(FWNavigatorModule);\nexport { FWNavigatorModuleEventEmitter };\nexport default FWNavigatorModule as IFWNavigatorModule;\n"]}
@@ -32,7 +32,7 @@ class FWNavigator {
32
32
  return FWNavigatorModule.pushNativeContainer(props);
33
33
  }
34
34
  /**
35
- * Pop top-most native container. The native container embed the RN page.
35
+ * Pop top-most native container.
36
36
  * @returns {Promise<boolean>} The result of poping top-most native container.
37
37
  */
38
38
 
@@ -40,6 +40,15 @@ class FWNavigator {
40
40
  popNativeContainer() {
41
41
  return FWNavigatorModule.popNativeContainer();
42
42
  }
43
+ /**
44
+ * Indicate if we can pop top-most native container.
45
+ * @returns {Promise<boolean>} If the result is true, we could call popNativeContainer to pop top-most native container.
46
+ */
47
+
48
+
49
+ canPopNativeContainer() {
50
+ return FWNavigatorModule.canPopNativeContainer();
51
+ }
43
52
 
44
53
  }
45
54
 
@@ -1 +1 @@
1
- {"version":3,"sources":["FWNavigator.tsx"],"names":["FWEventName","FWNavigatorModule","FWNavigatorModuleEventEmitter","FWLoggerUtil","FWNavigator","getInstance","_instance","constructor","addListener","LogMessage","pushNativeContainer","props","log","popNativeContainer"],"mappings":";;AAAA,SAASA,WAAT,QAA4B,sBAA5B;AACA,OAAOC,iBAAP,IACEC,6BADF,QAEO,6BAFP;AAGA,OAAOC,YAAP,MAAyB,sBAAzB;;AAMA;AACA;AACA;AACA,MAAMC,WAAN,CAAkB;AAGS,SAAXC,WAAW,GAAgB;AACvC,QAAI,CAACD,WAAW,CAACE,SAAjB,EAA4B;AAC1BF,MAAAA,WAAW,CAACE,SAAZ,GAAwB,IAAIF,WAAJ,EAAxB;AACD;;AACD,WAAOA,WAAW,CAACE,SAAnB;AACD;;AAEOC,EAAAA,WAAW,GAAG;AACpBL,IAAAA,6BAA6B,CAACM,WAA9B,CAA0CR,WAAW,CAACS,UAAtD,EAAkE,MAAM,CAAE,CAA1E;AACD;AAED;AACF;AACA;AACA;AACA;AACA;;;AACSC,EAAAA,mBAAmB,CAACC,KAAD,EAAkD;AAC1ER,IAAAA,YAAY,CAACS,GAAb,CAAkB,8BAAlB;AAEA,WAAOX,iBAAiB,CAACS,mBAAlB,CAAsCC,KAAtC,CAAP;AACD;AAED;AACF;AACA;AACA;;;AACSE,EAAAA,kBAAkB,GAAqB;AAC5C,WAAOZ,iBAAiB,CAACY,kBAAlB,EAAP;AACD;;AAhCe;;gBAAZT,W;;AAmCN,eAAeA,WAAf","sourcesContent":["import { FWEventName } from './models/FWEventName';\nimport FWNavigatorModule, {\n FWNavigatorModuleEventEmitter,\n} from './modules/FWNavigatorModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\n\ntype FWNativeContainerProps = {\n [key: string]: any;\n};\n\n/**\n * You can use this class for pushing RN page from the native page.\n */\nclass FWNavigator {\n private static _instance?: FWNavigator;\n\n public static getInstance(): FWNavigator {\n if (!FWNavigator._instance) {\n FWNavigator._instance = new FWNavigator();\n }\n return FWNavigator._instance!;\n }\n\n private constructor() {\n FWNavigatorModuleEventEmitter.addListener(FWEventName.LogMessage, () => {});\n }\n\n /**\n * Push a new native container. We will render your app component in new native container.\n * Please set your app component name through FireworkSDK.getInstance().appComponentName before calling this method\n * @param {FWNativeContainerProps} props We will pass the props to your app component.\n * @returns {Promise<boolean>} The result of pushing RN page from native page.\n */\n public pushNativeContainer(props: FWNativeContainerProps): Promise<boolean> {\n FWLoggerUtil.log(`Enter pushNewNativeContainer`);\n\n return FWNavigatorModule.pushNativeContainer(props);\n }\n\n /**\n * Pop top-most native container. The native container embed the RN page.\n * @returns {Promise<boolean>} The result of poping top-most native container.\n */\n public popNativeContainer(): Promise<boolean> {\n return FWNavigatorModule.popNativeContainer();\n }\n}\n\nexport default FWNavigator;\n"]}
1
+ {"version":3,"sources":["FWNavigator.tsx"],"names":["FWEventName","FWNavigatorModule","FWNavigatorModuleEventEmitter","FWLoggerUtil","FWNavigator","getInstance","_instance","constructor","addListener","LogMessage","pushNativeContainer","props","log","popNativeContainer","canPopNativeContainer"],"mappings":";;AAAA,SAASA,WAAT,QAA4B,sBAA5B;AACA,OAAOC,iBAAP,IACEC,6BADF,QAEO,6BAFP;AAGA,OAAOC,YAAP,MAAyB,sBAAzB;;AAMA;AACA;AACA;AACA,MAAMC,WAAN,CAAkB;AAGS,SAAXC,WAAW,GAAgB;AACvC,QAAI,CAACD,WAAW,CAACE,SAAjB,EAA4B;AAC1BF,MAAAA,WAAW,CAACE,SAAZ,GAAwB,IAAIF,WAAJ,EAAxB;AACD;;AACD,WAAOA,WAAW,CAACE,SAAnB;AACD;;AAEOC,EAAAA,WAAW,GAAG;AACpBL,IAAAA,6BAA6B,CAACM,WAA9B,CAA0CR,WAAW,CAACS,UAAtD,EAAkE,MAAM,CAAE,CAA1E;AACD;AAED;AACF;AACA;AACA;AACA;AACA;;;AACSC,EAAAA,mBAAmB,CAACC,KAAD,EAAkD;AAC1ER,IAAAA,YAAY,CAACS,GAAb,CAAkB,8BAAlB;AAEA,WAAOX,iBAAiB,CAACS,mBAAlB,CAAsCC,KAAtC,CAAP;AACD;AAED;AACF;AACA;AACA;;;AACSE,EAAAA,kBAAkB,GAAqB;AAC5C,WAAOZ,iBAAiB,CAACY,kBAAlB,EAAP;AACD;AAED;AACF;AACA;AACA;;;AACSC,EAAAA,qBAAqB,GAAqB;AAC/C,WAAOb,iBAAiB,CAACa,qBAAlB,EAAP;AACD;;AAxCe;;gBAAZV,W;;AA2CN,eAAeA,WAAf","sourcesContent":["import { FWEventName } from './models/FWEventName';\nimport FWNavigatorModule, {\n FWNavigatorModuleEventEmitter,\n} from './modules/FWNavigatorModule';\nimport FWLoggerUtil from './utils/FWLoggerUtil';\n\ntype FWNativeContainerProps = {\n [key: string]: any;\n};\n\n/**\n * You can use this class for pushing RN page from the native page.\n */\nclass FWNavigator {\n private static _instance?: FWNavigator;\n\n public static getInstance(): FWNavigator {\n if (!FWNavigator._instance) {\n FWNavigator._instance = new FWNavigator();\n }\n return FWNavigator._instance!;\n }\n\n private constructor() {\n FWNavigatorModuleEventEmitter.addListener(FWEventName.LogMessage, () => {});\n }\n\n /**\n * Push a new native container. We will render your app component in new native container.\n * Please set your app component name through FireworkSDK.getInstance().appComponentName before calling this method\n * @param {FWNativeContainerProps} props We will pass the props to your app component.\n * @returns {Promise<boolean>} The result of pushing RN page from native page.\n */\n public pushNativeContainer(props: FWNativeContainerProps): Promise<boolean> {\n FWLoggerUtil.log(`Enter pushNewNativeContainer`);\n\n return FWNavigatorModule.pushNativeContainer(props);\n }\n\n /**\n * Pop top-most native container.\n * @returns {Promise<boolean>} The result of poping top-most native container.\n */\n public popNativeContainer(): Promise<boolean> {\n return FWNavigatorModule.popNativeContainer();\n }\n\n /**\n * Indicate if we can pop top-most native container.\n * @returns {Promise<boolean>} If the result is true, we could call popNativeContainer to pop top-most native container.\n */\n public canPopNativeContainer(): Promise<boolean> {\n return FWNavigatorModule.canPopNativeContainer();\n }\n}\n\nexport default FWNavigator;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["FWNavigatorModule.ts"],"names":["NativeEventEmitter","NativeModules","LINKING_ERROR","FWNavigatorModule","Proxy","get","Error","FWNavigatorModuleEventEmitter"],"mappings":"AAAA,SAASA,kBAAT,QAAiD,cAAjD;AACA,SAASC,aAAT,QAA8B,cAA9B;AACA,SAASC,aAAT,QAA8B,6BAA9B;AAEA,MAAMC,iBAAiB,GAAGF,aAAa,CAACE,iBAAd,GACtBF,aAAa,CAACE,iBADQ,GAEtB,IAAIC,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUJ,aAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAeA,MAAMK,6BAA6B,GAAG,IAAIP,kBAAJ,CAAuBG,iBAAvB,CAAtC;AACA,SAASI,6BAAT;AACA,eAAeJ,iBAAf","sourcesContent":["import { NativeEventEmitter, NativeModule } from 'react-native';\nimport { NativeModules } from 'react-native';\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\n\nconst FWNavigatorModule = NativeModules.FWNavigatorModule\n ? NativeModules.FWNavigatorModule\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\ninterface IFWNavigatorModule extends NativeModule {\n pushNativeContainer(props: { [key: string]: any }): Promise<boolean>;\n popNativeContainer(): Promise<boolean>;\n}\n\nconst FWNavigatorModuleEventEmitter = new NativeEventEmitter(FWNavigatorModule);\nexport { FWNavigatorModuleEventEmitter };\nexport default FWNavigatorModule as IFWNavigatorModule;\n"]}
1
+ {"version":3,"sources":["FWNavigatorModule.ts"],"names":["NativeEventEmitter","NativeModules","LINKING_ERROR","FWNavigatorModule","Proxy","get","Error","FWNavigatorModuleEventEmitter"],"mappings":"AAAA,SAASA,kBAAT,QAAiD,cAAjD;AACA,SAASC,aAAT,QAA8B,cAA9B;AACA,SAASC,aAAT,QAA8B,6BAA9B;AAEA,MAAMC,iBAAiB,GAAGF,aAAa,CAACE,iBAAd,GACtBF,aAAa,CAACE,iBADQ,GAEtB,IAAIC,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUJ,aAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAgBA,MAAMK,6BAA6B,GAAG,IAAIP,kBAAJ,CAAuBG,iBAAvB,CAAtC;AACA,SAASI,6BAAT;AACA,eAAeJ,iBAAf","sourcesContent":["import { NativeEventEmitter, NativeModule } from 'react-native';\nimport { NativeModules } from 'react-native';\nimport { LINKING_ERROR } from '../constants/FWErrorMessage';\n\nconst FWNavigatorModule = NativeModules.FWNavigatorModule\n ? NativeModules.FWNavigatorModule\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\ninterface IFWNavigatorModule extends NativeModule {\n pushNativeContainer(props: { [key: string]: any }): Promise<boolean>;\n popNativeContainer(): Promise<boolean>;\n canPopNativeContainer(): Promise<boolean>;\n}\n\nconst FWNavigatorModuleEventEmitter = new NativeEventEmitter(FWNavigatorModule);\nexport { FWNavigatorModuleEventEmitter };\nexport default FWNavigatorModule as IFWNavigatorModule;\n"]}
@@ -16,9 +16,14 @@ declare class FWNavigator {
16
16
  */
17
17
  pushNativeContainer(props: FWNativeContainerProps): Promise<boolean>;
18
18
  /**
19
- * Pop top-most native container. The native container embed the RN page.
19
+ * Pop top-most native container.
20
20
  * @returns {Promise<boolean>} The result of poping top-most native container.
21
21
  */
22
22
  popNativeContainer(): Promise<boolean>;
23
+ /**
24
+ * Indicate if we can pop top-most native container.
25
+ * @returns {Promise<boolean>} If the result is true, we could call popNativeContainer to pop top-most native container.
26
+ */
27
+ canPopNativeContainer(): Promise<boolean>;
23
28
  }
24
29
  export default FWNavigator;
@@ -4,6 +4,7 @@ interface IFWNavigatorModule extends NativeModule {
4
4
  [key: string]: any;
5
5
  }): Promise<boolean>;
6
6
  popNativeContainer(): Promise<boolean>;
7
+ canPopNativeContainer(): Promise<boolean>;
7
8
  }
8
9
  declare const FWNavigatorModuleEventEmitter: NativeEventEmitter;
9
10
  export { FWNavigatorModuleEventEmitter };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-firework-sdk",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Firework React Native SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -38,12 +38,20 @@ class FWNavigator {
38
38
  }
39
39
 
40
40
  /**
41
- * Pop top-most native container. The native container embed the RN page.
41
+ * Pop top-most native container.
42
42
  * @returns {Promise<boolean>} The result of poping top-most native container.
43
43
  */
44
44
  public popNativeContainer(): Promise<boolean> {
45
45
  return FWNavigatorModule.popNativeContainer();
46
46
  }
47
+
48
+ /**
49
+ * Indicate if we can pop top-most native container.
50
+ * @returns {Promise<boolean>} If the result is true, we could call popNativeContainer to pop top-most native container.
51
+ */
52
+ public canPopNativeContainer(): Promise<boolean> {
53
+ return FWNavigatorModule.canPopNativeContainer();
54
+ }
47
55
  }
48
56
 
49
57
  export default FWNavigator;
@@ -15,6 +15,7 @@ const FWNavigatorModule = NativeModules.FWNavigatorModule
15
15
  interface IFWNavigatorModule extends NativeModule {
16
16
  pushNativeContainer(props: { [key: string]: any }): Promise<boolean>;
17
17
  popNativeContainer(): Promise<boolean>;
18
+ canPopNativeContainer(): Promise<boolean>;
18
19
  }
19
20
 
20
21
  const FWNavigatorModuleEventEmitter = new NativeEventEmitter(FWNavigatorModule);