@btsd/aitu-bridge 0.3.44 → 0.3.46

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/src/index.ts CHANGED
@@ -88,7 +88,8 @@ export enum HeaderMenuIcon {
88
88
  Error = "Error",
89
89
  Person = "Person",
90
90
  Sort = "Sort",
91
- Filter = "Filter"
91
+ Filter = "Filter",
92
+ Close = "Close"
92
93
  }
93
94
 
94
95
  interface HeaderMenuItem {
@@ -151,6 +152,7 @@ export interface AituBridge {
151
152
  openPayment: (transactionId: string) => Promise<ResponseType>;
152
153
  setCustomBackArrowOnClickHandler: (handler: BackArrowClickHandlerType) => void;
153
154
  checkBiometry: () => Promise<ResponseType>;
155
+ openExternalUrl: (url: string) => Promise<ResponseType>;
154
156
  }
155
157
 
156
158
  const invokeMethod = 'invoke';
@@ -179,6 +181,7 @@ const setCustomBackArrowVisibleMethod = 'setCustomBackArrowVisible';
179
181
  const openPaymentMethod = 'openPayment'
180
182
  const setCustomBackArrowOnClickHandlerMethod = 'setCustomBackArrowOnClickHandler';
181
183
  const checkBiometryMethod = 'checkBiometry';
184
+ const openExternalUrlMethod = 'openExternalUrl';
182
185
 
183
186
  const android = typeof window !== 'undefined' && (window as any).AndroidBridge;
184
187
  const ios = typeof window !== 'undefined' && (window as any).webkit && (window as any).webkit.messageHandlers;
@@ -622,6 +625,19 @@ const buildBridge = (): AituBridge => {
622
625
  }
623
626
  }
624
627
 
628
+ const openExternalUrl = (reqId, url: string) => {
629
+ const isAndroid = android && android[openExternalUrlMethod];
630
+ const isIos = ios && ios[openExternalUrlMethod];
631
+
632
+ if (isAndroid) {
633
+ android[openExternalUrlMethod](reqId, url);
634
+ } else if (isIos) {
635
+ ios[openExternalUrlMethod].postMessage({ reqId, url });
636
+ } else {
637
+ console.log("--openExternalUrlMethod-isUnknown");
638
+ }
639
+ };
640
+
625
641
 
626
642
  const invokePromise = promisifyInvoke(invoke, sub);
627
643
  const storagePromise = promisifyStorage(storage, sub);
@@ -645,6 +661,7 @@ const buildBridge = (): AituBridge => {
645
661
  const setCustomBackArrowVisiblePromise = promisifyMethod(setCustomBackArrowVisible, setCustomBackArrowVisibleMethod, sub);
646
662
  const openPaymentPromise = promisifyMethod(openPayment, openPaymentMethod, sub);
647
663
  const checkBiometryPromise = promisifyMethod(checkBiometry, checkBiometryMethod, sub);
664
+ const openExternalUrlPromise = promisifyMethod(openExternalUrl, openExternalUrlMethod, sub);
648
665
 
649
666
  return {
650
667
  version: String(LIB_VERSION),
@@ -657,12 +674,15 @@ const buildBridge = (): AituBridge => {
657
674
  getGeo: getGeoPromise,
658
675
  getQr: getQrPromise,
659
676
  getSMSCode: getSMSCodePromise,
660
- getUserProfile: (id: string) => invokePromise(EInvokeRequest.getUserProfile, { id }),
677
+ getUserProfile: (id: string) =>
678
+ invokePromise(EInvokeRequest.getUserProfile, { id }),
661
679
  selectContact: selectContactPromise,
662
680
  enableNotifications,
663
681
  disableNotifications,
664
- enablePrivateMessaging: (appId: string) => invokePromise(EInvokeRequest.enablePrivateMessaging, { appId }),
665
- disablePrivateMessaging: (appId: string) => invokePromise(EInvokeRequest.disablePrivateMessaging, { appId }),
682
+ enablePrivateMessaging: (appId: string) =>
683
+ invokePromise(EInvokeRequest.enablePrivateMessaging, { appId }),
684
+ disablePrivateMessaging: (appId: string) =>
685
+ invokePromise(EInvokeRequest.disablePrivateMessaging, { appId }),
666
686
  openSettings: openSettingsPromise,
667
687
  closeApplication: closeApplicationPromise,
668
688
  setTitle: setTitlePromise,
@@ -685,7 +705,8 @@ const buildBridge = (): AituBridge => {
685
705
  openPayment: openPaymentPromise,
686
706
  setCustomBackArrowOnClickHandler,
687
707
  checkBiometry: checkBiometryPromise,
688
- }
708
+ openExternalUrl: openExternalUrlPromise,
709
+ };
689
710
  }
690
711
 
691
712
  const bridge = buildBridge();
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const LIB_VERSION = "0.3.44";
1
+ export const LIB_VERSION = "0.3.46";