Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: Added to iPhone QR code on watchOS #278

Merged
merged 1 commit into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions DarockBili.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1461,7 +1461,7 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
CODE_SIGN_ENTITLEMENTS = "MeowBili/MeowBili Vision App.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 833;
CURRENT_PROJECT_VERSION = 842;
DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\"";
DEVELOPMENT_TEAM = B57D8PP775;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -1496,7 +1496,7 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
CODE_SIGN_ENTITLEMENTS = "MeowBili/MeowBili Vision App.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 833;
CURRENT_PROJECT_VERSION = 842;
DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\"";
DEVELOPMENT_TEAM = B57D8PP775;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -1533,7 +1533,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = MeowBili/MeowBili.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 833;
CURRENT_PROJECT_VERSION = 842;
DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\"";
DEVELOPMENT_TEAM = B57D8PP775;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -1580,7 +1580,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = MeowBili/MeowBili.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 833;
CURRENT_PROJECT_VERSION = 842;
DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\"";
DEVELOPMENT_TEAM = B57D8PP775;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -1624,7 +1624,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIconWatch;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 833;
CURRENT_PROJECT_VERSION = 842;
DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview\\ Content\"";
DEVELOPMENT_TEAM = B57D8PP775;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -1660,7 +1660,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIconWatch;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 833;
CURRENT_PROJECT_VERSION = 842;
DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview\\ Content\"";
DEVELOPMENT_TEAM = B57D8PP775;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -1699,7 +1699,7 @@
CODE_SIGN_ENTITLEMENTS = "MeowBili/MeowBili Mac App.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 833;
CURRENT_PROJECT_VERSION = 842;
DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\"";
DEVELOPMENT_TEAM = B57D8PP775;
ENABLE_HARDENED_RUNTIME = YES;
Expand Down Expand Up @@ -1732,7 +1732,7 @@
CODE_SIGN_ENTITLEMENTS = "MeowBili/MeowBili Mac App.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 833;
CURRENT_PROJECT_VERSION = 842;
DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\"";
DEVELOPMENT_TEAM = B57D8PP775;
ENABLE_HARDENED_RUNTIME = YES;
Expand Down Expand Up @@ -1761,7 +1761,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 833;
CURRENT_PROJECT_VERSION = 842;
DEVELOPMENT_TEAM = B57D8PP775;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
Expand All @@ -1784,7 +1784,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 833;
CURRENT_PROJECT_VERSION = 842;
DEVELOPMENT_TEAM = B57D8PP775;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
Expand Down
6 changes: 6 additions & 0 deletions Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -8014,6 +8014,9 @@
}
}
}
},
"使用“相机”App" : {

},
"使用恢复密钥" : {

Expand Down Expand Up @@ -8293,6 +8296,9 @@
},
"在App内反馈" : {

},
"在iPhone上继续" : {

},
"在使用本 App 前,您需要先知晓以下信息:\n· 本 App 由第三方开发者以及部分社区用户贡献,与哔哩哔哩无合作关系,哔哩哔哩是上海宽娱数码科技有限公司的商标。\n· 本 App 并不是哔哩哔哩的替代品,我们建议您在能够使用官方客户端时尽量使用官方客户端。\n· 本 App 均使用来源于网络的公开信息进行开发。\n· 本 App 中和B站相关的功能完全免费\n· 本 App 中所呈现的B站内容来自哔哩哔哩官方。\n· 本 App 的开发者、负责人和实际责任人是%@\n 联系QQ:3245146430" : {
"localizations" : {
Expand Down
28 changes: 27 additions & 1 deletion MeowBili/MeowBiliApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@
@State var fileLockerRetryCount = 0
@State var fileLockerInput = ""
@State var recoveryCodeInput = ""
// Navigators
@State var isUrlOpenVideoPresented = false
@State var urlOpenVideoDetails = [String: String]()
#if os(watchOS)
@State var isMemoryWarningPresented = false
#else
Expand Down Expand Up @@ -241,7 +244,30 @@
}
}
#else
ContentView()
NavigationStack {
ZStack {
// Hide NavigationLinks behind
NavigationLink("", isActive: $isUrlOpenVideoPresented, destination: { VideoDetailView(videoDetails: urlOpenVideoDetails) })

Check notice on line 250 in MeowBili/MeowBiliApp.swift

View check run for this annotation

Xcode Cloud / DarockBili | Analysis | Build - iOS

MeowBili/MeowBiliApp.swift#L250

'init(_:isActive:destination:)' was deprecated in iOS 16.0: use NavigationLink(value:label:), or navigationDestination(isPresented:destination:), inside a NavigationStack or NavigationSplitView
ContentView()
.onOpenURL { url in
let dec = url.absoluteString.urlDecoded()
let spd = dec.split(separator: "/").dropFirst()
debugPrint(spd)
switch spd[1] {
case "withvideodetail":
let kvs = dec.split(separator: "/", maxSplits: 1).dropFirst()[2].split(separator: "&") // e.g.: ["BV=xxx", "Title=xxx"]
urlOpenVideoDetails.removeAll()
for kv in kvs {
let kav = kv.split(separator: "=")
urlOpenVideoDetails.updateValue(String(kav[1]), forKey: String(kav[0]))
}
isUrlOpenVideoPresented = true
default:
break
}
}
}
}
if shouldShowAppName {
VStack {
Spacer()
Expand Down
23 changes: 23 additions & 0 deletions MeowBili/Video/VideoDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import SwiftUI
import Marquee
import Mixpanel
import EFQRCode
import DarockKit
import Alamofire
import SwiftyJSON
Expand Down Expand Up @@ -94,6 +95,7 @@
#else
@State var isVideoPlayerPresented = false
@State var isNowPlayingPresented = false
@State var continueQr: CGImage?
#endif
var body: some View {
Group {
Expand Down Expand Up @@ -125,7 +127,7 @@
var alpha: CGFloat = 0
UIColor(danmakuSendColor).getRed(&red, green: &green, blue: &blue, alpha: &alpha)
return (Int(red * 255) << 16) + (Int(green * 255) << 8) + Int(blue * 255)
}(), "fontsize": danmakuSendFontSize, "pool": 0, "mode": danmakuSendMode, "rnd": Date.now.timeStamp * 1000000, "csrf": biliJct], headers: headers).response { response in

Check notice on line 130 in MeowBili/Video/VideoDetailView.swift

View check run for this annotation

Xcode Cloud / DarockBili | Analysis | Build - iOS

MeowBili/Video/VideoDetailView.swift#L130

Collection Element Alignment Violation: All elements in a collection literal should be vertically aligned (collection_alignment)
debugPrint(response)
danmakuSendCache = ""
}
Expand Down Expand Up @@ -531,7 +533,7 @@
Group {
TabView(selection: $mainVerticalTabViewSelection) {
VStack {
NavigationLink("", isActive: $isNowPlayingPresented, destination: { AudioPlayerView(videoDetails: videoDetails, videoLink: $videoLink, videoBvid: $videoBvid, videoCID: $videoCID) })

Check notice on line 536 in MeowBili/Video/VideoDetailView.swift

View check run for this annotation

Xcode Cloud / DarockBili | Analysis | Build - iOS

MeowBili/Video/VideoDetailView.swift#L536

'init(_:isActive:destination:)' was deprecated in watchOS 9.0: use NavigationLink(value:label:), or navigationDestination(isPresented:destination:), inside a NavigationStack or NavigationSplitView
.frame(width: 0, height: 0)

DetailViewFirstPageBase(videoDetails: $videoDetails, videoPages: $videoPages, honors: $honors, subTitles: $subTitles, isLoading: $isLoading, videoLink: $videoLink, videoBvid: $videoBvid, videoCID: $videoCID)
Expand Down Expand Up @@ -576,6 +578,27 @@
}, label: {
Label("Video.watch-later", systemImage: "memories.badge.plus")
})
NavigationLink(destination: {
VStack {
if let qrImg = continueQr {
Image(uiImage: UIImage(cgImage: qrImg))
.resizable()
.frame(width: 130, height: 130)
Text("使用“相机”App")
.bold()
}
}
.onAppear {
var tmpStr = ""
for (key, value) in videoDetails {
tmpStr += "\(key)=\(value)&"
}
tmpStr.removeLast()
continueQr = EFQRCode.generate(for: "drkbili://withvideodetail/\(tmpStr)")
}
}, label: {
Label("在iPhone上继续", systemImage: "iphone.and.arrow.forward")
})
}
}, label: {
Image(systemName: "ellipsis")
Expand Down Expand Up @@ -1166,7 +1189,7 @@
VideoPlayerView(videoDetails: $videoDetails, videoLink: $videoLink, videoBvid: $videoBvid, videoCID: $videoCID)
.navigationBarHidden(true)
})
NavigationLink("", isActive: $isNowPlayingPresented, destination: { AudioPlayerView(videoDetails: videoDetails, videoLink: $videoLink, videoBvid: $videoBvid, videoCID: $videoCID) })

