enable onscreen widget for pencil pro pack
This commit is contained in:
1 parent
85df511a23
commit
04845df09c
1 file changed
+20
@@ -220,6 +220,7 @@ import StoreKit
|
|||||||
self.delegate?.iapManagerDidPurchase(product)
|
self.delegate?.iapManagerDidPurchase(product)
|
||||||
}
|
}
|
||||||
await transaction.finish()
|
await transaction.finish()
|
||||||
|
IAPManager.handlePurchaseSuccess(product)
|
||||||
NotificationCenter.default.post(name: product.purchaseSucceededNotification(), object: nil)
|
NotificationCenter.default.post(name: product.purchaseSucceededNotification(), object: nil)
|
||||||
case .unverified(_, let err):
|
case .unverified(_, let err):
|
||||||
NotificationCenter.default.post(name: product.purchaseAbortedNotification(), object: PurchaseInterruption.unlockNow, userInfo:["interruption": PurchaseInterruption.unlockNow.rawValue])
|
NotificationCenter.default.post(name: product.purchaseAbortedNotification(), object: PurchaseInterruption.unlockNow, userInfo:["interruption": PurchaseInterruption.unlockNow.rawValue])
|
||||||
@@ -242,6 +243,25 @@ import StoreKit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc static func handlePurchaseSuccess(_ product: AddOnProduct) {
|
||||||
|
switch product {
|
||||||
|
case .PencilProPack:
|
||||||
|
let dataMan = DataManager()
|
||||||
|
let settings = dataMan.retrieveSettings()
|
||||||
|
settings?.onscreenControls = 1
|
||||||
|
dataMan.saveData()
|
||||||
|
let profileMan = OSCProfilesManager.sharedManager(.zero)
|
||||||
|
let profiles = profileMan.getAllProfiles()
|
||||||
|
guard profiles.count > 1 else { break }
|
||||||
|
guard let targetProfile = profiles[1] as? OSCProfile else { break }
|
||||||
|
if targetProfile.name == "Pencil Pro" {
|
||||||
|
profileMan.setProfileToSelected(1)
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private func purchaseLegacy(_ product: AddOnProduct) {
|
private func purchaseLegacy(_ product: AddOnProduct) {
|
||||||
let productId = product.productId()
|
let productId = product.productId()
|
||||||
print("products \(skProducts.count)")
|
print("products \(skProducts.count)")
|
||||||
|
|||||||
Reference in new issue
Block a user