[AltStoreCore] Fixes ALTAppPrivacyPermission.synthesizedName for legacy permissions

This commit is contained in:
Riley Testut
2023-10-10 15:29:34 -05:00
committed by Magesh K
parent 21b2a869a1
commit e33a40ecb1
5 changed files with 78 additions and 68 deletions

View File

@@ -374,7 +374,7 @@
D55467C52A8D72C300F4CE90 /* ActiveAppsWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = D55467C42A8D72C300F4CE90 /* ActiveAppsWidget.swift */; }; D55467C52A8D72C300F4CE90 /* ActiveAppsWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = D55467C42A8D72C300F4CE90 /* ActiveAppsWidget.swift */; };
D561B2EB28EF5A4F006752E4 /* AltSign-Dynamic in Frameworks */ = {isa = PBXBuildFile; productRef = D561B2EA28EF5A4F006752E4 /* AltSign-Dynamic */; }; D561B2EB28EF5A4F006752E4 /* AltSign-Dynamic in Frameworks */ = {isa = PBXBuildFile; productRef = D561B2EA28EF5A4F006752E4 /* AltSign-Dynamic */; };
D561B2ED28EF5A4F006752E4 /* AltSign-Dynamic in Embed Frameworks */ = {isa = PBXBuildFile; productRef = D561B2EA28EF5A4F006752E4 /* AltSign-Dynamic */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; D561B2ED28EF5A4F006752E4 /* AltSign-Dynamic in Embed Frameworks */ = {isa = PBXBuildFile; productRef = D561B2EA28EF5A4F006752E4 /* AltSign-Dynamic */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
D56915062AD5D75B00A2B747 /* Regex+Permissions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D56915052AD5D75B00A2B747 /* Regex+Permissions.swift */; }; D56915072AD5E91B00A2B747 /* Regex+Permissions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D56915052AD5D75B00A2B747 /* Regex+Permissions.swift */; };
D5708417292448DA00D42D34 /* OperatingSystemVersion+Comparable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5708416292448DA00D42D34 /* OperatingSystemVersion+Comparable.swift */; }; D5708417292448DA00D42D34 /* OperatingSystemVersion+Comparable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5708416292448DA00D42D34 /* OperatingSystemVersion+Comparable.swift */; };
D570841A2924680D00D42D34 /* OperatingSystemVersion+Comparable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5708416292448DA00D42D34 /* OperatingSystemVersion+Comparable.swift */; }; D570841A2924680D00D42D34 /* OperatingSystemVersion+Comparable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5708416292448DA00D42D34 /* OperatingSystemVersion+Comparable.swift */; };
D571ADD02A02FC7200B24B63 /* ALTAppPermission.swift in Sources */ = {isa = PBXBuildFile; fileRef = D571ADCF2A02FC7200B24B63 /* ALTAppPermission.swift */; }; D571ADD02A02FC7200B24B63 /* ALTAppPermission.swift in Sources */ = {isa = PBXBuildFile; fileRef = D571ADCF2A02FC7200B24B63 /* ALTAppPermission.swift */; };
@@ -1737,6 +1737,7 @@
D5893F7E2A14183200E767CD /* NSManagedObjectContext+Conveniences.swift */, D5893F7E2A14183200E767CD /* NSManagedObjectContext+Conveniences.swift */,
D52A2F962ACB40F700BDF8E3 /* Logger+AltStore.swift */, D52A2F962ACB40F700BDF8E3 /* Logger+AltStore.swift */,
D5B6F6A82AD75D01007EED5A /* ProcessInfo+Previews.swift */, D5B6F6A82AD75D01007EED5A /* ProcessInfo+Previews.swift */,
D56915052AD5D75B00A2B747 /* Regex+Permissions.swift */,
); );
path = Extensions; path = Extensions;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -3103,6 +3104,7 @@
D5F99A1A28D12B1400476A16 /* StoreApp10ToStoreApp11Policy.swift in Sources */, D5F99A1A28D12B1400476A16 /* StoreApp10ToStoreApp11Policy.swift in Sources */,
D5177B0D2A26944600270065 /* AltStore12ToAltStore13.xcmappingmodel in Sources */, D5177B0D2A26944600270065 /* AltStore12ToAltStore13.xcmappingmodel in Sources */,
BFAECC562501B0A400528F27 /* ALTServerError+Conveniences.swift in Sources */, BFAECC562501B0A400528F27 /* ALTServerError+Conveniences.swift in Sources */,
D56915072AD5E91B00A2B747 /* Regex+Permissions.swift in Sources */,
BFAECC592501B0A400528F27 /* Result+Conveniences.swift in Sources */, BFAECC592501B0A400528F27 /* Result+Conveniences.swift in Sources */,
D571ADD02A02FC7200B24B63 /* ALTAppPermission.swift in Sources */, D571ADD02A02FC7200B24B63 /* ALTAppPermission.swift in Sources */,
D5E3FB9828FDFAD90034B72C /* NSError+AltStore.swift in Sources */, D5E3FB9828FDFAD90034B72C /* NSError+AltStore.swift in Sources */,

