objc2-store-kit 0.3.2

Bindings to the StoreKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/storekit/skpaymentqueue?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated = "No longer supported"]
    pub struct SKPaymentQueue;
);

unsafe impl Send for SKPaymentQueue {}

unsafe impl Sync for SKPaymentQueue {}

extern_conformance!(
    unsafe impl NSObjectProtocol for SKPaymentQueue {}
);

impl SKPaymentQueue {
    extern_methods!(
        #[deprecated = "No longer supported"]
        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn SKPaymentQueueDelegate>>>;

        /// Setter for [`delegate`][Self::delegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[deprecated = "No longer supported"]
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn SKPaymentQueueDelegate>>,
        );

        #[cfg(feature = "SKStorefront")]
        #[deprecated = "Use Storefront.current"]
        #[unsafe(method(storefront))]
        #[unsafe(method_family = none)]
        pub unsafe fn storefront(&self) -> Option<Retained<SKStorefront>>;

        #[deprecated = "No longer supported"]
        #[unsafe(method(defaultQueue))]
        #[unsafe(method_family = none)]
        pub unsafe fn defaultQueue() -> Retained<Self>;

        #[deprecated = "Use AppStore.canMakePayments"]
        #[unsafe(method(canMakePayments))]
        #[unsafe(method_family = none)]
        pub unsafe fn canMakePayments() -> bool;

        #[cfg(feature = "SKPayment")]
        #[deprecated = "Use Product.purchase(confirmIn:options:)"]
        #[unsafe(method(addPayment:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addPayment(&self, payment: &SKPayment);

        #[deprecated = "Use AppStore.sync()"]
        #[unsafe(method(restoreCompletedTransactions))]
        #[unsafe(method_family = none)]
        pub unsafe fn restoreCompletedTransactions(&self);

        #[deprecated = "Use AppStore.sync()"]
        #[unsafe(method(restoreCompletedTransactionsWithApplicationUsername:))]
        #[unsafe(method_family = none)]
        pub unsafe fn restoreCompletedTransactionsWithApplicationUsername(
            &self,
            username: Option<&NSString>,
        );

        #[cfg(feature = "SKPaymentTransaction")]
        #[deprecated = "Use Transaction.finish()"]
        #[unsafe(method(finishTransaction:))]
        #[unsafe(method_family = none)]
        pub unsafe fn finishTransaction(&self, transaction: &SKPaymentTransaction);

        #[cfg(feature = "SKDownload")]
        #[deprecated = "Hosted content is no longer supported"]
        #[unsafe(method(startDownloads:))]
        #[unsafe(method_family = none)]
        pub unsafe fn startDownloads(&self, downloads: &NSArray<SKDownload>);

        #[cfg(feature = "SKDownload")]
        #[deprecated = "Hosted content is no longer supported"]
        #[unsafe(method(pauseDownloads:))]
        #[unsafe(method_family = none)]
        pub unsafe fn pauseDownloads(&self, downloads: &NSArray<SKDownload>);

        #[cfg(feature = "SKDownload")]
        #[deprecated = "Hosted content is no longer supported"]
        #[unsafe(method(resumeDownloads:))]
        #[unsafe(method_family = none)]
        pub unsafe fn resumeDownloads(&self, downloads: &NSArray<SKDownload>);

        #[cfg(feature = "SKDownload")]
        #[deprecated = "Hosted content is no longer supported"]
        #[unsafe(method(cancelDownloads:))]
        #[unsafe(method_family = none)]
        pub unsafe fn cancelDownloads(&self, downloads: &NSArray<SKDownload>);

        #[deprecated = "Use Transaction.updates or PurchaseResult from Product.purchase(confirmIn:options:)"]
        #[unsafe(method(addTransactionObserver:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addTransactionObserver(
            &self,
            observer: &ProtocolObject<dyn SKPaymentTransactionObserver>,
        );

        #[deprecated = "No longer supported"]
        #[unsafe(method(removeTransactionObserver:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeTransactionObserver(
            &self,
            observer: &ProtocolObject<dyn SKPaymentTransactionObserver>,
        );

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Use Transaction.updates or PurchaseResult from Product.purchase(confirmIn:options:)"]
        #[unsafe(method(transactionObservers))]
        #[unsafe(method_family = none)]
        pub unsafe fn transactionObservers(
            &self,
        ) -> Retained<NSArray<ProtocolObject<dyn SKPaymentTransactionObserver>>>;

        #[cfg(feature = "SKPaymentTransaction")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Use Transaction.unfinished"]
        #[unsafe(method(transactions))]
        #[unsafe(method_family = none)]
        pub unsafe fn transactions(&self) -> Retained<NSArray<SKPaymentTransaction>>;

        #[deprecated = "Use Message.messages and Message.display(in:)"]
        #[unsafe(method(showPriceConsentIfNeeded))]
        #[unsafe(method_family = none)]
        pub unsafe fn showPriceConsentIfNeeded(&self);

        #[deprecated = "Use AppStore.presentOfferCodeRedeemSheet(in:)"]
        #[unsafe(method(presentCodeRedemptionSheet))]
        #[unsafe(method_family = none)]
        pub unsafe fn presentCodeRedemptionSheet(&self);
    );
}

