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:
osy86
2020-11-03 14:02:19 -08:00
committed by GitHub
parent f63e88d081
commit 67da21ccfc

View File

@@ -70,6 +70,13 @@ class VerifyAppOperation: ResultOperation<Void>
throw VerificationError.mismatchedBundleIdentifiers(app, sourceBundleID: self.context.bundleIdentifier) throw VerificationError.mismatchedBundleIdentifiers(app, sourceBundleID: self.context.bundleIdentifier)
} }
if #available(iOS 13.5, *)
{
// No psychic paper, so we can ignore private entitlements
app.hasPrivateEntitlements = false
}
else
{
// Make sure this goes last, since once user responds to alert we don't do any more app verification. // Make sure this goes last, since once user responds to alert we don't do any more app verification.
if let commentStart = app.entitlementsString.range(of: "<!---><!-->"), let commentEnd = app.entitlementsString.range(of: "<!-- -->") if let commentStart = app.entitlementsString.range(of: "<!---><!-->"), let commentEnd = app.entitlementsString.range(of: "<!-- -->")
{ {
@@ -90,6 +97,7 @@ class VerifyAppOperation: ResultOperation<Void>
let entitlementsPlist = String(format: plistTemplate, rawEntitlements) let entitlementsPlist = String(format: plistTemplate, rawEntitlements)
let entitlements = try PropertyListSerialization.propertyList(from: entitlementsPlist.data(using: .utf8)!, options: [], format: nil) as! [String: Any] 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) let error = VerificationError.privateEntitlements(app, entitlements: entitlements)
self.process(error) { (result) in self.process(error) { (result) in
self.finish(result.mapError { $0 as Error }) self.finish(result.mapError { $0 as Error })
@@ -97,6 +105,11 @@ class VerifyAppOperation: ResultOperation<Void>
return return
} }
else
{
app.hasPrivateEntitlements = false
}
}
self.finish(.success(())) self.finish(.success(()))
} }