From 12bf862f8845e9b097669d1d5e5827adc6f0d7a9 Mon Sep 17 00:00:00 2001 From: Linecom-lik <3448336734@qq.com> Date: Tue, 16 Jul 2024 05:50:12 +0800 Subject: [PATCH 01/10] Update Package --- .../xcshareddata/swiftpm/Package.resolved | 20 +++++++++---------- MeowBili/Others/PhoneFormatterExt.swift | 19 ++++++++++++++++++ 2 files changed, 29 insertions(+), 10 deletions(-) create mode 100644 MeowBili/Others/PhoneFormatterExt.swift diff --git a/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 34a131b8e..ad5c83ab7 100644 --- a/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -33,8 +33,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/adamzarn/AZVideoPlayer", "state" : { - "revision" : "75e9e05b87d2bd60d83be4b8db280eb2859a86bc", - "version" : "1.3.0" + "revision" : "f37c779bf5c00e85dc31ad25d883b3f2e5242b2a", + "version" : "1.2.0" } }, { @@ -42,8 +42,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Serene-Garden/Cepheus", "state" : { - "revision" : "0754853c69a39f6cdc04abb8b1d194a3ed3a483e", - "version" : "2.3.0" + "revision" : "38adeadadc1b52a61db4078a80aac98af3311890", + "version" : "2.0.2" } }, { @@ -52,7 +52,7 @@ "location" : "https://github.com/Darock-Studio/DarockKit", "state" : { "branch" : "main", - "revision" : "4afcdeba8f3c6ca4dbd7ba2886924bdcbadec262" + "revision" : "0735d98596b3fe5280a3d287264150d4ae202076" } }, { @@ -97,7 +97,7 @@ "location" : "https://github.com/mixpanel/mixpanel-swift", "state" : { "branch" : "master", - "revision" : "e7869c433ee01cdc52aa14abf636fe0b412d72f8" + "revision" : "1ae92448ec3b0841ae5ceaa151c98ae66776596a" } }, { @@ -105,8 +105,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/RickeyBoy/ScreenshotableView", "state" : { - "revision" : "4dcc274e518756c9bb6eabc153b2edb51a7bd482", - "version" : "1.1.0" + "revision" : "3c140215fb12c7e8aef78e853006110350455c5b", + "version" : "1.0.0" } }, { @@ -114,8 +114,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/SDWebImage/SDWebImage.git", "state" : { - "revision" : "be0bcd7823ce56629948491f2eaeaa19979514f7", - "version" : "5.19.4" + "revision" : "f6afa0132961d593f07970d84e2d8b588c29ea04", + "version" : "5.19.1" } }, { diff --git a/MeowBili/Others/PhoneFormatterExt.swift b/MeowBili/Others/PhoneFormatterExt.swift new file mode 100644 index 000000000..a218be8e6 --- /dev/null +++ b/MeowBili/Others/PhoneFormatterExt.swift @@ -0,0 +1,19 @@ +// +// +// PhoneFormatterExt.swift +// MeowBili +// +// Created by linecom on 2024/7/16. +// +//===----------------------------------------------------------------------===// +// +// This source file is part of the MeowBili open source project +// +// Copyright (c) 2024 Darock Studio and the MeowBili project authors +// Licensed under GNU General Public License v3 +// +// See https://darock.top/LICENSE.txt for license information +// +//===----------------------------------------------------------------------===// + +import Foundation From 9b62a78450846d998705080d6b6ddc8ad2ffd90b Mon Sep 17 00:00:00 2001 From: Linecom-lik <3448336734@qq.com> Date: Tue, 16 Jul 2024 05:50:31 +0800 Subject: [PATCH 02/10] Add files in project --- DarockBili.xcodeproj/project.pbxproj | 30 +++++++++++++++++----------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/DarockBili.xcodeproj/project.pbxproj b/DarockBili.xcodeproj/project.pbxproj index c0fed8b70..e9a4c3c43 100644 --- a/DarockBili.xcodeproj/project.pbxproj +++ b/DarockBili.xcodeproj/project.pbxproj @@ -21,6 +21,8 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ + 03B2F80F2C45AED7007EB850 /* PhoneFormatterExt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03B2F80E2C45AED7007EB850 /* PhoneFormatterExt.swift */; }; + 03B2F8102C45AED7007EB850 /* PhoneFormatterExt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03B2F80E2C45AED7007EB850 /* PhoneFormatterExt.swift */; }; 8C03B6DE2C280BAA000770B4 /* Cepheus in Frameworks */ = {isa = PBXBuildFile; productRef = 8C03B6DD2C280BAA000770B4 /* Cepheus */; }; 8C0557DF2B791B84009D9CD0 /* AZVideoPlayer in Frameworks */ = {isa = PBXBuildFile; productRef = 8C0557DE2B791B84009D9CD0 /* AZVideoPlayer */; }; 8C617F412B92334B000A3687 /* SafariWebExtensionHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8C617F402B92334B000A3687 /* SafariWebExtensionHandler.swift */; }; @@ -255,6 +257,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 03B2F80E2C45AED7007EB850 /* PhoneFormatterExt.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhoneFormatterExt.swift; sourceTree = ""; }; 8C0557E02B7A0480009D9CD0 /* MeowBili.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = MeowBili.entitlements; sourceTree = ""; }; 8C617F3E2B92334B000A3687 /* SafariExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = SafariExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; 8C617F402B92334B000A3687 /* SafariWebExtensionHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariWebExtensionHandler.swift; sourceTree = ""; }; @@ -576,6 +579,7 @@ 8CA7CC9C2B77B150008E587F /* AboutView.swift */, 8CA7CC9E2B77B166008E587F /* SettingsView.swift */, 8CA7CCA02B77B2DC008E587F /* LoginView.swift */, + 03B2F80E2C45AED7007EB850 /* PhoneFormatterExt.swift */, 8CA7CCA22B77B2F2008E587F /* NoticeView.swift */, 8CA53B022BB963D700D6D692 /* WatchUIDebugView.swift */, ); @@ -1095,6 +1099,7 @@ 8CA7CC8A2B77B061008E587F /* AppFileManager.swift in Sources */, 8CA7CCB22B77B398008E587F /* FollowListView.swift in Sources */, 8C81D2B12BCBA57F00EC58F4 /* FansListView.swift in Sources */, + 03B2F80F2C45AED7007EB850 /* PhoneFormatterExt.swift in Sources */, 8C9776082BCECBC3006EDB58 /* Audio.swift in Sources */, 8CA7CC7B2B77AF93008E587F /* NetwokFixView.swift in Sources */, 8CA7CCD32B77B51A008E587F /* BangumiDownloadView.swift in Sources */, @@ -1119,6 +1124,7 @@ 8CBFF0C82B85E55F00350E0F /* BangumiPlayerView.swift in Sources */, 8CBFF0C42B85E55F00350E0F /* backtrace.swift in Sources */, 8CBFF0C72B85E55F00350E0F /* VideoDownloadView.swift in Sources */, + 03B2F8102C45AED7007EB850 /* PhoneFormatterExt.swift in Sources */, 8CBFF0E32B85E55F00350E0F /* AboutView.swift in Sources */, 8CBFF0E52B85E55F00350E0F /* CodingTime.m in Sources */, 8CBFF0C52B85E55F00350E0F /* SkinExplorerView.swift in Sources */, @@ -1214,7 +1220,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1280; + CURRENT_PROJECT_VERSION = 1313; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = SafariExtension/Info.plist; @@ -1245,7 +1251,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1280; + CURRENT_PROJECT_VERSION = 1313; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = SafariExtension/Info.plist; @@ -1342,7 +1348,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = MeowBili/MeowBiliAlternative.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1280; + CURRENT_PROJECT_VERSION = 1313; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B38QUJMY47; ENABLE_PREVIEWS = YES; @@ -1387,7 +1393,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIconWatch; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1280; + CURRENT_PROJECT_VERSION = 1313; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview\\ Content\""; DEVELOPMENT_TEAM = B38QUJMY47; ENABLE_PREVIEWS = YES; @@ -1423,7 +1429,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1280; + CURRENT_PROJECT_VERSION = 1313; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 16.0; @@ -1447,7 +1453,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1280; + CURRENT_PROJECT_VERSION = 1313; DEVELOPMENT_TEAM = B38QUJMY47; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = SafariExtension/Info.plist; @@ -1515,7 +1521,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = MeowBili/MeowBili.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1280; + CURRENT_PROJECT_VERSION = 1313; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1562,7 +1568,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = MeowBili/MeowBili.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1280; + CURRENT_PROJECT_VERSION = 1313; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1607,7 +1613,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIconWatch; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1280; + CURRENT_PROJECT_VERSION = 1313; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview\\ Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1643,7 +1649,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIconWatch; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1280; + CURRENT_PROJECT_VERSION = 1313; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview\\ Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1679,7 +1685,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1280; + CURRENT_PROJECT_VERSION = 1313; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 16.0; @@ -1702,7 +1708,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1280; + CURRENT_PROJECT_VERSION = 1313; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 16.0; From 3df4e8f607d895c4a50aa0854cce68731e0ea1ed Mon Sep 17 00:00:00 2001 From: Linecom-lik <3448336734@qq.com> Date: Tue, 16 Jul 2024 05:50:49 +0800 Subject: [PATCH 03/10] Localizable update --- Localizable.xcstrings | 422 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 422 insertions(+) diff --git a/Localizable.xcstrings b/Localizable.xcstrings index c92755b1a..852423c64 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -500,6 +500,7 @@ } }, "+86" : { + "extractionState" : "stale", "localizations" : { "en" : { "stringUnit" : { @@ -3397,6 +3398,7 @@ } }, "Login.step1.phone-number" : { + "extractionState" : "stale", "localizations" : { "en" : { "stringUnit" : { @@ -8155,9 +8157,45 @@ }, "下一步" : { + }, + "不丹 975" : { + }, "不支持全键盘的 Apple Watch 可通过打开此开关以使用第三方的全键盘" : { + }, + "中国台湾 886" : { + + }, + "中国大陆 86" : { + + }, + "中国澳门特别行政区 853" : { + + }, + "中国香港特别行政区 852" : { + + }, + "丹麦 45" : { + + }, + "乌克兰 380" : { + + }, + "乌兹别克斯坦 998" : { + + }, + "乌干达 256" : { + + }, + "乌拉圭 598" : { + + }, + "乍得 235" : { + + }, + "也门 967" : { + }, "二维码名片" : { "localizations" : { @@ -8183,6 +8221,9 @@ }, "互联网" : { + }, + "亚美尼亚 374" : { + }, "什么都木有" : { "localizations" : { @@ -8221,6 +8262,18 @@ } } } + }, + "以色列 972" : { + + }, + "伊拉克 964" : { + + }, + "伊朗 98" : { + + }, + "伯利兹 501" : { + }, "使用“相机”App" : { @@ -8230,6 +8283,12 @@ }, "使用第三方全键盘" : { + }, + "俄罗斯 7" : { + + }, + "保加利亚 359" : { + }, "停止支持后,将不再为此版本系统提供功能性更新" : { @@ -8271,12 +8330,18 @@ } } } + }, + "冰岛 354" : { + }, "分析与改进" : { }, "列表视图" : { + }, + "加拿大 1" : { + }, "加载更多" : { @@ -8362,6 +8427,27 @@ } } } + }, + "匈牙利 36" : { + + }, + "南非 27" : { + + }, + "博茨瓦纳 267" : { + + }, + "印尼 62" : { + + }, + "印度 91" : { + + }, + "厄瓜多尔 593" : { + + }, + "厄立特里亚 291" : { + }, "历史记录" : { "localizations" : { @@ -8459,6 +8545,9 @@ }, "发送评论" : { + }, + "叙利亚 963" : { + }, "可选, 最多9个" : { "localizations" : { @@ -8534,6 +8623,27 @@ }, "回复内容" : { + }, + "图瓦卢 688" : { + + }, + "土库曼斯坦 993" : { + + }, + "土耳其 90" : { + + }, + "圣卢西亚 1784" : { + + }, + "圣多美和普林西比 239" : { + + }, + "圣皮埃尔和密克隆群岛 508" : { + + }, + "圣马力诺 378" : { + }, "在App内反馈" : { @@ -8578,9 +8688,27 @@ }, "在搜索页显示热搜" : { + }, + "坦桑尼亚 255" : { + }, "垂下手腕时隐藏内容" : { + }, + "塞内加尔 221" : { + + }, + "塞尔维亚 381" : { + + }, + "塞拉利昂 232" : { + + }, + "塞浦路斯 357" : { + + }, + "塞舌尔共和国 248" : { + }, "声音与触感" : { @@ -8601,6 +8729,15 @@ } } } + }, + "多哥 228" : { + + }, + "多米尼加 1767" : { + + }, + "多米尼加代表 1809" : { + }, "大" : { "localizations" : { @@ -8623,6 +8760,9 @@ }, "如不希望显示来自 Darock 的推荐,可前往%@关闭" : { + }, + "委内瑞拉 58" : { + }, "媒体" : { @@ -8642,9 +8782,15 @@ } } } + }, + "孟加拉国 880" : { + }, "完成" : { + }, + "密克罗尼西亚 691" : { + }, "密码" : { @@ -8684,6 +8830,18 @@ } } } + }, + "尼加拉瓜 505" : { + + }, + "尼日利亚 234" : { + + }, + "尼日尔 227" : { + + }, + "尼泊尔 977" : { + }, "已使用 %@ MB" : { @@ -8709,6 +8867,18 @@ } } } + }, + "布基纳法索 226" : { + + }, + "布隆迪 257" : { + + }, + "希腊 30" : { + + }, + "帕劳 680" : { + }, "应用" : { "localizations" : { @@ -8789,6 +8959,9 @@ } } } + }, + "德国 49" : { + }, "快进 10 秒" : { @@ -8839,6 +9012,9 @@ }, "您的 Apple Watch 运行的 watchOS 已过时,喵哩喵哩将在 2024/6/10 之后停止支持" : { + }, + "意大利 39" : { + }, "我的收藏" : { "localizations" : { @@ -8864,6 +9040,9 @@ }, "所有历史记录" : { + }, + "所罗门群岛 677" : { + }, "手记建议" : { "extractionState" : "stale", @@ -8875,9 +9054,15 @@ } } } + }, + "托克劳岛 690" : { + }, "扩展的触感反馈" : { + }, + "挪威 47" : { + }, "推荐" : { "localizations" : { @@ -8909,6 +9094,15 @@ }, "搜索" : { + }, + "摩尔多瓦 373" : { + + }, + "摩洛哥 212" : { + + }, + "摩纳哥 377" : { + }, "播放" : { @@ -8951,9 +9145,33 @@ } } } + }, + "文莱 673" : { + + }, + "斯威士兰 268" : { + + }, + "斯洛伐克 421" : { + + }, + "斯洛文尼亚 386" : { + + }, + "斯里兰卡 94" : { + + }, + "新加坡 65" : { + }, "新建反馈" : { + }, + "新西兰 64" : { + + }, + "日本 81" : { + }, "昨天和今天" : { @@ -9042,6 +9260,9 @@ } } } + }, + "智利 56" : { + }, "暂停->退出" : { @@ -9102,6 +9323,12 @@ }, "标题" : { + }, + "格鲁吉亚 995" : { + + }, + "桑给巴尔岛 259" : { + }, "模式" : { "localizations" : { @@ -9134,6 +9361,45 @@ }, "正常" : { + }, + "比利时 32" : { + + }, + "毛里塔尼亚 222" : { + + }, + "毛里求斯 230" : { + + }, + "汤加 676" : { + + }, + "沙特阿拉伯 966" : { + + }, + "法国 33" : { + + }, + "法属圭亚那 594" : { + + }, + "法属波利尼西亚 689" : { + + }, + "法罗岛 298" : { + + }, + "波兰 48" : { + + }, + "波多黎各 1787" : { + + }, + "波黑 387" : { + + }, + "泰国 66" : { + }, "清除历史记录" : { @@ -9165,12 +9431,42 @@ }, "清除缓存" : { + }, + "澳大利亚 61" : { + }, "热搜" : { + }, + "牙买加 1876" : { + + }, + "特克斯和凯科斯 1649" : { + + }, + "特立尼达和多巴哥 1868" : { + }, "状态" : { + }, + "玻利维亚 591" : { + + }, + "瑙鲁 674" : { + + }, + "瑞典 46" : { + + }, + "瑞士 41" : { + + }, + "瓦利斯群岛和富图纳群岛 1681" : { + + }, + "瓦努阿图 678" : { + }, "生日快乐,%@!" : { @@ -9190,6 +9486,9 @@ } } } + }, + "直布罗陀 350" : { + }, "离线缓存" : { "localizations" : { @@ -9212,6 +9511,12 @@ } } } + }, + "科特迪瓦 225" : { + + }, + "秘鲁 51" : { + }, "稍后再看" : { "localizations" : { @@ -9250,6 +9555,9 @@ } } } + }, + "突尼斯 216" : { + }, "简洁地描述问题" : { @@ -9259,6 +9567,18 @@ }, "粉丝列表" : { + }, + "索马里 252" : { + + }, + "约旦 962" : { + + }, + "纳米比亚 264" : { + + }, + "纽埃岛 683" : { + }, "经验" : { "localizations" : { @@ -9281,15 +9601,60 @@ } } } + }, + "维珍群岛(美属) 1340" : { + + }, + "维珍群岛(英属) 1284" : { + + }, + "缅甸 95" : { + }, "缓存数据" : { }, "编辑" : { + }, + "美国 1" : { + + }, + "苏丹 249" : { + + }, + "苏里南 597" : { + + }, + "英国 44" : { + + }, + "莫桑比克 258" : { + + }, + "萨尔瓦多 503" : { + + }, + "萨摩亚,东部 684" : { + + }, + "萨摩亚,西部 685" : { + + }, + "葡萄牙 351" : { + + }, + "蒙古 976" : { + + }, + "蒙特塞拉特岛 1664" : { + }, "行为" : { + }, + "西班牙 34" : { + }, "要使用动态小尾巴吗?" : { "localizations" : { @@ -9400,9 +9765,21 @@ }, "请求在线支持 (Beta)" : { + }, + "诺福克岛 672" : { + }, "调试构建" : { + }, + "贝宁 229" : { + + }, + "赞比亚 260" : { + + }, + "赤道几内亚 240" : { + }, "超大" : { "localizations" : { @@ -9435,6 +9812,9 @@ } } } + }, + "越南 84" : { + }, "辅助功能" : { @@ -9444,6 +9824,9 @@ }, "过时的 watchOS" : { + }, + "迪戈加西亚岛 246" : { + }, "退出 App" : { @@ -9526,12 +9909,18 @@ }, "键盘" : { + }, + "阿森松岛 247" : { + }, "降低亮度" : { }, "隐私与安全性" : { + }, + "韩国 82" : { + }, "顶部" : { "localizations" : { @@ -9564,6 +9953,39 @@ } } } + }, + "马其顿 389" : { + + }, + "马尔代夫 960" : { + + }, + "马拉维 265" : { + + }, + "马提尼克岛 596" : { + + }, + "马来西亚 60" : { + + }, + "马歇尔岛 692" : { + + }, + "马耳他 356" : { + + }, + "马达加斯加 261" : { + + }, + "马里 223" : { + + }, + "马里亚纳岛 1670" : { + + }, + "墨西哥 52" : { + }, "" : { From aa33cf88274c3c4fee3ced1e8f1a617caffd9a31 Mon Sep 17 00:00:00 2001 From: Linecom-lik <3448336734@qq.com> Date: Tue, 16 Jul 2024 05:51:33 +0800 Subject: [PATCH 04/10] Add Country Code selection --- MeowBili/Others/LoginView.swift | 726 +++++++++++++++----------------- 1 file changed, 333 insertions(+), 393 deletions(-) diff --git a/MeowBili/Others/LoginView.swift b/MeowBili/Others/LoginView.swift index 96b973372..559deca9a 100644 --- a/MeowBili/Others/LoginView.swift +++ b/MeowBili/Others/LoginView.swift @@ -41,7 +41,6 @@ struct LoginView: View { //User Input @State var accountInput = "" @State var passwdInput = "" - @State var phoneCode = "86" //---QR Login--- @State var qrImage: CGImage? @State var qrKey = "" @@ -50,6 +49,10 @@ struct LoginView: View { @State var smsLoginToken = "" + @State var countryCode = "86" + @State var PhoneFormat = "" + @State var displayCC = "" + @State var userList1: [Any] = [] @State var userList2: [Any] = [] @State var userList3: [Any] = [] @@ -141,14 +144,306 @@ struct LoginView: View { Label("Login.step1.title", systemImage: "1.circle") .bold() // .foregroundStyle(currentStep == 1 ? Color.accentColor : Color.primary) + if #available(watchOS 9, *) { + Picker("", selection: $countryCode) { + Text("").tag("") + Text("中国大陆 86").tag("86") + Text("中国香港特别行政区 852").tag("852") + Text("中国澳门特别行政区 853").tag("853") + Text("中国台湾 886").tag("886") + Text("美国 1").tag("us") + Text("比利时 32").tag("32") + Text("澳大利亚 61").tag("61") + Text("法国 33").tag("33") + Text("加拿大 1").tag("ca") + Text("日本 81").tag("81") + Text("新加坡 65").tag("65") + Text("韩国 82").tag("82") + Text("马来西亚 60").tag("60") + Text("英国 44").tag("44") + Text("意大利 39").tag("39") + Text("德国 49").tag("49") + Text("俄罗斯 7").tag("7") + Text("新西兰 64").tag("64") + Text("瓦利斯群岛和富图纳群岛 1681").tag("1681") + Text("葡萄牙 351").tag("351") + Text("帕劳 680").tag("680") + Text("诺福克岛 672").tag("672") + Text("挪威 47").tag("47") + Text("纽埃岛 683").tag("683") + Text("尼日利亚 234").tag("234") + Text("尼日尔 227").tag("227") + Text("尼加拉瓜 505").tag("505") + Text("尼泊尔 977").tag("977") + Text("瑙鲁 674").tag("674") + Text("格鲁吉亚 995").tag("995") + Text("瑞典 46").tag("46") + Text("沙特阿拉伯 966").tag("966") + Text("桑给巴尔岛 259").tag("259") + Text("塞舌尔共和国 248").tag("248") + Text("塞浦路斯 357").tag("357") + Text("塞内加尔 221").tag("221") + Text("塞拉利昂 232").tag("232") + Text("萨摩亚,东部 684").tag("684") + Text("萨摩亚,西部 685").tag("685") + Text("萨尔瓦多 503").tag("503") + Text("瑞士 41").tag("41") + Text("圣多美和普林西比 239").tag("239") + Text("塞尔维亚 381").tag("381") + Text("南非 27").tag("27") + Text("毛里塔尼亚 222").tag("222") + Text("毛里求斯 230").tag("230") + Text("马歇尔岛 692").tag("692") + Text("马提尼克岛 596").tag("596") + Text("马其顿 389").tag("389") + Text("马里亚纳岛 1670").tag("1670") + Text("马里 223").tag("223") + Text("马拉维 265").tag("265") + Text("马耳他 356").tag("356") + Text("马尔代夫 960").tag("960") + Text("蒙古 976").tag("976") + Text("蒙特塞拉特岛 1664").tag("1664") + Text("纳米比亚 264").tag("264") + Text("墨西哥 52").tag("52") + Text("莫桑比克 258").tag("258") + Text("摩纳哥 377").tag("377") + Text("摩洛哥 212").tag("212") + Text("摩尔多瓦 373").tag("373") + Text("缅甸 95").tag("95") + Text("密克罗尼西亚 691").tag("691") + Text("秘鲁 51").tag("51") + Text("孟加拉国 880").tag("880") + Text("马达加斯加 261").tag("261") + Text("圣卢西亚 1784").tag("1784") + Text("智利 56").tag("56") + Text("牙买加 1876").tag("1876") + Text("叙利亚 963").tag("963") + Text("匈牙利 36").tag("36") + Text("科特迪瓦 225").tag("225") + Text("希腊 30").tag("30") + Text("西班牙 34").tag("34") + Text("乌兹别克斯坦 998").tag("998") + Text("乌拉圭 598").tag("598") + Text("乌克兰 380").tag("380") + Text("乌干达 256").tag("256") + Text("亚美尼亚 374").tag("374") + Text("也门 967").tag("967") + Text("直布罗陀 350").tag("350") + Text("乍得 235").tag("235") + Text("赞比亚 260").tag("260") + Text("越南 84").tag("84") + Text("约旦 962").tag("962") + Text("印尼 62").tag("62") + Text("印度 91").tag("91") + Text("以色列 972").tag("972") + Text("伊朗 98").tag("98") + Text("伊拉克 964").tag("964") + Text("文莱 673").tag("673") + Text("委内瑞拉 58").tag("58") + Text("维珍群岛(英属) 1284").tag("1284") + Text("泰国 66").tag("66") + Text("索马里 252").tag("252") + Text("所罗门群岛 677").tag("677") + Text("苏里南 597").tag("597") + Text("苏丹 249").tag("249") + Text("斯威士兰 268").tag("268") + Text("斯洛文尼亚 386").tag("386") + Text("斯洛伐克 421").tag("421") + Text("斯里兰卡 94").tag("94") + Text("圣皮埃尔和密克隆群岛 508").tag("508") + Text("坦桑尼亚 255").tag("255") + Text("汤加 676").tag("676") + Text("维珍群岛(美属) 1340").tag("1340") + Text("瓦努阿图 678").tag("678") + Text("托克劳岛 690").tag("690") + Text("土库曼斯坦 993").tag("993") + Text("土耳其 90").tag("90") + Text("图瓦卢 688").tag("688") + Text("突尼斯 216").tag("216") + Text("阿森松岛 247").tag("247") + Text("特立尼达和多巴哥 1868").tag("1868") + Text("特克斯和凯科斯 1649").tag("1649") + Text("圣马力诺 378").tag("378") + Text("法属圭亚那 594").tag("594") + Text("不丹 975").tag("975") + Text("博茨瓦纳 267").tag("267") + Text("伯利兹 501").tag("501") + Text("玻利维亚 591").tag("591") + Text("波兰 48").tag("48") + Text("波黑 387").tag("387") + Text("波多黎各 1787").tag("1787") + Text("冰岛 354").tag("354") + Text("贝宁 229").tag("229") + Text("保加利亚 359").tag("359") + Text("布基纳法索 226").tag("226") + Text("布隆迪 257").tag("257") + Text("法属波利尼西亚 689").tag("689") + Text("法罗岛 298").tag("298") + Text("厄立特里亚 291").tag("291") + Text("厄瓜多尔 593").tag("593") + Text("多米尼加代表 1809").tag("1809") + Text("多米尼加 1767").tag("1767") + Text("多哥 228").tag("228") + Text("迪戈加西亚岛 246").tag("246") + Text("丹麦 45").tag("45") + Text("赤道几内亚 240").tag("240") + }.frame(height: 50) + } else { + Picker("", selection: $countryCode) { + Text("").tag("") + Text("中国大陆 86").tag("86") + Text("中国香港特别行政区 852").tag("852") + Text("中国澳门特别行政区 853").tag("853") + Text("中国台湾 886").tag("886") + Text("美国 1").tag("us") + Text("比利时 32").tag("32") + Text("澳大利亚 61").tag("61") + Text("法国 33").tag("33") + Text("加拿大 1").tag("ca") + Text("日本 81").tag("81") + Text("新加坡 65").tag("65") + Text("韩国 82").tag("82") + Text("马来西亚 60").tag("60") + Text("英国 44").tag("44") + Text("意大利 39").tag("39") + Text("德国 49").tag("49") + Text("俄罗斯 7").tag("7") + Text("新西兰 64").tag("64") + Text("瓦利斯群岛和富图纳群岛 1681").tag("1681") + Text("葡萄牙 351").tag("351") + Text("帕劳 680").tag("680") + Text("诺福克岛 672").tag("672") + Text("挪威 47").tag("47") + Text("纽埃岛 683").tag("683") + Text("尼日利亚 234").tag("234") + Text("尼日尔 227").tag("227") + Text("尼加拉瓜 505").tag("505") + Text("尼泊尔 977").tag("977") + Text("瑙鲁 674").tag("674") + Text("格鲁吉亚 995").tag("995") + Text("瑞典 46").tag("46") + Text("沙特阿拉伯 966").tag("966") + Text("桑给巴尔岛 259").tag("259") + Text("塞舌尔共和国 248").tag("248") + Text("塞浦路斯 357").tag("357") + Text("塞内加尔 221").tag("221") + Text("塞拉利昂 232").tag("232") + Text("萨摩亚,东部 684").tag("684") + Text("萨摩亚,西部 685").tag("685") + Text("萨尔瓦多 503").tag("503") + Text("瑞士 41").tag("41") + Text("圣多美和普林西比 239").tag("239") + Text("塞尔维亚 381").tag("381") + Text("南非 27").tag("27") + Text("毛里塔尼亚 222").tag("222") + Text("毛里求斯 230").tag("230") + Text("马歇尔岛 692").tag("692") + Text("马提尼克岛 596").tag("596") + Text("马其顿 389").tag("389") + Text("马里亚纳岛 1670").tag("1670") + Text("马里 223").tag("223") + Text("马拉维 265").tag("265") + Text("马耳他 356").tag("356") + Text("马尔代夫 960").tag("960") + Text("蒙古 976").tag("976") + Text("蒙特塞拉特岛 1664").tag("1664") + Text("纳米比亚 264").tag("264") + Text("墨西哥 52").tag("52") + Text("莫桑比克 258").tag("258") + Text("摩纳哥 377").tag("377") + Text("摩洛哥 212").tag("212") + Text("摩尔多瓦 373").tag("373") + Text("缅甸 95").tag("95") + Text("密克罗尼西亚 691").tag("691") + Text("秘鲁 51").tag("51") + Text("孟加拉国 880").tag("880") + Text("马达加斯加 261").tag("261") + Text("圣卢西亚 1784").tag("1784") + Text("智利 56").tag("56") + Text("牙买加 1876").tag("1876") + Text("叙利亚 963").tag("963") + Text("匈牙利 36").tag("36") + Text("科特迪瓦 225").tag("225") + Text("希腊 30").tag("30") + Text("西班牙 34").tag("34") + Text("乌兹别克斯坦 998").tag("998") + Text("乌拉圭 598").tag("598") + Text("乌克兰 380").tag("380") + Text("乌干达 256").tag("256") + Text("亚美尼亚 374").tag("374") + Text("也门 967").tag("967") + Text("直布罗陀 350").tag("350") + Text("乍得 235").tag("235") + Text("赞比亚 260").tag("260") + Text("越南 84").tag("84") + Text("约旦 962").tag("962") + Text("印尼 62").tag("62") + Text("印度 91").tag("91") + Text("以色列 972").tag("972") + Text("伊朗 98").tag("98") + Text("伊拉克 964").tag("964") + Text("文莱 673").tag("673") + Text("委内瑞拉 58").tag("58") + Text("维珍群岛(英属) 1284").tag("1284") + Text("泰国 66").tag("66") + Text("索马里 252").tag("252") + Text("所罗门群岛 677").tag("677") + Text("苏里南 597").tag("597") + Text("苏丹 249").tag("249") + Text("斯威士兰 268").tag("268") + Text("斯洛文尼亚 386").tag("386") + Text("斯洛伐克 421").tag("421") + Text("斯里兰卡 94").tag("94") + Text("圣皮埃尔和密克隆群岛 508").tag("508") + Text("坦桑尼亚 255").tag("255") + Text("汤加 676").tag("676") + Text("维珍群岛(美属) 1340").tag("1340") + Text("瓦努阿图 678").tag("678") + Text("托克劳岛 690").tag("690") + Text("土库曼斯坦 993").tag("993") + Text("土耳其 90").tag("90") + Text("图瓦卢 688").tag("688") + Text("突尼斯 216").tag("216") + Text("阿森松岛 247").tag("247") + Text("特立尼达和多巴哥 1868").tag("1868") + Text("特克斯和凯科斯 1649").tag("1649") + Text("圣马力诺 378").tag("378") + Text("法属圭亚那 594").tag("594") + Text("不丹 975").tag("975") + Text("博茨瓦纳 267").tag("267") + Text("伯利兹 501").tag("501") + Text("玻利维亚 591").tag("591") + Text("波兰 48").tag("48") + Text("波黑 387").tag("387") + Text("波多黎各 1787").tag("1787") + Text("冰岛 354").tag("354") + Text("贝宁 229").tag("229") + Text("保加利亚 359").tag("359") + Text("布基纳法索 226").tag("226") + Text("布隆迪 257").tag("257") + Text("法属波利尼西亚 689").tag("689") + Text("法罗岛 298").tag("298") + Text("厄立特里亚 291").tag("291") + Text("厄瓜多尔 593").tag("593") + Text("多米尼加代表 1809").tag("1809") + Text("多米尼加 1767").tag("1767") + Text("多哥 228").tag("228") + Text("迪戈加西亚岛 246").tag("246") + Text("丹麦 45").tag("45") + Text("赤道几内亚 240").tag("240") + } + } HStack { -// Picker("+\(phoneCode)", selection: $phoneCode) { +// Picker("\(phoneCode)", selection: $phoneCode) { // ForEach(callNations.indices) { codeIndex in // Text(callNations[codeIndex]).tag(callCodes[codeIndex]) // } // } - Text("+86") - TextField("Login.step1.phone-number", text: $accountInput) + //Text("86") + #if !os(watchOS) + TextField("", text: $displayCC).frame(width: 40) + #endif + TextField("\(PhoneFormat)", text: $accountInput) #if !os(watchOS) .keyboardType(.phonePad) #endif @@ -161,6 +456,21 @@ struct LoginView: View { currentStep = 1 } }) + .onChange(of: countryCode, perform: { _ in + PhoneFormat = PhoneFormatter(region: countryCode) + if countryCode == "us" || countryCode == "ca" { + displayCC = "1" + } else { + displayCC = countryCode + } + }) + .onChange(of: displayCC, perform: { _ in + if displayCC == "1" { + countryCode = "us" + } else { + countryCode = displayCC + } + }) } } } @@ -186,7 +496,8 @@ struct LoginView: View { print(currentStep) }) Button(action: { - if accountInput.count == 11 && !accountInput.contains(" ") { + let isValidPhone = validatePhoneNumber(num: accountInput, cc: displayCC) + if !accountInput.contains(" ") && isValidPhone { if validate.isEmpty { #if !os(watchOS) UIApplication.shared.open(URL(string: "https://darock.top/geetest?gt=\(gt)&challenge=\(challenge)")!) @@ -214,7 +525,7 @@ struct LoginView: View { "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15", "Cookie": "browser_resolution=1580-497; FEED_LIVE_VERSION=V8; buvid4=818BA302-8EAC-0630-67AB-BB978A5797AF60982-023042618-ho21%2BqF6LZokzAShrGptM4EHZm2TE4%2FTXmfZyPpzfCnLuUmUckb8wg%3D%3D; buvid_fp=5a716236853dd1e737d439882c685594; header_theme_version=CLOSE; home_feed_column=5; _uuid=15B5A2103-BBC2-9109A-7458-6410C3CF101028B94909infoc; b_lsid=CCF71993_18991563B31; b_ut=7; i-wanna-go-back=-1; innersign=0; b_nut=1690360493; buvid3=6481EDF5-10C43-9593-251E-89210B4A1C10A193894infoc" ] - AF.request("https://passport.bilibili.com/x/passport-login/web/sms/send", method: .post, parameters: BiliSmsCodePost(cid: Int(phoneCode)!, tel: Int(accountInput)!, token: loginToken, challenge: challenge, validate: validate, seccode: seccode), headers: headers).response { response in + AF.request("https://passport.bilibili.com/x/passport-login/web/sms/send", method: .post, parameters: BiliSmsCodePost(cid: Int(phoneIdList[countryCode]!)!, tel: Int(accountInput)!, token: loginToken, challenge: challenge, validate: validate, seccode: seccode), headers: headers).response { response in debugPrint(response) let json = try! JSON(data: response.data!) smsLoginToken = json["data"]["captcha_key"].string! @@ -222,7 +533,7 @@ struct LoginView: View { } } else { #if os(iOS) - AlertKitAPI.present(title: "手机号错误", subtitle: "请输入正确的11位手机号", icon: .error, style: .iOS17AppleMusic, haptic: .error) + AlertKitAPI.present(title: "手机号错误", subtitle: "请输入正确的手机号", icon: .error, style: .iOS17AppleMusic, haptic: .error) #else tipWithText("手机号错误", symbol: "xmark.circle.fill") #endif @@ -253,7 +564,7 @@ struct LoginView: View { .disabled(currentStep < 2) .foregroundStyle(currentStep >= 2 ? Color.primary : Color.secondary) Button(action: { - AF.request("https://passport.bilibili.com/x/passport-login/web/login/sms", method: .post, parameters: BiliLoginPost(cid: Int(phoneCode)!, tel: Int(accountInput)!, code: Int(passwdInput)!, captcha_key: smsLoginToken)).response { response in + AF.request("https://passport.bilibili.com/x/passport-login/web/login/sms", method: .post, parameters: BiliLoginPost(cid: Int(phoneIdList[countryCode]!)!, tel: Int(accountInput)!, code: Int(passwdInput)!, captcha_key: smsLoginToken)).response { response in let data = response.data if data != nil { let json = try! JSON(data: data!) @@ -318,6 +629,17 @@ struct LoginView: View { loginToken = respJson["data"]["token"].string! } } + PhoneFormat = PhoneFormatter(region: countryCode) + if countryCode == "us" || countryCode == "ca" { + displayCC = "1" + } else { + displayCC = countryCode + } + if displayCC == "1" { + countryCode = "us" + } else { + countryCode = displayCC + } } } } @@ -352,388 +674,6 @@ struct LoginView: View { } } -public let callNations = [ - "Afghanistan", - "Albania", - "Algeria", - "Andorra", - "Angola", - "Antigua and Barbuda", - "Argentina", - "Armenia", - "Australia", - "Austria", - "Azerbaijan", - "Bahamas", - "Bahrain", - "Bangladesh", - "Barbados", - "Belarus", - "Belgium", - "Belize", - "Benin", - "Bhutan", - "Bolivia", - "Bosnia and Herzegovina", - "Botswana", - "Brazil", - "Brunei", - "Bulgaria", - "Burkina Faso", - "Burundi", - "Cabo Verde (Cape Verde)", - "Cambodia", - "Cameroon", - "Canada", - "Central African Republic", - "Chad", - "Chile", - "China mainland", - "Colombia", - "Comoros", - "Congo, Democratic Republic of the", - "Congo, Republic of the", - "Costa Rica", - "Croatia", - "Cuba", - "Cyprus", - "Czech Republic", - "Denmark", - "Djibouti", - "Dominica", - "Dominican Republic", - "East Timor (Timor-Leste)", - "Ecuador", - "Egypt", - "El Salvador", - "Equatorial Guinea", - "Eritrea", - "Estonia", - "Eswatini (Swaziland)", - "Ethiopia", - "Fiji", - "Finland", - "France", - "Gabon", - "Gambia", - "Georgia", - "Germany", - "Ghana", - "Greece", - "Grenada", - "Guatemala", - "Guinea", - "Guinea-Bissau", - "Guyana", - "Haiti", - "Honduras", - "Hungary", - "Iceland", - "India", - "Indonesia", - "Iran", - "Iraq", - "Ireland", - "Israel", - "Italy", - "Jamaica", - "Japan", - "Jordan", - "Kazakhstan", - "Kenya", - "Kiribati", - "Korea, North (North Korea)", - "Korea, South (South Korea)", - "Kosovo", - "Kuwait", - "Kyrgyzstan", - "Laos", - "Latvia", - "Lebanon", - "Lesotho", - "Liberia", - "Libya", - "Liechtenstein", - "Lithuania", - "Luxembourg", - "Madagascar", - "Malawi", - "Malaysia", - "Maldives", - "Mali", - "Malta", - "Marshall Islands", - "Mauritania", - "Mauritius", - "Mexico", - "Micronesia", - "Moldova", - "Monaco", - "Mongolia", - "Montenegro", - "Morocco", - "Mozambique", - "Myanmar (Burma)", - "Namibia", - "Nauru", - "Nepal", - "Netherlands", - "New Zealand", - "Nicaragua", - "Niger", - "Nigeria", - "North Macedonia (formerly Macedonia)", - "Norway", - "Oman", - "Pakistan", - "Palau", - "Palestine State", - "Panama", - "Papua New Guinea", - "Paraguay", - "Peru", - "Philippines", - "Poland", - "Portugal", - "Qatar", - "Romania", - "Russia", - "Rwanda", - "Saint Kitts and Nevis", - "Saint Lucia", - "Saint Vincent and the Grenadines", - "Samoa", - "San Marino", - "Sao Tome and Principe", - "Saudi Arabia", - "Senegal", - "Serbia", - "Seychelles", - "Sierra Leone", - "Singapore", - "Slovakia", - "Slovenia", - "Solomon Islands", - "Somalia", - "South Africa", - "South Sudan", - "Spain", - "Sri Lanka", - "Sudan", - "Suriname", - "Sweden", - "Switzerland", - "Syria", - "Taiwan", - "Tajikistan", - "Tanzania", - "Thailand", - "Togo", - "Tonga", - "Trinidad and Tobago", - "Tunisia", - "Turkey", - "Turkmenistan", - "Tuvalu", - "Uganda", - "Ukraine", - "United Arab Emirates", - "United Kingdom", - "United States of America", - "Uruguay", - "Uzbekistan", - "Vanuatu", - "Vatican City" -] - -public let callCodes = [ - "93", - "355", - "213", - "376", - "244", - "1-268", - "54", - "374", - "61", - "43", - "994", - "1-242", - "973", - "880", - "1-246", - "375", - "32", - "501", - "229", - "975", - "591", - "387", - "267", - "55", - "673", - "359", - "226", - "257", - "238", - "855", - "237", - "1", - "236", - "235", - "56", - "86", - "57", - "269", - "243", - "242", - "506", - "385", - "53", - "357", - "420", - "45", - "253", - "1", - "670", - "593", - "20", - "503", - "240", - "291", - "372", - "268", - "251", - "679", - "358", - "33", - "241", - "220", - "995", - "49", - "233", - "30", - "1", - "502", - "224", - "245", - "592", - "509", - "504", - "36", - "354", - "91", - "62", - "98", - "964", - "353", - "972", - "39", - "81", - "962", - "7", - "254", - "686", - "850", - "82", - "383", - "965", - "996", - "856", - "371", - "961", - "266", - "231", - "218", - "423", - "370", - "352", - "261", - "265", - "60", - "960", - "223", - "356", - "692", - "222", - "230", - "52", - "691", - "373", - "377", - "976", - "382", - "212", - "258", - "95", - "264", - "674", - "977", - "31", - "64", - "505", - "227", - "234", - "389", - "47", - "968", - "92", - "680", - "970", - "507", - "675", - "595", - "51", - "63", - "48", - "351", - "974", - "40", - "7", - "250", - "378", - "239", - "966", - "221", - "381", - "248", - "232", - "65", - "421", - "386", - "677", - "252", - "27", - "211", - "34", - "94", - "249", - "597", - "46", - "41", - "963", - "886", - "992", - "255", - "66", - "228", - "676", - "1-868", - "216", - "90", - "993", - "688", - "256", - "380", - "971", - "44", - "598", - "998", - "678", - "379", - "58", - "84", - "967", - "260", - "263" -] +#Preview { + LoginView() +} From 1736d9b0da17b4c329d5a351efad65649b0c7fea Mon Sep 17 00:00:00 2001 From: Linecom-lik <3448336734@qq.com> Date: Tue, 16 Jul 2024 05:51:58 +0800 Subject: [PATCH 05/10] Phone relation extension --- MeowBili/Others/PhoneFormatterExt.swift | 195 ++++++++++++++++++++++++ 1 file changed, 195 insertions(+) diff --git a/MeowBili/Others/PhoneFormatterExt.swift b/MeowBili/Others/PhoneFormatterExt.swift index a218be8e6..4a22ffce2 100644 --- a/MeowBili/Others/PhoneFormatterExt.swift +++ b/MeowBili/Others/PhoneFormatterExt.swift @@ -17,3 +17,198 @@ //===----------------------------------------------------------------------===// import Foundation + +func PhoneFormatter(region: String) -> String { + switch region { + case "" : + return "手机号码" + case "86" : + return "000 0000 0000" + case "us","ca" : + return "000 000 0000" + case "886" : + return "000 000 000" + case "852","853" : + return "0000 0000" + case "44" : + return "0000 000000" + default: + return "手机号码" + } +} + +func validatePhoneNumber(num: String, cc: String) -> Bool { + switch cc { + case "86": + if num.count == 11 { + return true + } else { + return false + } + case "852","853" : + if num.count == 8 { + return true + } else { + return false + } + case "886" : + if num.count == 9 { + return true + } else { + return false + } + case "1","44" : + if num.count == 10 { + return true + } else { + return false + } + default: + //一些地区手机号无固定格式 + return true + } +} + +let phoneIdList = [ + //数据来自哔哩哔哩官方接口 + "86":"1", + "852":"5", + "853":"2", + "886":"3", + "us":"4", + "32":"6", + "61":"7", + "33":"8", + "ca":"9", + "81":"10", + "65":"11", + "82":"12", + "60":"13", + "44":"14", + "39":"15", + "49":"16", + "7":"18", + "64":"19", + "1681":"153", + "351":"152", + "680":"151", + "672":"150", + "47":"149", + "683":"148", + "234":"147", + "227":"146", + "505":"145", + "977":"144", + "674":"143", + "995":"154", + "46":"155", + "966":"165", + "259":"164", + "248":"163", + "357":"162", + "221":"161", + "232":"160", + "684":"159", + "685":"158", + "503":"157", + "41":"156", + "239":"166", + "381":"142", + "27":"141", + "222":"128", + "230":"127", + "692":"126", + "596":"125", + "389":"124", + "1670":"123", + "223":"122", + "265":"121", + "356":"120", + "960":"119", + "976":"129", + "1664":"130", + "264":"140", + "52":"139", + "258":"138", + "377":"137", + "212":"136", + "373":"135", + "95":"134", + "691":"133", + "51":"132", + "880":"131", + "261":"118", + "1784":"167", + "56":"216", + "1876":"203", + "963":"202", + "36":"201", + "225":"200", + "30":"199", + "34":"198", + "998":"197", + "598":"196", + "380":"195", + "256":"194", + "374":"204", + "967":"205", + "350":"215", + "235":"214", + "260":"213", + "84":"212", + "962":"211", + "62":"210", + "91":"209", + "972":"208", + "98":"207", + "964":"206", + "673":"193", + "58":"192", + "1284":"191", + "66":"178", + "252":"177", + "677":"176", + "597":"175", + "249":"174", + "268":"173", + "386":"172", + "421":"171", + "94":"170", + "508":"169", + "255":"179", + "676":"180", + "1340":"190", + "678":"189", + "690":"188", + "993":"187", + "90":"186", + "688":"185", + "216":"184", + "247":"183", + "1868":"182", + "1649":"181", + "378":"168", + "594":"67", + "975":"54", + "267":"53", + "501":"52", + "591":"51", + "48":"50", + "387":"49", + "1787":"48", + "354":"47", + "229":"46", + "359":"45", + "226":"55", + "257":"56", + "689":"66", + "298":"65", + "291":"64", + "593":"63", + "1809":"62", + "1767":"61", + "228":"60", + "246":"59", + "45":"58", + "240":"57", +] From 4a1d37a66b90d5f9a1a4552de5889c0df9dc9f22 Mon Sep 17 00:00:00 2001 From: Linecom-lik <3448336734@qq.com> Date: Tue, 16 Jul 2024 06:10:23 +0800 Subject: [PATCH 06/10] fix packages --- .../xcshareddata/swiftpm/Package.resolved | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index ad5c83ab7..e7aebd413 100644 --- a/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -33,8 +33,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/adamzarn/AZVideoPlayer", "state" : { - "revision" : "f37c779bf5c00e85dc31ad25d883b3f2e5242b2a", - "version" : "1.2.0" + "revision" : "75e9e05b87d2bd60d83be4b8db280eb2859a86bc", + "version" : "1.3.0" } }, { @@ -42,8 +42,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Serene-Garden/Cepheus", "state" : { - "revision" : "38adeadadc1b52a61db4078a80aac98af3311890", - "version" : "2.0.2" + "revision" : "5ff00498df1fa89c92af56780d3818c0c4380f6a", + "version" : "2.3.1" } }, { @@ -52,7 +52,7 @@ "location" : "https://github.com/Darock-Studio/DarockKit", "state" : { "branch" : "main", - "revision" : "0735d98596b3fe5280a3d287264150d4ae202076" + "revision" : "9a43584cb32e53ae339532a6f49c19c7bc17aa8a" } }, { @@ -97,7 +97,7 @@ "location" : "https://github.com/mixpanel/mixpanel-swift", "state" : { "branch" : "master", - "revision" : "1ae92448ec3b0841ae5ceaa151c98ae66776596a" + "revision" : "e7869c433ee01cdc52aa14abf636fe0b412d72f8" } }, { @@ -105,8 +105,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/RickeyBoy/ScreenshotableView", "state" : { - "revision" : "3c140215fb12c7e8aef78e853006110350455c5b", - "version" : "1.0.0" + "revision" : "4dcc274e518756c9bb6eabc153b2edb51a7bd482", + "version" : "1.1.0" } }, { @@ -114,8 +114,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/SDWebImage/SDWebImage.git", "state" : { - "revision" : "f6afa0132961d593f07970d84e2d8b588c29ea04", - "version" : "5.19.1" + "revision" : "be0bcd7823ce56629948491f2eaeaa19979514f7", + "version" : "5.19.4" } }, { From 70644e0b7ae5f792efffffbd8a88c5cf8158bc8c Mon Sep 17 00:00:00 2001 From: Linecom-lik <3448336734@qq.com> Date: Tue, 16 Jul 2024 06:10:50 +0800 Subject: [PATCH 07/10] update project version --- DarockBili.xcodeproj/project.pbxproj | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/DarockBili.xcodeproj/project.pbxproj b/DarockBili.xcodeproj/project.pbxproj index e9a4c3c43..e935400be 100644 --- a/DarockBili.xcodeproj/project.pbxproj +++ b/DarockBili.xcodeproj/project.pbxproj @@ -1220,7 +1220,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1313; + CURRENT_PROJECT_VERSION = 1314; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = SafariExtension/Info.plist; @@ -1251,7 +1251,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1313; + CURRENT_PROJECT_VERSION = 1314; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = SafariExtension/Info.plist; @@ -1348,7 +1348,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = MeowBili/MeowBiliAlternative.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1313; + CURRENT_PROJECT_VERSION = 1314; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B38QUJMY47; ENABLE_PREVIEWS = YES; @@ -1393,7 +1393,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIconWatch; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1313; + CURRENT_PROJECT_VERSION = 1314; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview\\ Content\""; DEVELOPMENT_TEAM = B38QUJMY47; ENABLE_PREVIEWS = YES; @@ -1429,7 +1429,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1313; + CURRENT_PROJECT_VERSION = 1314; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 16.0; @@ -1453,7 +1453,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1313; + CURRENT_PROJECT_VERSION = 1314; DEVELOPMENT_TEAM = B38QUJMY47; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = SafariExtension/Info.plist; @@ -1521,7 +1521,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = MeowBili/MeowBili.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1313; + CURRENT_PROJECT_VERSION = 1314; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1568,7 +1568,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = MeowBili/MeowBili.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1313; + CURRENT_PROJECT_VERSION = 1314; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1613,7 +1613,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIconWatch; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1313; + CURRENT_PROJECT_VERSION = 1314; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview\\ Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1649,7 +1649,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIconWatch; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1313; + CURRENT_PROJECT_VERSION = 1314; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview\\ Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1685,7 +1685,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1313; + CURRENT_PROJECT_VERSION = 1314; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 16.0; @@ -1708,7 +1708,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1313; + CURRENT_PROJECT_VERSION = 1314; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 16.0; From 99e9998611db435abade34346e7257e54a14bff6 Mon Sep 17 00:00:00 2001 From: Linecom-lik <3448336734@qq.com> Date: Tue, 16 Jul 2024 17:04:46 +0800 Subject: [PATCH 08/10] update project number --- DarockBili.xcodeproj/project.pbxproj | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/DarockBili.xcodeproj/project.pbxproj b/DarockBili.xcodeproj/project.pbxproj index e935400be..145f56fb0 100644 --- a/DarockBili.xcodeproj/project.pbxproj +++ b/DarockBili.xcodeproj/project.pbxproj @@ -1220,7 +1220,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1314; + CURRENT_PROJECT_VERSION = 1316; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = SafariExtension/Info.plist; @@ -1251,7 +1251,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1314; + CURRENT_PROJECT_VERSION = 1316; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = SafariExtension/Info.plist; @@ -1348,7 +1348,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = MeowBili/MeowBiliAlternative.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1314; + CURRENT_PROJECT_VERSION = 1316; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B38QUJMY47; ENABLE_PREVIEWS = YES; @@ -1393,7 +1393,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIconWatch; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1314; + CURRENT_PROJECT_VERSION = 1316; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview\\ Content\""; DEVELOPMENT_TEAM = B38QUJMY47; ENABLE_PREVIEWS = YES; @@ -1429,7 +1429,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1314; + CURRENT_PROJECT_VERSION = 1316; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 16.0; @@ -1453,7 +1453,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1314; + CURRENT_PROJECT_VERSION = 1316; DEVELOPMENT_TEAM = B38QUJMY47; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = SafariExtension/Info.plist; @@ -1521,7 +1521,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = MeowBili/MeowBili.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1314; + CURRENT_PROJECT_VERSION = 1316; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1568,7 +1568,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = MeowBili/MeowBili.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1314; + CURRENT_PROJECT_VERSION = 1316; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1613,7 +1613,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIconWatch; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1314; + CURRENT_PROJECT_VERSION = 1316; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview\\ Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1649,7 +1649,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIconWatch; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1314; + CURRENT_PROJECT_VERSION = 1316; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview\\ Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1685,7 +1685,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1314; + CURRENT_PROJECT_VERSION = 1316; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 16.0; @@ -1708,7 +1708,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1314; + CURRENT_PROJECT_VERSION = 1316; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 16.0; From c0be59af81e2a6f49f8d61f01a3ff73111660c3a Mon Sep 17 00:00:00 2001 From: Linecom-lik <3448336734@qq.com> Date: Tue, 16 Jul 2024 17:05:40 +0800 Subject: [PATCH 09/10] rename func --- MeowBili/Others/LoginView.swift | 4 ++-- MeowBili/Others/PhoneFormatterExt.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MeowBili/Others/LoginView.swift b/MeowBili/Others/LoginView.swift index 559deca9a..e2fed0ee2 100644 --- a/MeowBili/Others/LoginView.swift +++ b/MeowBili/Others/LoginView.swift @@ -457,7 +457,7 @@ struct LoginView: View { } }) .onChange(of: countryCode, perform: { _ in - PhoneFormat = PhoneFormatter(region: countryCode) + PhoneFormat = phoneFormatter(region: countryCode) if countryCode == "us" || countryCode == "ca" { displayCC = "1" } else { @@ -629,7 +629,7 @@ struct LoginView: View { loginToken = respJson["data"]["token"].string! } } - PhoneFormat = PhoneFormatter(region: countryCode) + PhoneFormat = phoneFormatter(region: countryCode) if countryCode == "us" || countryCode == "ca" { displayCC = "1" } else { diff --git a/MeowBili/Others/PhoneFormatterExt.swift b/MeowBili/Others/PhoneFormatterExt.swift index 4a22ffce2..e3c9d354d 100644 --- a/MeowBili/Others/PhoneFormatterExt.swift +++ b/MeowBili/Others/PhoneFormatterExt.swift @@ -18,7 +18,7 @@ import Foundation -func PhoneFormatter(region: String) -> String { +func phoneFormatter(region: String) -> String { switch region { case "" : return "手机号码" From 7edd4f8dfdd7f8379edc2736b8d30fd43a79adac Mon Sep 17 00:00:00 2001 From: Linecom-lik <3448336734@qq.com> Date: Tue, 16 Jul 2024 17:06:01 +0800 Subject: [PATCH 10/10] update LoginView --- MeowBili/Others/LoginView.swift | 2 -- 1 file changed, 2 deletions(-) diff --git a/MeowBili/Others/LoginView.swift b/MeowBili/Others/LoginView.swift index e2fed0ee2..36a2066f7 100644 --- a/MeowBili/Others/LoginView.swift +++ b/MeowBili/Others/LoginView.swift @@ -146,7 +146,6 @@ struct LoginView: View { // .foregroundStyle(currentStep == 1 ? Color.accentColor : Color.primary) if #available(watchOS 9, *) { Picker("", selection: $countryCode) { - Text("").tag("") Text("中国大陆 86").tag("86") Text("中国香港特别行政区 852").tag("852") Text("中国澳门特别行政区 853").tag("853") @@ -290,7 +289,6 @@ struct LoginView: View { }.frame(height: 50) } else { Picker("", selection: $countryCode) { - Text("").tag("") Text("中国大陆 86").tag("86") Text("中国香港特别行政区 852").tag("852") Text("中国澳门特别行政区 853").tag("853")