Esempio n. 1
0
        void IStoreListener.OnInitialized(IStoreController controller, IExtensionProvider extensions)
        {
            storeController = controller;
            apple           = extensions.GetExtension <IAppleExtensions>();
            initStatus      = InitStatus.Ok;

            // Notify callback for when purchases are deferred to a parent.
            if (deferPurchaseCompatible)
            {
                apple.RegisterPurchaseDeferredListener(product => {
                    DebugLog("Purchase request deferred to parent.");
                    OnPurchaseDeferred?.Invoke(product);
                });
            }

            if (promotionalPurchaseCompatible)
            {
                foreach (var item in controller.products.all)
                {
                    if (item.availableToPurchase)
                    {
                        // Set all these products to be visible in the user's App Store
                        apple.SetStorePromotionVisibility(item, AppleStorePromotionVisibility.Show);
                    }
                }
            }

            DebugLog("IAP Manager successfully initialized");

            onInitDone?.Invoke(initStatus);
            onInitDone = null;
        }
Esempio n. 2
0
        void IStoreListener.OnInitialized(IStoreController controller, IExtensionProvider extensions)
        {
            DebugLog("IAP Manager successfully initialized");

            storeController = controller;
            googlePlay      = extensions.GetExtension <Google.Play.Billing.IGooglePlayStoreExtensions>();

            if (deferPurchaseCompatible)
            {
                // enable deferred purchases
                IPurchasingModule googlePlayModule = Google.Play.Billing.GooglePlayStoreModule.Instance();
                var configurationBuilder           = ConfigurationBuilder.Instance(googlePlayModule);
                configurationBuilder.Configure <Google.Play.Billing.IGooglePlayConfiguration>().EnableDeferredPurchase();

                // Notify callback for when purchases are deferred to a parent.
                googlePlay.SetDeferredPurchaseListener(product => {
                    DebugLog("Purchase request deferred to parent.");
                    OnPurchaseDeferred?.Invoke(product);
                });
            }

            initStatus = InitStatus.Ok;

            onInitDone?.Invoke(initStatus);
            onInitDone = null;
        }