feat: show downgrade warning logic

This commit is contained in:
Joel
2025-06-24 11:21:57 +08:00
parent 825fbcc6f8
commit 7ec5816513
2 changed files with 20 additions and 2 deletions

View File

@ -77,6 +77,7 @@ const DetailHeader = ({
const [targetVersion, setTargetVersion] = useState({
version: latest_version,
unique_identifier: latest_unique_identifier,
isDowngrade: false,
})
const hasNewVersion = useMemo(() => {
if (isFromMarketplace)
@ -98,8 +99,18 @@ const DetailHeader = ({
setFalse: hideUpdateModal,
}] = useBoolean(false)
const isAutoUpgradeEnabled = true // toeo
const [isShowDowngradeWarningModal, {
setTrue: showDowngradeWarningModal,
setFalse: hideDowngradeWarningModal,
}] = useBoolean(false)
const handleUpdate = async () => {
if (isFromMarketplace) {
if(isAutoUpgradeEnabled && targetVersion.isDowngrade) {
showDowngradeWarningModal()
return
}
showUpdateModal()
return
}
@ -222,6 +233,7 @@ const DetailHeader = ({
setTargetVersion({
version: latest_version,
unique_identifier: latest_unique_identifier,
isDowngrade: false,
})
}
handleUpdate()
@ -316,6 +328,7 @@ const DetailHeader = ({
/>
)
}
{ isShowDowngradeWarningModal && (<div>aaa</div>)}
</div>
)
}