💄 取消 hint 统一为 cancel

This commit is contained in:
目棃
2024-01-18 15:44:31 +08:00
parent 16b981c5bc
commit 8390ce2309
3 changed files with 29 additions and 17 deletions

View File

@@ -102,7 +102,7 @@ async function confirmRefresh(): Promise<void> {
}); });
if (!confirmRes) { if (!confirmRes) {
showSnackbar({ showSnackbar({
color: "grey", color: "cancel",
text: "已取消刷新祈愿数据", text: "已取消刷新祈愿数据",
}); });
return; return;
@@ -244,7 +244,7 @@ async function handleImportBtn(savePath?: string): Promise<void> {
}); });
if (!res) { if (!res) {
showSnackbar({ showSnackbar({
color: "grey", color: "cancel",
text: "已取消祈愿数据导入", text: "已取消祈愿数据导入",
}); });
return; return;
@@ -269,7 +269,7 @@ async function handleImportBtn(savePath?: string): Promise<void> {
} }
} else { } else {
showSnackbar({ showSnackbar({
color: "grey", color: "cancel",
text: "已取消文件选择", text: "已取消文件选择",
}); });
} }
@@ -291,7 +291,7 @@ async function handleExportBtn(): Promise<void> {
}); });
if (!res) { if (!res) {
showSnackbar({ showSnackbar({
color: "grey", color: "cancel",
text: "已取消祈愿数据导出", text: "已取消祈愿数据导出",
}); });
return; return;
@@ -308,7 +308,7 @@ async function handleExportBtn(): Promise<void> {
}); });
if (!file) { if (!file) {
showSnackbar({ showSnackbar({
color: "grey", color: "cancel",
text: "已取消文件保存", text: "已取消文件保存",
}); });
return; return;
@@ -343,7 +343,7 @@ async function backupGacha(): Promise<void> {
}); });
if (!res) { if (!res) {
showSnackbar({ showSnackbar({
color: "grey", color: "cancel",
text: "已取消祈愿数据备份", text: "已取消祈愿数据备份",
}); });
return; return;
@@ -375,7 +375,7 @@ async function deleteGacha(): Promise<void> {
}); });
if (!firstConfirm) { if (!firstConfirm) {
showSnackbar({ showSnackbar({
color: "grey", color: "cancel",
text: "已取消祈愿数据删除", text: "已取消祈愿数据删除",
}); });
return; return;
@@ -390,7 +390,7 @@ async function deleteGacha(): Promise<void> {
} }
if (!secondConfirm) { if (!secondConfirm) {
showSnackbar({ showSnackbar({
color: "grey", color: "cancel",
text: "已取消祈愿数据删除", text: "已取消祈愿数据删除",
}); });
return; return;

View File

@@ -282,7 +282,7 @@ async function importJson(): Promise<void> {
}); });
if (!selectedFile) { if (!selectedFile) {
showSnackbar({ showSnackbar({
color: "grey", color: "cancel",
text: "已取消文件选择", text: "已取消文件选择",
}); });
return; return;

View File

@@ -252,7 +252,7 @@ async function confirmRefreshUser(): Promise<void> {
}); });
if (!res) { if (!res) {
showSnackbar({ showSnackbar({
color: "grey", color: "cancel",
text: "已取消刷新", text: "已取消刷新",
}); });
return; return;
@@ -360,13 +360,14 @@ async function confirmBackup(): Promise<void> {
}); });
if (!res) { if (!res) {
showSnackbar({ showSnackbar({
color: "grey", color: "cancel",
text: "已取消备份", text: "已取消备份",
}); });
return; return;
} }
loadingTitle.value = "正在备份数据..."; loadingTitle.value = "正在备份数据...";
loading.value = true; loading.value = true;
// todo 这边采用自定义路径
if (!(await fs.exists("userData", { dir: fs.BaseDirectory.AppLocalData }))) { if (!(await fs.exists("userData", { dir: fs.BaseDirectory.AppLocalData }))) {
await fs.createDir("userData", { dir: fs.BaseDirectory.AppLocalData, recursive: true }); await fs.createDir("userData", { dir: fs.BaseDirectory.AppLocalData, recursive: true });
} }
@@ -374,15 +375,19 @@ async function confirmBackup(): Promise<void> {
loadingSub.value = "正在获取成就数据"; loadingSub.value = "正在获取成就数据";
const achievements = await TGSqlite.getUIAF(); const achievements = await TGSqlite.getUIAF();
loadingSub.value = "正在备份成就数据"; loadingSub.value = "正在备份成就数据";
// todo 自定义路径
await backupUiafData(achievements); await backupUiafData(achievements);
loadingSub.value = "正在获取 Cookie"; loadingSub.value = "正在获取 Cookie";
const cookie = await TGSqlite.getCookie(); const cookie = await TGSqlite.getCookie();
loadingSub.value = "正在备份 Cookie"; loadingSub.value = "正在备份 Cookie";
// todo 自定义路径
await backupCookieData(cookie); await backupCookieData(cookie);
loadingSub.value = "正在获取深渊数据"; loadingSub.value = "正在获取深渊数据";
const abyss = await TGSqlite.getAbyss(); const abyss = await TGSqlite.getAbyss();
loadingSub.value = "正在备份深渊数据"; loadingSub.value = "正在备份深渊数据";
// todo 自定义路径
await backupAbyssData(abyss); await backupAbyssData(abyss);
// todo 其他数据备份?
loadingSub.value = ""; loadingSub.value = "";
loading.value = false; loading.value = false;
showSnackbar({ text: "数据已备份!" }); showSnackbar({ text: "数据已备份!" });
@@ -396,11 +401,12 @@ async function confirmRestore(): Promise<void> {
}); });
if (!resConfirm) { if (!resConfirm) {
showSnackbar({ showSnackbar({
color: "grey", color: "cancel",
text: "已取消恢复", text: "已取消恢复",
}); });
return; return;
} }
// todo 自定义路径
loadingTitle.value = "正在恢复数据..."; loadingTitle.value = "正在恢复数据...";
loading.value = true; loading.value = true;
if (!(await fs.exists("userData", { dir: fs.BaseDirectory.AppLocalData }))) { if (!(await fs.exists("userData", { dir: fs.BaseDirectory.AppLocalData }))) {
@@ -413,17 +419,20 @@ async function confirmRestore(): Promise<void> {
const fail: string[] = []; const fail: string[] = [];
let res: boolean; let res: boolean;
loadingSub.value = "正在恢复成就数据"; loadingSub.value = "正在恢复成就数据";
// todo 自定义路径
res = await restoreUiafData(); res = await restoreUiafData();
if (!res) { if (!res) {
fail.push("成就数据"); fail.push("成就数据");
} }
loadingSub.value = "正在恢复祈愿数据"; loadingSub.value = "正在恢复祈愿数据";
// todo 自定义路径
res = await restoreCookieData(); res = await restoreCookieData();
userStore.cookie.value = await TGSqlite.getCookie(); userStore.cookie.value = await TGSqlite.getCookie();
if (!res) { if (!res) {
fail.push("Cookie"); fail.push("Cookie");
} }
loadingSub.value = "正在恢复深渊数据"; loadingSub.value = "正在恢复深渊数据";
// todo 自定义路径
res = await restoreAbyssData(); res = await restoreAbyssData();
if (!res) { if (!res) {
fail.push("深渊数据"); fail.push("深渊数据");
@@ -434,6 +443,9 @@ async function confirmRestore(): Promise<void> {
loading.value = false; loading.value = false;
} }
// todo 设置自定义数据保存路径并进行数据迁移
// todo macOS 需要测试
// 更新数据 // 更新数据
async function confirmUpdate(title?: string): Promise<void> { async function confirmUpdate(title?: string): Promise<void> {
const res = await showConfirm({ const res = await showConfirm({
@@ -442,7 +454,7 @@ async function confirmUpdate(title?: string): Promise<void> {
}); });
if (!res) { if (!res) {
showSnackbar({ showSnackbar({
color: "grey", color: "cancel",
text: "已取消更新数据库", text: "已取消更新数据库",
}); });
return; return;
@@ -546,7 +558,7 @@ async function confirmDelCache(): Promise<void> {
}); });
if (!res) { if (!res) {
showSnackbar({ showSnackbar({
color: "grey", color: "cancel",
text: "已取消清除缓存", text: "已取消清除缓存",
}); });
return; return;
@@ -571,7 +583,7 @@ async function confirmResetApp(): Promise<void> {
}); });
if (!res) { if (!res) {
showSnackbar({ showSnackbar({
color: "grey", color: "cancel",
text: "已取消恢复默认设置", text: "已取消恢复默认设置",
}); });
return; return;
@@ -594,7 +606,7 @@ async function tryShowReset(): Promise<void> {
}); });
if (!res) { if (!res) {
showSnackbar({ showSnackbar({
color: "grey", color: "cancel",
text: "已取消", text: "已取消",
}); });
return; return;
@@ -622,7 +634,7 @@ async function confirmResetDB(title?: string): Promise<void> {
}); });
if (!res) { if (!res) {
showSnackbar({ showSnackbar({
color: "grey", color: "cancel",
text: "已取消重置数据库", text: "已取消重置数据库",
}); });
return; return;