private async Task Load() { Web.UserInteractionEnabled = false; Web.LoadHtmlString("", NSBundle.MainBundle.BundleUrl); _activityView.Alpha = 1; _activityView.StartAnimating(); View.Add(_activityView); try { var productData = (await _inAppPurchaseService.RequestProductData(FeaturesService.ProEdition)).Products.FirstOrDefault(); var enabled = _featuresService.IsProEnabled; var model = new UpgradeDetailsModel(productData != null ? productData.LocalizedPrice() : null, enabled); var content = new UpgradeDetailsRazorView { Model = model }.GenerateString(); LoadContent(content); Web.UserInteractionEnabled = true; } finally { UIView.Animate(0.2f, 0, UIViewAnimationOptions.BeginFromCurrentState | UIViewAnimationOptions.CurveEaseInOut, () => _activityView.Alpha = 0, () => { _activityView.RemoveFromSuperview(); _activityView.StopAnimating(); }); } }
private async Task Load() { Web.UserInteractionEnabled = false; Web.LoadHtmlString("", NSBundle.MainBundle.BundleUrl); _activityView.Alpha = 1; _activityView.StartAnimating(); View.Add(_activityView); try { var request = _inAppPurchaseService.RequestProductData(FeaturesService.ProEdition).WithTimeout(TimeSpan.FromSeconds(30)); var productData = (await request).Products.FirstOrDefault(); var enabled = _featuresService.IsProEnabled; var model = new UpgradeDetailsModel(productData != null ? productData.LocalizedPrice() : null, enabled); var content = new UpgradeDetailsView { Model = model }.GenerateString(); LoadContent(content); Web.UserInteractionEnabled = true; } catch (Exception e) { AlertDialogService.ShowAlert("Error Loading Upgrades", e.Message); } finally { UIView.Animate(0.2f, 0, UIViewAnimationOptions.BeginFromCurrentState | UIViewAnimationOptions.CurveEaseInOut, () => _activityView.Alpha = 0, () => { _activityView.RemoveFromSuperview(); _activityView.StopAnimating(); }); } }
public async Task ActivatePro() { var productData = (await _inAppPurchaseService.RequestProductData(ProEdition)).Products.FirstOrDefault(); if (productData == null) { throw new InvalidOperationException("Unable to activate CodeHub Pro"); } await _inAppPurchaseService.PurchaseProduct(productData); }
public async Task ActivatePro() { var productData = (await _inAppPurchaseService.RequestProductData(ProEdition)).Products.FirstOrDefault(); if (productData == null) { throw new InvalidOperationException("Unable to activate CodeHub Pro"); } await _inAppPurchaseService.PurchaseProduct(productData); _defaultValueService.Set(ProEdition, true); _defaultValueService.Set(PushNotifications, true); var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate; appDelegate?.RegisterUserForNotifications(); }
public System.Threading.Tasks.Task <StoreKit.SKProductsResponse> RequestProductData(params string[] productIds) { using (_networkActivity.ActivateNetwork()) return(_inAppPurcahseService.RequestProductData(productIds)); }