xfangfang / wiliwili

第三方B站客户端,目前可以运行在PC全平台、PSVita、PS4 、Xbox 和 Nintendo Switch上
https://xfangfang.github.io/wiliwili
GNU General Public License v3.0
3k stars 147 forks source link

Add share dialog with clipboard #277

Closed dragonflylee closed 5 months ago

dragonflylee commented 5 months ago

@happytommyl

解決 https://github.com/xfangfang/wiliwili/issues/201 看到 https://github.com/xfangfang/wiliwili/pull/205 好久沒有更新 这里补完一下代码

image

xfangfang commented 5 months ago

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

  1. 缺少了 “已复制到剪贴板” 这句话的英语翻译
  2. 使用按键操作时,在微信上焦点框会挡住弹出来的提示,好像不太好解决,感觉可以把微信放右上角去,避免重合
  3. 贴吧我测试好像不能分享,在 safari 中弹出来提示 “分享URL不合法”,我测试在 分享的视频 url 后面手动加个 %2F 就行了
  4. 番剧视频没有接入这个分享的功能,触发代码在:https://github.com/xfangfang/wiliwili/blob/2183dd1bf3ca2648961be47cc11499edce1d018f/wiliwili/source/activity/player_season_activity.cpp#L111-L114
dragonflylee commented 5 months ago

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

xfangfang commented 5 months ago

应用下面的补丁之后,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 commented 5 months ago

已更新番剧分享的逻辑

xfangfang commented 5 months ago

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

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

xfangfang commented 5 months ago

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