diff --git a/AltStore.xcodeproj/project.pbxproj b/AltStore.xcodeproj/project.pbxproj index 85b4696c..dd1ad90e 100644 --- a/AltStore.xcodeproj/project.pbxproj +++ b/AltStore.xcodeproj/project.pbxproj @@ -23,6 +23,7 @@ 1F0DD81329322487007608A4 /* LazyScrollingVStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0DD81229322487007608A4 /* LazyScrollingVStack.swift */; }; 1F0DD81C2932D2FF007608A4 /* AppScreenshotsScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0DD81B2932D2FF007608A4 /* AppScreenshotsScrollView.swift */; }; 1F0DD81F2932D84C007608A4 /* ExpandableText in Frameworks */ = {isa = PBXBuildFile; productRef = 1F0DD81E2932D84C007608A4 /* ExpandableText */; }; + 1F0DD8212933B749007608A4 /* AppPermissionsGrid.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0DD8202933B749007608A4 /* AppPermissionsGrid.swift */; }; 1F6E08DA292806E0005059C0 /* AppRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F6E08D9292806E0005059C0 /* AppRowView.swift */; }; 1F6E08DC292807D3005059C0 /* AppIconView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F6E08DB292807D3005059C0 /* AppIconView.swift */; }; 1F6E08E029280B12005059C0 /* SafariView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F6E08DF29280B12005059C0 /* SafariView.swift */; }; @@ -39,7 +40,6 @@ 1F943C702927F90400ABE095 /* BrowseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FAFC5BA2927E0F800B8D837 /* BrowseView.swift */; }; 1F943C712927F90400ABE095 /* MyAppsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FAFC5BD2927E10D00B8D837 /* MyAppsView.swift */; }; 1FB84BA62928DE08006A5CF4 /* AppDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FB84BA52928DE08006A5CF4 /* AppDetailView.swift */; }; - 1FB96FB829297C11007E68D1 /* GridStack in Frameworks */ = {isa = PBXBuildFile; productRef = 1FB96FB729297C11007E68D1 /* GridStack */; }; 1FB96FBE292A20E5007E68D1 /* ObservableScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FB96FBD292A20E5007E68D1 /* ObservableScrollView.swift */; }; 1FB96FC0292A63F2007E68D1 /* AppPillButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FB96FBF292A63F2007E68D1 /* AppPillButton.swift */; }; 1FB96FC3292A6D7E007E68D1 /* DateFormatterHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FB96FC2292A6D7E007E68D1 /* DateFormatterHelper.swift */; }; @@ -545,6 +545,7 @@ 19B9B7442845E6DF0076EF69 /* SelectTeamViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectTeamViewController.swift; sourceTree = ""; }; 1F0DD81229322487007608A4 /* LazyScrollingVStack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LazyScrollingVStack.swift; sourceTree = ""; }; 1F0DD81B2932D2FF007608A4 /* AppScreenshotsScrollView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppScreenshotsScrollView.swift; sourceTree = ""; }; + 1F0DD8202933B749007608A4 /* AppPermissionsGrid.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppPermissionsGrid.swift; sourceTree = ""; }; 1F6E08D9292806E0005059C0 /* AppRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppRowView.swift; sourceTree = ""; }; 1F6E08DB292807D3005059C0 /* AppIconView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppIconView.swift; sourceTree = ""; }; 1F6E08DF29280B12005059C0 /* SafariView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariView.swift; sourceTree = ""; }; @@ -979,7 +980,6 @@ 19104DBC2909C4E500C49C7B /* libEmotionalDamage.a in Frameworks */, 19104D952909BAEA00C49C7B /* libimobiledevice.a in Frameworks */, 1F0DD81F2932D84C007608A4 /* ExpandableText in Frameworks */, - 1FB96FB829297C11007E68D1 /* GridStack in Frameworks */, B3146ED2284F581E00BBC3FD /* Roxas.framework in Frameworks */, D533E8B72727841800A9B5DD /* libAppleArchive.tbd in Frameworks */, B3C395F9284F362400DA9E2F /* AppCenterCrashes in Frameworks */, @@ -1107,6 +1107,7 @@ children = ( 1FB84BA52928DE08006A5CF4 /* AppDetailView.swift */, 1F0DD81B2932D2FF007608A4 /* AppScreenshotsScrollView.swift */, + 1F0DD8202933B749007608A4 /* AppPermissionsGrid.swift */, ); path = "App Detail"; sourceTree = ""; @@ -2211,7 +2212,6 @@ B3C395F6284F362400DA9E2F /* AppCenterAnalytics */, B3C395F8284F362400DA9E2F /* AppCenterCrashes */, 4879A9612861049C00FC1BBD /* OpenSSL */, - 1FB96FB729297C11007E68D1 /* GridStack */, 1F0DD80F293222DF007608A4 /* AsyncImage */, 1F0DD81E2932D84C007608A4 /* ExpandableText */, ); @@ -2725,6 +2725,7 @@ BFF0B69A2322D7D0007A79E1 /* UIScreen+CompactHeight.swift in Sources */, D5F2F6A92720B7C20081CCF5 /* PatchViewController.swift in Sources */, B39F16132918D7C5002E9404 /* Consts.swift in Sources */, + 1F0DD8212933B749007608A4 /* AppPermissionsGrid.swift in Sources */, BF8F69C222E659F700049BA1 /* AppContentViewController.swift in Sources */, BF08858522DE7EC800DE9F1E /* UpdateCollectionViewCell.swift in Sources */, BFB39B5C252BC10E00D1BE50 /* Managed.swift in Sources */, @@ -3605,14 +3606,6 @@ kind = branch; }; }; - 1FB96FB629297C11007E68D1 /* XCRemoteSwiftPackageReference "GridStack" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/pietropizzi/GridStack"; - requirement = { - kind = upToNextMajorVersion; - minimumVersion = 0.4.3; - }; - }; 4879A95D2861046500FC1BBD /* XCRemoteSwiftPackageReference "AltSign" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/SideStore/AltSign"; @@ -3708,11 +3701,6 @@ package = 1F0DD81D2932D84C007608A4 /* XCRemoteSwiftPackageReference "ExpandableText" */; productName = ExpandableText; }; - 1FB96FB729297C11007E68D1 /* GridStack */ = { - isa = XCSwiftPackageProductDependency; - package = 1FB96FB629297C11007E68D1 /* XCRemoteSwiftPackageReference "GridStack" */; - productName = GridStack; - }; 4879A95E2861046500FC1BBD /* AltSign */ = { isa = XCSwiftPackageProductDependency; package = 4879A95D2861046500FC1BBD /* XCRemoteSwiftPackageReference "AltSign" */; diff --git a/AltStore.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/AltStore.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 773a2475..13d25ec3 100644 --- a/AltStore.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/AltStore.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -36,15 +36,6 @@ "revision" : "d140b404c6683bb169bb01ef4eeecdb6d9be8fb8" } }, - { - "identity" : "gridstack", - "kind" : "remoteSourceControl", - "location" : "https://github.com/pietropizzi/GridStack", - "state" : { - "revision" : "777c3b9d789d377033d8e4c8f99f9d0a04485dc4", - "version" : "0.4.3" - } - }, { "identity" : "keychainaccess", "kind" : "remoteSourceControl", diff --git a/AltStore/Views/App Detail/AppDetailView.swift b/AltStore/Views/App Detail/AppDetailView.swift index 45d0c9e9..94fed3da 100644 --- a/AltStore/Views/App Detail/AppDetailView.swift +++ b/AltStore/Views/App Detail/AppDetailView.swift @@ -7,7 +7,6 @@ // import SwiftUI -import GridStack import AsyncImage import ExpandableText import AltStoreCore @@ -88,7 +87,7 @@ struct AppDetailView: View { } var contentView: some View { - VStack(alignment: .leading, spacing: 24) { + VStack(alignment: .leading, spacing: 32) { if let subtitle = storeApp.subtitle { Text(subtitle) .multilineTextAlignment(.center) @@ -170,18 +169,7 @@ struct AppDetailView: View { .font(.callout) .foregroundColor(.secondary) } else { - GridStack(minCellWidth: 40, spacing: 8, numItems: storeApp.permissions.count, alignment: .leading) { index, cellWidth in - let permission = storeApp.permissions[index] - - VStack { - Image(systemName: "photo.on.rectangle") - .padding() - .background(Circle().foregroundColor(Color(UIColor.secondarySystemBackground))) - Text(permission.type.localizedShortName ?? "") - } - .frame(width: cellWidth, height: cellWidth * 1.2) - .background(Color.red) - } + AppPermissionsGrid(permissions: storeApp.permissions) } Spacer() diff --git a/AltStore/Views/App Detail/AppPermissionsGrid.swift b/AltStore/Views/App Detail/AppPermissionsGrid.swift new file mode 100644 index 00000000..f76138e6 --- /dev/null +++ b/AltStore/Views/App Detail/AppPermissionsGrid.swift @@ -0,0 +1,54 @@ +// +// AppPermissionsGrid.swift +// SideStore +// +// Created by Fabian Thies on 27.11.22. +// Copyright © 2022 SideStore. All rights reserved. +// + +import SwiftUI +import AltStoreCore + +struct AppPermissionsGrid: View { + + let permissions: [AppPermission] + + let columns = Array(repeating: GridItem(.flexible()), count: 3) + + var body: some View { + LazyVGrid(columns: columns) { + ForEach(permissions, id: \.type) { permission in + AppPermissionGridItemView(permission: permission) + } + } + } +} + +struct AppPermissionGridItemView: View { + let permission: AppPermission + + @State var isPopoverPresented = false + + var body: some View { + SwiftUI.Button { + self.isPopoverPresented = true + } label: { + VStack { + Image(uiImage: (permission.type.icon?.withRenderingMode(.alwaysTemplate) ?? UIImage(systemName: "questionmark"))!) // TODO: Replace with system icon + .padding() + .background(Circle().foregroundColor(Color(.secondarySystemBackground))) + Text(permission.type.localizedShortName ?? "") + } + .foregroundColor(.primary) + } + .alert(isPresented: self.$isPopoverPresented) { + Alert(title: Text("Usage Description"), message: Text(permission.usageDescription)) + } + } +} + +//struct AppPermissionsGrid_Previews: PreviewProvider { +// static var previews: some View { +// AppPermissionsGrid() +// } +//}