Skip to content

Commit

Permalink
feat(UpdateChecker): 添加更新对话框中的日期和时间显示,优化文本内容
Browse files Browse the repository at this point in the history
  • Loading branch information
thoulee21 committed Dec 13, 2024
1 parent ac6fff9 commit 494eef4
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 9 deletions.
42 changes: 37 additions & 5 deletions src/components/UpdateChecker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ import { useTranslation } from 'react-i18next';
import {
Alert,
DeviceEventEmitter,
StyleSheet,
ToastAndroid,
View,
} from 'react-native';
import HapticFeedback, {
HapticFeedbackTypes,
} from 'react-native-haptic-feedback';
import {
ActivityIndicator,
Button,
Chip,
Dialog,
List,
Portal,
Expand Down Expand Up @@ -175,14 +178,33 @@ export const UpdateChecker = () => {
onDismiss={() => setDialogVisible(false)}
>
<Dialog.Icon icon="information" size={40} />
<Dialog.Title>{t('about.update.dialog.title')}</Dialog.Title>
<Dialog.Title>
{t('about.update.dialog.title')}
</Dialog.Title>

<Dialog.Content>
{availableUpdate && (
<View style={styles.row}>
<Chip
icon="calendar"
compact
mode="outlined"
style={styles.chip}
>
{availableUpdate.createdAt.toLocaleDateString()}
</Chip>
<Chip
icon="clock-outline"
compact
mode="outlined"
style={styles.chip}
>
{availableUpdate.createdAt.toLocaleTimeString()}
</Chip>
</View>
)}

<Text>
{availableUpdate?.createdAt && t(
'about.update.dialog.caption',
{ date: availableUpdate.createdAt.toISOString() }
)}
{t('about.update.dialog.ask')}
</Text>
</Dialog.Content>
Expand All @@ -208,3 +230,13 @@ export const UpdateChecker = () => {
</>
);
};

const styles = StyleSheet.create({
row: {
flexDirection: 'row',
marginBottom: 2,
},
chip: {
marginRight: 4,
}
});
1 change: 0 additions & 1 deletion src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
"cancel": "Cancel",
"update": "Update"
},
"caption": "New update created at {{date}} is available.\n",
"ask": "Do you want to update now?"
}
},
Expand Down
1 change: 0 additions & 1 deletion src/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"update": "更新"
},
"ask": "您想现在更新吗?",
"caption": "在{{date}}创建的新更新可用。\n",
"title": "更新可用"
},
"listItem": {
Expand Down
3 changes: 1 addition & 2 deletions src/locales/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"update": "更新"
},
"ask": "您想現在更新嗎?",
"caption": "在{{date}}創建的新更新可用。\n",
"title": "更新可用"
},
"listItem": {
Expand Down Expand Up @@ -254,4 +253,4 @@
"success": "問題已提交"
}
}
}
}

0 comments on commit 494eef4

Please sign in to comment.