Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added promo offer logic #233

Merged
merged 2 commits into from
Nov 15, 2024
Merged

Added promo offer logic #233

merged 2 commits into from
Nov 15, 2024

Conversation

suriksarkisyan
Copy link
Collaborator

No description provided.

Comment on lines 93 to 108
var purchaseOptions = Qonversion.PurchaseOptions(quantity: quantity, contextKeys: contextKeys)

if #available(iOS 12.2, macOS 10.14.4, watchOS 6.2, tvOS 12.2, visionOS 1.0, *),
let productDiscountId = promoOffer["productDiscountId"] as? String,
let productDiscount = product.skProduct?.discounts.first(where: { $0.identifier == productDiscountId }),
let keyIdentifier = promoOffer["keyIdentifier"] as? String,
let nonce = promoOffer["nonce"] as? String,
let nonceUUID = UUID(uuidString: nonce),
let signature = promoOffer["signature"] as? String,
let timestamp = promoOffer["timestamp"] as? Int {
let timestampNumber = NSNumber(value: timestamp)
let paymentDiscount = SKPaymentDiscount(identifier: productDiscountId, keyIdentifier: keyIdentifier, nonce: nonceUUID, signature: signature, timestamp: timestampNumber)

let promotionalOffer = Qonversion.PromotionalOffer(productDiscount: productDiscount, paymentDiscount: paymentDiscount)
purchaseOptions = Qonversion.PurchaseOptions(quantity: purchaseOptions.quantity, contextKeys: purchaseOptions.contextKeys, promoOffer: promotionalOffer)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets move basic initialization to else branch

@suriksarkisyan suriksarkisyan merged commit 3f82c7f into develop Nov 15, 2024
1 check passed
@suriksarkisyan suriksarkisyan deleted the feature/promoOffer branch November 15, 2024 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants