mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
Revises store page permissions UI
* Switches “Permissions” and “Privacy” titles * Makes “Entitlements” and “Other Entitlements” top-level sections * Matches parent table view layout margins
This commit is contained in:
@@ -100,6 +100,10 @@ class AppDetailCollectionViewController: UICollectionViewController
|
|||||||
// Allow parent background color to show through.
|
// Allow parent background color to show through.
|
||||||
self.collectionView.backgroundColor = nil
|
self.collectionView.backgroundColor = nil
|
||||||
|
|
||||||
|
// Match the parent table view margins.
|
||||||
|
self.collectionView.directionalLayoutMargins.leading = 20
|
||||||
|
self.collectionView.directionalLayoutMargins.trailing = 20
|
||||||
|
|
||||||
let collectionViewLayout = self.makeLayout()
|
let collectionViewLayout = self.makeLayout()
|
||||||
self.collectionView.collectionViewLayout = collectionViewLayout
|
self.collectionView.collectionViewLayout = collectionViewLayout
|
||||||
|
|
||||||
@@ -109,21 +113,21 @@ class AppDetailCollectionViewController: UICollectionViewController
|
|||||||
self.headerRegistration = UICollectionView.SupplementaryRegistration<UICollectionViewListCell>(elementKind: UICollectionView.elementKindSectionHeader) { [weak self] (headerView, elementKind, indexPath) in
|
self.headerRegistration = UICollectionView.SupplementaryRegistration<UICollectionViewListCell>(elementKind: UICollectionView.elementKindSectionHeader) { [weak self] (headerView, elementKind, indexPath) in
|
||||||
var configuration = UIListContentConfiguration.plainHeader()
|
var configuration = UIListContentConfiguration.plainHeader()
|
||||||
|
|
||||||
|
// Match parent table view section headers.
|
||||||
|
configuration.textProperties.font = UIFont.systemFont(ofSize: 22, weight: .bold) // .boldSystemFont(ofSize:) returns *semi-bold* color smh.
|
||||||
|
configuration.textProperties.color = .label
|
||||||
|
|
||||||
switch Section(rawValue: indexPath.section)!
|
switch Section(rawValue: indexPath.section)!
|
||||||
{
|
{
|
||||||
case .privacy: break
|
case .privacy: break
|
||||||
case .knownEntitlements:
|
case .knownEntitlements:
|
||||||
let fontDescriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: .title3).withSymbolicTraits(.traitBold) ?? UIFontDescriptor.preferredFontDescriptor(withTextStyle: .title3)
|
|
||||||
configuration.textProperties.font = UIFont(descriptor: fontDescriptor, size: 0.0)
|
|
||||||
configuration.text = NSLocalizedString("Entitlements", comment: "")
|
configuration.text = NSLocalizedString("Entitlements", comment: "")
|
||||||
|
|
||||||
configuration.secondaryTextProperties.font = UIFont.preferredFont(forTextStyle: .callout)
|
configuration.secondaryTextProperties.font = UIFont.preferredFont(forTextStyle: .callout)
|
||||||
configuration.textToSecondaryTextVerticalPadding = 8
|
configuration.textToSecondaryTextVerticalPadding = 8
|
||||||
configuration.secondaryText = NSLocalizedString("Entitlements are additional permissions that grant access to certain system services, including potentially sensitive information. We recommend reviewing these before sideloading.", comment: "")
|
configuration.secondaryText = NSLocalizedString("Entitlements are additional permissions that grant access to certain system services, including potentially sensitive information.", comment: "")
|
||||||
|
|
||||||
case .unknownEntitlements:
|
case .unknownEntitlements:
|
||||||
let fontDescriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: .body).withSymbolicTraits(.traitBold) ?? UIFontDescriptor.preferredFontDescriptor(withTextStyle: .body)
|
|
||||||
configuration.textProperties.font = UIFont(descriptor: fontDescriptor, size: 0.0)
|
|
||||||
configuration.text = NSLocalizedString("Other Entitlements", comment: "")
|
configuration.text = NSLocalizedString("Other Entitlements", comment: "")
|
||||||
|
|
||||||
let action = UIAction(image: UIImage(systemName: "questionmark.circle")) { _ in
|
let action = UIAction(image: UIImage(systemName: "questionmark.circle")) { _ in
|
||||||
@@ -149,6 +153,9 @@ private extension AppDetailCollectionViewController
|
|||||||
{
|
{
|
||||||
func makeLayout() -> UICollectionViewCompositionalLayout
|
func makeLayout() -> UICollectionViewCompositionalLayout
|
||||||
{
|
{
|
||||||
|
let layoutConfig = UICollectionViewCompositionalLayoutConfiguration()
|
||||||
|
layoutConfig.contentInsetsReference = .layoutMargins
|
||||||
|
|
||||||
let layout = UICollectionViewCompositionalLayout(sectionProvider: { [privacyPermissions, knownEntitlementPermissions, unknownEntitlementPermissions] (sectionIndex, layoutEnvironment) -> NSCollectionLayoutSection? in
|
let layout = UICollectionViewCompositionalLayout(sectionProvider: { [privacyPermissions, knownEntitlementPermissions, unknownEntitlementPermissions] (sectionIndex, layoutEnvironment) -> NSCollectionLayoutSection? in
|
||||||
guard let section = Section(rawValue: sectionIndex) else { return nil }
|
guard let section = Section(rawValue: sectionIndex) else { return nil }
|
||||||
switch section
|
switch section
|
||||||
@@ -179,7 +186,7 @@ private extension AppDetailCollectionViewController
|
|||||||
|
|
||||||
case .knownEntitlements, .unknownEntitlements: return nil
|
case .knownEntitlements, .unknownEntitlements: return nil
|
||||||
}
|
}
|
||||||
})
|
}, configuration: layoutConfig)
|
||||||
|
|
||||||
return layout
|
return layout
|
||||||
}
|
}
|
||||||
@@ -199,12 +206,12 @@ private extension AppDetailCollectionViewController
|
|||||||
guard let self, #available(iOS 16, *) else { return }
|
guard let self, #available(iOS 16, *) else { return }
|
||||||
|
|
||||||
cell.contentConfiguration = UIHostingConfiguration {
|
cell.contentConfiguration = UIHostingConfiguration {
|
||||||
AppPermissionsCard(title: "Privacy",
|
AppPermissionsCard(title: "Permissions",
|
||||||
description: "\(self.app.name) may request access to the following:",
|
description: "\(self.app.name) may request access to the following:",
|
||||||
tintColor: Color(uiColor: self.app.tintColor ?? .altPrimary),
|
tintColor: Color(uiColor: self.app.tintColor ?? .altPrimary),
|
||||||
permissions: self.privacyPermissions)
|
permissions: self.privacyPermissions)
|
||||||
}
|
}
|
||||||
.margins(.horizontal, 20)
|
.margins(.horizontal, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
if #available(iOS 16, *)
|
if #available(iOS 16, *)
|
||||||
|
|||||||
@@ -402,8 +402,8 @@
|
|||||||
<stackView opaque="NO" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" axis="vertical" distribution="equalSpacing" alignment="center" spacing="15" translatesAutoresizingMaskIntoConstraints="NO" id="Jvb-r8-XrY">
|
<stackView opaque="NO" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" axis="vertical" distribution="equalSpacing" alignment="center" spacing="15" translatesAutoresizingMaskIntoConstraints="NO" id="Jvb-r8-XrY">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="375" height="300"/>
|
<rect key="frame" x="0.0" y="0.0" width="375" height="300"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" text="Permissions" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dj7-G8-GFv">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" text="Privacy" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dj7-G8-GFv">
|
||||||
<rect key="frame" x="20" y="0.0" width="335" height="26"/>
|
<rect key="frame" x="20" y="0.0" width="335" height="26.5"/>
|
||||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="22"/>
|
<fontDescription key="fontDescription" type="boldSystem" pointSize="22"/>
|
||||||
<nil key="textColor"/>
|
<nil key="textColor"/>
|
||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user