mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-08 22:33:26 +01:00
45 lines
1.1 KiB
Swift
45 lines
1.1 KiB
Swift
//
|
|
// AppPermissionProtocol.swift
|
|
// AltStore
|
|
//
|
|
// Created by Riley Testut on 5/23/23.
|
|
// Copyright © 2023 Riley Testut. All rights reserved.
|
|
//
|
|
|
|
import AltStoreCore
|
|
|
|
@dynamicMemberLookup
|
|
protocol AppPermissionProtocol: Hashable
|
|
{
|
|
var permission: any ALTAppPermission { get }
|
|
var usageDescription: String? { get }
|
|
|
|
subscript<T>(dynamicMember dynamicMember: KeyPath<any ALTAppPermission, T>) -> T { get }
|
|
}
|
|
|
|
extension AppPermission: AppPermissionProtocol {}
|
|
|
|
struct PreviewAppPermission: AppPermissionProtocol
|
|
{
|
|
var permission: any ALTAppPermission
|
|
var usageDescription: String? { "Allows Delta to use images from your Photo Library as game artwork." }
|
|
|
|
subscript<T>(dynamicMember dynamicMember: KeyPath<any ALTAppPermission, T>) -> T
|
|
{
|
|
return self.permission[keyPath: dynamicMember]
|
|
}
|
|
}
|
|
|
|
extension PreviewAppPermission
|
|
{
|
|
static func ==(lhs: PreviewAppPermission, rhs: PreviewAppPermission) -> Bool
|
|
{
|
|
return lhs.permission.isEqual(rhs.permission)
|
|
}
|
|
|
|
func hash(into hasher: inout Hasher)
|
|
{
|
|
hasher.combine(self.permission)
|
|
}
|
|
}
|