Make all referrer info sync (#4782)
This commit is contained in:
parent
f021c06468
commit
306f162639
7 changed files with 26 additions and 28 deletions
|
@ -23,7 +23,7 @@ class ExpoBlueskyReferrerModule : Module() {
|
|||
activityReferrer = appContext.currentActivity?.referrer
|
||||
}
|
||||
|
||||
AsyncFunction("getReferrerInfoAsync") {
|
||||
Function("getReferrerInfo") {
|
||||
val intentReferrer =
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
intent?.getParcelableExtra(Intent.EXTRA_REFERRER, Uri::class.java)
|
||||
|
@ -40,7 +40,7 @@ class ExpoBlueskyReferrerModule : Module() {
|
|||
"hostname" to intentReferrer.host,
|
||||
)
|
||||
intent = null
|
||||
return@AsyncFunction res
|
||||
return@Function res
|
||||
}
|
||||
|
||||
// In all other cases, we'll just record the app that sent the intent.
|
||||
|
@ -52,10 +52,10 @@ class ExpoBlueskyReferrerModule : Module() {
|
|||
"hostname" to (activityReferrer?.host ?: ""),
|
||||
)
|
||||
activityReferrer = null
|
||||
return@AsyncFunction res
|
||||
return@Function res
|
||||
}
|
||||
|
||||
return@AsyncFunction null
|
||||
return@Function null
|
||||
}
|
||||
|
||||
AsyncFunction("getGooglePlayReferrerInfoAsync") { promise: Promise ->
|
||||
|
|
|
@ -8,6 +8,6 @@ export function getGooglePlayReferrerInfoAsync(): Promise<GooglePlayReferrerInfo
|
|||
return NativeModule.getGooglePlayReferrerInfoAsync()
|
||||
}
|
||||
|
||||
export function getReferrerInfoAsync(): Promise<ReferrerInfo | null> {
|
||||
return NativeModule.getReferrerInfoAsync()
|
||||
export function getReferrerInfo(): Promise<ReferrerInfo | null> {
|
||||
return NativeModule.getReferrerInfo()
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ export function getGooglePlayReferrerInfoAsync(): Promise<GooglePlayReferrerInfo
|
|||
throw new NotImplementedError()
|
||||
}
|
||||
|
||||
export function getReferrerInfoAsync(): Promise<ReferrerInfo | null> {
|
||||
export function getReferrerInfo(): ReferrerInfo | null {
|
||||
const referrer = SharedPrefs.getString('referrer')
|
||||
if (referrer) {
|
||||
SharedPrefs.removeValue('referrer')
|
||||
|
@ -19,7 +19,7 @@ export function getReferrerInfoAsync(): Promise<ReferrerInfo | null> {
|
|||
} catch (e) {
|
||||
return {
|
||||
referrer,
|
||||
hostname: undefined,
|
||||
hostname: referrer,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,6 @@ export function getGooglePlayReferrerInfoAsync(): Promise<GooglePlayReferrerInfo
|
|||
throw new NotImplementedError()
|
||||
}
|
||||
|
||||
export function getReferrerInfoAsync(): Promise<ReferrerInfo | null> {
|
||||
export function getReferrerInfo(): ReferrerInfo | null {
|
||||
throw new NotImplementedError()
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ export function getGooglePlayReferrerInfoAsync(): Promise<GooglePlayReferrerInfo
|
|||
throw new NotImplementedError()
|
||||
}
|
||||
|
||||
export async function getReferrerInfoAsync(): Promise<ReferrerInfo | null> {
|
||||
export function getReferrerInfo(): ReferrerInfo | null {
|
||||
if (
|
||||
Platform.OS === 'web' &&
|
||||
// for ssr
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue