Add stable ID to discover requests

This commit is contained in:
Eric Bailey
2026-02-11 14:43:01 -06:00
parent ff4512bede
commit 17117abe11
2 changed files with 29 additions and 6 deletions
+19
View File
@@ -3,6 +3,7 @@ import {type LocationGeocodedAddress} from 'expo-location'
import {IS_ANDROID} from '#/env'
import {logger} from '#/geolocation/logger'
import {type Geolocation} from '#/geolocation/types'
import {device} from '#/storage'
/**
* Maps full US region names to their short codes.
@@ -125,3 +126,21 @@ export function mergeGeolocations(
})
return geolocation
}
/**
* Get's the merged geolocation as a string in the format of
* "countryCode-regionCode", or just "countryCode" if regionCode is not
* available.
*/
export function getGeolocationString() {
const geo = device.get(['mergedGeolocation'])
if (!geo) return
const {countryCode, regionCode} = geo
if (countryCode) {
if (regionCode) {
return `${countryCode}-${regionCode}`
} else {
return countryCode
}
}
}
+10 -6
View File
@@ -9,6 +9,7 @@ import {
getAppLanguageAsContentLanguage,
getContentLanguages,
} from '#/state/preferences/languages'
import {getDeviceId} from '#/analytics/identifiers'
import {type FeedAPI, type FeedAPIResponse} from './types'
import {createBskyTopicsHeader, isBlueskyOwnedFeed} from './utils'
@@ -62,12 +63,15 @@ export class CustomFeedAPI implements FeedAPI {
limit,
},
{
headers: {
...(isBlueskyOwned
? createBskyTopicsHeader(this.userInterests)
: {}),
'Accept-Language': contentLangs,
},
headers: isBlueskyOwned
? {
...createBskyTopicsHeader(this.userInterests),
'X-Bsky-Stable-Id': getDeviceId(),
'Accept-Language': contentLangs,
}
: {
'Accept-Language': contentLangs,
},
},
)
: await loggedOutFetch({...this.params, cursor, limit})