Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add share dialog with clipboard #277

Merged
merged 4 commits into from
Jan 31, 2024
Merged

Conversation

dragonflylee
Copy link
Contributor

@dragonflylee dragonflylee commented Jan 30, 2024

@happytommyl

解決 #201
看到 #205 好久沒有更新 这里补完一下代码

image

@dragonflylee dragonflylee force-pushed the share branch 2 times, most recently from 9ce8923 to c1373a2 Compare January 30, 2024 15:31
@dragonflylee dragonflylee changed the title 增加分享至剪贴板 Add share dialog with clipboard Jan 30, 2024
@xfangfang
Copy link
Owner

xfangfang commented Jan 30, 2024

感谢贡献,我在mac下测试剪贴板功能正常~

  1. 缺少了 “已复制到剪贴板” 这句话的英语翻译
  2. 使用按键操作时,在微信上焦点框会挡住弹出来的提示,好像不太好解决,感觉可以把微信放右上角去,避免重合
  3. 贴吧我测试好像不能分享,在 safari 中弹出来提示 “分享URL不合法”,我测试在 分享的视频 url 后面手动加个 %2F 就行了
  4. 番剧视频没有接入这个分享的功能,触发代码在:
    this->btnQR->getParent()->registerClickAction([this](...) {
    this->showShareDialog(this->episodeResult.link);
    return true;
    });

@dragonflylee
Copy link
Contributor Author

番剧分享好像信息不太全,比如缺少图片链接

@xfangfang
Copy link
Owner

应用下面的补丁之后,this->episodeResult.cover 是单独一集的封面,this->seasonInfo.cover 是整个番剧的封面。(可以在单集封面不存在的情况下使用番剧封面)

diff --git a/wiliwili/include/api/bilibili/result/home_pgc_season_result.h b/wiliwili/include/api/bilibili/result/home_pgc_season_result.h
index 96eed9f..3b5753e 100644
--- a/wiliwili/include/api/bilibili/result/home_pgc_season_result.h
+++ b/wiliwili/include/api/bilibili/result/home_pgc_season_result.h
@@ -47,6 +47,7 @@ public:
     std::string long_title;
     std::string subtitle;
     std::string link;
+    std::string cover;
     unsigned int pub_time;
     EpisodesBadge badge_info;
 
@@ -66,7 +67,9 @@ inline void from_json(const nlohmann::json& nlohmann_json_j, SeasonEpisodeResult
     if (nlohmann_json_j.contains("subtitle")) {
         nlohmann_json_j.at("subtitle").get_to(nlohmann_json_t.subtitle);
     }
-
+    if (nlohmann_json_j.contains("cover")) {
+        nlohmann_json_j.at("cover").get_to(nlohmann_json_t.cover);
+    }
     if (nlohmann_json_j.contains("badge_info")) {
         nlohmann_json_j.at("badge_info").get_to(nlohmann_json_t.badge_info);
     }
@@ -206,6 +209,7 @@ inline void from_json(const nlohmann::json& nlohmann_json_j, SeasonRecommendWrap
 class SeasonResultWrapper {
 public:
     unsigned int season_id;
+    std::string cover;
     std::string season_title;
     std::string season_desc;
     SeasonEpisodeListResult episodes;
@@ -257,6 +261,9 @@ inline void from_json(const nlohmann::json& nlohmann_json_j, SeasonResultWrapper
     if (nlohmann_json_j.contains("user_status")) {
         nlohmann_json_j.at("user_status").get_to(nlohmann_json_t.user_status);
     }
+    if (nlohmann_json_j.contains("cover")) {
+        nlohmann_json_j.at("cover").get_to(nlohmann_json_t.cover);
+    }
     NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, season_id, season_title, evaluate));
 }

@dragonflylee
Copy link
Contributor Author

已更新番剧分享的逻辑

@xfangfang
Copy link
Owner

感谢,我刚刚切换到浅色主题又测试了一下,发现分割线和右上角的关闭按键用的颜色在浅色下显示效果不佳。

对于关闭按钮,好像是不指定 textColor 就会自动根据主题更换颜色。对于分割线,可以使用 @theme/color/line

@xfangfang
Copy link
Owner

同时如果方便的话最好可以手动指定一下分享按钮焦点切换的逻辑,(在 xml 里使用 focusDown 和 focusUp)
现在使用按键上下切换的时候,可能会让用户搞不明白焦点是怎么切换的,比如焦点先从 “qq” 切换到 “qq 空间”,然后向下,用户可能预期切换到“微博”,但是程序会默认切换到 “贴吧”。

@xfangfang xfangfang merged commit e2b30ad into xfangfang:dev Jan 31, 2024
15 checks passed
@dragonflylee dragonflylee deleted the share branch January 31, 2024 10:29
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants