From e94b7aa2624601af7265823b02796e617c020aa6 Mon Sep 17 00:00:00 2001 From: iHTCboy Date: Mon, 16 Jan 2023 16:36:00 +0800 Subject: [PATCH] =?UTF-8?q?v1.2.0=20=E5=A2=9E=E5=8A=A0=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=8C=85=E5=A4=A7=E5=B0=8F=E5=92=8C=E6=94=AF=E6=8C=81=E6=9C=80?= =?UTF-8?q?=E4=BD=8E=E7=B3=BB=E7=BB=9F=E7=89=88=E6=9C=AC=E3=80=81=E5=BC=80?= =?UTF-8?q?=E5=8F=91=E8=80=85=E5=95=86=E5=BA=97=E9=93=BE=E6=8E=A5=E7=9A=84?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=88Add=20the=20function=20of=20displayi?= =?UTF-8?q?ng=20the=20package=20size=20and=20supporting=20the=20minimum=20?= =?UTF-8?q?system=20version,=20developer=20App=20Store=20link=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iAppStore.xcodeproj/project.pbxproj | 8 ++--- .../components/rankLists/AppContextMenu.swift | 23 ++++++++++++-- .../components/rankLists/RankCellView.swift | 30 ++++++++++++++----- iAppStore/components/rankLists/RankHome.swift | 2 +- .../components/search/SearchCellView.swift | 18 +++++++---- 5 files changed, 60 insertions(+), 21 deletions(-) diff --git a/iAppStore.xcodeproj/project.pbxproj b/iAppStore.xcodeproj/project.pbxproj index 36bd12f..e7c72db 100644 --- a/iAppStore.xcodeproj/project.pbxproj +++ b/iAppStore.xcodeproj/project.pbxproj @@ -645,7 +645,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2021.01.26; + CURRENT_PROJECT_VERSION = 2022.01.16; DEVELOPMENT_ASSET_PATHS = "\"iAppStore/Preview Content\""; DEVELOPMENT_TEAM = ""; ENABLE_PREVIEWS = YES; @@ -663,7 +663,7 @@ "@executable_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 11.0; - MARKETING_VERSION = 1.1.1; + MARKETING_VERSION = 1.2.0; PRODUCT_BUNDLE_IDENTIFIER = com.37iOS.iAppStore; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -685,7 +685,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2021.01.26; + CURRENT_PROJECT_VERSION = 2022.01.16; DEVELOPMENT_ASSET_PATHS = "\"iAppStore/Preview Content\""; DEVELOPMENT_TEAM = ""; ENABLE_PREVIEWS = YES; @@ -703,7 +703,7 @@ "@executable_path/Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 11.0; - MARKETING_VERSION = 1.1.1; + MARKETING_VERSION = 1.2.0; PRODUCT_BUNDLE_IDENTIFIER = com.37iOS.iAppStore; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/iAppStore/components/rankLists/AppContextMenu.swift b/iAppStore/components/rankLists/AppContextMenu.swift index d92ebcc..80f3daf 100644 --- a/iAppStore/components/rankLists/AppContextMenu.swift +++ b/iAppStore/components/rankLists/AppContextMenu.swift @@ -13,6 +13,9 @@ struct AppContextMenu: View { let appleID: String? let bundleID: String? let appUrl: String? + let developerUrl: String? + + @AppStorage("kIsShowAppDataSize") private var isShowAppDataSize = false var body: some View { VStack { @@ -33,12 +36,28 @@ struct AppContextMenu: View { appUrl!.copyToClipboard() } - CreateMenuItem(text: "从 App Store 打开", imgName: "square.and.arrow.up") { + CreateMenuItem(text: "从 App Store 打开 App", imgName: "paperplane") { if let url = URL(string: appUrl!) { UIApplication.shared.open(url) } } } + + if developerUrl != nil { + CreateMenuItem(text: "复制开发者商店链接", imgName: "person") { + developerUrl!.copyToClipboard() + } + + CreateMenuItem(text: "打开开发者商店主页", imgName: "person.fill") { + if let url = URL(string: developerUrl!) { + UIApplication.shared.open(url) + } + } + } + + CreateMenuItem(text: "\(isShowAppDataSize ? "隐藏" : "显示") App 大小和最低支持系统", imgName: "arrow.down.app") { + isShowAppDataSize.toggle() + } } } @@ -62,6 +81,6 @@ struct AppContextMenu: View { struct AppContextMenu_Previews: PreviewProvider { static var previews: some View { - AppContextMenu(appleID: "123456", bundleID: "iAppStore", appUrl: "https://juejin.cn/user/1002387318511214") + AppContextMenu(appleID: "123456", bundleID: "iAppStore", appUrl: "https://juejin.cn/user/1002387318511214", developerUrl: "https://juejin.cn/user/1002387318511214") } } diff --git a/iAppStore/components/rankLists/RankCellView.swift b/iAppStore/components/rankLists/RankCellView.swift index c2036d5..4fea0f5 100644 --- a/iAppStore/components/rankLists/RankCellView.swift +++ b/iAppStore/components/rankLists/RankCellView.swift @@ -10,8 +10,12 @@ import SwiftUI struct RankCellView: View { - var index: Int - var item: AppRank + let index: Int + let regionName: String + let item: AppRank + + @StateObject private var appModel = AppDetailModel() + @State @AppStorage("kIsShowAppDataSize") private var isShowAppDataSize = false var body: some View { HStack { @@ -50,11 +54,16 @@ struct RankCellView: View { Spacer().frame(height: 5) - Text(item.summary?.label.replacingOccurrences(of: "\n", with: "") ?? item.rights?.label ?? "") - .foregroundColor(.secondary) - .font(.footnote) - .lineLimit(2) - .truncationMode(.tail) + if isShowAppDataSize { + Text("占用大小:\(appModel.app?.fileSizeMB ?? "")").font(.footnote).lineLimit(1).foregroundColor(.gray) + Text("最低支持系统:\(appModel.app?.minimumOsVersion ?? "")").font(.footnote).lineLimit(1).foregroundColor(.gray) + } else { + Text(item.summary?.label.replacingOccurrences(of: "\n", with: "") ?? item.rights?.label ?? "") + .foregroundColor(.secondary) + .font(.footnote) + .lineLimit(2) + .truncationMode(.tail) + } Spacer().frame(height: 10) @@ -72,7 +81,12 @@ struct RankCellView: View { } } } - .contextMenu { AppContextMenu(appleID: item.id.attributes.imID, bundleID: item.id.attributes.imBundleID, appUrl: item.id.label) } + .contextMenu { AppContextMenu(appleID: item.id.attributes.imID, bundleID: item.id.attributes.imBundleID, appUrl: item.id.label, developerUrl: item.imArtist.attributes?.href) } + .onAppear { + if isShowAppDataSize && appModel.app == nil { + appModel.searchAppData(item.id.attributes.imID, nil, regionName) + } + } } } diff --git a/iAppStore/components/rankLists/RankHome.swift b/iAppStore/components/rankLists/RankHome.swift index d00a4ba..b2b8f01 100644 --- a/iAppStore/components/rankLists/RankHome.swift +++ b/iAppStore/components/rankLists/RankHome.swift @@ -70,7 +70,7 @@ extension RankHome { regionName: regionName, item: item ) ) { - RankCellView(index: index ?? 0, item: item) + RankCellView(index: index ?? 0, regionName: regionName, item: item) .frame(height: 110) } } diff --git a/iAppStore/components/search/SearchCellView.swift b/iAppStore/components/search/SearchCellView.swift index 5416d50..9c0a3c4 100644 --- a/iAppStore/components/search/SearchCellView.swift +++ b/iAppStore/components/search/SearchCellView.swift @@ -12,6 +12,7 @@ struct SearchCellView: View { var index: Int var item: AppDetail + @State @AppStorage("kIsShowAppDataSize") private var isShowAppDataSize = false var body: some View { HStack { @@ -50,11 +51,16 @@ struct SearchCellView: View { Spacer().frame(height: 5) - Text(item.description.replacingOccurrences(of: "\n", with: "")) - .foregroundColor(.secondary) - .font(.footnote) - .lineLimit(2) - .truncationMode(.tail) + if isShowAppDataSize { + Text("占用大小:\(item.fileSizeMB)").font(.footnote).lineLimit(1).foregroundColor(.gray) + Text("最低支持系统:\(item.minimumOsVersion)").font(.footnote).lineLimit(1).foregroundColor(.gray) + } else { + Text(item.description.replacingOccurrences(of: "\n", with: "")) + .foregroundColor(.secondary) + .font(.footnote) + .lineLimit(2) + .truncationMode(.tail) + } Spacer().frame(height: 10) @@ -72,7 +78,7 @@ struct SearchCellView: View { } } } - .contextMenu { AppContextMenu(appleID: String(item.trackId), bundleID: item.bundleId, appUrl: item.trackViewUrl) } + .contextMenu { AppContextMenu(appleID: String(item.trackId), bundleID: item.bundleId, appUrl: item.trackViewUrl, developerUrl: item.artistViewUrl) } } }