Bluesky app fork with some witchin' additions 馃挮 witchsky.app
bluesky fork client
117
fork

Configure Feed

Select the types of activity you want to include in your feed.

at a876aae44ea07494ebea9727350aa060b81f317b 79 lines 2.0 kB view raw
1import {type Geolocation} from '#/geolocation' 2 3export type BaseMetadata = { 4 deviceId: string 5 sessionId: string 6 platform: string 7 appVersion: string 8 bundleIdentifier: string 9 bundleDate: number 10 referrerSrc: string 11 referrerUrl: string 12} 13 14export type GeolocationMetadata = Geolocation 15 16export type SessionMetadata = { 17 did: string 18 isBskyPds: boolean 19} 20 21export type PreferencesMetadata = { 22 appLanguage: string 23 contentLanguages: string[] 24} 25 26export type MergeableMetadata = { 27 session?: SessionMetadata 28 preferences?: PreferencesMetadata 29 /** 30 * Navigation metadata is not actually available on this object, instead it's 31 * merged in at time-of-log/metric. See `#/analytics/metadata.ts` for details. 32 */ 33 navigation?: NavigationMetadata 34} 35 36export type Metadata = { 37 base: BaseMetadata 38 geolocation: GeolocationMetadata 39} & MergeableMetadata 40 41/* 42 * Navigation metadata is handle out-of-band from React, since we don't want to 43 * slow down screen transitions in any way, and there doesn't seem to be a nice 44 * way to get current navigation state without an additional re-render between 45 * navigations. 46 * 47 * So instead of this data being available on the Metadata object, it's stored 48 * here and merged in at time-of-log/metric. 49 */ 50export type NavigationMetadata = { 51 previousScreen?: string 52 currentScreen?: string 53} 54let navigationMetadata: NavigationMetadata | undefined 55export function getNavigationMetadata() { 56 return navigationMetadata 57} 58export function setNavigationMetadata(meta: NavigationMetadata | undefined) { 59 navigationMetadata = meta 60} 61 62/** 63 * We don't want or need to send all data to the logger 64 */ 65export function getMetadataForLogger({ 66 base, 67 geolocation, 68 session, 69}: Metadata): Record<string, any> { 70 return { 71 deviceId: base.deviceId, 72 sessionId: base.sessionId, 73 platform: base.platform, 74 appVersion: base.appVersion, 75 countryCode: geolocation.countryCode, 76 regionCode: geolocation.regionCode, 77 isBskyPds: session?.isBskyPds || 'anonymous', 78 } 79}