@btsd/aitu-bridge 0.3.4 → 0.3.42

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
@@ -37,6 +37,8 @@ interface GetMeResponse {
37
37
  id: string;
38
38
  avatar?: string;
39
39
  avatarThumb?: string;
40
+ notifications_allowed: boolean;
41
+ private_messaging_enabled: boolean;
40
42
  sign: string;
41
43
  }
42
44
 
@@ -74,6 +76,11 @@ interface GetUserProfileResponse {
74
76
  avatarThumb?: string;
75
77
  }
76
78
 
79
+ interface CheckBiometryResponse {
80
+ data: boolean;
81
+ error?: string
82
+ }
83
+
77
84
  const MAX_HEADER_MENU_ITEMS_COUNT = 3;
78
85
 
79
86
  export enum HeaderMenuIcon {
@@ -148,6 +155,7 @@ export interface AituBridge {
148
155
  setCustomBackArrowVisible: (visible: boolean) => Promise<ResponseType>;
149
156
  openPayment: (transactionId: string) => Promise<ResponseType>;
150
157
  setCustomBackArrowOnClickHandler: (handler: BackArrowClickHandlerType) => void;
158
+ checkBiometry: () => Promise<CheckBiometryResponse>;
151
159
  }
152
160
 
153
161
  const invokeMethod = 'invoke';
@@ -175,6 +183,7 @@ const getCustomBackArrowModeMethod = 'getCustomBackArrowMode';
175
183
  const setCustomBackArrowVisibleMethod = 'setCustomBackArrowVisible';
176
184
  const openPaymentMethod = 'openPayment'
177
185
  const setCustomBackArrowOnClickHandlerMethod = 'setCustomBackArrowOnClickHandler';
186
+ const checkBiometryMethod = 'checkBiometry';
178
187
 
179
188
  const android = typeof window !== 'undefined' && (window as any).AndroidBridge;
180
189
  const ios = typeof window !== 'undefined' && (window as any).webkit && (window as any).webkit.messageHandlers;
@@ -189,7 +198,7 @@ const buildBridge = (): AituBridge => {
189
198
  })
190
199
 
191
200
  window.addEventListener('message', (e) => {
192
- if(typeof e.data !== 'string') {
201
+ if (typeof e.data !== 'string') {
193
202
  return;
194
203
  }
195
204
 
@@ -619,6 +628,21 @@ const buildBridge = (): AituBridge => {
619
628
  }
620
629
  }
621
630
 
631
+ const checkBiometry = (reqId) => {
632
+ const isAndroid = android && android[checkBiometryMethod];
633
+ const isIos = ios && ios[checkBiometryMethod];
634
+
635
+ if (isAndroid) {
636
+ android[checkBiometryMethod](reqId);
637
+ } else if (isIos) {
638
+ ios[checkBiometryMethod].postMessage({ reqId });
639
+ } else if (web) {
640
+ web.execute(checkBiometryMethod, reqId);
641
+ } else if (typeof window !== 'undefined') {
642
+ console.log('--checkBiometry-isUnknown');
643
+ }
644
+ }
645
+
622
646
 
623
647
  const invokePromise = promisifyInvoke(invoke, sub);
624
648
  const storagePromise = promisifyStorage(storage, sub);
@@ -641,6 +665,7 @@ const buildBridge = (): AituBridge => {
641
665
  const getCustomBackArrowModePromise = promisifyMethod(getCustomBackArrowMode, getCustomBackArrowModeMethod, sub);
642
666
  const setCustomBackArrowVisiblePromise = promisifyMethod(setCustomBackArrowVisible, setCustomBackArrowVisibleMethod, sub);
643
667
  const openPaymentPromise = promisifyMethod(openPayment, openPaymentMethod, sub);
668
+ const checkBiometryPromise = promisifyMethod(checkBiometry, checkBiometryMethod, sub);
644
669
 
645
670
  return {
646
671
  version: String(LIB_VERSION),
@@ -680,6 +705,7 @@ const buildBridge = (): AituBridge => {
680
705
  setCustomBackArrowVisible: setCustomBackArrowVisiblePromise,
681
706
  openPayment: openPaymentPromise,
682
707
  setCustomBackArrowOnClickHandler,
708
+ checkBiometry: checkBiometryPromise,
683
709
  }
684
710
  }
685
711
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const LIB_VERSION = "0.3.4";
1
+ export const LIB_VERSION = "0.3.42";