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) } } }