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

iOS 专栏更新 #228

Merged
merged 1 commit into from
Feb 12, 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
16 changes: 8 additions & 8 deletions DarockBili.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1371,7 +1371,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = MeowBili/MeowBili.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 489;
CURRENT_PROJECT_VERSION = 500;
DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\"";
DEVELOPMENT_TEAM = B57D8PP775;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -1416,7 +1416,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = MeowBili/MeowBili.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 489;
CURRENT_PROJECT_VERSION = 500;
DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\"";
DEVELOPMENT_TEAM = B57D8PP775;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -1458,7 +1458,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 489;
CURRENT_PROJECT_VERSION = 500;
DEVELOPMENT_ASSET_PATHS = "\"DarockBili Watch App/Preview Content\"";
DEVELOPMENT_TEAM = B57D8PP775;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -1490,7 +1490,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 489;
CURRENT_PROJECT_VERSION = 500;
DEVELOPMENT_ASSET_PATHS = "\"DarockBili Watch App/Preview Content\"";
DEVELOPMENT_TEAM = B57D8PP775;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -1643,7 +1643,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 489;
CURRENT_PROJECT_VERSION = 500;
DEVELOPMENT_ASSET_PATHS = "\"DarockBili Watch App/Preview Content\"";
DEVELOPMENT_TEAM = B57D8PP775;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -1675,7 +1675,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 489;
CURRENT_PROJECT_VERSION = 500;
DEVELOPMENT_ASSET_PATHS = "\"DarockBili Watch App/Preview Content\"";
DEVELOPMENT_TEAM = B57D8PP775;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -1707,7 +1707,7 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 489;
CURRENT_PROJECT_VERSION = 500;
DEVELOPMENT_TEAM = B57D8PP775;
INFOPLIST_KEY_CFBundleDisplayName = DarockBili;
MARKETING_VERSION = 1.0.0;
Expand All @@ -1723,7 +1723,7 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 489;
CURRENT_PROJECT_VERSION = 500;
DEVELOPMENT_TEAM = B57D8PP775;
INFOPLIST_KEY_CFBundleDisplayName = DarockBili;
MARKETING_VERSION = 1.0.0;
Expand Down
3 changes: 3 additions & 0 deletions Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -4857,6 +4857,9 @@
},
"第二步: 人机验证" : {

},
"经验" : {

},
"获取验证码" : {

Expand Down
49 changes: 49 additions & 0 deletions MeowBili/Extension/UIExt.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//===----------------------------------------------------------------------===//

import UIKit
import WebKit
import SwiftUI
import Foundation
import SDWebImageSwiftUI
Expand Down Expand Up @@ -146,6 +147,43 @@ import AuthenticationServices
.buttonBorderShape(.roundedRectangle(radius: 14))
}

@ViewBuilder func ArticleCard(_ article: [String: String]) -> some View {
NavigationLink(destination: {ArticleView(cvid: article["CV"]!)}, label: {
VStack {
HStack {
Text(article["Title"]!)
.font(.system(size: 16, weight: .bold))
.lineLimit(3)
Spacer()
}
HStack {
VStack {
Text(article["Summary"]!)
.font(.system(size: 14, weight: .bold))
.lineLimit(3)
.foregroundColor(.gray)
HStack {
Text(article["Type"]!)
.font(.system(size: 12))
.lineLimit(1)
.foregroundColor(.gray)
Label(article["View"]!, systemImage: "eye.fill")
.font(.system(size: 12))
.lineLimit(1)
.foregroundColor(.gray)
Label(article["Like"]!, systemImage: "hand.thumbsup.fill")
.font(.system(size: 12))
.lineLimit(1)
.foregroundColor(.gray)
}
}
WebImage(url: URL(string: article["Pic"]! + "@100w"), options: [.progressiveLoad])
.cornerRadius(4)
}
}
})
}

//struct zoomable: ViewModifier {
// @AppStorage("MaxmiumScale") var maxmiumScale = 6.0
// @State var scale: CGFloat = 1.0
Expand Down Expand Up @@ -211,3 +249,14 @@ struct UIImageTransfer: Transferable {
}
}

struct WebView: UIViewRepresentable {
let url: URL

func makeUIView(context: Context) -> WKWebView {
let webView = WKWebView()
webView.load(URLRequest(url: url))
return webView
}

func updateUIView(_ uiView: WKWebView, context: Context) {}
}
21 changes: 17 additions & 4 deletions MeowBili/InMain/MainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,23 @@ struct MainView: View {
Button(action: {
mainTabSelection = 2
}, label: {
CachedAsyncImage(url: URL(string: userFaceUrl + "@35w"))
.frame(width: 35)
.clipShape(Circle())
.matchedGeometryEffect(id: "image", in: imageAnimation)
CachedAsyncImage(url: URL(string: userFaceUrl)) { phase in
switch phase {
case .empty:
Circle()
.frame(width: 35, height: 35)
.redacted(reason: .placeholder)
case .success(let image):
image.resizable()
case .failure(let error):
Circle()
.frame(width: 35, height: 35)
.redacted(reason: .placeholder)
}
}
.frame(width: 35, height: 35)
.clipShape(Circle())
.matchedGeometryEffect(id: "image", in: imageAnimation)
})
.buttonStyle(.borderless)
}
Expand Down
1 change: 1 addition & 0 deletions MeowBili/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
<string>fetch</string>
</array>
</dict>
</plist>
13 changes: 2 additions & 11 deletions MeowBili/PersonalCenter/ArticleView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,15 @@
//
//===----------------------------------------------------------------------===//

import WebKit
import SwiftUI
import DarockKit
import SwiftSoup

struct ArticleView: View {
var cvid: String
var body: some View {
ScrollView {

}
.onAppear {
DarockKit.Network.shared.requestString("https://www.bilibili.com/read/cv\(cvid)") { respStr, isSuccess in
if isSuccess {
let doc: Document = try! SwiftSoup.parse(respStr)
debugPrint(try! doc.text())
}
}
}
WebView(url: URL(string: "https://www.bilibili.com/read/cv\(cvid)")!)
}
}

Expand Down
21 changes: 17 additions & 4 deletions MeowBili/PersonalCenter/PersonAccountView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,23 @@ struct PersonAccountView: View {
NavigationLink(destination: {UserDetailView(uid: dedeUserID)}, label: {
HStack {
if userFaceUrl != "" {
CachedAsyncImage(url: URL(string: userFaceUrl + "@60w"))
.frame(width: 60)
.clipShape(Circle())
.matchedGeometryEffect(id: "image", in: imageAnimation)
CachedAsyncImage(url: URL(string: userFaceUrl)) { phase in
switch phase {
case .empty:
Circle()
.frame(width: 60, height: 60)
.redacted(reason: .placeholder)
case .success(let image):
image.resizable()
case .failure(let error):
Circle()
.frame(width: 60, height: 60)
.redacted(reason: .placeholder)
}
}
.frame(width: 60, height: 60)
.clipShape(Circle())
.matchedGeometryEffect(id: "image", in: imageAnimation)
} else {
Image("Placeholder")
.resizable()
Expand Down
Loading