mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 07:47:24 +00:00
Prevent window from closing while uploading data
This commit is contained in:
@@ -140,18 +140,18 @@
|
||||
"Block": "屏蔽",
|
||||
"Add new favorite to": "添加新收藏到",
|
||||
"Move favorite after reading": "阅读后移动收藏",
|
||||
"Delete folder?" : "删除文件夹?",
|
||||
"Delete folder '@f' ?" : "删除文件夹 '@f' ?",
|
||||
"Delete folder?": "删除文件夹?",
|
||||
"Delete folder '@f' ?": "删除文件夹 '@f' ?",
|
||||
"Import from file": "从文件导入",
|
||||
"Failed to import": "导入失败",
|
||||
"Cache Limit": "缓存限制",
|
||||
"Set Cache Limit": "设置缓存限制",
|
||||
"Size in MB": "大小(MB)",
|
||||
"Select a directory which contains the comic directories." : "选择一个包含漫画文件夹的目录",
|
||||
"Select a directory which contains the comic directories.": "选择一个包含漫画文件夹的目录",
|
||||
"Help": "帮助",
|
||||
"Export as cbz": "导出为cbz",
|
||||
"Select an archive file (cbz, zip, 7z, cb7)" : "选择一个归档文件 (cbz, zip, 7z, cb7)",
|
||||
"An archive file" : "一个归档文件",
|
||||
"Select an archive file (cbz, zip, 7z, cb7)": "选择一个归档文件 (cbz, zip, 7z, cb7)",
|
||||
"An archive file": "一个归档文件",
|
||||
"Fullscreen": "全屏",
|
||||
"Exit": "退出",
|
||||
"View more": "查看更多",
|
||||
@@ -198,9 +198,9 @@
|
||||
"Long press on the favorite button to quickly add to this folder": "长按收藏按钮快速添加到这个文件夹",
|
||||
"Added": "已添加",
|
||||
"Turn page by volume keys": "使用音量键翻页",
|
||||
"Display time & battery info in reader":"在阅读器中显示时间和电量信息",
|
||||
"EhViewer downloads":"EhViewer下载",
|
||||
"Select an EhViewer database and a download folder.":"选择EhViewer的下载数据(导出的db文件)与存放下载内容的目录",
|
||||
"Display time & battery info in reader": "在阅读器中显示时间和电量信息",
|
||||
"EhViewer downloads": "EhViewer下载",
|
||||
"Select an EhViewer database and a download folder.": "选择EhViewer的下载数据(导出的db文件)与存放下载内容的目录",
|
||||
"(EhViewer)Default": "(EhViewer)默认",
|
||||
"If you import an EhViewer's database, program will automatically create folders according to the download label in that database.": "若通过EhViewer数据库导入漫画,程序将会按其中的下载标签自动创建收藏文件夹。",
|
||||
"Multi-Select": "进入多选模式",
|
||||
@@ -241,7 +241,7 @@
|
||||
"Delete all unavailable local favorite items": "删除所有无效的本地收藏",
|
||||
"Deleted @a favorite items.": "已删除 @a 条无效收藏",
|
||||
"New version available": "有新版本可用",
|
||||
"A new version is available. Do you want to update now?" : "有新版本可用。您要现在更新吗?",
|
||||
"A new version is available. Do you want to update now?": "有新版本可用。您要现在更新吗?",
|
||||
"No new version available": "没有新版本可用",
|
||||
"Export as pdf": "导出为pdf",
|
||||
"Export as epub": "导出为epub",
|
||||
@@ -288,15 +288,15 @@
|
||||
"Copy the title successfully": "复制标题成功",
|
||||
"The comic is invalid, please long press to delete, you can double click the title to copy": "该漫画已失效, 请长按删除, 可以双击标题进行复制",
|
||||
"No search results found": "未找到搜索结果",
|
||||
"Added @c comics to download queue." : "已添加 @c 本漫画到下载队列",
|
||||
"Added @c comics to download queue.": "已添加 @c 本漫画到下载队列",
|
||||
"Download started": "下载已开始",
|
||||
"Click favorite": "点击收藏",
|
||||
"End": "末尾",
|
||||
"None": "无",
|
||||
"View Detail": "查看详情",
|
||||
"Select a directory which contains multiple archive files." : "选择一个包含多个归档文件的目录",
|
||||
"Multiple archive files" : "多个归档文件",
|
||||
"No valid comics found" : "未找到有效的漫画",
|
||||
"Select a directory which contains multiple archive files.": "选择一个包含多个归档文件的目录",
|
||||
"Multiple archive files": "多个归档文件",
|
||||
"No valid comics found": "未找到有效的漫画",
|
||||
"Enable DNS Overrides": "启用DNS覆写",
|
||||
"DNS Overrides": "DNS覆写",
|
||||
"Custom Image Processing": "自定义图片处理",
|
||||
@@ -342,12 +342,12 @@
|
||||
"Replies": "回复",
|
||||
"Follow Updates": "追更",
|
||||
"Not Configured": "未配置",
|
||||
"Choose a folder to follow updates." : "选择一个文件夹以追更",
|
||||
"Choose a folder to follow updates.": "选择一个文件夹以追更",
|
||||
"Choose Folder": "选择文件夹",
|
||||
"No folders available": "没有可用的文件夹",
|
||||
"Updating comics...": "更新漫画中...",
|
||||
"Automatic update checking enabled." : "已启用自动更新检查",
|
||||
"The app will check for updates at most once a day." : "APP将每天最多检查一次更新",
|
||||
"Automatic update checking enabled.": "已启用自动更新检查",
|
||||
"The app will check for updates at most once a day.": "APP将每天最多检查一次更新",
|
||||
"Change Folder": "更改文件夹",
|
||||
"Check Now": "立即检查",
|
||||
"Updates": "更新",
|
||||
@@ -360,7 +360,7 @@
|
||||
"Disabled": "已禁用",
|
||||
"Auto Sync Data": "自动同步数据",
|
||||
"Mark all as read": "全部标记为已读",
|
||||
"Do you want to mark all as read?" : "您要全部标记为已读吗?",
|
||||
"Do you want to mark all as read?": "您要全部标记为已读吗?",
|
||||
"Swipe down for previous chapter": "向下滑动查看上一章",
|
||||
"Swipe up for next chapter": "向上滑动查看下一章",
|
||||
"Initial Page": "初始页面",
|
||||
@@ -378,7 +378,9 @@
|
||||
"Page": "页面",
|
||||
"Jump": "跳转",
|
||||
"Copy Image": "复制图片",
|
||||
"A valid WebDav directory URL": "有效的WebDav目录URL"
|
||||
"A valid WebDav directory URL": "有效的WebDav目录URL",
|
||||
"Shut Down": "关闭",
|
||||
"Uploading data...": "正在上传数据..."
|
||||
},
|
||||
"zh_TW": {
|
||||
"Home": "首頁",
|
||||
@@ -520,18 +522,18 @@
|
||||
"Block": "封鎖",
|
||||
"Add new favorite to": "添加新收藏到",
|
||||
"Move favorite after reading": "閱讀後移動收藏",
|
||||
"Delete folder?" : "刪除資料夾?",
|
||||
"Delete folder '@f' ?" : "刪除資料夾 '@f' ?",
|
||||
"Delete folder?": "刪除資料夾?",
|
||||
"Delete folder '@f' ?": "刪除資料夾 '@f' ?",
|
||||
"Import from file": "從文件匯入",
|
||||
"Failed to import": "匯入失敗",
|
||||
"Cache Limit": "快取限制",
|
||||
"Set Cache Limit": "設定快取限制",
|
||||
"Size in MB": "大小(MB)",
|
||||
"Select a directory which contains the comic directories." : "選擇一個包含漫畫資料夾的目錄",
|
||||
"Select a directory which contains the comic directories.": "選擇一個包含漫畫資料夾的目錄",
|
||||
"Help": "幫助",
|
||||
"Export as cbz": "匯出為cbz",
|
||||
"Select an archive file (cbz, zip, 7z, cb7)" : "選擇一個歸檔文件 (cbz, zip, 7z, cb7)",
|
||||
"An archive file" : "一個歸檔文件",
|
||||
"Select an archive file (cbz, zip, 7z, cb7)": "選擇一個歸檔文件 (cbz, zip, 7z, cb7)",
|
||||
"An archive file": "一個歸檔文件",
|
||||
"Fullscreen": "全螢幕",
|
||||
"Exit": "退出",
|
||||
"View more": "查看更多",
|
||||
@@ -622,13 +624,13 @@
|
||||
"Delete all unavailable local favorite items": "刪除所有無效的本機收藏",
|
||||
"Deleted @a favorite items.": "已刪除 @a 條無效收藏",
|
||||
"New version available": "有新版本可用",
|
||||
"A new version is available. Do you want to update now?" : "有新版本可用。您要現在更新嗎?",
|
||||
"A new version is available. Do you want to update now?": "有新版本可用。您要現在更新嗎?",
|
||||
"No new version available": "沒有新版本可用",
|
||||
"Export as pdf": "匯出為pdf",
|
||||
"Export as epub": "匯出為epub",
|
||||
"Aggregated Search": "聚合搜尋",
|
||||
"No search results found": "未找到搜尋結果",
|
||||
"Added @c comics to download queue." : "已添加 @c 本漫畫到下載佇列",
|
||||
"Added @c comics to download queue.": "已添加 @c 本漫畫到下載佇列",
|
||||
"Download started": "下載已開始",
|
||||
"Click favorite": "點擊收藏",
|
||||
"Local comic collection is not supported at present": "本機收藏暫不支援",
|
||||
@@ -675,9 +677,9 @@
|
||||
"End": "末尾",
|
||||
"None": "無",
|
||||
"View Detail": "查看詳情",
|
||||
"Select a directory which contains multiple archive files." : "選擇一個包含多個歸檔文件的目錄",
|
||||
"Multiple archive files" : "多個歸檔文件",
|
||||
"No valid comics found" : "未找到有效的漫畫",
|
||||
"Select a directory which contains multiple archive files.": "選擇一個包含多個歸檔文件的目錄",
|
||||
"Multiple archive files": "多個歸檔文件",
|
||||
"No valid comics found": "未找到有效的漫畫",
|
||||
"Enable DNS Overrides": "啟用DNS覆寫",
|
||||
"DNS Overrides": "DNS覆寫",
|
||||
"Custom Image Processing": "自訂圖片處理",
|
||||
@@ -723,12 +725,12 @@
|
||||
"Replies": "回覆",
|
||||
"Follow Updates": "追更",
|
||||
"Not Configured": "未配置",
|
||||
"Choose a folder to follow updates." : "選擇一個資料夾以追更",
|
||||
"Choose a folder to follow updates.": "選擇一個資料夾以追更",
|
||||
"Choose Folder": "選擇資料夾",
|
||||
"No folders available": "沒有可用的資料夾",
|
||||
"Updating comics...": "更新漫畫中...",
|
||||
"Automatic update checking enabled." : "已啟用自動更新檢查",
|
||||
"The app will check for updates at most once a day." : "APP將每天最多檢查一次更新",
|
||||
"Automatic update checking enabled.": "已啟用自動更新檢查",
|
||||
"The app will check for updates at most once a day.": "APP將每天最多檢查一次更新",
|
||||
"Change Folder": "更改資料夾",
|
||||
"Check Now": "立即檢查",
|
||||
"Updates": "更新",
|
||||
@@ -741,7 +743,7 @@
|
||||
"Disabled": "已停用",
|
||||
"Auto Sync Data": "自動同步資料",
|
||||
"Mark all as read": "全部標記為已讀",
|
||||
"Do you want to mark all as read?" : "您要全部標記為已讀嗎?",
|
||||
"Do you want to mark all as read?": "您要全部標記為已讀嗎?",
|
||||
"Swipe down for previous chapter": "向下滑動查看上一章",
|
||||
"Swipe up for next chapter": "向上滑動查看下一章",
|
||||
"Initial Page": "初始頁面",
|
||||
@@ -759,6 +761,8 @@
|
||||
"Page": "頁面",
|
||||
"Jump": "跳轉",
|
||||
"Copy Image": "複製圖片",
|
||||
"A valid WebDav directory URL": "有效的WebDav目錄URL"
|
||||
"A valid WebDav directory URL": "有效的WebDav目錄URL",
|
||||
"Shut Down": "關閉",
|
||||
"Uploading data...": "正在上傳數據..."
|
||||
}
|
||||
}
|
||||
|
@@ -82,10 +82,7 @@ class _WindowFrameState extends State<WindowFrame> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
windowManager.close().then((_) {
|
||||
// Make sure the app exits when the window is closed.
|
||||
exit(0);
|
||||
});
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@@ -1,4 +1,6 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:venera/components/components.dart';
|
||||
import 'package:venera/components/window_frame.dart';
|
||||
import 'package:venera/foundation/app.dart';
|
||||
import 'package:venera/foundation/appdata.dart';
|
||||
import 'package:venera/foundation/comic_source/comic_source.dart';
|
||||
@@ -10,6 +12,7 @@ import 'package:venera/utils/data.dart';
|
||||
import 'package:venera/utils/ext.dart';
|
||||
import 'package:webdav_client/webdav_client.dart' hide File;
|
||||
import 'package:rhttp/rhttp.dart' as rhttp;
|
||||
import 'package:venera/utils/translations.dart';
|
||||
|
||||
import 'io.dart';
|
||||
|
||||
@@ -20,6 +23,10 @@ class DataSync with ChangeNotifier {
|
||||
}
|
||||
LocalFavoritesManager().addListener(onDataChanged);
|
||||
ComicSourceManager().addListener(onDataChanged);
|
||||
Future.delayed(const Duration(seconds: 1), () {
|
||||
var controller = WindowFrame.of(App.rootContext);
|
||||
controller.addCloseListener(_handleWindowClose);
|
||||
});
|
||||
}
|
||||
|
||||
void onDataChanged() {
|
||||
@@ -28,6 +35,28 @@ class DataSync with ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
bool _handleWindowClose() {
|
||||
if (_isUploading) {
|
||||
_showWindowCloseDialog();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void _showWindowCloseDialog() async {
|
||||
showLoadingDialog(
|
||||
App.rootContext,
|
||||
cancelButtonText: "Shut Down".tl,
|
||||
onCancel: () => exit(0),
|
||||
barrierDismissible: false,
|
||||
message: "Uploading data...".tl,
|
||||
);
|
||||
while (_isUploading) {
|
||||
await Future.delayed(const Duration(milliseconds: 50));
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static DataSync? instance;
|
||||
|
||||
factory DataSync() => instance ?? (instance = DataSync._());
|
||||
|
Reference in New Issue
Block a user