fix(mobile-upgrade): 添加解析失败时的友好提示
当 APK/IPA 解析失败时,显示黄色警告提示用户手动填写版本信息 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
eb57309724
commit
12ec5e6fc3
|
|
@ -26,6 +26,7 @@ export function UploadModal({ onClose, onSuccess }: UploadModalProps) {
|
||||||
})
|
})
|
||||||
const [file, setFile] = useState<File | null>(null)
|
const [file, setFile] = useState<File | null>(null)
|
||||||
const [error, setError] = useState<string | null>(null)
|
const [error, setError] = useState<string | null>(null)
|
||||||
|
const [parseWarning, setParseWarning] = useState<string | null>(null)
|
||||||
|
|
||||||
const handleFileChange = async (e: React.ChangeEvent<HTMLInputElement>) => {
|
const handleFileChange = async (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
const selectedFile = e.target.files?.[0]
|
const selectedFile = e.target.files?.[0]
|
||||||
|
|
@ -33,6 +34,7 @@ export function UploadModal({ onClose, onSuccess }: UploadModalProps) {
|
||||||
|
|
||||||
setFile(selectedFile)
|
setFile(selectedFile)
|
||||||
setError(null)
|
setError(null)
|
||||||
|
setParseWarning(null)
|
||||||
|
|
||||||
// Auto-detect platform from file extension
|
// Auto-detect platform from file extension
|
||||||
let detectedPlatform: Platform = 'android'
|
let detectedPlatform: Platform = 'android'
|
||||||
|
|
@ -56,7 +58,8 @@ export function UploadModal({ onClose, onSuccess }: UploadModalProps) {
|
||||||
}))
|
}))
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed to parse package:', err)
|
console.error('Failed to parse package:', err)
|
||||||
// Don't show error, just let user fill in manually
|
// Show warning but allow user to fill in manually
|
||||||
|
setParseWarning('无法自动解析安装包信息,请手动填写版本号和构建号')
|
||||||
} finally {
|
} finally {
|
||||||
setIsParsing(false)
|
setIsParsing(false)
|
||||||
}
|
}
|
||||||
|
|
@ -123,6 +126,12 @@ export function UploadModal({ onClose, onSuccess }: UploadModalProps) {
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{parseWarning && (
|
||||||
|
<div className="mb-4 p-3 bg-yellow-50 border border-yellow-200 rounded-lg text-yellow-700 text-sm">
|
||||||
|
{parseWarning}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
<form onSubmit={handleSubmit} className="space-y-4">
|
<form onSubmit={handleSubmit} className="space-y-4">
|
||||||
{/* File Upload */}
|
{/* File Upload */}
|
||||||
<div>
|
<div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue