2026-10-29 09:58:51 +08:00
|
|
|
|
import {Text} from './typography';
|
|
|
|
|
|
import React from 'react';
|
|
|
|
|
|
import {Modal,ScrollView,View} from 'react-native';
|
2026-10-30 15:02:54 +08:00
|
|
|
|
import {Button,Note,useTheme} from './ui';
|
2026-10-29 09:58:51 +08:00
|
|
|
|
import type {UpdateView} from './core/updates';
|
2026-10-30 15:02:54 +08:00
|
|
|
|
import {UpdateNotes} from './UpdateNotes';
|
2026-10-29 09:58:51 +08:00
|
|
|
|
|
|
|
|
|
|
export function AppUpdateDialog({view,later,restart}:{view:UpdateView;later:()=>void;restart:()=>void}){
|
|
|
|
|
|
const t=useTheme();if(!view.visible)return null;
|
2026-10-30 15:02:54 +08:00
|
|
|
|
return <Modal transparent visible animationType="fade" onRequestClose={later}><View style={{flex:1,backgroundColor:'#0008',justifyContent:'center',alignItems:'center',padding:24}}><View accessibilityViewIsModal accessibilityRole="alert" style={{width:'100%',maxWidth:380,maxHeight:'85%',borderRadius:20,backgroundColor:t.card,padding:22,gap:16}}>
|
|
|
|
|
|
<ScrollView contentContainerStyle={{gap:12}}>
|
|
|
|
|
|
<Text style={{fontSize:18,lineHeight:25,fontWeight:'700',color:t.text}}>发现新版本</Text><UpdateNotes notes={view.notes}/><Note>更新已下载,重启后生效。请先保存当前内容,未提交的内容不会保留。</Note>
|
2026-10-29 09:58:51 +08:00
|
|
|
|
{!!view.error&&<Text accessibilityRole="alert" style={{color:'#c64650',fontSize:14,lineHeight:21}}>{view.error}</Text>}
|
|
|
|
|
|
</ScrollView>
|
|
|
|
|
|
<View style={{gap:9}}><Button title={view.restarting?'正在重启…':'重启并更新'} busy={view.restarting} onPress={restart}/><Button title="稍后再说" secondary disabled={view.restarting} onPress={later}/></View>
|
|
|
|
|
|
</View></View></Modal>;
|
|
|
|
|
|
}
|