Exemplo n.º 1
0
        public static void BuyVotesPack(VotesPack votesPack, BalanceTopupSource source, Action successCallback = null, Action errorCallback = null)
        {
            FullscreenLoader loader = new FullscreenLoader();

            loader.Show(null, true);
            EventAggregator.Current.Publish((object)new BalanceTopupEvent(source, BalanceTopupAction.purchase_click));
            StoreService.Instance.PurchaseVotesPack(votesPack, (Action)(() =>
            {
                EventAggregator.Current.Publish((object)new BalanceTopupEvent(source, BalanceTopupAction.success));
                StorePurchaseManager.UpdateBalanceData((Action)(() =>
                {
                    loader.Hide(false);
                    Action action = successCallback;
                    if (action == null)
                    {
                        return;
                    }
                    action();
                }));
            }), (Action <BackendResult <StorePurchaseResult, ResultCode> >)(result =>
            {
                loader.HiddenCallback = (Action <FullscreenLoaderHiddenEventArgs>)(args => StorePurchaseManager.HandleStorePurchaseError(result, errorCallback));
                loader.Hide(false);
            }), (Action)(() => loader.Hide(false)));
        }
Exemplo n.º 2
0
        public static void RestorePurchases(string productId = null)
        {
            FullscreenLoader loader = new FullscreenLoader();

            loader.Show(null, true);
            StoreService.Instance.RestorePurchases(productId, (Action)(() => StorePurchaseManager.UpdateBalanceData((Action)(() => loader.Hide(false)))), (Action <BackendResult <StorePurchaseResult, ResultCode> >)(result =>
            {
                loader.HiddenCallback = (Action <FullscreenLoaderHiddenEventArgs>)(args => StorePurchaseManager.HandleStorePurchaseError(result, null));
                loader.Hide(false);
            }));
        }
Exemplo n.º 3
0
        public static void BuyStickersPack(StockItemHeader stockItemHeader, string referrer = "", Action successCallback = null, Action errorCallback = null)
        {
            StoreBuyProductParams buyParams = new StoreBuyProductParams(StoreProductType.stickers, stockItemHeader.ProductId)
            {
                StickerReferrer = referrer
            };
            FullscreenLoader loader = new FullscreenLoader();

            loader.Show(null, true);
            StoreService.Instance.BuyProduct(buyParams, (Action <BackendResult <StoreBuyProductResult, ResultCode> >)(result =>
            {
                loader.Hide(false);
                Action action = successCallback;
                if (action != null)
                {
                    action();
                }
                stockItemHeader.SetPurchasedState();
                EventAggregator.Current.Publish((object)new StickersPurchaseFunnelEvent(StickersPurchaseFunnelAction.success));
                EventAggregator.Current.Publish((object)new StickersPackPurchasedEvent(stockItemHeader));
            }), (Action <BackendResult <StorePurchaseResult, ResultCode> >)(result =>
            {
                loader.HiddenCallback = (Action <FullscreenLoaderHiddenEventArgs>)(args => StorePurchaseManager.HandleStorePurchaseError(result, errorCallback));
                loader.Hide(false);
            }));
        }