diff --git a/library/borealis b/library/borealis index a9e68576..71e08a6d 160000 --- a/library/borealis +++ b/library/borealis @@ -1 +1 @@ -Subproject commit a9e68576f81d8e5c66f7305e10ab3fae18ae407e +Subproject commit 71e08a6d4d9c0670dddb1ab7ff46f57d0cdec624 diff --git a/resources/i18n/en-US/wiliwili.json b/resources/i18n/en-US/wiliwili.json index e5a44d37..99f3fe7d 100644 --- a/resources/i18n/en-US/wiliwili.json +++ b/resources/i18n/en-US/wiliwili.json @@ -112,7 +112,9 @@ "dlna_waiting": "Waiting for DLNA casting...", "dlna_quit": "Exit the DLNA casting?", "up2date": "App is up to date", + "checking_update": "Checking for updates...", "release": "Check for updates", + "config_dir": "Config directory", "config": "Open config directory" } }, diff --git a/resources/i18n/zh-Hans/wiliwili.json b/resources/i18n/zh-Hans/wiliwili.json index 0fe4757c..b61f1534 100644 --- a/resources/i18n/zh-Hans/wiliwili.json +++ b/resources/i18n/zh-Hans/wiliwili.json @@ -112,7 +112,9 @@ "dlna_waiting": "等待 DLNA 投屏中...", "dlna_quit": "确定要退出投屏?", "up2date": "应用已经是最新版", + "checking_update": "正在检查更新...", "release": "检查更新", + "config_dir": "配置目录", "config": "打开配置目录" } }, diff --git a/resources/i18n/zh-Hant/wiliwili.json b/resources/i18n/zh-Hant/wiliwili.json index fa4d8a06..47599200 100644 --- a/resources/i18n/zh-Hant/wiliwili.json +++ b/resources/i18n/zh-Hant/wiliwili.json @@ -112,7 +112,9 @@ "dlna_waiting": "等待 DLNA 投映中...", "dlna_quit": "確定要退出投映?", "up2date": "應用程式為最新版本。", + "checking_update": "正在檢查更新...", "release": "檢查更新", + "config_dir": "設定檔目錄", "config": "開啟設定檔目錄" } }, diff --git a/resources/xml/fragment/share_dialog.xml b/resources/xml/fragment/share_dialog.xml index 40df2626..c009368f 100644 --- a/resources/xml/fragment/share_dialog.xml +++ b/resources/xml/fragment/share_dialog.xml @@ -89,20 +89,4 @@ - - - - \ No newline at end of file diff --git a/wiliwili/include/fragment/share_dialog.hpp b/wiliwili/include/fragment/share_dialog.hpp index aff60e4e..dc6c4123 100644 --- a/wiliwili/include/fragment/share_dialog.hpp +++ b/wiliwili/include/fragment/share_dialog.hpp @@ -46,7 +46,6 @@ class ShareDialog : public brls::Box { private: BRLS_BIND(QRImage, qrcode, "share/qrcode"); BRLS_BIND(brls::Box, boxShare, "share/box"); - BRLS_BIND(brls::Box, boxHint, "share/hint/box"); BRLS_BIND(ShareBox, qq, "share/box/qq"); BRLS_BIND(ShareBox, qzone, "share/box/qzone"); BRLS_BIND(ShareBox, tieba, "share/box/tieba"); diff --git a/wiliwili/source/activity/setting_activity.cpp b/wiliwili/source/activity/setting_activity.cpp index 35171f9a..045400a1 100644 --- a/wiliwili/source/activity/setting_activity.cpp +++ b/wiliwili/source/activity/setting_activity.cpp @@ -189,20 +189,31 @@ void SettingActivity::onContentAvailable() { return true; }); -#if !defined(__SWITCH__) && !defined(IOS) && !defined(__PSV__) && !defined(PS4) - btnOpenConfig->registerClickAction([](...) -> bool { - auto* p = (brls::DesktopPlatform*)brls::Application::getPlatform(); - p->openBrowser(ProgramConfig::instance().getConfigDir()); - return true; - }); +#if defined(__SWITCH__) || defined(__PSV__) || defined(PS4) + btnOpenConfig->title->setText("wiliwili/setting/tools/others/config_dir"_i18n); +#endif #ifdef __linux__ if (brls::isSteamDeck()) { - btnOpenConfig->setVisibility(brls::Visibility::GONE); + btnOpenConfig->title->setText("wiliwili/setting/tools/others/config_dir"_i18n); } #endif + btnOpenConfig->registerClickAction([](...) -> bool { + auto configPath = ProgramConfig::instance().getConfigDir(); + brls::Application::notify("wiliwili/setting/tools/others/config_dir"_i18n + ": " + configPath); +#if !defined(__SWITCH__) && !defined(__PSV__) && !defined(PS4) +#ifdef __linux__ + if (!brls::isSteamDeck()) #else - btnOpenConfig->setVisibility(brls::Visibility::GONE); + { + auto* p = (brls::DesktopPlatform*)brls::Application::getPlatform(); + p->openBrowser(configPath); + } #endif +#endif + return true; + }); + + btnTutorialFont->registerClickAction([](...) -> bool { auto dialog = new brls::Dialog((brls::Box*)brls::View::createFromXMLResource("fragment/settings_tutorial_font.xml")); @@ -241,7 +252,7 @@ void SettingActivity::onContentAvailable() { btnReleaseChecker->title->setText("wiliwili/setting/tools/others/release"_i18n + " (" + "hints/current"_i18n + ": " + version + ")"); btnReleaseChecker->registerClickAction([](...) -> bool { - // todo: 弹出一个提示提醒用户正在检查更新 + brls::Application::notify("wiliwili/setting/tools/others/checking_update"_i18n); APPVersion::instance().checkUpdate(0, true); return true; }); diff --git a/wiliwili/source/fragment/share_dialog.cpp b/wiliwili/source/fragment/share_dialog.cpp index 74937d61..d2c404ce 100644 --- a/wiliwili/source/fragment/share_dialog.cpp +++ b/wiliwili/source/fragment/share_dialog.cpp @@ -14,6 +14,8 @@ #include "view/qr_image.hpp" #include "view/button_close.hpp" +using namespace brls::literals; + ShareBox::ShareBox() { this->inflateFromXMLRes("xml/fragment/share_box.xml"); this->registerStringXMLAttribute("title", [this](const std::string& value) { this->title->setText(value); }); @@ -80,9 +82,6 @@ void ShareDialog::open(const std::string& link, const std::string& title, const "url={}&type=3&count=1&appkey=2841902482&title={}&pic={}&language=zh_cn", cpr::util::urlEncode(link), cpr::util::urlEncode(title + "#哔哩哔哩动画#"), cpr::util::urlEncode(pic))); - this->boxHint->hide([]() {}, false, 0); - this->boxHint->setVisibility(brls::Visibility::VISIBLE); - this->dynamic->setLink(link); this->dynamic->getEvent()->subscribe([this]() { this->showHint(); }); this->wechat->setLink(link); @@ -95,11 +94,5 @@ void ShareDialog::open(const std::string& link, const std::string& title, const ShareDialog::~ShareDialog() { brls::Logger::debug("Fragment ShareDialog: delete"); } void ShareDialog::showHint() { - ASYNC_RETAIN - this->boxHint->show([ASYNC_TOKEN]() { - brls::delay(500, [ASYNC_TOKEN]() { - ASYNC_RELEASE - this->boxHint->hide([]() {}); - }); - }); + brls::Application::notify("wiliwili/player/clipboard"_i18n); } \ No newline at end of file diff --git a/wiliwili/source/presenter/video_detail.cpp b/wiliwili/source/presenter/video_detail.cpp index 208c7d2f..45cbc377 100644 --- a/wiliwili/source/presenter/video_detail.cpp +++ b/wiliwili/source/presenter/video_detail.cpp @@ -615,7 +615,8 @@ void VideoDetail::beAgree(uint64_t aid) { [ASYNC_TOKEN](BILI_ERR) { // 请求失败 恢复默认状态 brls::Logger::error("{}", error); - brls::sync([ASYNC_TOKEN]() { + brls::sync([ASYNC_TOKEN, error]() { + brls::Application::notify(error); ASYNC_RELEASE this->onVideoRelationInfo(videoRelation); }); @@ -648,6 +649,7 @@ void VideoDetail::addCoin(uint64_t aid, int num, bool like) { // 请求失败 恢复默认状态 brls::Logger::error("{}", error); brls::sync([ASYNC_TOKEN, error]() { + brls::Application::notify(error); ASYNC_RELEASE // 投币达到上限 if (pystring::count(error, "34005")) videoRelation.coin = 2; @@ -679,7 +681,8 @@ void VideoDetail::addResource(uint64_t aid, int type, bool isFavorite, std::stri [ASYNC_TOKEN](BILI_ERR) { // 请求失败 恢复默认状态 brls::Logger::error("{}", error); - brls::sync([ASYNC_TOKEN]() { + brls::sync([ASYNC_TOKEN, error]() { + brls::Application::notify(error); ASYNC_RELEASE this->onVideoRelationInfo(videoRelation); }); diff --git a/wiliwili/source/utils/version_helper.cpp b/wiliwili/source/utils/version_helper.cpp index 17db15ac..bb112b4d 100644 --- a/wiliwili/source/utils/version_helper.cpp +++ b/wiliwili/source/utils/version_helper.cpp @@ -77,12 +77,16 @@ bool APPVersion::needUpdate(std::string latestVersion) { } void APPVersion::checkUpdate(int delay, bool showUpToDateDialog) { + static bool checking_update = false; + if (checking_update) return; + checking_update = true; brls::Threading::delay(delay, [showUpToDateDialog]() { std::string url = ProgramConfig::instance().getSettingItem(SettingItem::CUSTOM_UPDATE_API, APPVersion::RELEASE_API); cpr::GetCallback( [showUpToDateDialog](cpr::Response r) { + checking_update = false; try { if (r.status_code != 200 || r.text.empty()) { brls::Logger::error("Cannot check update: {} {}", r.status_code, r.text); @@ -98,7 +102,7 @@ void APPVersion::checkUpdate(int delay, bool showUpToDateDialog) { brls::Logger::info("App is up to date"); if (showUpToDateDialog) { brls::sync( - []() { DialogHelper::showDialog("wiliwili/setting/tools/others/up2date"_i18n); }); + []() { brls::Application::notify("wiliwili/setting/tools/others/up2date"_i18n); }); } return; }