Add stable ID to discover requests
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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})
|
||||
|
||||
Reference in New Issue
Block a user