async void ILabelButtonCancelPopupPage.DidTapButton(LabelButtonCancelPopupPage page, object output) { var subscriptionOption = output.ToString(); BillingItem billingItem = new BillingItem(); this.CustomActivityIndicator.IsRunning = true; if (subscriptionOption.ToLower() == StringSingleSubscription.ToLower()) { billingItem = await BillingManager.PurchaseProductWithTypeAsync(EVeSubscriptionType.SingleSubscription); if (billingItem.Success && await ViewModel.UserSingleSubscribe()) { await DisplayAlert("Success", $"Thank you for your support! You have been granted slideshow access", "Ok"); Title = ViewModel.InitialTitle; } else { await DisplayAlert("Error", $"Something went wrong, please try again later.", "Ok"); } } else if (subscriptionOption.ToLower() == StringAdditionalSubscription.ToLower()) { billingItem = await BillingManager.PurchaseProductWithTypeAsync(EVeSubscriptionType.AdditionalSubscription); if (billingItem.Success && await ViewModel.UserMultipleSubscribe()) { await DisplayAlert("Success", $"Thank you for your support! You have been granted multiple slideshow access", "Ok"); } else { await DisplayAlert("Error", $"Something went wrong, please try again later.", "Ok"); } } this.CustomActivityIndicator.IsRunning = false; }
void ILabelButtonCancelPopupPage.DidTapDisclaimer(LabelButtonCancelPopupPage page) { this.OpenWebView("http://evslideshowfortesla.com/termsofuse.pdf"); }
async void ButtonSubscribe_ClickedAsync(object sender, EventArgs e) { this.CustomActivityIndicator.IsRunning = true; string productDisclaimer; switch (Device.RuntimePlatform) { case Device.iOS: productDisclaimer = ViewModel.kAppleSubscriptionDisclaimer; break; case Device.Android: productDisclaimer = ViewModel.kAndroidSubscriptionDisclaimer; break; default: productDisclaimer = ""; break; } if (!ViewModel.User.IsSubscribed) { // needs subscribe to single first var product = await BillingManager.GetIAPBillingProductWithTypeAsync(EVeSubscriptionType.SingleSubscription); if (product.Success) { var popupPage = new LabelButtonCancelPopupPage(StringSingleSubscription, "Subscribe now to get your 30 image slideshow of your very own photos! Images upload to your Tesla screen " + "in a matter of seconds directly from your mobile phone.\n\n", $"Pay {product.Product.LocalizedPrice}", productDisclaimer, "See Terms and Condition", 200) { PageDelegate = this }; await Navigation.PushPopupAsync(popupPage); } else { if (!String.IsNullOrEmpty(product.Message)) { await DisplayAlert("Error", product.Message, "Ok"); } else { await DisplayAlert("Error", "Oops, something went wrong. Please try again later.", "Ok"); } return; } } else if (!ViewModel.User.HasMultipleSubscription) { // they already have single so they can opt for multiple var product = await BillingManager.GetIAPBillingProductWithTypeAsync(EVeSubscriptionType.AdditionalSubscription); if (product.Success) { var popupPage = new LabelButtonCancelPopupPage(StringAdditionalSubscription, "Get 2 additional slideshows for your Tesla Screen! " + "Use additional slideshows for family, business, or specific events.\n\n" + productDisclaimer, $"Buy for {product.Product.LocalizedPrice}", "See Terms and Condition", productDisclaimer, 200) { PageDelegate = this }; await Navigation.PushPopupAsync(popupPage); } else { if (!String.IsNullOrEmpty(product.Message)) { await DisplayAlert("Error", product.Message, "Ok"); } else { await DisplayAlert("Error", "Oops, something went wrong. Please try again later.", "Ok"); } return; } } else { // they already have both memberships await DisplayAlert("Subscription", "You already have full access", "Ok"); } this.CustomActivityIndicator.IsRunning = false; }