feat: 优化视频组件缓存逻辑,调整列表加载距离;更新更新检查器配置以关闭定时检查
This commit is contained in:
parent
a5b825e761
commit
7349d62046
|
|
@ -46,6 +46,7 @@ const VideoBox = ({ url, needWeb = true, width = 256, style, ...videoProps }: Pr
|
|||
try {
|
||||
// 先尝试从缓存获取
|
||||
const cachedUrl = await videoUrlCache.get(url!, width)
|
||||
console.log('getRedirectUrl cachedUrl-----------', url, cachedUrl)
|
||||
if (cachedUrl) {
|
||||
setUrlFinal(cachedUrl)
|
||||
return
|
||||
|
|
@ -55,6 +56,7 @@ const VideoBox = ({ url, needWeb = true, width = 256, style, ...videoProps }: Pr
|
|||
const webpUrl = createUrl(url!)
|
||||
const finalUrl = await resolveRedirect(webpUrl)
|
||||
|
||||
console.log('getRedirectUrl finalUrl-----------', url, finalUrl)
|
||||
// 缓存结果
|
||||
await videoUrlCache.set(url!, finalUrl, width)
|
||||
|
||||
|
|
@ -112,7 +114,8 @@ const VideoBox = ({ url, needWeb = true, width = 256, style, ...videoProps }: Pr
|
|||
return (
|
||||
// 移除 key 避免组件重建导致闪烁,使用 transition 实现平滑切换
|
||||
<Image
|
||||
cachePolicy="memory-disk"
|
||||
// cachePolicy="memory-disk"
|
||||
cachePolicy="disk"
|
||||
source={{ uri: urlFinal }}
|
||||
style={style as any}
|
||||
transition={{ duration: 200, effect: 'cross-dissolve' }}
|
||||
|
|
|
|||
|
|
@ -399,7 +399,7 @@ const Index = observer(function Index() {
|
|||
}
|
||||
numColumns={3}
|
||||
onEndReached={handleLoadMore}
|
||||
drawDistance={1200}
|
||||
drawDistance={600}
|
||||
onEndReachedThreshold={0.3}
|
||||
refreshControl={<RefreshControl colors={['#FFE500']} refreshing={refreshing} onRefresh={handleRefresh} />}
|
||||
renderItem={renderItem}
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ const Sync = observer(() => {
|
|||
}
|
||||
}, [posts])
|
||||
|
||||
// console.log('selectedItem-----------', selectedItem)
|
||||
console.log('selectedItem-----------', selectedItem)
|
||||
|
||||
const canSync = useMemo(() => {
|
||||
return !!connectedDevice?.id && !!selectedItem?.imageUrl
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ const BannerSection = memo<BannerProps>(function Banner({ bgVideo }) {
|
|||
setBgurl(bgVideo)
|
||||
}, [bgVideo])
|
||||
|
||||
return null
|
||||
return (
|
||||
<Block className="absolute inset-0 z-0 overflow-hidden">
|
||||
<VideoBox style={{ width: screenWidth, height: screenHeight }} url={bgUrl} width={512} />
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@ interface UseUpdateCheckerOptions {
|
|||
|
||||
export const useUpdateChecker = ({
|
||||
interval = 5 * 60 * 1000, // 5分钟
|
||||
enablePeriodicCheck = true,
|
||||
// 关闭轮询
|
||||
enablePeriodicCheck = false,
|
||||
}: UseUpdateCheckerOptions = {}) => {
|
||||
const [hasUpdate, setHasUpdate] = useState(false)
|
||||
const [isChecking, setIsChecking] = useState(false)
|
||||
|
|
|
|||
Loading…
Reference in New Issue