mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-10 07:13:28 +01:00
Apple's Info.plist support platform and device specific keys to augment existing keys. For example `UISupportedInterfaceOrientations~ipad` replaces `UISupportedInterfaceOrientations` when running on an iPad. By using Bundle.infoDictionary, Apple will pre-process the Info.plist and replace any key with its device specific variant. Since AltStore does not support iPad, this will strip out any iPad specific keys for the installing app. We add an extension Bundle.completeInfoDictionary that will return the original de-serialized dictionary including all the device specific keys. See: https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html#//apple_ref/doc/uid/TP40009254-SW9 # Conflicts: # AltKit/Extensions/Bundle+AltStore.swift # AltStore/Model/DatabaseManager.swift
59 lines
1.6 KiB
Swift
59 lines
1.6 KiB
Swift
//
|
|
// Bundle+AltStore.swift
|
|
// AltStore
|
|
//
|
|
// Created by Riley Testut on 5/30/19.
|
|
// Copyright © 2019 Riley Testut. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public extension Bundle
|
|
{
|
|
struct Info
|
|
{
|
|
public static let deviceID = "ALTDeviceID"
|
|
public static let serverID = "ALTServerID"
|
|
public static let certificateID = "ALTCertificateID"
|
|
public static let appGroups = "ALTAppGroups"
|
|
public static let altBundleID = "ALTBundleIdentifier"
|
|
|
|
public static let urlTypes = "CFBundleURLTypes"
|
|
public static let exportedUTIs = "UTExportedTypeDeclarations"
|
|
}
|
|
}
|
|
|
|
public extension Bundle
|
|
{
|
|
static var baseAltStoreAppGroupID = "group.com.rileytestut.AltStore"
|
|
|
|
var infoPlistURL: URL {
|
|
let infoPlistURL = self.bundleURL.appendingPathComponent("Info.plist")
|
|
return infoPlistURL
|
|
}
|
|
|
|
var provisioningProfileURL: URL {
|
|
let infoPlistURL = self.bundleURL.appendingPathComponent("embedded.mobileprovision")
|
|
return infoPlistURL
|
|
}
|
|
|
|
var certificateURL: URL {
|
|
let infoPlistURL = self.bundleURL.appendingPathComponent("ALTCertificate.p12")
|
|
return infoPlistURL
|
|
}
|
|
|
|
var appGroups: [String] {
|
|
return self.infoDictionary?[Bundle.Info.appGroups] as? [String] ?? []
|
|
}
|
|
|
|
var altstoreAppGroup: String? {
|
|
let appGroup = self.appGroups.first { $0.contains(Bundle.baseAltStoreAppGroupID) }
|
|
return appGroup
|
|
}
|
|
|
|
var completeInfoDictionary: [String : Any]? {
|
|
let infoPlistURL = self.infoPlistURL
|
|
return NSDictionary(contentsOf: infoPlistURL) as? [String : Any]
|
|
}
|
|
}
|