use correct did
This commit is contained in:
@@ -60,11 +60,13 @@ export function IS_PROD_SERVICE(url?: string) {
|
|||||||
return url && url !== STAGING_SERVICE && !url.startsWith(LOCAL_DEV_SERVICE)
|
return url && url !== STAGING_SERVICE && !url.startsWith(LOCAL_DEV_SERVICE)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const PROD_DEFAULT_FEED_DID = 'did:plc:z72i7hdynmk6r22z27h6tvur'
|
||||||
export const PROD_DEFAULT_FEED = (rkey: string) =>
|
export const PROD_DEFAULT_FEED = (rkey: string) =>
|
||||||
`at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.generator/${rkey}`
|
`at://${PROD_DEFAULT_FEED_DID}/app.bsky.feed.generator/${rkey}`
|
||||||
|
|
||||||
|
export const STAGING_DEFAULT_FEED_DID = 'did:plc:yofh3kx63drvfljkibw5zuxo'
|
||||||
export const STAGING_DEFAULT_FEED = (rkey: string) =>
|
export const STAGING_DEFAULT_FEED = (rkey: string) =>
|
||||||
`at://did:plc:yofh3kx63drvfljkibw5zuxo/app.bsky.feed.generator/${rkey}`
|
`at://${STAGING_DEFAULT_FEED_DID}/app.bsky.feed.generator/${rkey}`
|
||||||
|
|
||||||
export const POST_IMG_MAX = {
|
export const POST_IMG_MAX = {
|
||||||
width: 2000,
|
width: 2000,
|
||||||
|
|||||||
@@ -3,7 +3,11 @@ import {AppState, AppStateStatus} from 'react-native'
|
|||||||
import {AppBskyFeedDefs} from '@atproto/api'
|
import {AppBskyFeedDefs} from '@atproto/api'
|
||||||
import throttle from 'lodash.throttle'
|
import throttle from 'lodash.throttle'
|
||||||
|
|
||||||
import {PROD_DEFAULT_FEED, STAGING_DEFAULT_FEED} from '#/lib/constants'
|
import {
|
||||||
|
PROD_DEFAULT_FEED,
|
||||||
|
STAGING_DEFAULT_FEED,
|
||||||
|
STAGING_DEFAULT_FEED_DID,
|
||||||
|
} from '#/lib/constants'
|
||||||
import {logEvent} from '#/lib/statsig/statsig'
|
import {logEvent} from '#/lib/statsig/statsig'
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
import {FeedDescriptor, FeedPostSliceItem} from '#/state/queries/post-feed'
|
import {FeedDescriptor, FeedPostSliceItem} from '#/state/queries/post-feed'
|
||||||
@@ -25,6 +29,7 @@ const stateContext = React.createContext<StateContext>({
|
|||||||
export function useFeedFeedback(feed: FeedDescriptor, hasSession: boolean) {
|
export function useFeedFeedback(feed: FeedDescriptor, hasSession: boolean) {
|
||||||
const agent = useAgent()
|
const agent = useAgent()
|
||||||
const enabled = isDiscoverFeed(feed) && hasSession
|
const enabled = isDiscoverFeed(feed) && hasSession
|
||||||
|
|
||||||
const queue = React.useRef<Set<string>>(new Set())
|
const queue = React.useRef<Set<string>>(new Set())
|
||||||
const history = React.useRef<
|
const history = React.useRef<
|
||||||
// Use a WeakSet so that we don't need to clear it.
|
// Use a WeakSet so that we don't need to clear it.
|
||||||
@@ -46,6 +51,11 @@ export function useFeedFeedback(feed: FeedDescriptor, hasSession: boolean) {
|
|||||||
const interactions = Array.from(queue.current).map(toInteraction)
|
const interactions = Array.from(queue.current).map(toInteraction)
|
||||||
queue.current.clear()
|
queue.current.clear()
|
||||||
|
|
||||||
|
let proxyDid = 'did:web:discover.bsky.app'
|
||||||
|
if (feed.includes(STAGING_DEFAULT_FEED_DID)) {
|
||||||
|
proxyDid = 'did:web:algo.pop2.bsky.app'
|
||||||
|
}
|
||||||
|
|
||||||
// Send to the feed
|
// Send to the feed
|
||||||
agent.app.bsky.feed
|
agent.app.bsky.feed
|
||||||
.sendInteractions(
|
.sendInteractions(
|
||||||
@@ -54,7 +64,7 @@ export function useFeedFeedback(feed: FeedDescriptor, hasSession: boolean) {
|
|||||||
encoding: 'application/json',
|
encoding: 'application/json',
|
||||||
headers: {
|
headers: {
|
||||||
// TODO when we start sending to other feeds, we need to grab their DID -prf
|
// TODO when we start sending to other feeds, we need to grab their DID -prf
|
||||||
'atproto-proxy': 'did:web:discover.bsky.app#bsky_fg',
|
'atproto-proxy': `${proxyDid}#bsky_fg`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@@ -68,7 +78,7 @@ export function useFeedFeedback(feed: FeedDescriptor, hasSession: boolean) {
|
|||||||
}
|
}
|
||||||
sendOrAggregateInteractionsForStats(aggregatedStats.current, interactions)
|
sendOrAggregateInteractionsForStats(aggregatedStats.current, interactions)
|
||||||
throttledFlushAggregatedStats()
|
throttledFlushAggregatedStats()
|
||||||
}, [agent, throttledFlushAggregatedStats])
|
}, [agent, throttledFlushAggregatedStats, feed])
|
||||||
|
|
||||||
const sendToFeed = React.useMemo(
|
const sendToFeed = React.useMemo(
|
||||||
() =>
|
() =>
|
||||||
|
|||||||
Reference in New Issue
Block a user