Skip to content

Commit de93523

Browse files
guanbinruiswkatmask
andcommitted
fix: flags (#11965)
* fix: twitter handle * refactor: flags --------- Co-authored-by: Wukong Sun <[email protected]>
1 parent d4854ab commit de93523

File tree

2 files changed

+7
-24
lines changed

2 files changed

+7
-24
lines changed

packages/flags/src/flags/buildInfo.ts

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Environment, isEnvironment } from '@dimensiondev/holoflows-kit'
21
import { defer } from '@masknet/kit'
32

43
export interface BuildInfoFile {
@@ -11,30 +10,15 @@ export interface BuildInfoFile {
1110
readonly REACT_DEVTOOLS_EDITOR_URL?: string
1211
readonly channel: 'stable' | 'beta' | 'insider'
1312
}
14-
15-
export async function getBuildInfo(): Promise<BuildInfoFile> {
16-
try {
17-
const hasBrowserAPI = isEnvironment(Environment.HasBrowserAPI)
18-
const b = (globalThis as any).browser
19-
const manifestVersion = hasBrowserAPI ? b.runtime.getManifest().version : undefined
20-
const response = await fetch(hasBrowserAPI ? b.runtime.getURL('/build-info.json') : '/build-info.json')
21-
const env: BuildInfoFile = await response.json()
22-
if (manifestVersion) Object.assign(env, { VERSION: manifestVersion })
23-
Object.freeze(env)
24-
return env
25-
} catch {
26-
return {
27-
channel: 'stable',
28-
}
29-
}
30-
}
3113
export let env: BuildInfoFile = {
3214
channel: 'stable',
3315
}
3416
const [_promise, resolve] = defer<void>()
3517
export const buildInfoReadyPromise = _promise
3618
export async function setupBuildInfo(): Promise<void> {
37-
return setupBuildInfoManually(await getBuildInfo())
19+
return setupBuildInfoManually({
20+
channel: 'stable',
21+
})
3822
}
3923
export function setupBuildInfoManually(_env: BuildInfoFile) {
4024
resolve()

packages/plugins/RedPacket/src/SiteAdaptor/Requirements/MentionLink.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,22 @@ export function MentionLink({ platform, profileId, handle }: MentionLinkProps) {
3333
const { data: twitterHandle, isLoading } = useQuery({
3434
enabled: isTwitter && !handle,
3535
queryKey: ['twitter-user-info', profileId],
36-
queryFn: async () => {
37-
return FireflyTwitter.getUserInfoById(profileId)
38-
},
36+
queryFn: () => FireflyTwitter.getUserInfoById(profileId),
3937
select(data) {
4038
return data?.username
4139
},
4240
})
4341

42+
const screenName = isTwitter ? twitterHandle || handle : handle
4443
if (isLoading) return <LoadingBase size={12} />
4544

46-
if (!handle) return <span>the creator</span>
45+
if (!screenName) return <span>the creator</span>
4746

4847
return (
4948
<Link
5049
href={resolveProfileUrl(
5150
platform,
52-
platform === FireflyRedPacketAPI.PlatformType.farcaster ? profileId : handle,
51+
platform === FireflyRedPacketAPI.PlatformType.farcaster ? profileId : screenName,
5352
)}
5453
target="_blank"
5554
className={classes.textLink}>

0 commit comments

Comments
 (0)