-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
referrers for all platforms #4514
Conversation
Your Render PR Server URL is https://social-app-pr-4514.onrender.com. Follow its progress at https://dashboard.render.com/web/srv-cplv9e5ds78s738a1760. |
The Pull Request introduced fingerprint changes against the base commit: Fingerprint diff[{"type":"dir","filePath":"modules/expo-bluesky-swiss-army/android","reasons":["expoAutolinkingAndroid"],"hash":"7dab4983b0c8c39ed00de86fe163d32d93f5dc39"},{"type":"contents","id":"expoConfig","contents":"{\"android\":{\"adaptiveIcon\":{\"backgroundColor\":\"#1185FE\",\"backgroundImage\":\"./assets/icon-android-background.png\",\"foregroundImage\":\"./assets/icon-android-foreground.png\",\"monochromeImage\":\"./assets/icon-android-foreground.png\"},\"googleServicesFile\":\"./google-services.json\",\"icon\":\"./assets/icon.png\",\"intentFilters\":[{\"action\":\"VIEW\",\"autoVerify\":true,\"category\":[\"BROWSABLE\",\"DEFAULT\"],\"data\":[false,{\"host\":\"bsky.app\",\"scheme\":\"https\"}]}],\"package\":\"xyz.blueskyweb.app\",\"splash\":{\"backgroundColor\":\"#0c7cff\",\"dark\":{\"backgroundColor\":\"#0f141b\",\"image\":\"./assets/splash-dark.png\",\"resizeMode\":\"cover\"},\"image\":\"./assets/splash.png\",\"resizeMode\":\"cover\"}},\"androidNavigationBar\":{\"backgroundColor\":\"#0f141b\",\"barStyle\":\"light-content\"},\"androidStatusBar\":{\"backgroundColor\":\"#00000000\",\"barStyle\":\"light-content\"},\"extra\":{\"eas\":{\"build\":{\"experimental\":{\"ios\":{\"appExtensions\":[{\"bundleIdentifier\":\"xyz.blueskyweb.app.AppClip\",\"targetName\":\"BlueskyClip\"},{\"bundleIdentifier\":\"xyz.blueskyweb.app.BlueskyNSE\",\"entitlements\":{\"com.apple.security.application-groups\":[\"group.app.bsky\"]},\"targetName\":\"BlueskyNSE\"},{\"bundleIdentifier\":\"xyz.blueskyweb.app.Share-with-Bluesky\",\"entitlements\":{\"com.apple.security.application-groups\":[\"group.app.bsky\"]},\"targetName\":\"Share-with-Bluesky\"}]}}},\"projectId\":\"55bd077a-d905-4184-9c7f-94789ba0f302\"}},\"hooks\":{\"postPublish\":[{\"config\":{\"dist\":\"undefined.1.89.0.\",\"organization\":\"blueskyweb\",\"project\":\"react-native\",\"release\":\"1.89.0\"},\"file\":\"sentry-expo/upload-sourcemaps\"}]},\"icon\":\"./assets/icon.png\",\"ios\":{\"associatedDomains\":[\"appclips:bsky.app\",\"appclips:go.bsky.app\",\"applinks:bsky.app\",\"applinks:staging.bsky.app\"],\"bundleIdentifier\":\"xyz.blueskyweb.app\",\"config\":{\"usesNonExemptEncryption\":false},\"entitlements\":{\"com.apple.security.application-groups\":\"group.app.bsky\"},\"infoPlist\":{\"NSCameraUsageDescription\":\"Used for profile pictures, posts, and other kinds of content.\",\"NSMicrophoneUsageDescription\":\"Used for posts and other kinds of content.\",\"NSPhotoLibraryAddUsageDescription\":\"Used to save images to your library.\",\"NSPhotoLibraryUsageDescription\":\"Used for profile pictures, posts, and other kinds of content\",\"UIBackgroundModes\":[\"remote-notification\"]},\"privacyManifests\":{\"NSPrivacyAccessedAPITypes\":[{\"NSPrivacyAccessedAPIType\":\"NSPrivacyAccessedAPICategoryDiskSpace\",\"NSPrivacyAccessedAPITypeReasons\":[\"85F4.1\",\"E174.1\"]},{\"NSPrivacyAccessedAPIType\":\"NSPrivacyAccessedAPICategoryFileTimestamp\",\"NSPrivacyAccessedAPITypeReasons\":[\"0A2A.1\",\"3B52.1\",\"C617.1\"]},{\"NSPrivacyAccessedAPIType\":\"NSPrivacyAccessedAPICategorySystemBootTime\",\"NSPrivacyAccessedAPITypeReasons\":[\"35F9.1\"]},{\"NSPrivacyAccessedAPIType\":\"NSPrivacyAccessedAPICategoryUserDefaults\",\"NSPrivacyAccessedAPITypeReasons\":[\"1C8F.1\",\"CA92.1\"]}]},\"splash\":{\"backgroundColor\":\"#ffffff\",\"dark\":{\"backgroundColor\":\"#001429\",\"image\":\"./assets/splash-dark.png\",\"resizeMode\":\"cover\"},\"image\":\"./assets/splash.png\",\"resizeMode\":\"cover\"},\"supportsTablet\":false},\"name\":\"Bluesky\",\"orientation\":\"portrait\",\"owner\":\"blueskysocial\",\"platforms\":[\"android\",\"ios\",\"web\"],\"plugins\":[\"./plugins/notificationsExtension/withNotificationsExtension.js\",\"./plugins/shareExtension/withShareExtensions.js\",\"./plugins/starterPackAppClipExtension/withStarterPackAppClip.js\",\"./plugins/withAndroidManifestFCMIconPlugin.js\",\"./plugins/withAndroidManifestPlugin.js\",\"./plugins/withAndroidSplashScreenStatusBarTranslucentPlugin.js\",\"./plugins/withAndroidStylesAccentColorPlugin.js\",\"./plugins/withAndroidStylesWindowBackgroundPlugin.js\",\"expo-localization\",\"expo-video\",\"react-native-compressor\",[\"expo-build-properties\",{\"android\":{\"buildToolsVersion\":\"34.0.0\",\"compileSdkVersion\":34,\"kotlinVersion\":\"1.8.0\",\"newArchEnabled\":false,\"targetSdkVersion\":34},\"ios\":{\"deploymentTarget\":\"14.0\",\"newArchEnabled\":false}}],[\"expo-notifications\",{\"color\":\"#1185fe\",\"icon\":\"./assets/icon-android-notification.png\",\"sounds\":[\"assets/dm.mp3\"]}]],\"primaryColor\":\"#1083fe\",\"runtimeVersion\":{\"policy\":\"appVersion\"},\"scheme\":\"bluesky\",\"sdkVersion\":\"51.0.0\",\"slug\":\"bluesky\",\"splash\":{\"backgroundColor\":\"#ffffff\",\"image\":\"./assets/splash.png\",\"resizeMode\":\"cover\"},\"updates\":{\"checkAutomatically\":\"NEVER\",\"enabled\":false,\"fallbackToCacheTimeout\":30000,\"url\":\"https://updates.bsky.app/manifest\"},\"userInterfaceStyle\":\"automatic\",\"version\":\"1.89.0\",\"web\":{\"favicon\":\"./assets/favicon.png\"}}","reasons":["expoConfig"],"hash":"2a729a89ae75af14e7d718523967b0afe2f93b9a"}] Generated by PR labeler 🤖 |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gonna wait with this until after sp
// referrer could become null here. `.toString()` though can be called on null | ||
val res = mapOf( | ||
"referrer" to activityReferrer.toString(), | ||
"hostname" to (activityReferrer?.host ?: ""), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like this broke web?
Lines 773 to 775 in 2c754bf
|
Relies on #4654
Why
We currently are not able to track referrers if the user is on native. This PR introduces a way for us to - when possible - see those referrals.
How
There's a little bit of native code needed on each platform.
iOS
On iOS, we can get the
referrerURL
fromNSUserActivity
. See https://developer.apple.com/documentation/foundation/nsuseractivity/2875762-referrerurlThis requires a little plugin to add some code to our
AppDelegate.mm
. Whenever a user opens the app through a Universal Link, we can - when it is provided by the browser - record the referrer URL here. To make things simple and reduce the scope of the plugin, I am just storing the URL toNSUserDefaults
and then retrieving it in our module.We also are able to get the same for deep links, also in the
AppDelegate
. See https://developer.apple.com/documentation/uikit/uiapplicationopenurloptionssourceapplicationkeyThe same process is used here: save the value to
NSUserDefaults
and retrieve it through our module.The build plugin in this PR adds the necessary lines to the
AppDelegate.mm
file to achieve this.Android
On Android, we need to do two things to get this information:
Intent.EXTRA_REFERRER
, which will be the URI of the website that the request is coming from - if it is coming from one.referrer
property, which will tell us the application the request was made from.Since we can access these straight from the module code, all we do is store the intent whenever it comes in and return it to the JS side when calling
getReferrerAsync()
.The
getGooglePlayReferrerInfoAsync()
call uses the Google Play Install Referrer API (see https://developer.android.com/google/play/installreferrer) to retrieve the URL that referred the user to the app store. This will be used for starter packs. I've already added this code to the starter packs PR, but once we merge that in and later review this, I'll just migrate the code to use this single module instead.Web
Same process as what exists in the app right now, but just made to follow the same API as iOS and Android.
Sending to Statsig
On iOS and Android, we will send this info to Statsig in the
useIntentHandler
hook, whenever we receive a new link into the app.On web, I've moved this from being a custom user property to being it's own event - again to align with how we handle this on iOS and Android. Whenever send the
init
event to Statsig, we will also send this event if needed.Test Plan
AppDelegate.mm
to make sure it looks good (there are commented blocks that signify where code is being added). App should still build on iOS.useIntentHandler
to check the status