View File

@@ -9,7 +9,7 @@
import RegexBuilder import RegexBuilder
@available(iOS 16, *) @available(iOS 16, *)
extension Regex where Output == (Substring, Substring) public extension Regex where Output == (Substring, Substring)
{ {
static var privacyPermission: some RegexComponent<(Substring, Substring)> { static var privacyPermission: some RegexComponent<(Substring, Substring)> {
Regex { Regex {

View File

@@ -230,7 +230,8 @@ internal struct AppPermissions: Decodable
let usageDescription = dictionary[CodingKeys.usageDescription.rawValue] let usageDescription = dictionary[CodingKeys.usageDescription.rawValue]
let permission = AppPermission(permission: name, usageDescription: usageDescription, type: .privacy, context: context) let convertedName = "NS" + name + "UsageDescription" // Convert legacy privacy permissions to their NS[Privacy]UsageDescription equivalent.
let permission = AppPermission(permission: convertedName, usageDescription: usageDescription, type: .privacy, context: context)
return permission return permission
} }

View File

@@ -6,6 +6,8 @@
// Copyright © 2023 Riley Testut. All rights reserved. // Copyright © 2023 Riley Testut. All rights reserved.
// //
import RegexBuilder
import AltSign import AltSign
extension ALTAppPermissionType extension ALTAppPermissionType
@@ -156,5 +158,10 @@ extension ALTAppPrivacyPermission: ALTAppPermission
{ {
public var type: ALTAppPermissionType { .privacy } public var type: ALTAppPermissionType { .privacy }
public var synthesizedName: String? { nil } public var synthesizedName: String? {
guard #available(iOS 16, *), let match = self.rawValue.wholeMatch(of: Regex.privacyPermission) else { return nil }
let synthesizedNamed = String(match.1)
return synthesizedNamed
}
} }

View File

@@ -865,291 +865,291 @@
</dict> </dict>
<key>privacy</key> <key>privacy</key>
<dict> <dict>
<key>BluetoothAlways</key> <key>NSBluetoothAlwaysUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Bluetooth</string> <string>Bluetooth</string>
<key>key</key> <key>key</key>
<string>BluetoothAlways</string> <string>NSBluetoothAlwaysUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>antenna.radiowaves.left.and.right</string> <string>antenna.radiowaves.left.and.right</string>
</dict> </dict>
<key>BluetoothPeripheral</key> <key>NSBluetoothPeripheralUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Bluetooth (Peripherals)</string> <string>Bluetooth (Peripherals)</string>
<key>key</key> <key>key</key>
<string>BluetoothPeripheral</string> <string>NSBluetoothPeripheralUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>antenna.radiowaves.left.and.right</string> <string>antenna.radiowaves.left.and.right</string>
</dict> </dict>
<key>Calendars</key> <key>NSCalendarsUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Calendars</string> <string>Calendars</string>
<key>key</key> <key>key</key>
<string>Calendars</string> <string>NSCalendarsUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>calendar</string> <string>calendar</string>
</dict> </dict>
<key>Reminders</key> <key>NSRemindersUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Reminders</string> <string>Reminders</string>
<key>key</key> <key>key</key>
<string>Reminders</string> <string>NSRemindersUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>note.text</string> <string>note.text</string>
</dict> </dict>
<key>Camera</key> <key>NSCameraUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Camera</string> <string>Camera</string>
<key>key</key> <key>key</key>
<string>Camera</string> <string>NSCameraUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>camera</string> <string>camera</string>
</dict> </dict>
<key>Microphone</key> <key>NSMicrophoneUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Microphone</string> <string>Microphone</string>
<key>key</key> <key>key</key>
<string>Microphone</string> <string>NSMicrophoneUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>mic</string> <string>mic</string>
</dict> </dict>
<key>Contacts</key> <key>NSContactsUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Contacts</string> <string>Contacts</string>
<key>key</key> <key>key</key>
<string>Contacts</string> <string>NSContactsUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>person.crop.circle</string> <string>person.crop.circle</string>
</dict> </dict>
<key>FaceID</key> <key>NSFaceIDUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Face ID</string> <string>Face ID</string>
<key>key</key> <key>key</key>
<string>FaceID</string> <string>NSFaceIDUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>faceid</string> <string>faceid</string>
</dict> </dict>
<key>GKFriendList</key> <key>NSGKFriendListUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Game Center Friends List</string> <string>Game Center Friends List</string>
<key>key</key> <key>key</key>
<string>GKFriendList</string> <string>NSGKFriendListUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>gamecontroller</string> <string>gamecontroller</string>
</dict> </dict>
<key>HealthClinicalHealthRecordsShare</key> <key>NSHealthClinicalHealthRecordsShareUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Health (Clinical Records)</string> <string>Health (Clinical Records)</string>
<key>key</key> <key>key</key>
<string>HealthClinicalHealthRecordsShare</string> <string>NSHealthClinicalHealthRecordsShareUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>heart.text.square</string> <string>heart.text.square</string>
</dict> </dict>
<key>HealthShare</key> <key>NSHealthShareUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Health</string> <string>Health</string>
<key>key</key> <key>key</key>
<string>HealthShare</string> <string>NSHealthShareUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>heart.text.square</string> <string>heart.text.square</string>
</dict> </dict>
<key>HealthUpdate</key> <key>NSHealthUpdateUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Health (Add)</string> <string>Health (Add)</string>
<key>key</key> <key>key</key>
<string>HealthUpdate</string> <string>NSHealthUpdateUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>heart.text.square</string> <string>heart.text.square</string>
</dict> </dict>
<key>HomeKit</key> <key>NSHomeKitUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>HomeKit</string> <string>HomeKit</string>
<key>key</key> <key>key</key>
<string>HomeKit</string> <string>NSHomeKitUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>homekit</string> <string>homekit</string>
</dict> </dict>
<key>LocationAlways</key> <key>NSLocationAlwaysUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Location (Background)</string> <string>Location (Background)</string>
<key>key</key> <key>key</key>
<string>LocationAlways</string> <string>NSLocationAlwaysUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>location.fill</string> <string>location.fill</string>
</dict> </dict>
<key>LocationAlwaysAndWhenInUse</key> <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Location (Always)</string> <string>Location (Always)</string>
<key>key</key> <key>key</key>
<string>LocationAlwaysAndWhenInUse</string> <string>NSLocationAlwaysAndWhenInUseUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>location.fill</string> <string>location.fill</string>
</dict> </dict>
<key>Location</key> <key>NSLocationUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Location</string> <string>Location</string>
<key>key</key> <key>key</key>
<string>Location</string> <string>NSLocationUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>location.fill</string> <string>location.fill</string>
</dict> </dict>
<key>LocationWhenInUse</key> <key>NSLocationWhenInUseUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Location (When Using)</string> <string>Location (When Using)</string>
<key>key</key> <key>key</key>
<string>LocationWhenInUse</string> <string>NSLocationWhenInUseUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>location</string> <string>location</string>
</dict> </dict>
<key>LocationTemporary</key> <key>NSLocationTemporaryUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Location (Temporary)</string> <string>Location (Temporary)</string>
<key>key</key> <key>key</key>
<string>LocationTemporary</string> <string>NSLocationTemporaryUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>location</string> <string>location</string>
</dict> </dict>
<key>AppleMusic</key> <key>NSAppleMusicUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Apple Music</string> <string>Apple Music</string>
<key>key</key> <key>key</key>
<string>AppleMusic</string> <string>NSAppleMusicUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>music.note</string> <string>music.note</string>
</dict> </dict>
<key>Motion</key> <key>NSMotionUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Motion</string> <string>Motion</string>
<key>key</key> <key>key</key>
<string>Motion</string> <string>NSMotionUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>figure.run</string> <string>figure.run</string>
</dict> </dict>
<key>FallDetection</key> <key>NSFallDetectionUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Fall Detection</string> <string>Fall Detection</string>
<key>key</key> <key>key</key>
<string>FallDetection</string> <string>NSFallDetectionUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>figure.fall</string> <string>figure.fall</string>
</dict> </dict>
<key>LocalNetwork</key> <key>NSLocalNetworkUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Local Network</string> <string>Local Network</string>
<key>key</key> <key>key</key>
<string>LocalNetwork</string> <string>NSLocalNetworkUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>network</string> <string>network</string>
</dict> </dict>
<key>NearbyInteraction</key> <key>NSNearbyInteractionUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Nearby Interaction</string> <string>Nearby Interaction</string>
<key>key</key> <key>key</key>
<string>NearbyInteraction</string> <string>NSNearbyInteractionUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>dot.radiowaves.left.and.right</string> <string>dot.radiowaves.left.and.right</string>
</dict> </dict>
<key>NearbyInteractionAllowOnce</key> <key>NSNearbyInteractionAllowOnceUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Nearby Interaction (Once)</string> <string>Nearby Interaction (Once)</string>
<key>key</key> <key>key</key>
<string>NearbyInteractionAllowOnce</string> <string>NSNearbyInteractionAllowOnceUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>dot.radiowaves.left.and.right</string> <string>dot.radiowaves.left.and.right</string>
</dict> </dict>
<key>NFCReader</key> <key>NFCReaderUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>NFC</string> <string>NFC</string>
<key>key</key> <key>key</key>
<string>NFCReader</string> <string>NSNFCReaderUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>sensor.tag.radiowaves.forward</string> <string>sensor.tag.radiowaves.forward</string>
</dict> </dict>
<key>PhotoLibraryAdd</key> <key>NSPhotoLibraryAddUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Photos (Add)</string> <string>Photos (Add)</string>
<key>key</key> <key>key</key>
<string>PhotoLibraryAdd</string> <string>NSPhotoLibraryAddUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>photo</string> <string>photo</string>
</dict> </dict>
<key>PhotoLibrary</key> <key>NSPhotoLibraryUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Photos</string> <string>Photos</string>
<key>key</key> <key>key</key>
<string>PhotoLibrary</string> <string>NSPhotoLibraryUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>photo.stack</string> <string>photo.stack</string>
</dict> </dict>
<key>UserTracking</key> <key>NSUserTrackingUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>User Tracking</string> <string>User Tracking</string>
<key>key</key> <key>key</key>
<string>UserTracking</string> <string>NSUserTrackingUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>location.magnifyingglass</string> <string>location.magnifyingglass</string>
</dict> </dict>
<key>SensorKit</key> <key>NSSensorKitUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>SensorKit</string> <string>SensorKit</string>
<key>key</key> <key>key</key>
<string>SensorKit</string> <string>NSSensorKitUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>sensor</string> <string>sensor</string>
</dict> </dict>
<key>Siri</key> <key>NSSiriUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Siri</string> <string>Siri</string>
<key>key</key> <key>key</key>
<string>Siri</string> <string>NSSiriUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>mic.circle</string> <string>mic.circle</string>
</dict> </dict>
<key>SpeechRecognition</key> <key>NSSpeechRecognitionUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>Speech Recognition</string> <string>Speech Recognition</string>
<key>key</key> <key>key</key>
<string>SpeechRecognition</string> <string>NSSpeechRecognitionUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>waveform.and.mic</string> <string>waveform.and.mic</string>
</dict> </dict>
<key>Identity</key> <key>NSIdentityUsageDescription</key>
<dict> <dict>
<key>name</key> <key>name</key>
<string>ID Cards</string> <string>ID Cards</string>
<key>key</key> <key>key</key>
<string>Identity</string> <string>NSIdentityUsageDescription</string>
<key>symbol</key> <key>symbol</key>
<string>wallet.pass</string> <string>wallet.pass</string>
</dict> </dict>