mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
[WIP] Fixed the app permissions grid in AppDetailView
This commit is contained in:
committed by
Joe Mattiello
parent
eb151d74dd
commit
c81f716427
@@ -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 = "<group>"; };
|
||||
1F0DD81229322487007608A4 /* LazyScrollingVStack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LazyScrollingVStack.swift; sourceTree = "<group>"; };
|
||||
1F0DD81B2932D2FF007608A4 /* AppScreenshotsScrollView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppScreenshotsScrollView.swift; sourceTree = "<group>"; };
|
||||
1F0DD8202933B749007608A4 /* AppPermissionsGrid.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppPermissionsGrid.swift; sourceTree = "<group>"; };
|
||||
1F6E08D9292806E0005059C0 /* AppRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppRowView.swift; sourceTree = "<group>"; };
|
||||
1F6E08DB292807D3005059C0 /* AppIconView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppIconView.swift; sourceTree = "<group>"; };
|
||||
1F6E08DF29280B12005059C0 /* SafariView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariView.swift; sourceTree = "<group>"; };
|
||||
@@ -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 = "<group>";
|
||||
@@ -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" */;
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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()
|
||||
|
||||
54
AltStore/Views/App Detail/AppPermissionsGrid.swift
Normal file
54
AltStore/Views/App Detail/AppPermissionsGrid.swift
Normal file
@@ -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()
|
||||
// }
|
||||
//}
|
||||
Reference in New Issue
Block a user