/// <summary> /// The btnBuyPremium_Clicked /// </summary> /// <param name="sender">The sender<see cref="object"/></param> /// <param name="e">The e<see cref="EventArgs"/></param> private async void btnBuyPremium_Clicked(object sender, EventArgs e) { var sMessage = "There are several features in the domoticz app that are locked until you buy the premium version\r\n- no ads!!\r\n-notification support\r\n- theming\r\n- talkback\r\n- qrcode scanning\r\n\r\n- and more features in the future"; #if OOTT sMessage = "There are several features in the OOTT app that are locked until you buy the premium version\r\n- no ads!!\r\n-notification support\r\n- theming\r\n- talkback\r\n- qrcode scanning\r\n\r\n- and more features in the future"; #endif var result = await UserDialogs.Instance.ConfirmAsync(new ConfirmConfig { Message = sMessage, OkText = "Buy", CancelText = "Cancel" }); if (!result) { return; } if (await InAppPurchaseHelper.PurchaseItem()) { App.ShowToast("Thanks for buying premium!!"); } PremiumScreenSetup(); }
private async void BtnRestore_OnClicked(object sender, EventArgs e) { if (await InAppPurchaseHelper.PremiumAccountPurchased()) { App.ShowToast("Thanks for buying premium!!"); PremiumScreenSetup(); } else { App.ShowToast("Could not restore your premium account."); } }
private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
public static void Init() { if (InAppPurchaseHelper.CheckReceipt(remove_ads)) { PlayerPrefs.SetInt(PREF_NO_ADS, 1); } else { PlayerPrefs.SetInt(PREF_NO_ADS, 0); } SetupNoAds(); }
public override async Task <bool> PromptPurchase() { Task <InAppPurchaseHelper.PurchaseResponse> responseTask; if (IsNewPurchaseOperation) { responseTask = InAppPurchaseHelper.PurchaseAsync(); } else { responseTask = InAppPurchaseHelper.RestoreAsync(); } var response = await responseTask; ResponseReceived?.Invoke(null, response); return(response.Success); }
public static bool OnPurchase(PurchaseEventArgs args) { string id = args.purchasedProduct.definition.id; IAPProductData productData = GetProductData(id); bool isValidPurchase = true; if (productData == null) { //invalid product isValidPurchase = false; } else { foreach (var payout in productData.payouts) { switch (payout.type) { case PayoutType.Diamond: //User.AddGems(payout.quantity); break; case PayoutType.Hint: User.AddHint(payout.quantity); break; case PayoutType.Other: if (InAppPurchaseHelper.CompareProductId(remove_ads, args)) { PlayerPrefs.SetInt(Const.PREF_NO_ADS, 1); PlayerPrefs.Save(); SetupNoAds(); } break; } } } return(isValidPurchase); //SS.View.Manager.Add(PopupController.POPUP_SCENE_NAME, new PopupData(PopupType.OK, msg)); }
void CheckDisableIfOwned() { if ((disableIfOwned && productData.productType == UnityEngine.Purchasing.ProductType.NonConsumable && InAppPurchaseHelper.CheckReceipt(productData.ProductId)) || (disableIfAdRemoved && IAPProcessor.CheckNoAds())) { gameObject.SetActive(false); } }
public override async void OnViewModelLoadedOverride() { if (ViewModel.ContextualMessage != null) { var labelContextualMessage = new UILabel() { TranslatesAutoresizingMaskIntoConstraints = false, Text = ViewModel.ContextualMessage, Font = UIFont.PreferredBody.Bold(), Lines = 0 }; StackView.AddArrangedSubview(labelContextualMessage); labelContextualMessage.StretchWidth(StackView); AddSpacing(16); } var labelDescription = new UILabel() { TranslatesAutoresizingMaskIntoConstraints = false, Text = @"The premium version of Power Planner unlocks a number of useful features. The free version is limited to... - 1 semester - 5 grades per class - 1 repeating bulk entry of a task/event Once you purchase the premium version, you own the premium version on all your devices.", Lines = 0 }; StackView.AddArrangedSubview(labelDescription); labelDescription.StretchWidth(StackView); AddSpacing(16); _errorVisibilityContainer = new BareUIVisibilityContainer() { TranslatesAutoresizingMaskIntoConstraints = false, IsVisible = false }; { _labelError = new UILabel() { TextColor = UIColor.Red, Font = UIFont.PreferredBody.Bold(), Lines = 0 }; _errorVisibilityContainer.Child = _labelError; } StackView.AddArrangedSubview(_errorVisibilityContainer); _errorVisibilityContainer.StretchWidth(StackView); _buttonUpgrade = new UIButton(UIButtonType.System) { TranslatesAutoresizingMaskIntoConstraints = false }; _buttonUpgrade.SetTitle("UPGRADE TO PREMIUM", UIControlState.Normal); _buttonUpgrade.SetTitleColor(new UIColor(1, 1), UIControlState.Normal); _buttonUpgrade.BackgroundColor = ColorResources.PowerPlannerAccentBlue; _buttonUpgrade.TouchUpInside += new WeakEventHandler(ButtonUpgrade_TouchUpInside).Handler; StackView.AddArrangedSubview(_buttonUpgrade); _buttonUpgrade.StretchWidth(StackView); AddSpacing(16); var buttonRestore = new UIButton(UIButtonType.System) { TranslatesAutoresizingMaskIntoConstraints = false }; buttonRestore.SetTitle("Restore Previous Purchase", UIControlState.Normal); buttonRestore.SetTitleColor(new UIColor(1, 1), UIControlState.Normal); buttonRestore.BackgroundColor = ColorResources.PowerPlannerAccentBlue; buttonRestore.TouchUpInside += new WeakEventHandler(ButtonRestore_TouchUpInside).Handler; StackView.AddArrangedSubview(buttonRestore); buttonRestore.StretchWidth(StackView); if (!InAppPurchaseHelper.CanMakePayments) { _buttonUpgrade.Enabled = false; buttonRestore.Enabled = false; _labelError.Text = "App Store purchases not supported."; _errorVisibilityContainer.IsVisible = true; } else { iOSInAppPurchaseExtension.ResponseReceived += new WeakEventHandler <InAppPurchaseHelper.PurchaseResponse>(IOSInAppPurchaseExtension_ResponseReceived).Handler; string price = await InAppPurchaseHelper.GetPriceAsync(); if (price != null) { _buttonUpgrade.SetTitle("UPGRADE TO PREMIUM - " + price, UIControlState.Normal); } } base.OnViewModelLoadedOverride(); }