From 3bf3b175ce7644f62d8a4e8479a4e9e7d3dce643 Mon Sep 17 00:00:00 2001 From: bluecco Date: Tue, 14 Nov 2023 17:02:42 +0100 Subject: [PATCH] fix: expose check for argent mobile inApp browser --- src/connectors/argentMobile/helpers/inAppBrowser.ts | 13 +++++++++++++ src/connectors/argentMobile/helpers/index.ts | 1 + src/connectors/argentMobile/index.ts | 2 ++ 3 files changed, 16 insertions(+) create mode 100644 src/connectors/argentMobile/helpers/inAppBrowser.ts create mode 100644 src/connectors/argentMobile/helpers/index.ts diff --git a/src/connectors/argentMobile/helpers/inAppBrowser.ts b/src/connectors/argentMobile/helpers/inAppBrowser.ts new file mode 100644 index 0000000..77f21a2 --- /dev/null +++ b/src/connectors/argentMobile/helpers/inAppBrowser.ts @@ -0,0 +1,13 @@ +import type { StarknetWindowObject } from "get-starknet-core" + +export const isInArgentMobileAppBrowser = (): boolean => { + if (!window?.starknet_argentX) { + return false + } + + const starknetMobile = window?.starknet_argentX as StarknetWindowObject & { + isInAppBrowser: boolean + } + + return starknetMobile?.isInAppBrowser +} diff --git a/src/connectors/argentMobile/helpers/index.ts b/src/connectors/argentMobile/helpers/index.ts new file mode 100644 index 0000000..bfe3f22 --- /dev/null +++ b/src/connectors/argentMobile/helpers/index.ts @@ -0,0 +1 @@ +export * from "./inAppBrowser" diff --git a/src/connectors/argentMobile/index.ts b/src/connectors/argentMobile/index.ts index f97206c..e1939d8 100644 --- a/src/connectors/argentMobile/index.ts +++ b/src/connectors/argentMobile/index.ts @@ -184,3 +184,5 @@ export class ArgentMobileConnector extends Connector { }) } } + +export { isInArgentMobileAppBrowser } from "./helpers"