From 464a3e871c832a18e743b9c8206e08fa93ba2c87 Mon Sep 17 00:00:00 2001 From: 0xAsimetriq <3154053+0xAsimetriq@users.noreply.github.com> Date: Tue, 12 Sep 2023 15:31:24 +0300 Subject: [PATCH] [v3] Image fixes, android improvements (#1329) --- packages/core/src/controllers/ApiController.ts | 4 ++-- packages/core/src/utils/CoreHelperUtil.ts | 12 ++++++++++++ .../src/partials/w3m-connecting-wc-mobile/index.ts | 3 ++- packages/ui/src/components/wui-image/index.ts | 8 +------- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/packages/core/src/controllers/ApiController.ts b/packages/core/src/controllers/ApiController.ts index 680bcf34d0..9ab7516c1c 100644 --- a/packages/core/src/controllers/ApiController.ts +++ b/packages/core/src/controllers/ApiController.ts @@ -162,7 +162,7 @@ export const ApiController = { }) const images = data.map(w => w.image_id).filter(Boolean) await Promise.allSettled([ - (images as string[]).map(id => ApiController._fetchWalletImage(id)), + ...(images as string[]).map(id => ApiController._fetchWalletImage(id)), CoreHelperUtil.wait(300) ]) state.wallets = [...state.wallets, ...data] @@ -186,7 +186,7 @@ export const ApiController = { }) const images = data.map(w => w.image_id).filter(Boolean) await Promise.allSettled([ - (images as string[]).map(id => ApiController._fetchWalletImage(id)), + ...(images as string[]).map(id => ApiController._fetchWalletImage(id)), CoreHelperUtil.wait(300) ]) state.search = data diff --git a/packages/core/src/utils/CoreHelperUtil.ts b/packages/core/src/utils/CoreHelperUtil.ts index b7349706f4..281be3b106 100644 --- a/packages/core/src/utils/CoreHelperUtil.ts +++ b/packages/core/src/utils/CoreHelperUtil.ts @@ -13,6 +13,18 @@ export const CoreHelperUtil = { return false }, + isAndroid() { + const ua = navigator.userAgent.toLowerCase() + + return CoreHelperUtil.isMobile() && ua.includes('android') + }, + + isIos() { + const ua = navigator.userAgent.toLowerCase() + + return CoreHelperUtil.isMobile() && (ua.includes('iphone') || ua.includes('ipad')) + }, + isClient() { return typeof window !== 'undefined' }, diff --git a/packages/scaffold/src/partials/w3m-connecting-wc-mobile/index.ts b/packages/scaffold/src/partials/w3m-connecting-wc-mobile/index.ts index a064ffeeed..fef9262c33 100644 --- a/packages/scaffold/src/partials/w3m-connecting-wc-mobile/index.ts +++ b/packages/scaffold/src/partials/w3m-connecting-wc-mobile/index.ts @@ -43,7 +43,8 @@ export class W3mConnectingWcMobile extends W3mConnectingWidget { } private onBuffering() { - if (document.visibilityState === 'visible' && !this.error) { + const isIos = CoreHelperUtil.isIos() + if (document.visibilityState === 'visible' && !this.error && isIos) { ConnectionController.setBuffering(true) setTimeout(() => { ConnectionController.setBuffering(false) diff --git a/packages/ui/src/components/wui-image/index.ts b/packages/ui/src/components/wui-image/index.ts index 0ab596cfa9..0a33c65116 100644 --- a/packages/ui/src/components/wui-image/index.ts +++ b/packages/ui/src/components/wui-image/index.ts @@ -14,13 +14,7 @@ export class WuiImage extends LitElement { // -- Render -------------------------------------------- // public override render() { - return html`${this.alt}` + return html`${this.alt}` } }