The only downloader you need. 下载器的集大成者。
TypeScript asyncasynciobittorentbtcross-platformdownload-managerdownloaderfluent-designftphttp3magnetpyqtpyside6pythonqtquicreactsoftwarestreaming
fix(update): #671 #672
XiaoYouChR363abd16cb1b
diff --git a/app/view/mobile/setting_page.py b/app/view/mobile/setting_page.pyindex 5f3d2776..7ae4e0fc 100644--- a/app/view/mobile/setting_page.py+++ b/app/view/mobile/setting_page.py@@ -12,8 +12,8 @@ QWIDGETSIZE_MAX = (1 << 24) - 1class MobileSettingPage(SettingPage):- def __init__(self, featureService, browserService, coroutineRunner, categoryService, parent=None):- super().__init__(featureService, browserService, coroutineRunner, categoryService, parent=parent)+ def __init__(self, featureService, browserService, coroutineRunner, categoryService, taskService, parent=None):+ super().__init__(featureService, browserService, coroutineRunner, categoryService, taskService, parent=parent)self._setScrollContentOpaque()def showEvent(self, event):diff --git a/app/view/mobile/window.py b/app/view/mobile/window.pyindex a401ed05..38e2d155 100644--- a/app/view/mobile/window.py+++ b/app/view/mobile/window.py@@ -13,6 +13,7 @@ from app.config.cfg import cfgfrom app.platform.android import clearShare, isStorageGranted, parseShare, requestStoragePermissionfrom app.platform.android_notification import isNotificationEnabled, requestNotificationPermissionfrom app.services.task_draft import TaskDraft+from app.update import addBestAssetTask, showReleaseDialogfrom app.view.dialogs.task_draft import TaskDraftDialogfrom app.view.mobile.device import setupAccentColorfrom app.view.mobile.navigation import BottomNavigationBar@@ -43,7 +44,7 @@ class MobileMainWindow(QWidget):parent=self,)self.taskPage = MobileTaskPage(taskService, featureService, categoryService, speedMeter, parent=self)- self.settingPage = MobileSettingPage(featureService, browserService, coroutineRunner, categoryService, parent=self)+ self.settingPage = MobileSettingPage(featureService, browserService, coroutineRunner, categoryService, taskService, parent=self)self.searchEdit = SearchLineEdit(self)self.addButton = PrimaryToolButton(FluentIcon.ADD, self)self.vBoxLayout = QVBoxLayout(self)@@ -200,7 +201,6 @@ class MobileMainWindow(QWidget):def _onUpdateAvailable(self, release) -> None:from qfluentwidgets import PrimaryPushButton, PushButton- from app.update import addBestAssetTask, showReleaseDialoginfoBar = InfoBar(icon=FluentIcon.CLOUD,@@ -213,10 +213,10 @@ class MobileMainWindow(QWidget):parent=self,)downloadButton = PrimaryPushButton(FluentIcon.DOWNLOAD, self.tr("立即下载"))- downloadButton.clicked.connect(lambda: addBestAssetTask(release, self))+ downloadButton.clicked.connect(lambda: addBestAssetTask(release, self, self._coroutineRunner, self._featureService, self._taskService))infoBar.addWidget(downloadButton)detailButton = PushButton(FluentIcon.CHAT, self.tr("查看详情"))- detailButton.clicked.connect(lambda: showReleaseDialog(release, self))+ detailButton.clicked.connect(lambda: showReleaseDialog(release, self, self._coroutineRunner, self._featureService, self._taskService))infoBar.addWidget(detailButton)infoBar.show()diff --git a/app/view/pages/setting_page.py b/app/view/pages/setting_page.pyindex a4e546c7..d5359e20 100644--- a/app/view/pages/setting_page.py+++ b/app/view/pages/setting_page.py@@ -27,17 +27,19 @@ from app.view.components.setting_cards import (HeadersPresetSettingCard, IdentitySettingCard, LineEditSettingCard,PercentSpinBoxSettingCard, ProxySettingCard, SpinBoxSettingCard,)+from app.update import fetchRelease, isOutdated, showReleaseDialogfrom app.view.components.editors import FolderPickerclass SettingPage(ScrollArea):- def __init__(self, featureService, browserService, coroutineRunner, categoryService, parent=None):+ def __init__(self, featureService, browserService, coroutineRunner, categoryService, taskService, parent=None):super().__init__(parent)self._featureService = featureServiceself._browserService = browserServiceself._coroutineRunner = coroutineRunnerself._categoryService = categoryService+ self._taskService = taskServiceself.container = QWidget()self.vBoxLayout = QVBoxLayout(self.container)self.vBoxLayout.addStretch(1)@@ -489,8 +491,6 @@ class SettingPage(ScrollArea):QApplication.instance().quit()def _onAboutCardClicked(self) -> None:- from app.update import fetchRelease-InfoBar.info(self.tr("检查更新"), self.tr("正在检查更新..."),duration=1500, position=InfoBarPosition.BOTTOM_RIGHT, parent=self.window())self._coroutineRunner.submit(@@ -500,17 +500,13 @@ class SettingPage(ScrollArea):)def _onUpdateChecked(self, release) -> None:- from app.config.constants import VERSION- from app.update import isOutdated-if not isOutdated(release):InfoBar.success(self.tr("当前已是最新版本"),self.tr("当前版本 {0},最新版本 {1}").format(VERSION, release.version),duration=3000, position=InfoBarPosition.BOTTOM_RIGHT, parent=self.window())return- from app.update import showReleaseDialog- showReleaseDialog(release, self.window())+ showReleaseDialog(release, self.window(), self._coroutineRunner, self._featureService, self._taskService)def _onUpdateCheckFailed(self, error: str) -> None:InfoBar.error(self.tr("检查更新失败"), self.tr("无法获取最新版本信息"),diff --git a/app/view/windows/main_window.py b/app/view/windows/main_window.pyindex 439406e0..a507c44c 100644--- a/app/view/windows/main_window.py+++ b/app/view/windows/main_window.py@@ -16,6 +16,7 @@ from app.config.cfg import CloseMode, cfgfrom app.config.constants import DONATE_URL, FEEDBACK_URLfrom app.services.task_draft import TaskDraftfrom app.signal_bus import signalBus+from app.update import addBestAssetTask, showReleaseDialogfrom app.view.pages.setting_page import SettingPagefrom app.view.pages.task_page import TaskPage@@ -141,7 +142,7 @@ class MainWindow(MSFluentWindow):if pageClass is SettingPage:return SettingPage(self._featureService, self._browserService,- self._coroutineRunner, self._categoryService, parent=self,+ self._coroutineRunner, self._categoryService, self._taskService, parent=self,)return self._featureService.createPage(pageClass, parent=self)@@ -241,7 +242,6 @@ class MainWindow(MSFluentWindow):def _onUpdateAvailable(self, release) -> None:from qfluentwidgets import PrimaryPushButton, PushButton- from app.update import addBestAssetTask, showReleaseDialoginfoBar = InfoBar(icon=FluentIcon.CLOUD,@@ -254,10 +254,10 @@ class MainWindow(MSFluentWindow):parent=self,)downloadButton = PrimaryPushButton(FluentIcon.DOWNLOAD, self.tr("立即下载"))- downloadButton.clicked.connect(lambda: addBestAssetTask(release, self))+ downloadButton.clicked.connect(lambda: addBestAssetTask(release, self, self._coroutineRunner, self._featureService, self._taskService))infoBar.addWidget(downloadButton)detailButton = PushButton(FluentIcon.CHAT, self.tr("查看详情"))- detailButton.clicked.connect(lambda: showReleaseDialog(release, self))+ detailButton.clicked.connect(lambda: showReleaseDialog(release, self, self._coroutineRunner, self._featureService, self._taskService))infoBar.addWidget(detailButton)sponsorButton = PushButton(FluentIcon.HEART, self.tr("请作者喝咖啡"))sponsorButton.clicked.connect(lambda: QDesktopServices.openUrl(QUrl(DONATE_URL)))