mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-19 11:43:24 +01:00
Hide private entitlements on >= iOS 13.5 (#415)
iOS 13.5 fixes the psychic paper hack so showing the private entitlement warning popup is confusing to the user. Additionally iOS 14 checks the entitlements on installation, so we should not copy the private entitlements on iOS 14. Depends on https://github.com/rileytestut/AltSign/pull/15 Co-authored-by: osy <osy86@users.noreply.github.com>
This commit is contained in:
@@ -70,32 +70,45 @@ class VerifyAppOperation: ResultOperation<Void>
|
|||||||
throw VerificationError.mismatchedBundleIdentifiers(app, sourceBundleID: self.context.bundleIdentifier)
|
throw VerificationError.mismatchedBundleIdentifiers(app, sourceBundleID: self.context.bundleIdentifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure this goes last, since once user responds to alert we don't do any more app verification.
|
if #available(iOS 13.5, *)
|
||||||
if let commentStart = app.entitlementsString.range(of: "<!---><!-->"), let commentEnd = app.entitlementsString.range(of: "<!-- -->")
|
|
||||||
{
|
{
|
||||||
// Psychic Paper private entitlements.
|
// No psychic paper, so we can ignore private entitlements
|
||||||
|
app.hasPrivateEntitlements = false
|
||||||
let entitlementsStart = app.entitlementsString.index(after: commentStart.upperBound)
|
}
|
||||||
let rawEntitlements = String(app.entitlementsString[entitlementsStart ..< commentEnd.lowerBound])
|
else
|
||||||
|
{
|
||||||
let plistTemplate = """
|
// Make sure this goes last, since once user responds to alert we don't do any more app verification.
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
if let commentStart = app.entitlementsString.range(of: "<!---><!-->"), let commentEnd = app.entitlementsString.range(of: "<!-- -->")
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
{
|
||||||
<plist version="1.0">
|
// Psychic Paper private entitlements.
|
||||||
<dict>
|
|
||||||
%@
|
let entitlementsStart = app.entitlementsString.index(after: commentStart.upperBound)
|
||||||
</dict>
|
let rawEntitlements = String(app.entitlementsString[entitlementsStart ..< commentEnd.lowerBound])
|
||||||
</plist>
|
|
||||||
"""
|
let plistTemplate = """
|
||||||
let entitlementsPlist = String(format: plistTemplate, rawEntitlements)
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
let entitlements = try PropertyListSerialization.propertyList(from: entitlementsPlist.data(using: .utf8)!, options: [], format: nil) as! [String: Any]
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
let error = VerificationError.privateEntitlements(app, entitlements: entitlements)
|
<dict>
|
||||||
self.process(error) { (result) in
|
%@
|
||||||
self.finish(result.mapError { $0 as Error })
|
</dict>
|
||||||
|
</plist>
|
||||||
|
"""
|
||||||
|
let entitlementsPlist = String(format: plistTemplate, rawEntitlements)
|
||||||
|
let entitlements = try PropertyListSerialization.propertyList(from: entitlementsPlist.data(using: .utf8)!, options: [], format: nil) as! [String: Any]
|
||||||
|
|
||||||
|
app.hasPrivateEntitlements = true
|
||||||
|
let error = VerificationError.privateEntitlements(app, entitlements: entitlements)
|
||||||
|
self.process(error) { (result) in
|
||||||
|
self.finish(result.mapError { $0 as Error })
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
app.hasPrivateEntitlements = false
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.finish(.success(()))
|
self.finish(.success(()))
|
||||||
|
|||||||
Reference in New Issue
Block a user