Check notice on line 1192 in MeowBili/Video/VideoDetailView.swift

View check run for this annotation

Xcode Cloud / DarockBili | Analysis | Build - iOS

MeowBili/Video/VideoDetailView.swift#L1192

'init(_:isActive:destination:)' was deprecated in watchOS 9.0: use NavigationLink(value:label:), or navigationDestination(isPresented:destination:), inside a NavigationStack or NavigationSplitView
.frame(width: 0, height: 0)
Button(action: {
isLoading = true
Expand Down Expand Up @@ -1285,13 +1308,13 @@
NavigationLink(destination: { UserDetailView(uid: owner["ID"]!) }, label: {
HStack {
CachedAsyncImage(url: URL(string: owner["Face"]! + "@100w")) { phase in
switch phase {

Check notice on line 1311 in MeowBili/Video/VideoDetailView.swift

View check run for this annotation

Xcode Cloud / DarockBili | Analysis | Build - iOS

MeowBili/Video/VideoDetailView.swift#L1311

Switch covers known cases, but 'AsyncImagePhase' may have additional unknown values, possibly added in future versions
case .empty:
Circle()
.redacted(reason: .placeholder)
case .success(let image):
image.resizable()
case .failure(let error):

Check notice on line 1317 in MeowBili/Video/VideoDetailView.swift

View check run for this annotation

Xcode Cloud / DarockBili | Analysis | Build - iOS

MeowBili/Video/VideoDetailView.swift#L1317

Immutable value 'error' was never used; consider replacing with '_' or removing it
Circle()
.redacted(reason: .placeholder)
}
Expand Down
2 changes: 1 addition & 1 deletion ci_scripts/ci_post_xcodebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ if [[ "$CI_WORKFLOW" == "Canary Deploy" ]]; then
TESTFLIGHT_DIR_PATH=../TestFlight
mkdir $TESTFLIGHT_DIR_PATH
echo "CI 自动生成信息,24小时内的main分支的提交:\n" > $TESTFLIGHT_DIR_PATH/WhatToTest.zh-Hans.txt
git fetch -a && git log --since="24 hours ago" main --pretty=format:"%s" >> $TESTFLIGHT_DIR_PATH/WhatToTest.zh-Hans.txt
git fetch -a && git log --since="24 hours ago" main --pretty=format:"%s" >! $TESTFLIGHT_DIR_PATH/WhatToTest.zh-Hans.txt
fi