lint
This commit is contained in:
+10
-5
@@ -14,7 +14,8 @@ class ExpoBlueskyReferrerModule : Module() {
|
|||||||
private var intent: Intent? = null
|
private var intent: Intent? = null
|
||||||
private var activityReferrer: Uri? = null
|
private var activityReferrer: Uri? = null
|
||||||
|
|
||||||
override fun definition() = ModuleDefinition {
|
override fun definition() =
|
||||||
|
ModuleDefinition {
|
||||||
Name("ExpoBlueskyReferrer")
|
Name("ExpoBlueskyReferrer")
|
||||||
|
|
||||||
OnNewIntent {
|
OnNewIntent {
|
||||||
@@ -23,7 +24,8 @@ class ExpoBlueskyReferrerModule : Module() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AsyncFunction("getReferrerInfoAsync") {
|
AsyncFunction("getReferrerInfoAsync") {
|
||||||
val intentReferrer = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
val intentReferrer =
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||||
intent?.getParcelableExtra(Intent.EXTRA_REFERRER, Uri::class.java)
|
intent?.getParcelableExtra(Intent.EXTRA_REFERRER, Uri::class.java)
|
||||||
} else {
|
} else {
|
||||||
intent?.getParcelableExtra(Intent.EXTRA_REFERRER)
|
intent?.getParcelableExtra(Intent.EXTRA_REFERRER)
|
||||||
@@ -32,7 +34,8 @@ class ExpoBlueskyReferrerModule : Module() {
|
|||||||
// Some apps explicitly set a referrer, like Chrome. In these cases, we prefer this since
|
// Some apps explicitly set a referrer, like Chrome. In these cases, we prefer this since
|
||||||
// it's the actual website that the user came from rather than the app.
|
// it's the actual website that the user came from rather than the app.
|
||||||
if (intentReferrer is Uri) {
|
if (intentReferrer is Uri) {
|
||||||
val res = mapOf(
|
val res =
|
||||||
|
mapOf(
|
||||||
"referrer" to intentReferrer.toString(),
|
"referrer" to intentReferrer.toString(),
|
||||||
"hostname" to intentReferrer.host,
|
"hostname" to intentReferrer.host,
|
||||||
)
|
)
|
||||||
@@ -43,7 +46,8 @@ class ExpoBlueskyReferrerModule : Module() {
|
|||||||
// In all other cases, we'll just record the app that sent the intent.
|
// In all other cases, we'll just record the app that sent the intent.
|
||||||
if (activityReferrer != null) {
|
if (activityReferrer != null) {
|
||||||
// referrer could become null here. `.toString()` though can be called on null
|
// referrer could become null here. `.toString()` though can be called on null
|
||||||
val res = mapOf(
|
val res =
|
||||||
|
mapOf(
|
||||||
"referrer" to activityReferrer.toString(),
|
"referrer" to activityReferrer.toString(),
|
||||||
"hostname" to (activityReferrer?.host ?: ""),
|
"hostname" to (activityReferrer?.host ?: ""),
|
||||||
)
|
)
|
||||||
@@ -56,7 +60,8 @@ class ExpoBlueskyReferrerModule : Module() {
|
|||||||
|
|
||||||
AsyncFunction("getGooglePlayReferrerInfoAsync") { promise: Promise ->
|
AsyncFunction("getGooglePlayReferrerInfoAsync") { promise: Promise ->
|
||||||
val referrerClient = InstallReferrerClient.newBuilder(appContext.reactContext).build()
|
val referrerClient = InstallReferrerClient.newBuilder(appContext.reactContext).build()
|
||||||
referrerClient.startConnection(object : InstallReferrerStateListener {
|
referrerClient.startConnection(
|
||||||
|
object : InstallReferrerStateListener {
|
||||||
override fun onInstallReferrerSetupFinished(responseCode: Int) {
|
override fun onInstallReferrerSetupFinished(responseCode: Int) {
|
||||||
if (responseCode == InstallReferrerClient.InstallReferrerResponse.OK) {
|
if (responseCode == InstallReferrerClient.InstallReferrerResponse.OK) {
|
||||||
Log.d("ExpoGooglePlayReferrer", "Successfully retrieved referrer info.")
|
Log.d("ExpoGooglePlayReferrer", "Successfully retrieved referrer info.")
|
||||||
|
|||||||
Reference in New Issue
Block a user