diff --git a/Localization/Localizable.xcstrings b/Localization/Localizable.xcstrings index b089e27..c691889 100644 --- a/Localization/Localizable.xcstrings +++ b/Localization/Localizable.xcstrings @@ -5520,6 +5520,9 @@ "A" : { "shouldTranslate" : false }, + "Active Pro" : { + "shouldTranslate" : false + }, "All data will be lost!" : { "shouldTranslate" : false }, @@ -23333,6 +23336,16 @@ } } }, + "前往 TestFlight" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Go to TestFlight" + } + } + } + }, "前往“提示”了解更多" : { "localizations" : { "ar" : { @@ -27325,6 +27338,16 @@ } } }, + "喵哩喵哩" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "MeowBili" + } + } + } + }, "回复" : { "localizations" : { "ar" : { @@ -29219,6 +29242,16 @@ } } }, + "在喵哩喵哩中打开" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Open in MeowBili" + } + } + } + }, "在安全延时期间您仍然可以使用暗礁浏览器。" : { "localizations" : { "ar" : { @@ -58906,6 +58939,16 @@ } } }, + "第三方哔哩哔哩客户端" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Third-party Bilibili Client" + } + } + } + }, "等待 Darock 修复" : { "localizations" : { "ar" : { diff --git a/WatchBrowser Watch App/Media/Image/ImageViewerView.swift b/WatchBrowser Watch App/Media/Image/ImageViewerView.swift index d10f57c..db7dde4 100644 --- a/WatchBrowser Watch App/Media/Image/ImageViewerView.swift +++ b/WatchBrowser Watch App/Media/Image/ImageViewerView.swift @@ -22,7 +22,6 @@ struct ImageViewerView: View { .onFailure { _ in isFailedToLoad = true } - .indicator(.activity) .transition(.fade(duration: 0.5)) .scaledToFit() .frame(width: CGFloat(100), height: CGFloat(100), alignment: .center) @@ -33,7 +32,6 @@ struct ImageViewerView: View { .onFailure { _ in isFailedToLoad = true } - .indicator(.activity) .transition(.fade(duration: 0.5)) .scaledToFit() } diff --git a/WatchBrowser Watch App/Preferences/SettingsView.swift b/WatchBrowser Watch App/Preferences/SettingsView.swift index c586de7..ca4f9c1 100644 --- a/WatchBrowser Watch App/Preferences/SettingsView.swift +++ b/WatchBrowser Watch App/Preferences/SettingsView.swift @@ -110,7 +110,7 @@ struct SettingsView: View { NavigationLink(destination: { ProPurchaseView() }, label: { SettingItemLabel(title: "暗礁浏览器 Pro", image: "sparkles", color: .blue) }) if isProPurchased { if _featureFlagIsDarockIntelligenceEnabled { - NavigationLink(destination: {}, label: { + NavigationLink(destination: { DarockIntelligenceView() }, label: { HStack { Image("DarockIntelligenceIcon") .resizable() @@ -248,6 +248,14 @@ struct SettingsView: View { } } + struct DarockIntelligenceView: View { + var body: some View { + List { + + } + .navigationTitle("Darock 智能") + } + } @available(watchOS 10.0, *) struct WidgetSettingsView: View { var body: some View { @@ -3464,6 +3472,14 @@ struct SettingsView: View { }, label: { Text("Reset Pro State") }) + Button(action: { + isProPurchased = true + UserDefaults(suiteName: "group.darock.WatchBrowser.Widgets")!.set(true, forKey: "IsProWidgetsAvailable") + WidgetCenter.shared.reloadAllTimelines() + WidgetCenter.shared.invalidateConfigurationRecommendations() + }, label: { + Text("Active Pro") + }) } header: { Text("Purchasing") } diff --git a/WatchBrowser Watch App/WebKit/BrowsingMenuView.swift b/WatchBrowser Watch App/WebKit/BrowsingMenuView.swift index dc43c1c..4e050ca 100644 --- a/WatchBrowser Watch App/WebKit/BrowsingMenuView.swift +++ b/WatchBrowser Watch App/WebKit/BrowsingMenuView.swift @@ -9,6 +9,7 @@ import SwiftUI import Dynamic import DarockKit import SwiftSoup +import SDWebImageSwiftUI struct BrowsingMenuView: View { @Binding var webViewPresentationMode: PresentationMode @@ -39,6 +40,60 @@ struct BrowsingMenuView: View { ZStack { NavigationStack { List { + if (webView.url?.absoluteString ?? "").contains("bilibili.com/") { + Section { + VStack { + HStack { + WebImage(url: URL(string: "https://darock.top/meowbili/assetsv2/meow-93aa09e9.png")!) + .resizable() + .placeholder { + RoundedRectangle(cornerRadius: 12) + .fill(Color.gray) + .opacity(0.6) + } + .cornerRadius(12) + .frame(width: 50, height: 50) + VStack(alignment: .leading) { + Text("喵哩喵哩") + Text("第三方哔哩哔哩客户端") + .font(.footnote) + .opacity(0.6) + } + Spacer() + } + Group { + if UserDefaults(suiteName: "group.darockst")?.bool(forKey: "DCIsMeowBiliInstalled") ?? false { + Button(action: { + if let bvid = (webView.url?.absoluteString ?? "").split(separator: "bilibili.com/video/")[from: 1], + bvid.hasPrefix("BV") { + WKExtension.shared().openSystemURL(URL(string: "https://darock.top/meowbili/video/\(bvid)")!) + } else { + WKExtension.shared().openSystemURL(URL(string: "https://darock.top/meowbili/video")!) + } + }, label: { + HStack { + Text("在喵哩喵哩中打开") + Image(systemName: "arrow.up.forward.app") + } + .font(.headline) + }) + } else { + Button(action: { + webView.load(URLRequest(url: URL(string: "https://testflight.apple.com/join/skaCe2L2")!)) + }, label: { + HStack { + Text("前往 TestFlight") + Image(systemName: "arrow.up.right.square") + } + .font(.headline) + }) + } + } + .buttonStyle(.borderedProminent) + .buttonBorderShape(.roundedRectangle(radius: 12)) + } + } + } Section { TextField("页面链接", text: $webLinkInput, style: "field-page") { if webLinkInput.isURL() { diff --git a/WatchBrowser Watch App/WebKit/WebViewDelegate.swift b/WatchBrowser Watch App/WebKit/WebViewDelegate.swift index d2949d6..816ce25 100644 --- a/WatchBrowser Watch App/WebKit/WebViewDelegate.swift +++ b/WatchBrowser Watch App/WebKit/WebViewDelegate.swift @@ -74,11 +74,6 @@ public final class WebViewNavigationDelegate: NSObject, WKNavigationDelegate { dismissListsShouldRepresentWebView = true return } - if _slowPath(curl.contains("bilibili.com/")) && (UserDefaults(suiteName: "group.darockst")?.bool(forKey: "DCIsMeowBiliInstalled") ?? false) { - if let bvid = curl.split(separator: "bilibili.com/video/")[from: 1], bvid.hasPrefix("BV") { - WKExtension.shared().openSystemURL(URL(string: "https://darock.top/meowbili/video/\(bvid)")!) - } - } } } diff --git a/WatchBrowser.xcodeproj/project.pbxproj b/WatchBrowser.xcodeproj/project.pbxproj index facfb37..5ac061e 100644 --- a/WatchBrowser.xcodeproj/project.pbxproj +++ b/WatchBrowser.xcodeproj/project.pbxproj @@ -2800,7 +2800,7 @@ repositoryURL = "https://github.com/SDWebImage/SDWebImageSwiftUI"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 3.0.4; + minimumVersion = 2.2.7; }; }; 8CA7B84D2BE3E053004643FE /* XCRemoteSwiftPackageReference "SDWebImageWebPCoder" */ = { diff --git a/WatchBrowser.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/WatchBrowser.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index f79f252..30ab96c 100644 --- a/WatchBrowser.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/WatchBrowser.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -132,8 +132,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/SDWebImage/SDWebImageSwiftUI", "state" : { - "revision" : "5aa947356f4ea49a0c3b9968564267f6ea5abea7", - "version" : "3.1.2" + "revision" : "53573d6dd017e354c0e7d8f1c86b77ef1383c996", + "version" : "2.2.7" } }, {