Don't show add account option for CloudKit when the entitlement isn't present.

This commit is contained in:
Maurice Parker 2020-03-25 16:09:01 -05:00
parent 25882f69c8
commit 53b00c5414
3 changed files with 20 additions and 2 deletions

View File

@ -160,9 +160,23 @@ extension AccountsAddViewController: OAuthAccountAuthorizationOperationDelegate
// MARK: Private
private extension AccountsAddViewController {
func removeCloudKitIfNecessary() {
if let index = AccountManager.shared.activeAccounts.firstIndex(where: { $0.type == .cloudKit }) {
addableAccountTypes.remove(at: index)
func removeCloudKit() {
if let cloudKitIndex = addableAccountTypes.firstIndex(of: .cloudKit) {
addableAccountTypes.remove(at: cloudKitIndex)
}
}
if AccountManager.shared.activeAccounts.firstIndex(where: { $0.type == .cloudKit }) != nil {
removeCloudKit()
return
}
// We don't want developers without entitlements to be trying to add the CloudKit account
if let dev = Bundle.main.object(forInfoDictionaryKey: "DeveloperEntitlements") as? String, dev == "-dev" {
removeCloudKit()
}
}
}

View File

@ -67,5 +67,7 @@
<string>NetNewsWire (RSS Reader; https://ranchero.com/netnewswire/)</string>
<key>OrganizationIdentifier</key>
<string>$(ORGANIZATION_IDENTIFIER)</string>
<key>DeveloperEntitlements</key>
<string>$(DEVELOPER_ENTITLEMENTS)</string>
</dict>
</plist>

View File

@ -4,6 +4,8 @@
<dict>
<key>OrganizationIdentifier</key>
<string>$(ORGANIZATION_IDENTIFIER)</string>
<key>DeveloperEntitlements</key>
<string>$(DEVELOPER_ENTITLEMENTS)</string>
<key>AppGroup</key>
<string>group.$(ORGANIZATION_IDENTIFIER).NetNewsWire.iOS</string>
<key>AppIdentifierPrefix</key>