From 1c1d45ba5a3bd3a452856fdfab583f5af93f6bd9 Mon Sep 17 00:00:00 2001 From: Hailey Date: Thu, 11 Jul 2024 19:47:54 -0700 Subject: [PATCH] lol --- .../src/Referrer/index.web.ts | 43 +++++++++---------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/modules/expo-bluesky-swiss-army/src/Referrer/index.web.ts b/modules/expo-bluesky-swiss-army/src/Referrer/index.web.ts index 99fa884c63..c092a67e73 100644 --- a/modules/expo-bluesky-swiss-army/src/Referrer/index.web.ts +++ b/modules/expo-bluesky-swiss-army/src/Referrer/index.web.ts @@ -7,30 +7,27 @@ export function getGooglePlayReferrerInfoAsync(): Promise { - // Returning a promise to match the functionality on native - return new Promise(resolve => { - if ( - Platform.OS === 'web' && - // for ssr - typeof document !== 'undefined' && - document != null && - document.referrer - ) { - try { - const url = new URL(document.referrer) - if (url.hostname !== 'bsky.app') { - resolve({ - referrer: url.href, - hostname: url.hostname, - }) +export async function getReferrerInfoAsync(): Promise { + if ( + Platform.OS === 'web' && + // for ssr + typeof document !== 'undefined' && + document != null && + document.referrer + ) { + try { + const url = new URL(document.referrer) + if (url.hostname !== 'bsky.app') { + return { + referrer: url.href, + hostname: url.hostname, } - } catch { - // If something happens to the URL parsing, we don't want to actually cause any problems for the user. Just - // log the error so we might catch it - console.error('Failed to parse referrer URL') } + } catch { + // If something happens to the URL parsing, we don't want to actually cause any problems for the user. Just + // log the error so we might catch it + console.error('Failed to parse referrer URL') } - resolve(null) - }) + } + return null }