diff --git a/DarockBili.xcodeproj/project.pbxproj b/DarockBili.xcodeproj/project.pbxproj index ded7330a6..2b0fd7621 100644 --- a/DarockBili.xcodeproj/project.pbxproj +++ b/DarockBili.xcodeproj/project.pbxproj @@ -109,6 +109,7 @@ 8CA3889F2B78B1E300F5F91F /* AZVideoPlayer in Frameworks */ = {isa = PBXBuildFile; productRef = 8CA3889E2B78B1E300F5F91F /* AZVideoPlayer */; }; 8CA388A22B78B5D800F5F91F /* BiliFont.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 8CA388A02B78B5D800F5F91F /* BiliFont.ttf */; }; 8CA388A32B78B5D800F5F91F /* BiliFont.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 8CA388A02B78B5D800F5F91F /* BiliFont.ttf */; }; + 8CA53B032BB963D700D6D692 /* WatchUIDebugView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CA53B022BB963D700D6D692 /* WatchUIDebugView.swift */; }; 8CA7CBC32B77AC4A008E587F /* MeowBiliApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CA7CBC22B77AC4A008E587F /* MeowBiliApp.swift */; }; 8CA7CBC52B77AC4A008E587F /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CA7CBC42B77AC4A008E587F /* ContentView.swift */; }; 8CA7CBC72B77AC4C008E587F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8CA7CBC62B77AC4C008E587F /* Assets.xcassets */; }; @@ -417,6 +418,7 @@ 8CA370E82B83BB4F00CE0E9E /* MeowBili Vision App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "MeowBili Vision App.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 8CA371332B83BE7D00CE0E9E /* MeowBili Vision App.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "MeowBili Vision App.entitlements"; sourceTree = ""; }; 8CA388A02B78B5D800F5F91F /* BiliFont.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = BiliFont.ttf; sourceTree = ""; }; + 8CA53B022BB963D700D6D692 /* WatchUIDebugView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WatchUIDebugView.swift; sourceTree = ""; }; 8CA7CBC02B77AC4A008E587F /* MeowBili.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MeowBili.app; sourceTree = BUILT_PRODUCTS_DIR; }; 8CA7CBC22B77AC4A008E587F /* MeowBiliApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeowBiliApp.swift; sourceTree = ""; }; 8CA7CBC42B77AC4A008E587F /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; @@ -753,6 +755,7 @@ 8CA7CC9E2B77B166008E587F /* SettingsView.swift */, 8CA7CCA02B77B2DC008E587F /* LoginView.swift */, 8CA7CCA22B77B2F2008E587F /* NoticeView.swift */, + 8CA53B022BB963D700D6D692 /* WatchUIDebugView.swift */, ); path = Others; sourceTree = ""; @@ -1491,6 +1494,7 @@ 8CBFF1282B861F7F00350E0F /* backtrace.c in Sources */, 8CBFF0EB2B85E55F00350E0F /* FavoriteView.swift in Sources */, 8CBFF0E12B85E55F00350E0F /* UserDynamicMainView.swift in Sources */, + 8CA53B032BB963D700D6D692 /* WatchUIDebugView.swift in Sources */, 8CBFF0BA2B85E55F00350E0F /* Passthroughs.swift in Sources */, 8CBFF0B92B85E55F00350E0F /* LinkDetectText.swift in Sources */, 8CBFF0CB2B85E55F00350E0F /* bMessageSendView.swift in Sources */, @@ -1616,7 +1620,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 938; + CURRENT_PROJECT_VERSION = 967; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = SafariExtension/Info.plist; @@ -1647,7 +1651,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 938; + CURRENT_PROJECT_VERSION = 967; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = SafariExtension/Info.plist; @@ -1669,6 +1673,7 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Osize"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; @@ -1743,7 +1748,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = MeowBili/MeowBiliAlternative.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 938; + CURRENT_PROJECT_VERSION = 967; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B38QUJMY47; ENABLE_PREVIEWS = YES; @@ -1775,6 +1780,7 @@ SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_OBJC_BRIDGING_HEADER = "MeowBili/MeowBili-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Osize"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,6"; VALIDATE_PRODUCT = YES; @@ -1787,7 +1793,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIconWatch; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 938; + CURRENT_PROJECT_VERSION = 967; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview\\ Content\""; DEVELOPMENT_TEAM = B38QUJMY47; ENABLE_PREVIEWS = YES; @@ -1809,6 +1815,7 @@ SKIP_INSTALL = YES; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_OBJC_BRIDGING_HEADER = "MeowBili/MeowBili-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Osize"; SWIFT_VERSION = 5.0; SYSTEM_FRAMEWORK_SEARCH_PATHS = ""; TARGETED_DEVICE_FAMILY = 4; @@ -1826,7 +1833,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; CODE_SIGN_ENTITLEMENTS = "MeowBili/MeowBili Vision App.entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 938; + CURRENT_PROJECT_VERSION = 967; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1862,7 +1869,7 @@ CODE_SIGN_ENTITLEMENTS = "MeowBili/MeowBili Mac App.entitlements"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 938; + CURRENT_PROJECT_VERSION = 967; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_HARDENED_RUNTIME = YES; @@ -1891,7 +1898,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 938; + CURRENT_PROJECT_VERSION = 967; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 16.0; @@ -1915,7 +1922,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 938; + CURRENT_PROJECT_VERSION = 967; DEVELOPMENT_TEAM = B38QUJMY47; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = SafariExtension/Info.plist; @@ -1937,6 +1944,7 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Osize"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; @@ -1981,7 +1989,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; CODE_SIGN_ENTITLEMENTS = "MeowBili/MeowBili Vision App.entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 938; + CURRENT_PROJECT_VERSION = 967; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -2016,7 +2024,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; CODE_SIGN_ENTITLEMENTS = "MeowBili/MeowBili Vision App.entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 938; + CURRENT_PROJECT_VERSION = 967; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -2053,7 +2061,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = MeowBili/MeowBili.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 938; + CURRENT_PROJECT_VERSION = 967; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -2100,7 +2108,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = MeowBili/MeowBili.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 938; + CURRENT_PROJECT_VERSION = 967; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -2132,6 +2140,7 @@ SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_OBJC_BRIDGING_HEADER = "MeowBili/MeowBili-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Osize"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,6"; VALIDATE_PRODUCT = YES; @@ -2144,7 +2153,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIconWatch; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 938; + CURRENT_PROJECT_VERSION = 967; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview\\ Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -2180,7 +2189,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIconWatch; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 938; + CURRENT_PROJECT_VERSION = 967; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview\\ Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -2202,6 +2211,7 @@ SKIP_INSTALL = YES; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_OBJC_BRIDGING_HEADER = "MeowBili/MeowBili-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Osize"; SWIFT_VERSION = 5.0; SYSTEM_FRAMEWORK_SEARCH_PATHS = ""; TARGETED_DEVICE_FAMILY = 4; @@ -2219,7 +2229,7 @@ CODE_SIGN_ENTITLEMENTS = "MeowBili/MeowBili Mac App.entitlements"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 938; + CURRENT_PROJECT_VERSION = 967; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_HARDENED_RUNTIME = YES; @@ -2252,7 +2262,7 @@ CODE_SIGN_ENTITLEMENTS = "MeowBili/MeowBili Mac App.entitlements"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 938; + CURRENT_PROJECT_VERSION = 967; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_HARDENED_RUNTIME = YES; @@ -2281,7 +2291,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 938; + CURRENT_PROJECT_VERSION = 967; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 16.0; @@ -2304,7 +2314,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 938; + CURRENT_PROJECT_VERSION = 967; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 16.0; diff --git a/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 9736141cc..27131528a 100644 --- a/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,13 +1,12 @@ { - "originHash" : "5f52a35e4ada7c12d51c2eee09d97f1980c344524854f6ea63bbd76076e1136e", "pins" : [ { "identity" : "alamofire", "kind" : "remoteSourceControl", "location" : "https://github.com/Alamofire/Alamofire", "state" : { - "revision" : "723fa5a6c65812aec4a0d7cc432ee198883b6e00", - "version" : "5.9.0" + "revision" : "f455c2975872ccd2d9c81594c658af65716e9b9a", + "version" : "5.9.1" } }, { @@ -130,7 +129,7 @@ { "identity" : "sdwebimageswiftui", "kind" : "remoteSourceControl", - "location" : "https://github.com/SDWebImage/SDWebImageSwiftUI.git", + "location" : "https://github.com/SDWebImage/SDWebImageSwiftUI", "state" : { "revision" : "53573d6dd017e354c0e7d8f1c86b77ef1383c996", "version" : "2.2.7" @@ -209,5 +208,5 @@ } } ], - "version" : 3 + "version" : 2 } diff --git a/DarockBili.xcodeproj/xcshareddata/xcschemes/Alternative Destribution.xcscheme b/DarockBili.xcodeproj/xcshareddata/xcschemes/Alternative Destribution.xcscheme index 4005fa802..4a2aef279 100644 --- a/DarockBili.xcodeproj/xcshareddata/xcschemes/Alternative Destribution.xcscheme +++ b/DarockBili.xcodeproj/xcshareddata/xcschemes/Alternative Destribution.xcscheme @@ -1,7 +1,7 @@ + version = "1.8"> String { let digitMap: [String] = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "10" @@ -680,6 +681,7 @@ extension Int { } extension Bool { + @_transparent init(_ input: Int) { if input == 0 { self = false @@ -688,6 +690,16 @@ extension Bool { } } } +extension Int { + @_transparent + init (_ input: Bool) { + if input { + self = 1 + } else { + self = 0 + } + } +} infix operator ~ extension Float { diff --git a/MeowBili/Extension/UIExt.swift b/MeowBili/Extension/UIExt.swift index 72c46f60c..be3ae8cfd 100644 --- a/MeowBili/Extension/UIExt.swift +++ b/MeowBili/Extension/UIExt.swift @@ -529,6 +529,96 @@ struct Zoomable: ViewModifier { } } } + +struct SegmentedPicker: View { + @Binding var selection: Int + private var leftText: (any StringProtocol)? + private var rightText: (any StringProtocol)? + private var localizedLeftText: LocalizedStringKey? + private var localizedRightText: LocalizedStringKey? + @State private var selectionOffset: CGFloat = 0 + + init(selection: Binding, leftText: LocalizedStringKey, rightText: LocalizedStringKey) { + self._selection = selection + self.localizedLeftText = leftText + self.localizedRightText = rightText + } + init(selection: Binding, leftText: LocalizedStringKey, rightText: LocalizedStringKey) { + self._selection = Binding(get: { Int(selection.wrappedValue) }, set: { newValue in selection.wrappedValue = Bool(newValue) }) + self.localizedLeftText = leftText + self.localizedRightText = rightText + } + @_disfavoredOverload + init(selection: Binding, leftText: S, rightText: S) where S: StringProtocol { + self._selection = selection + self.leftText = leftText + self.rightText = rightText + } + @_disfavoredOverload + init(selection: Binding, leftText: S, rightText: S) where S: StringProtocol { + self._selection = Binding(get: { Int(selection.wrappedValue) }, set: { newValue in selection.wrappedValue = Bool(newValue) }) + self.leftText = leftText + self.rightText = rightText + } + + var body: some View { + ZStack { + RoundedRectangle(cornerRadius: 9.8) + .fill(Color(hex: 0x5d5251)) + .frame(height: 36) + HStack { + RoundedRectangle(cornerRadius: 8) + .fill(Color(hex: 0x7d7877)) + .frame(width: 75, height: 32) + .offset(x: selectionOffset) + Spacer() + } + .padding(.horizontal, 3) + HStack { + Group { + if let lt = leftText, let rt = rightText { + Text(lt) + .onTapGesture { + selection = 0 + withAnimation(.easeOut(duration: 0.2)) { + selectionOffset = 0 + } + } + Text(rt) + .onTapGesture { + selection = 1 + withAnimation(.easeOut(duration: 0.2)) { + selectionOffset = 72 + } + } + } else if let ldlt = localizedLeftText, let ldrt = localizedRightText { + Text(ldlt) + .onTapGesture { + selection = 0 + withAnimation(.easeOut(duration: 0.2)) { + selectionOffset = 0 + } + } + Text(ldrt) + .onTapGesture { + selection = 1 + withAnimation(.easeOut(duration: 0.2)) { + selectionOffset = 72 + } + } + } + } + .lineLimit(1) + .minimumScaleFactor(0.1) + .fontWeight(.semibold) + .frame(width: 75, height: 32) + } + } + .onAppear { + selectionOffset = selection == 0 ? 0 : 72 + } + } +} #endif // swiftlint:disable unused_closure_parameter diff --git a/MeowBili/InMain/MainView.swift b/MeowBili/InMain/MainView.swift index 7348b46f3..6dac4e6e6 100644 --- a/MeowBili/InMain/MainView.swift +++ b/MeowBili/InMain/MainView.swift @@ -146,6 +146,11 @@ struct MainView: View { }, label: { Text("Home.debug") }) + #if os(watchOS) + NavigationLink(destination: { WatchUIDebugView() }, label: { + Text("UIDebug") + }) + #endif } if notice != "" { NavigationLink(destination: { NoticeView() }, label: { diff --git a/MeowBili/Others/SettingsView.swift b/MeowBili/Others/SettingsView.swift index 59f656c47..3eb79a119 100644 --- a/MeowBili/Others/SettingsView.swift +++ b/MeowBili/Others/SettingsView.swift @@ -318,18 +318,20 @@ struct SettingsView: View { Text("Settings.about") } }) - NavigationLink(destination: { SoftwareUpdateView().navigationTitle("Settings.update") }, label: { - HStack { - ZStack { - Color.gray - .frame(width: 20, height: 20) - .clipShape(Circle()) - Image(systemName: "arrow.clockwise") - .font(.system(size: 12)) + if (Bundle.main.infoDictionary?["CFBundleIdentifier"] as! String) != "com.darock.DarockBili.watchkitapp" { + NavigationLink(destination: { SoftwareUpdateView().navigationTitle("Settings.update") }, label: { + HStack { + ZStack { + Color.gray + .frame(width: 20, height: 20) + .clipShape(Circle()) + Image(systemName: "arrow.clockwise") + .font(.system(size: 12)) + } + Text("Settings.update") } - Text("Settings.update") - } - }) + }) + } if debug { Section { NavigationLink(destination: { DebugMenuView().navigationTitle("Settings.debug") }, label: { @@ -888,22 +890,15 @@ struct SoftwareUpdateView: View { } Divider() Text(releaseNote) - if (Bundle.main.infoDictionary?["CFBundleIdentifier"] as! String) != "com.darock.DarockBili.watchkitapp" { - Button(action: { - let session = ASWebAuthenticationSession(url: URL(string: "https://cd.darock.top:32767/meowbili/install.html")!, callbackURLScheme: "mlhd") { _, _ in - return - } - session.prefersEphemeralWebBrowserSession = true - session.start() - }, label: { - Text("Update.download-and-install") - }) - } else { - Spacer() - .frame(height: 10) - Text("Update.install-by-testflight") - .bold() - } + Button(action: { + let session = ASWebAuthenticationSession(url: URL(string: "https://cd.darock.top:32767/meowbili/install.html")!, callbackURLScheme: "mlhd") { _, _ in + return + } + session.prefersEphemeralWebBrowserSession = true + session.start() + }, label: { + Text("Update.download-and-install") + }) } else if isFailed { Text("Update.error") } else { diff --git a/MeowBili/Others/WatchUIDebugView.swift b/MeowBili/Others/WatchUIDebugView.swift new file mode 100644 index 000000000..c01cb0c3e --- /dev/null +++ b/MeowBili/Others/WatchUIDebugView.swift @@ -0,0 +1,35 @@ +// +// +// WatchUIDebugView.swift +// MeowBili Watch App +// +// Created by memz233 on 2024/3/31. +// +//===----------------------------------------------------------------------===// +// +// 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 SwiftUI + +struct WatchUIDebugView: View { + var body: some View { + List { + NavigationLink(destination: { SegmentedPicker(selection: .constant(0), leftText: "TLeft", rightText: "TRight") }, label: { + Text("DebugVPLD") + }) + } + } + + +} + +#Preview { + WatchUIDebugView() +} diff --git a/MeowBili/Video/VideoDetailView.swift b/MeowBili/Video/VideoDetailView.swift index 3c4fc3ec2..1582a0a80 100644 --- a/MeowBili/Video/VideoDetailView.swift +++ b/MeowBili/Video/VideoDetailView.swift @@ -219,26 +219,15 @@ struct VideoDetailView: View { if owner["ID"] != nil { NavigationLink(destination: { UserDetailView(uid: owner["ID"]!) }, label: { HStack { - AsyncImage(url: URL(string: owner["Face"]!)) { phase in - switch phase { - case .empty: - Circle() - .frame(width: 40, height: 40) - .redacted(reason: .placeholder) - case .success(let image): - image.resizable() - case .failure: - Circle() - .frame(width: 40, height: 40) - .redacted(reason: .placeholder) - @unknown default: + WebImage(url: URL(string: owner["Face"]!)) + .resizable() + .placeholder { Circle() .frame(width: 40, height: 40) .redacted(reason: .placeholder) } - } - .clipShape(Circle()) - .frame(width: 40, height: 40) + .clipShape(Circle()) + .frame(width: 40, height: 40) VStack { HStack { Text(owner["Name"]!) @@ -690,6 +679,7 @@ struct VideoDetailView: View { .containerBackground(for: .navigation) { ZStack { WebImage(url: URL(string: videoDetails["Pic"]!)) + .resizable() .blur(radius: 20) Color.black .opacity(0.4) @@ -1117,20 +1107,19 @@ struct VideoDetailView: View { } Spacer() .frame(height: 20) - HStack { - Marquee { - HStack { - Text(videoDetails["Title"]!) - .lineLimit(1) - .font(.system(size: 12, weight: .bold)) - .multilineTextAlignment(.center) - } + Marquee { + HStack { + Text(videoDetails["Title"]!) + .lineLimit(1) + .font(.system(size: 12, weight: .bold)) + .multilineTextAlignment(.center) } - .marqueeWhenNotFit(true) - .marqueeDuration(10) - .frame(height: 20) - .padding(.horizontal, 10) } + .marqueeWhenNotFit(true) + .marqueeDuration(10) + .marqueeIdleAlignment(.center) + .frame(height: 20) + .padding(.horizontal, 10) Text(videoDetails["UP"]!) .lineLimit(1) .font(.system(size: 12)) diff --git a/MeowBili/Video/VideoPlayerView.swift b/MeowBili/Video/VideoPlayerView.swift index 97ee3c7e2..b24709170 100644 --- a/MeowBili/Video/VideoPlayerView.swift +++ b/MeowBili/Video/VideoPlayerView.swift @@ -172,16 +172,7 @@ struct VideoPlayerView: View { .tag(1) List { Section { - Button(action: { - isFullScreen.toggle() - tabviewChoseTab = 1 - }, label: { - if isFullScreen { - Label("恢复", systemImage: "arrow.down.forward.and.arrow.up.backward") - } else { - Label("全屏", systemImage: "arrow.down.backward.and.arrow.up.forward") - } - }) + SegmentedPicker(selection: $isFullScreen, leftText: "正常", rightText: "全屏") } header: { Text("画面") } @@ -358,6 +349,8 @@ struct VideoPlayerView: View { #endif } + @_optimize(speed) + @inline(__always) func UpdateDanmaku() { AF.request("https://api.bilibili.com/x/v1/dm/list.so?oid=\(videoCID)").response { response in let danmakus = String(data: response.data!, encoding: .utf8)! diff --git a/README.md b/README.md index 30da20a70..46fdab2cf 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,18 @@ ## ⬇️安装 ### TestFlight -[此处](https://testflight.apple.com/join/TbuBT6ig) +[Darock 官方分发(推荐)](https://testflight.apple.com/join/TbuBT6ig) + +以下为替代分发通道,测试员满时可使用,来自相同的源代码编译: + +- [Linecom Software](https://testflight.apple.com/join/P5CLgWpk) + +## 🔨编译 +若要编译最新的提交,可从`main`编译,我们会尽可能确保`main`分支的代码能够直接编译。 + +使用[最新的 Release](https://github.com/Darock-Studio/Darock-Bili/releases/latest) 编译以获取与官方分发相同的稳定版本。 + +由于一个未知问题,您可能需要使用 [Xcode 15.2](https://developer.apple.com/download/all/) (而不是最新的 15.3) 来进行编译。 ## 🙌贡献 欢迎提交Issue和Pull Request帮助我们变得更好!