Move getMetadataForLogger
This commit is contained in:
@@ -16,13 +16,13 @@ import {
|
|||||||
useSessionId,
|
useSessionId,
|
||||||
} from '#/analytics/identifiers'
|
} from '#/analytics/identifiers'
|
||||||
import {
|
import {
|
||||||
|
getMetadataForLogger,
|
||||||
getNavigationMetadata,
|
getNavigationMetadata,
|
||||||
type MergeableMetadata,
|
type MergeableMetadata,
|
||||||
type Metadata,
|
type Metadata,
|
||||||
} from '#/analytics/metadata'
|
} from '#/analytics/metadata'
|
||||||
import {type Metrics, metrics} from '#/analytics/metrics'
|
import {type Metrics, metrics} from '#/analytics/metrics'
|
||||||
import * as refParams from '#/analytics/misc/refParams'
|
import * as refParams from '#/analytics/misc/refParams'
|
||||||
import {getMetadataForLogger} from '#/analytics/utils'
|
|
||||||
import * as env from '#/env'
|
import * as env from '#/env'
|
||||||
import {useGeolocation} from '#/geolocation'
|
import {useGeolocation} from '#/geolocation'
|
||||||
import {device} from '#/storage'
|
import {device} from '#/storage'
|
||||||
|
|||||||
@@ -58,3 +58,22 @@ export function getNavigationMetadata() {
|
|||||||
export function setNavigationMetadata(meta: NavigationMetadata | undefined) {
|
export function setNavigationMetadata(meta: NavigationMetadata | undefined) {
|
||||||
navigationMetadata = meta
|
navigationMetadata = meta
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We don't want or need to send all data to the logger
|
||||||
|
*/
|
||||||
|
export function getMetadataForLogger({
|
||||||
|
base,
|
||||||
|
geolocation,
|
||||||
|
session,
|
||||||
|
}: Metadata): Record<string, any> {
|
||||||
|
return {
|
||||||
|
deviceId: base.deviceId,
|
||||||
|
sessionId: base.sessionId,
|
||||||
|
platform: base.platform,
|
||||||
|
appVersion: base.appVersion,
|
||||||
|
countryCode: geolocation.countryCode,
|
||||||
|
regionCode: geolocation.regionCode,
|
||||||
|
isBskyPds: session?.isBskyPds || 'anonymous',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import {BSKY_SERVICE} from '#/lib/constants'
|
|||||||
import {type SessionAccount} from '#/state/session'
|
import {type SessionAccount} from '#/state/session'
|
||||||
import {
|
import {
|
||||||
type MergeableMetadata,
|
type MergeableMetadata,
|
||||||
type Metadata,
|
|
||||||
type SessionMetadata,
|
type SessionMetadata,
|
||||||
} from '#/analytics/metadata'
|
} from '#/analytics/metadata'
|
||||||
|
|
||||||
@@ -32,19 +31,3 @@ export function accountToSessionMetadata(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getMetadataForLogger({
|
|
||||||
base,
|
|
||||||
geolocation,
|
|
||||||
session,
|
|
||||||
}: Metadata): Record<string, any> {
|
|
||||||
return {
|
|
||||||
deviceId: base.deviceId,
|
|
||||||
sessionId: base.sessionId,
|
|
||||||
platform: base.platform,
|
|
||||||
appVersion: base.appVersion,
|
|
||||||
countryCode: geolocation.countryCode,
|
|
||||||
regionCode: geolocation.regionCode,
|
|
||||||
isBskyPds: session?.isBskyPds || 'anonymous',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user