Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Make all referrer info sync (#4782)

authored by

Hailey and committed by
GitHub
306f1626 f021c064

+26 -28
+4 -4
modules/expo-bluesky-swiss-army/android/src/main/java/expo/modules/blueskyswissarmy/referrer/ExpoBlueskyReferrerModule.kt
··· 23 23 activityReferrer = appContext.currentActivity?.referrer 24 24 } 25 25 26 - AsyncFunction("getReferrerInfoAsync") { 26 + Function("getReferrerInfo") { 27 27 val intentReferrer = 28 28 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { 29 29 intent?.getParcelableExtra(Intent.EXTRA_REFERRER, Uri::class.java) ··· 40 40 "hostname" to intentReferrer.host, 41 41 ) 42 42 intent = null 43 - return@AsyncFunction res 43 + return@Function res 44 44 } 45 45 46 46 // In all other cases, we'll just record the app that sent the intent. ··· 52 52 "hostname" to (activityReferrer?.host ?: ""), 53 53 ) 54 54 activityReferrer = null 55 - return@AsyncFunction res 55 + return@Function res 56 56 } 57 57 58 - return@AsyncFunction null 58 + return@Function null 59 59 } 60 60 61 61 AsyncFunction("getGooglePlayReferrerInfoAsync") { promise: Promise ->
+2 -2
modules/expo-bluesky-swiss-army/src/Referrer/index.android.ts
··· 8 8 return NativeModule.getGooglePlayReferrerInfoAsync() 9 9 } 10 10 11 - export function getReferrerInfoAsync(): Promise<ReferrerInfo | null> { 12 - return NativeModule.getReferrerInfoAsync() 11 + export function getReferrerInfo(): Promise<ReferrerInfo | null> { 12 + return NativeModule.getReferrerInfo() 13 13 }
+2 -2
modules/expo-bluesky-swiss-army/src/Referrer/index.ios.ts
··· 6 6 throw new NotImplementedError() 7 7 } 8 8 9 - export function getReferrerInfoAsync(): Promise<ReferrerInfo | null> { 9 + export function getReferrerInfo(): ReferrerInfo | null { 10 10 const referrer = SharedPrefs.getString('referrer') 11 11 if (referrer) { 12 12 SharedPrefs.removeValue('referrer') ··· 19 19 } catch (e) { 20 20 return { 21 21 referrer, 22 - hostname: undefined, 22 + hostname: referrer, 23 23 } 24 24 } 25 25 }
+1 -1
modules/expo-bluesky-swiss-army/src/Referrer/index.ts
··· 5 5 throw new NotImplementedError() 6 6 } 7 7 8 - export function getReferrerInfoAsync(): Promise<ReferrerInfo | null> { 8 + export function getReferrerInfo(): ReferrerInfo | null { 9 9 throw new NotImplementedError() 10 10 }
+1 -1
modules/expo-bluesky-swiss-army/src/Referrer/index.web.ts
··· 7 7 throw new NotImplementedError() 8 8 } 9 9 10 - export async function getReferrerInfoAsync(): Promise<ReferrerInfo | null> { 10 + export function getReferrerInfo(): ReferrerInfo | null { 11 11 if ( 12 12 Platform.OS === 'web' && 13 13 // for ssr
+8 -9
src/Navigation.tsx
··· 771 771 }) 772 772 773 773 if (isWeb) { 774 - Referrer.getReferrerInfoAsync().then(info => { 775 - if (info && info.hostname !== 'bsky.app') { 776 - logEvent('deepLink:referrerReceived', { 777 - to: window.location.href, 778 - referrer: info?.referrer, 779 - hostname: info?.hostname, 780 - }) 781 - } 782 - }) 774 + const referrerInfo = Referrer.getReferrerInfo() 775 + if (referrerInfo && referrerInfo.hostname !== 'bsky.app') { 776 + logEvent('deepLink:referrerReceived', { 777 + to: window.location.href, 778 + referrer: referrerInfo?.referrer, 779 + hostname: referrerInfo?.hostname, 780 + }) 781 + } 783 782 } 784 783 785 784 if (__DEV__) {
+8 -9
src/lib/hooks/useIntentHandler.ts
··· 18 18 19 19 React.useEffect(() => { 20 20 const handleIncomingURL = (url: string) => { 21 - Referrer.getReferrerInfoAsync().then(info => { 22 - if (info && info.hostname !== 'bsky.app') { 23 - logEvent('deepLink:referrerReceived', { 24 - to: url, 25 - referrer: info?.referrer, 26 - hostname: info?.hostname, 27 - }) 28 - } 29 - }) 21 + const referrerInfo = Referrer.getReferrerInfo() 22 + if (referrerInfo && referrerInfo.hostname !== 'bsky.app') { 23 + logEvent('deepLink:referrerReceived', { 24 + to: url, 25 + referrer: referrerInfo?.referrer, 26 + hostname: referrerInfo?.hostname, 27 + }) 28 + } 30 29 31 30 // We want to be able to support bluesky:// deeplinks. It's unnatural for someone to use a deeplink with three 32 31 // slashes, like bluesky:///intent/follow. However, supporting just two slashes causes us to have to take care