/// Methods declared on superclass `NSObject`.
impl SKPaymentQueue {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/storekit/skpaymentqueuedelegate?language=objc)
    #[deprecated = "No longer supported"]
    pub unsafe trait SKPaymentQueueDelegate: NSObjectProtocol {
        #[cfg(all(feature = "SKPaymentTransaction", feature = "SKStorefront"))]
        #[deprecated = "Pass Product.PurchaseOption.onStorefrontChange(shouldContinuePurchase:) to product.purchase(options:)"]
        #[optional]
        #[unsafe(method(paymentQueue:shouldContinueTransaction:inStorefront:))]
        #[unsafe(method_family = none)]
        unsafe fn paymentQueue_shouldContinueTransaction_inStorefront(
            &self,
            payment_queue: &SKPaymentQueue,
            transaction: &SKPaymentTransaction,
            new_storefront: &SKStorefront,
        ) -> bool;

        #[deprecated = "Use Message.messages and Message.display(in:)"]
        #[optional]
        #[unsafe(method(paymentQueueShouldShowPriceConsent:))]
        #[unsafe(method_family = none)]
        unsafe fn paymentQueueShouldShowPriceConsent(&self, payment_queue: &SKPaymentQueue)
            -> bool;
    }
);

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/storekit/skpaymenttransactionobserver?language=objc)
    #[deprecated = "Use StoreKit 2 Transaction APIs"]
    pub unsafe trait SKPaymentTransactionObserver: NSObjectProtocol {
        #[cfg(feature = "SKPaymentTransaction")]
        #[deprecated = "Use StoreKit 2 Transaction APIs"]
        #[unsafe(method(paymentQueue:updatedTransactions:))]
        #[unsafe(method_family = none)]
        unsafe fn paymentQueue_updatedTransactions(
            &self,
            queue: &SKPaymentQueue,
            transactions: &NSArray<SKPaymentTransaction>,
        );

        #[cfg(feature = "SKPaymentTransaction")]
        #[deprecated = "Use StoreKit 2 Transaction APIs"]
        #[optional]
        #[unsafe(method(paymentQueue:removedTransactions:))]
        #[unsafe(method_family = none)]
        unsafe fn paymentQueue_removedTransactions(
            &self,
            queue: &SKPaymentQueue,
            transactions: &NSArray<SKPaymentTransaction>,
        );

        #[deprecated = "Use AppStore.sync()"]
        #[optional]
        #[unsafe(method(paymentQueue:restoreCompletedTransactionsFailedWithError:))]
        #[unsafe(method_family = none)]
        unsafe fn paymentQueue_restoreCompletedTransactionsFailedWithError(
            &self,
            queue: &SKPaymentQueue,
            error: &NSError,
        );

        #[deprecated = "Use AppStore.sync()"]
        #[optional]
        #[unsafe(method(paymentQueueRestoreCompletedTransactionsFinished:))]
        #[unsafe(method_family = none)]
        unsafe fn paymentQueueRestoreCompletedTransactionsFinished(&self, queue: &SKPaymentQueue);

        #[cfg(feature = "SKDownload")]
        #[deprecated = "Hosted content is no longer supported"]
        #[optional]
        #[unsafe(method(paymentQueue:updatedDownloads:))]
        #[unsafe(method_family = none)]
        unsafe fn paymentQueue_updatedDownloads(
            &self,
            queue: &SKPaymentQueue,
            downloads: &NSArray<SKDownload>,
        );

        #[cfg(all(feature = "SKPayment", feature = "SKProduct"))]
        #[deprecated = "Use PurchaseIntent.intents"]
        #[optional]
        #[unsafe(method(paymentQueue:shouldAddStorePayment:forProduct:))]
        #[unsafe(method_family = none)]
        unsafe fn paymentQueue_shouldAddStorePayment_forProduct(
            &self,
            queue: &SKPaymentQueue,
            payment: &SKPayment,
            product: &SKProduct,
        ) -> bool;

        #[deprecated = "Use Storefront.updates"]
        #[optional]
        #[unsafe(method(paymentQueueDidChangeStorefront:))]
        #[unsafe(method_family = none)]
        unsafe fn paymentQueueDidChangeStorefront(&self, queue: &SKPaymentQueue);

        #[deprecated = "Use Transaction.updates"]
        #[optional]
        #[unsafe(method(paymentQueue:didRevokeEntitlementsForProductIdentifiers:))]
        #[unsafe(method_family = none)]
        unsafe fn paymentQueue_didRevokeEntitlementsForProductIdentifiers(
            &self,
            queue: &SKPaymentQueue,
            product_identifiers: &NSArray<NSString>,
        );
    }
);