diff --git a/.DS_Store b/.DS_Store index 894b5a60f..cbfb82966 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/DarockBili Watch App/Extension/UIExt.swift b/DarockBili Watch App/Extension/UIExt.swift index 1fda30614..7688d2477 100644 --- a/DarockBili Watch App/Extension/UIExt.swift +++ b/DarockBili Watch App/Extension/UIExt.swift @@ -15,13 +15,16 @@ import SDWebImageSwiftUI NavigationLink(destination: {VideoDetailView(videoDetails: videoDetails)}, label: { VStack { HStack { - WebImage(url: URL(string: videoDetails["Pic"]! + "@50w")!, options: [.progressiveLoad, .scaleDownLargeImages]) + WebImage(url: URL(string: videoDetails["Pic"]! + "@100w")!, options: [.progressiveLoad, .scaleDownLargeImages]) .placeholder { RoundedRectangle(cornerRadius: 7) - .frame(width: 50) + .frame(width: 50, height: 30) .foregroundColor(Color(hex: 0x3D3D3D)) .redacted(reason: .placeholder) } + .resizable() + .scaledToFit() + .frame(width: 50) .cornerRadius(7) Text(videoDetails["Title"]!) .font(.system(size: 14, weight: .bold)) diff --git a/DarockBili Watch App/InMain/MainView.swift b/DarockBili Watch App/InMain/MainView.swift index 2056a0b9a..a150edd44 100644 --- a/DarockBili Watch App/InMain/MainView.swift +++ b/DarockBili Watch App/InMain/MainView.swift @@ -8,6 +8,7 @@ import SwiftUI import DarockKit import SwiftyJSON +import Dynamic import Alamofire import SDWebImageSwiftUI @@ -56,7 +57,8 @@ struct MainView: View { Text("Debug Version. DO NOT Release!!") .bold() Button(action: { - tipWithText("Test") + //tipWithText("Test") + Dynamic.PUICApplication.sharedPUICApplication._setStatusBarTimeHidden(true, animated: false, completion: nil) }, label: { Text("Debug") }) diff --git a/DarockBili Watch App/PersonalCenter/DownloadsView.swift b/DarockBili Watch App/PersonalCenter/DownloadsView.swift index b9c3b6fe9..25256c923 100644 --- a/DarockBili Watch App/PersonalCenter/DownloadsView.swift +++ b/DarockBili Watch App/PersonalCenter/DownloadsView.swift @@ -45,15 +45,12 @@ struct DownloadsView: View { .cornerRadius(5) VStack { Text(metadatas[i]["Title"]!) - .font(.system(size: 15, weight: .bold)) + .font(.system(size: 14, weight: .bold)) .lineLimit(3) - HStack { - Label(metadatas[i]["View"]!, systemImage: "play.circle") - Label(metadatas[i]["UP"]!, systemImage: "person") - } - .font(.system(size: 11)) - .foregroundColor(.gray) - .lineLimit(1) + Label(metadatas[i]["UP"]!, systemImage: "person") + .font(.system(size: 11)) + .foregroundColor(.gray) + .lineLimit(1) } } }) diff --git a/DarockBili Watch App/PersonalCenter/FollowListView.swift b/DarockBili Watch App/PersonalCenter/FollowListView.swift index 45e3f56f5..123afc37f 100644 --- a/DarockBili Watch App/PersonalCenter/FollowListView.swift +++ b/DarockBili Watch App/PersonalCenter/FollowListView.swift @@ -20,39 +20,64 @@ struct FollowListView: View { @State var nowPage = 1 @State var totalPage = 1 @State var isLoadedFollows = false + @State var isLoadingNew = false + @State var pinnedUsers = [String]() var body: some View { - TabView { - List { + List { + if users.count != 0 { Section { - if users.count != 0 { - ForEach(0...users.count - 1, id: \.self) { i in - NavigationLink(destination: {UserDetailView(uid: users[i]["UID"]!)}, label: { - HStack { - WebImage(url: URL(string: users[i]["Face"]! + "@28w"), options: [.progressiveLoad]) - .cornerRadius(100) - VStack { - HStack { - Text(users[i]["Name"]!) - .font(.system(size: 16)) - .lineLimit(2) - Spacer() + ForEach(0...users.count - 1, id: \.self) { i in + NavigationLink(destination: {UserDetailView(uid: users[i]["UID"]!)}, label: { + HStack { + if pinnedUsers.contains(users[i]["UID"]!) { + Image(systemName: "pin.fill") + .foregroundColor(.gray) + } + WebImage(url: URL(string: users[i]["Face"]! + "@28w"), options: [.progressiveLoad]) + .cornerRadius(100) + VStack { + HStack { + Text(users[i]["Name"]!) + .font(.system(size: 16)) + .lineLimit(2) + Spacer() + } + } + } + }) + .swipeActions(edge: .leading, allowsFullSwipe: true) { + Button(action: { + if pinnedUsers.contains(users[i]["UID"]!) { + for j in 0.. videoTotalPage { + videoTargetJumpPageCache = String(videoTotalPage) + } + } else { + videoTargetJumpPageCache = String(videoNowPage) + } + } + Text(" / \(videoTotalPage)") + } + Button(action: { + if let cInt = Int(videoTargetJumpPageCache) { + videoNowPage = cInt + RefreshVideos() + } + isVideoPageJumpPresented = false + }, label: { + Text("跳转") + }) + } + }) + .onTapGesture { + videoTargetJumpPageCache = String(videoNowPage) + isVideoPageJumpPresented = true + } if videoNowPage != videoTotalPage { Button(action: { videoNowPage += 1 @@ -440,6 +479,41 @@ struct UserDetailView: View { } Text("\(articleNowPage) / \(articleTotalPage)") .font(.system(size: 18, weight: .bold)) + .sheet(isPresented: $isArticalPageJumpPresented, content: { + VStack { + Text("跳转到...") + .font(.system(size: 20, weight: .bold)) + HStack { + TextField("目标页", text: $articleTargetJumpPageCache) + .onSubmit { + if let cInt = Int(articleTargetJumpPageCache) { + if cInt <= 0 { + articleTargetJumpPageCache = "1" + } + if cInt > articleTotalPage { + articleTargetJumpPageCache = String(articleTotalPage) + } + } else { + articleTargetJumpPageCache = String(articleNowPage) + } + } + Text(" / \(articleTotalPage)") + } + Button(action: { + if let cInt = Int(articleTargetJumpPageCache) { + articleNowPage = cInt + RefreshArticles() + } + isArticalPageJumpPresented = false + }, label: { + Text("跳转") + }) + } + }) + .onTapGesture { + articleTargetJumpPageCache = String(articleNowPage) + isArticalPageJumpPresented = true + } if articleNowPage != articleTotalPage { Button(action: { articleNowPage += 1 diff --git a/DarockBili Watch App/Video/VideoDetailView.swift b/DarockBili Watch App/Video/VideoDetailView.swift index 5f1ac587f..176f78a53 100644 --- a/DarockBili Watch App/Video/VideoDetailView.swift +++ b/DarockBili Watch App/Video/VideoDetailView.swift @@ -364,22 +364,26 @@ struct VideoDetailView: View { @State var isMoreMenuPresented = false @State var isDownloadPresented = false @State var isNowPlayingPresented = false + @State var isCoverImageViewPresented = false var body: some View { VStack { Spacer() - CachedAsyncImage(url: URL(string: videoDetails["Pic"]! + "@120w_90h")) { phase in + CachedAsyncImage(url: URL(string: videoDetails["Pic"]! + "@240w_160h")) { phase in switch phase { case .empty: Image("Placeholder") .fixedSize() - .frame(width: 120, height: 90) + .frame(width: 120, height: 80) .redacted(reason: .placeholder) case .success(let image): image + .resizable() + .fixedSize() + .frame(width: 120, height: 80) case .failure(let error): Image("Placeholder") .fixedSize() - .frame(width: 120, height: 90) + .frame(width: 120, height: 80) .redacted(reason: .placeholder) .onAppear { debugPrint(error) @@ -387,14 +391,17 @@ struct VideoDetailView: View { @unknown default: Image("Placeholder") .fixedSize() - .frame(width: 120, height: 90) + .frame(width: 120, height: 80) .redacted(reason: .placeholder) } } .cornerRadius(5) .shadow(color: .black.opacity(0.5), radius: 5, x: 1, y: 2) .offset(y: 8) - + .sheet(isPresented: $isCoverImageViewPresented, content: {ImageViewerView(url: videoDetails["Pic"]!)}) + .onTapGesture { + isCoverImageViewPresented = true + } Spacer() .frame(height: 20) HStack { @@ -414,11 +421,15 @@ struct VideoDetailView: View { } } } - Text(videoDetails["Title"]!) - .lineLimit(2) - .font(.system(size: 12, weight: .bold)) - .multilineTextAlignment(.center) - .padding(.horizontal, 5) + ScrollView(.horizontal) { + Text(videoDetails["Title"]!) + + .lineLimit(1) + .font(.system(size: 12, weight: .bold)) + .multilineTextAlignment(.center) + } + .scrollIndicators(.never) + .padding(.horizontal, 5) } Text(videoDetails["UP"]!) .lineLimit(1) diff --git a/DarockBili.xcodeproj/project.pbxproj b/DarockBili.xcodeproj/project.pbxproj index f05f05d0e..fd5cd1b63 100644 --- a/DarockBili.xcodeproj/project.pbxproj +++ b/DarockBili.xcodeproj/project.pbxproj @@ -80,6 +80,7 @@ 6BFF29952A6C0E2200914A8E /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6B0253C62A4EF59700567986 /* Preview Assets.xcassets */; }; 6BFF29A62A6C10EB00914A8E /* DarockKit in Frameworks */ = {isa = PBXBuildFile; productRef = 6BFF29A52A6C10EB00914A8E /* DarockKit */; }; 8CA4537F2AE408A700138CE4 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 8CA4537E2AE408A700138CE4 /* README.md */; }; + 8CA453822AE42A3E00138CE4 /* Dynamic in Frameworks */ = {isa = PBXBuildFile; productRef = 8CA453812AE42A3E00138CE4 /* Dynamic */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -231,6 +232,7 @@ 6B853FEA2A7509DC0067B55C /* ZipArchive in Frameworks */, 6BC8CB342A6D758000D2E9E9 /* DarockKit in Frameworks */, 6B37B4BD2A715EF900F26F1A /* SFSymbol in Frameworks */, + 8CA453822AE42A3E00138CE4 /* Dynamic in Frameworks */, 6BC8CB2E2A6D758000D2E9E9 /* SDWebImageSVGCoder in Frameworks */, 6BC8CB322A6D758000D2E9E9 /* SwiftSoup in Frameworks */, ); @@ -587,6 +589,7 @@ 6BC8CB352A6D758000D2E9E9 /* CachedAsyncImage */, 6B37B4BC2A715EF900F26F1A /* SFSymbol */, 6B853FE92A7509DC0067B55C /* ZipArchive */, + 8CA453812AE42A3E00138CE4 /* Dynamic */, ); productName = "DarockBili WatchKit App Watch App"; productReference = 6BFF295C2A6C0D1C00914A8E /* DarockBili Watch App.app */; @@ -639,6 +642,7 @@ 6BC8CB1D2A6CF48400D2E9E9 /* XCRemoteSwiftPackageReference "swiftui-cached-async-image" */, 6B37B4BB2A715EF800F26F1A /* XCRemoteSwiftPackageReference "SFSymbol" */, 6B853FE82A7509DC0067B55C /* XCRemoteSwiftPackageReference "ZipArchive" */, + 8CA453802AE42A3E00138CE4 /* XCRemoteSwiftPackageReference "Dynamic" */, ); productRefGroup = 6B0253B52A4EF59600567986 /* Products */; projectDirPath = ""; @@ -913,7 +917,7 @@ buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 167; + CURRENT_PROJECT_VERSION = 168; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0.0; @@ -933,7 +937,7 @@ buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 167; + CURRENT_PROJECT_VERSION = 168; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0.0; @@ -953,7 +957,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 167; + CURRENT_PROJECT_VERSION = 168; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0.0; @@ -972,7 +976,7 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 167; + CURRENT_PROJECT_VERSION = 168; DEVELOPMENT_TEAM = B57D8PP775; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0.0; @@ -996,7 +1000,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = ""; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 167; + CURRENT_PROJECT_VERSION = 168; DEVELOPMENT_ASSET_PATHS = "\"DarockBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1035,7 +1039,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = ""; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 167; + CURRENT_PROJECT_VERSION = 168; DEVELOPMENT_ASSET_PATHS = "\"DarockBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1074,7 +1078,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = ""; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 167; + CURRENT_PROJECT_VERSION = 168; DEFINES_MODULE = YES; DEVELOPMENT_ASSET_PATHS = "\"DarockBili Watch App/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; @@ -1109,7 +1113,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = ""; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 167; + CURRENT_PROJECT_VERSION = 168; DEFINES_MODULE = YES; DEVELOPMENT_ASSET_PATHS = "\"DarockBili Watch App/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; @@ -1269,6 +1273,14 @@ minimumVersion = 2.1.1; }; }; + 8CA453802AE42A3E00138CE4 /* XCRemoteSwiftPackageReference "Dynamic" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/mhdhejazi/Dynamic"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 1.2.0; + }; + }; /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ @@ -1327,6 +1339,11 @@ package = 6BA1E5492A6AF2A900293B2C /* XCRemoteSwiftPackageReference "DarockKit" */; productName = DarockKit; }; + 8CA453812AE42A3E00138CE4 /* Dynamic */ = { + isa = XCSwiftPackageProductDependency; + package = 8CA453802AE42A3E00138CE4 /* XCRemoteSwiftPackageReference "Dynamic" */; + productName = Dynamic; + }; /* End XCSwiftPackageProductDependency section */ }; rootObject = 6B0253AE2A4EF59600567986 /* Project object */; diff --git a/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 8b367762d..f35f72792 100644 --- a/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DarockBili.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -18,6 +18,15 @@ "revision" : "8653ae946660d0669fc2bbbd40a40f62dc192308" } }, + { + "identity" : "dynamic", + "kind" : "remoteSourceControl", + "location" : "https://github.com/mhdhejazi/Dynamic", + "state" : { + "revision" : "ab9a2570862d54aed2663691bb767f881226a12f", + "version" : "1.2.0" + } + }, { "identity" : "efqrcode", "kind" : "remoteSourceControl", diff --git a/DarockBili.xcodeproj/project.xcworkspace/xcuserdata/memz233.xcuserdatad/UserInterfaceState.xcuserstate b/DarockBili.xcodeproj/project.xcworkspace/xcuserdata/memz233.xcuserdatad/UserInterfaceState.xcuserstate index 9a87934f5..de4eb6b19 100644 Binary files a/DarockBili.xcodeproj/project.xcworkspace/xcuserdata/memz233.xcuserdatad/UserInterfaceState.xcuserstate and b/DarockBili.xcodeproj/project.xcworkspace/xcuserdata/memz233.xcuserdatad/UserInterfaceState.xcuserstate differ