返回 AiToEarn
fansRefreshSupport.ts
根目录 / project / aitoearn-web / src / components / ChannelManager / utils / fansRefreshSupport.ts
1 import type { PlatformInfo } from '@/api/channels/channel.types'
2 import type { PlatType } from '@/app/config/platConfig'
3 import type { PluginPlatformType } from '@/store/plugin'
4 import { PLUGIN_SUPPORTED_PLATFORMS } from '@/store/plugin'
5
6 type PlatformFansRefreshInfo = Pick<PlatformInfo, 'capabilities'>
7
8 const pluginFansRefreshPlatformSet = new Set<PlatType>(PLUGIN_SUPPORTED_PLATFORMS)
9
10 export function isPluginFansRefreshPlatform(platform: PlatType): platform is PluginPlatformType {
11 return pluginFansRefreshPlatformSet.has(platform)
12 }
13
14 export function isPlatformFansRefreshSupported(
15 platform: PlatType,
16 platformInfo?: PlatformFansRefreshInfo | null,
17 ) {
18 if (isPluginFansRefreshPlatform(platform))
19 return true
20
21 return platformInfo?.capabilities.analytics.account === true
22 }
23
23 lines TYPESCRIPT