async void ProcessRequest(string url) { if (url.Equals("https://www.instagram.com/accounts/login/", StringComparison.InvariantCultureIgnoreCase)) { Load(); } if (url.Equals("https://www.instagram.com/", StringComparison.InvariantCultureIgnoreCase)) { Load(); } if (url.Contains(NotSensitive.SystemUrls.instagram_redirect_url)) { if (url.Contains(NotSensitive.SystemUrls.instagram_redirect_url + "/?code")) { var token = url.Substring(url.IndexOf("code=", StringComparison.InvariantCultureIgnoreCase) + 5); if (!String.IsNullOrEmpty(token)) { ShowHud(Strings.Hud.please_wait); var result = await InstagramAuthenticator.GetInstagramAccount(token); if (result != null) { var activity = Activity as BaseActivity; activity?.PopFragmentOverUntil(typeof(MyOutletsRecyclerViewFragment)); } HideHud(); } } } }
public override void OnViewModelChanged(object sender, PropertyChangedEventArgs e) { base.OnViewModelChanged(sender, e); if (e.PropertyName == PropertiesExtension.GetPropertyName(() => ViewModel.FBLoaderImage)) { if (ViewModel.IsBusy) { AnimateImage(twitterNetworkLoader); var auth = new FacebookAuthenticator(Configuration.FbClientId, Configuration.Scope, ViewModel); var authenticator = auth.GetAuthenticator(); var intent = authenticator.GetUI(this.Activity); this.StartActivity(intent); AnimateImage(fbNetworkLoader); } if (!ViewModel.IsBusy) { fbNetworkLoader.ClearAnimation(); } ChangeSocialNetworkTextColor(); } if (e.PropertyName == PropertiesExtension.GetPropertyName(() => ViewModel.TwitterLoaderImage)) { if (ViewModel.IsBusy) { var auth = new TwitterAuthentificator(Configuration.ConsumerKeyTwitter, Configuration.ConsumerSecretTwitter, Configuration.Scope, ViewModel); var authenticator = auth.GetAuthenticator(); var intent = authenticator.GetUI(this.Activity); this.StartActivity(intent); AnimateImage(twitterNetworkLoader); } if (!ViewModel.IsBusy) { twitterNetworkLoader.ClearAnimation(); } ChangeSocialNetworkTextColor(); } if (e.PropertyName == PropertiesExtension.GetPropertyName(() => ViewModel.InstaLoaderImage)) { if (ViewModel.IsBusy) { var auth = new InstagramAuthenticator(Configuration.ConsumerKeyInsta, string.Empty, Configuration.InstaScope, ViewModel); var authenticator = auth.GetAuthenticator(); var intent = authenticator.GetUI(this.Activity); this.StartActivity(intent); AnimateImage(instaNetworkLoader); } if (!ViewModel.IsBusy) { instaNetworkLoader.ClearAnimation(); } ChangeSocialNetworkTextColor(); } }
public override void ViewDidLoad() { base.ViewDidLoad(); RemoveBackBarButtonTitle(); //clear cache WebUtils.ClearCache(); //clear cookies WebUtils.ClearCookies(); var webViewDelegate = new InstagramWebViewDelegate(); webViewDelegate.TokenReceived += async(token) => { ShowHud(Strings.Hud.please_wait); var result = await InstagramAuthenticator.GetInstagramAccount(token); if (result != null) { var popToViewController = NavigationController.ViewControllers.Where(c => c.GetType() == typeof(MyOutletsViewController)).First(); NavigationController.PopToViewController(popToViewController, true); } }; webViewDelegate.Reload += () => { Load(); }; var offsetY = NavigationController.NavigationBar.Bounds.Height; WebView = new UIWebView(new CGRect(0, offsetY, View.Bounds.Width, View.Bounds.Height - offsetY)); WebView.Delegate = webViewDelegate; View.AddSubview(WebView); View.AddConstraint(NSLayoutConstraint.Create(WebView, NSLayoutAttribute.Top, NSLayoutRelation.Equal, View, NSLayoutAttribute.Top, 1, offsetY)); View.AddConstraint(NSLayoutConstraint.Create(WebView, NSLayoutAttribute.Right, NSLayoutRelation.Equal, View, NSLayoutAttribute.Right, 1, 0)); View.AddConstraint(NSLayoutConstraint.Create(WebView, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, View, NSLayoutAttribute.Bottom, 1, 0)); View.AddConstraint(NSLayoutConstraint.Create(WebView, NSLayoutAttribute.Left, NSLayoutRelation.Equal, View, NSLayoutAttribute.Left, 1, 0)); Load(); }