public bool shouldStartLoadWithRequest(NSUrlRequest request, UIWebViewNavigationType navigationType) { string urlString = request.Url.AbsoluteString; if (urlString.Contains(@"threedsecurecallback")) { NSData body = request.HttpMethod; string bodyString= body.EncodeTo(NSUTF8StringEncoding); NSMutableDictionary results = NSMutableDictionary.FromDictionary(dictionary); Array pairs = bodyString.Split("&"); foreach (string pair in pairs) { if (pair.Contains("=")) { Array components = pair.Split("="); string value = components[1];//[components objectAtIndex:1]; string escapedVal = ""; //(__bridge_transfer NSString *)CFURLCreateStringByReplacingPercentEscapes(kCFAllocatorDefault, (CFStringRef)value, CFSTR("")); // what is it???? results.SetValueForKey(escapedVal, components[0]); } } Console.WriteLine ("results :{0}", results); if(this.successBlock) { this.successBlock(200, results); } return false; } return true; }
public bool ShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { if (NSUrl.FromString("https://www.payumoney.com/mobileapp/payumoney/success.php") == request.Url) { //TODO Payment Success Event var okAlertController = UIAlertController.Create("Success", "Payment Successfully Completed", UIAlertControllerStyle.Alert); okAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null)); PresentViewController(okAlertController, true, null); } else if (NSUrl.FromString("https://www.payumoney.com/mobileapp/payumoney/failure.php") == request.Url) { // TODO Payment failure event var okAlertController = UIAlertController.Create("Failed", "Payment Failed and retry after sometime", UIAlertControllerStyle.Alert); okAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null)); PresentViewController(okAlertController, true, null); } return(true); }
private bool ShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { if (Url != null && request.Url.Equals(Url)) { return(true); } Url = request.Url; if (Url.Scheme.Equals("acs")) { var b = new StringBuilder(Uri.UnescapeDataString(request.Url.ToString())); b.Replace("acs://settoken?token=", string.Empty); var token = RequestSecurityTokenResponse.FromJSON(b.ToString()); _messageHub.Publish(new RequestTokenMessage(this) { TokenResponse = token }); DismissViewController(true, null); } NSUrlConnection.FromRequest(request, new LoginConnectionDelegate(this)); return(false); }
public override bool ShouldStartLoad(UIWebView webView, NSURLRequest request, UIWebViewNavigationType navigationType) { Debug.Log ("ShouldStartLoad"); // handle the special url schema as a way to communicate from the web NSURL url = request.URL(); if (url!=null && url.Scheme().Equals("u3dxt")) { object[] paths = url.PathComponents(); Debug.Log (paths.Length); string command = paths[1] as string; Debug.Log ("command: " + command); if ( command.Equals("say") ) { string phrase = paths[2] as string; Debug.Log ("Phrase: " + phrase); SpeechXT.Speak(phrase); } // do not actually load this return false; } else { return true; } }
public override bool ShouldStartLoad (UIWebView webView, Foundation.NSUrlRequest request, UIWebViewNavigationType navigationType) { WebNavigationEvent navEvent = WebNavigationEvent.NewPage; switch (navigationType) { case UIWebViewNavigationType.LinkClicked: navEvent = WebNavigationEvent.NewPage; break; case UIWebViewNavigationType.FormSubmitted: navEvent = WebNavigationEvent.NewPage; break; case UIWebViewNavigationType.Reload: navEvent = WebNavigationEvent.Refresh; break; case UIWebViewNavigationType.FormResubmitted: navEvent = WebNavigationEvent.NewPage; break; case UIWebViewNavigationType.Other: navEvent = WebNavigationEvent.NewPage; break; } lastEvent = navEvent; Console.WriteLine ("[Custom Delegate] Url: {0}", request.Url); Console.WriteLine ("[Custom Delegate] MainDocUrl: {0}", request.MainDocumentURL); return true; }
protected override bool ShouldStartLoad(NSUrlRequest request, UIWebViewNavigationType navigationType) { var url = request.Url; if (url.Scheme.Equals("app")) { var func = url.Host; try { if (func.Equals("comment") && !string.IsNullOrEmpty(url.Query)) { var param = url.Query.Split('&'); var p = param.ToDictionary(x => x.Split('=')[0], x => x.Split('=')[1]); ViewModel.SelectedPatchLine = Tuple.Create(int.Parse(p["index"]), int.Parse(p["line"])); ViewModel.GoToCommentCommand.ExecuteIfCan(); } } catch (Exception e) { this.Log().ErrorException("Unable to comment on diff", e); } return(false); } return(base.ShouldStartLoad(request, navigationType)); }
bool HandleShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { var scheme = "hybrid:"; // If the URL is not our own custom scheme, just let the webView load the URL as usual if (request.Url.Scheme != scheme.Replace(":", "")) { return(true); } // This handler will treat everything between the protocol and "?" // as the method name. The querystring has all of the parameters. var resources = request.Url.ResourceSpecifier.Split('?'); var method = resources [0]; var parameters = System.Web.HttpUtility.ParseQueryString(resources[1]); // breaks if ? not present (ie no params) if (method == "ListAll") { var model = new Lip3Data().MyRecs; var template = new DataCorpus() { Model = model }; var page = template.GenerateString(); webView.LoadHtmlString(page, NSBundle.MainBundle.BundleUrl); } return(false); }
bool HandleShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { // If the URL is not our own custom scheme, just let the webView load the URL as usual var scheme = "app:"; if (request.Url.Scheme != scheme.Replace(":", "")) return true; var resources = request.Url.ResourceSpecifier.Split('?'); var method = resources[0]; if (method == "QR") { var scanner = new ZXing.Mobile.MobileBarcodeScanner(); scanner.Scan().ContinueWith(result => { if (result != null){ var code = result.Result.Text; this.InvokeOnMainThread(new NSAction(() => webView.LoadRequest(new NSUrlRequest(new NSUrl(MainUrl + "code?value=" + code))))); } }); } return false; }
public override bool ShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { bool shouldStart = true; string url = request.Url.ToString(); if (url.Contains("js-frame")) { shouldStart = false; string pendingArgs = bridge.webBrowser.EvaluateJavascript("window.locationMessenger.pendingArg.toString();"); // Using JsonConvert.Deserialze<string[]> blows up under MonoTouch, so manually build the array of args instead JArray argsJArray = (JArray)Newtonsoft.Json.JsonConvert.DeserializeObject(pendingArgs); string[] args = new string[argsJArray.Count]; for (int i = 0; i < argsJArray.Count; i++) args[i] = (string)argsJArray[i]; if (args[0] == "HandleScriptPropertyChanged") { if (args.Length == 3) bridge.HandleScriptPropertyChanged(args[1], args[2], null); else bridge.HandleScriptPropertyChanged(args[1], args[2], args[3]); } else if (args[0] == "InvokeViewModelIndexMethod") bridge.InvokeViewModelMethod(args[1], args[2], args[3]); else if (args[0] == "InvokeViewModelMethod") bridge.InvokeViewModelMethod(args[1], args[2]); else if (args[0] == "HandleDocumentReady") bridge.HandleDocumentReady(); else if (args[0] == "HostLog") bridge.HostLog(args[1]); else SpinnakerConfiguration.CurrentConfig.Log(SpinnakerLogLevel.Error,"Ignoring unrecognized call from javascript for [" + args[0] + "] - this means that javascript in the view is trying to reach the host but with bad arguments"); } return shouldStart; }
private bool ShouldStartLoad(NSUrlRequest request, UIWebViewNavigationType navigationType) { if (request.Url.AbsoluteString.StartsWith("app://resize")) { // try // { // _height = WebView.SizeThatFits(SizeF.Empty).Height; // if (HeightChanged != null) // HeightChanged(_height); // } // catch // { // } return(false); } if (!request.Url.AbsoluteString.StartsWith("file://")) { if (UrlRequested != null) { UrlRequested(request.Url.AbsoluteString); } return(false); } return(true); }
private bool ShouldStartLoad (NSUrlRequest request, UIWebViewNavigationType navigationType) { if (request.Url.AbsoluteString.StartsWith("app://resize")) { try { var size = WebView.EvaluateJavascript("size();"); if (size != null) nfloat.TryParse(size, out _height); if (HeightChanged != null) HeightChanged(_height); } catch { } return false; } if (!request.Url.AbsoluteString.StartsWith("file://")) { if (UrlRequested != null) UrlRequested(request.Url.AbsoluteString); return false; } return true; }
protected override bool ShouldStartLoad(NSUrlRequest request, UIWebViewNavigationType navigationType) { var url = request.Url; if (url.Scheme.Equals("app")) { var func = url.Host; if (func.Equals("ready")) { _domLoaded = true; foreach (var e in _toBeExecuted) { Web.EvaluateJavascript(e); } } else if (func.Equals("comment")) { var commentModel = _serializationService.Deserialize <JavascriptCommentModel>(UrlDecode(url.Fragment)); PromptForComment(commentModel); } return(false); } return(base.ShouldStartLoad(request, navigationType)); }
private bool ShouldStartLoad(NSUrlRequest request, UIWebViewNavigationType navigationType) { if (request.Url.AbsoluteString.StartsWith("app://resize")) { try { var size = WebView.EvaluateJavascript("size();"); if (size != null) { float.TryParse(size, out _height); } if (HeightChanged != null) { HeightChanged(_height); } } catch { } return(false); } if (!request.Url.AbsoluteString.StartsWith("file://")) { if (UrlRequested != null) { UrlRequested(request.Url.AbsoluteString); } return(false); } return(true); }
bool HandleShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { // If the URL is not our own custom scheme, just let the webView load the URL as usual const string scheme = "hybrid:"; if (request.Url.Scheme != scheme.Replace (":", "")) return true; // This handler will treat everything between the protocol and "?" // as the method name. The querystring has all of the parameters. var resources = request.Url.ResourceSpecifier.Split ('?'); var method = resources [0]; var parameters = System.Web.HttpUtility.ParseQueryString (resources [1]); if (method == "UpdateLabel") { var textbox = parameters ["textbox"]; // Add some text to our string here so that we know something // happened on the native part of the round trip. var prepended = string.Format ("C# says: {0}", textbox); // Build some javascript using the C#-modified result var js = string.Format ("SetLabelText('{0}');", prepended); webView.EvaluateJavascript (js); } return false; }
bool HandleShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { // If the URL is not our own custom scheme, just let the webView load the URL as usual var scheme = "hybrid:"; if (request.Url.Scheme != scheme.Replace(":", "")) { return(true); } // This handler will treat everything between the protocol and "?" // as the method name. The querystring has all of the parameters. var resources = request.Url.ResourceSpecifier.Split('?'); var method = resources[0]; var parameters = System.Web.HttpUtility.ParseQueryString(resources[1]); if (method == "UpdateLabel") { var textbox = parameters["textbox"]; // Add some text to our string here so that we know something // happened on the native part of the round trip. var prepended = string.Format("C# says \"{0}\"", textbox); // Build some javascript using the C#-modified result var js = string.Format("SetLabelText('{0}');", prepended); webView.EvaluateJavascript(js); } return(false); }
bool WebViewAuth_ShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { if (request.Url.Host == "www.yandex.ru") { _continueAthorizationDelegate(request.Url.Query); } return(true); }
public bool OpenWebViewUrl(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { if (navigationType == UIWebViewNavigationType.LinkClicked) { UIApplication.SharedApplication.OpenUrl(request.Url); return(false); } return(true); }
protected override bool ShouldStartLoad(Foundation.NSUrlRequest request, UIWebViewNavigationType navigationType) { if (request.Url.AbsoluteString.StartsWith("file://", StringComparison.Ordinal)) { return(base.ShouldStartLoad(request, navigationType)); } ViewModel.GoToLinkCommand.ExecuteIfCan(request.Url.AbsoluteString); return(false); }
public override bool ShouldStartLoad (UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { if (navigationType == UIWebViewNavigationType.LinkClicked) { UIApplication.SharedApplication.OpenUrl (request.Url); return false; } return true; }
public override bool ShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { webView.UserInteractionEnabled = false; _cookieWebView.OnNavigating(new CookieNavigationEventArgs { Url = request.Url.AbsoluteString }); return true; }
public override bool ShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { if (navigationType == UIWebViewNavigationType.LinkClicked) { //To prevent navigation when a link is click, return false return(false); } return(true); }
private bool HandleStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { var shouldStartLoad = !this.CheckRequest(request.Url.RelativeString); if (shouldStartLoad) { Element.OnNavigating(new Uri(request.Url.AbsoluteUrl.AbsoluteString)); } return(shouldStartLoad); }
private bool OnStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { // On vérifie que c'est bien la bonne url qui appelle notre code C# if (request.MainDocumentURL.ToString() == "callios://functionTest") { // On affiche une alerte new UIAlertView("Valider", "Fonction C# invoquée", null, "ok", null).Show(); } return(true); }
private bool ShouldStartLoad (NSUrlRequest request, UIWebViewNavigationType navigationType) { if (!request.Url.AbsoluteString.StartsWith("file://")) { if (UrlRequested != null) UrlRequested(request.Url.AbsoluteString); return false; } return true; }
bool webViewShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { Console.WriteLine(request.Url.AbsoluteString); if (request.Url.AbsoluteString.IndexOf("#back") > -1) { NavigationController.PopViewControllerAnimated(true); return(false); } return(true); }
public override bool ShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { // TODO: add Settings.Current.UserSettings.OpenInSafari if (navigationType == UIWebViewNavigationType.LinkClicked) { UIApplication.SharedApplication.OpenUrl(request.Url); return false; } return true; }
private bool shouldLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { var uri = new Uri(request.Url.AbsoluteString); var linkClicked = navigationType == UIWebViewNavigationType.LinkClicked; var doLoad = Element.ShouldHandleUri(uri, linkClicked); if (doLoad && linkClicked) { Element.Html = null; // otherwise we don't get a property change call when reloading. } return(doLoad); }
bool HandleShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { if (request.Url.AbsoluteString.Contains(PopditServer.WebRoot.AbsoluteString)) { return(true); } else { UIApplication.SharedApplication.OpenUrl(request.Url); return(false); } }
public override bool ShouldStartLoad(UIWebView webView, MonoTouch.Foundation.NSUrlRequest request, UIWebViewNavigationType navigationType) { string actionUri = string.Empty; string uri = request.Url.AbsoluteUrl.ToString(); if(uri.ToLower().Contains("hybrid://")) { actionUri = uri.Substring(9); CallNativeMethod(actionUri); return false; } return true; }
private bool ShouldStartLoad(NSUrlRequest request, UIWebViewNavigationType navigationType) { if (!request.Url.AbsoluteString.StartsWith("file://")) { if (UrlRequested != null) { UrlRequested(request.Url.AbsoluteString); } return(false); } return(true); }
public override bool ShouldStartLoad (UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { var nsUrl = request.Url; if (nsUrl != null) { Uri url; if (Uri.TryCreate (nsUrl.AbsoluteString, UriKind.Absolute, out url)) { controller.authenticator.OnPageLoading (url); } } return true; }
bool HandleShouldStartLoad (UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { // Filter out clicked links if(navigationType == UIWebViewNavigationType.LinkClicked) { if(UIApplication.SharedApplication.CanOpenUrl(request.Url)) { // Open in Safari instead UIApplication.SharedApplication.OpenUrl(request.Url); return false; } } return true; }
public override bool ShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { string urlString = request.Url.AbsoluteString.ToString( ); if( urlString.StartsWith( PrivateGeneralConfig.ExternalUrlToken ) ) { // strip off the PrivateGeneralConfig.ExternalUrlToken and forward it urlString = urlString.Substring( PrivateGeneralConfig.ExternalUrlToken.Length ); UIApplication.SharedApplication.OpenUrl( new NSUrl( urlString ) ); return false; } return true; }
private static bool LoadHook(UIWebView webview, NSUrlRequest request, UIWebViewNavigationType navigationtype) { if (navigationtype == UIWebViewNavigationType.LinkClicked) { var url = request.Url.AbsoluteString; if (url.StartsWith("http:") || url.StartsWith("https:")) { UIApplication.SharedApplication.OpenUrl(new NSUrl(url)); return(false); } } return(true); }
bool HandleShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { // Filter out clicked links if (navigationType == UIWebViewNavigationType.LinkClicked) { if (UIApplication.SharedApplication.CanOpenUrl(request.Url)) { // Open in Safari instead UIApplication.SharedApplication.OpenUrl(request.Url); return(false); } } return(true); }
private bool HandleShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { if (!request.Url.ToString().Contains("file://")) { if (UIApplication.SharedApplication.CanOpenUrl(request.Url)) { return(UIApplication.SharedApplication.OpenUrl(request.Url)); } return(true); } else { return(true); } }
bool LoadHook(UIWebView sender, NSUrlRequest request, UIWebViewNavigationType navType) { var requestString = request.Url.AbsoluteString; if (requestString.StartsWith(container.config.Callback)) { var results = HttpUtility.ParseQueryString(requestString.Substring(container.config.Callback.Length + 1)); container.AccessCode = results["code"]; DismissModalViewControllerAnimated(false); container.AcquireAccessToken(); callback(); } return(true); }
protected virtual bool ShouldStartLoad(NSUrlRequest request, UIWebViewNavigationType navigationType) { var url = request.Url; if (url.Scheme.Equals("app")) { var func = url.Host; if (string.Equals(func, "buy", StringComparison.OrdinalIgnoreCase)) { // Purchase Activate(_featuresService.ActivatePro).ToBackground(); } else if (string.Equals(func, "restore", StringComparison.OrdinalIgnoreCase)) { // Restore Activate(_featuresService.RestorePro).ToBackground(); } return(false); } if (url.Scheme.Equals("mailto", StringComparison.OrdinalIgnoreCase)) { UIApplication.SharedApplication.OpenUrl(url); return(false); } if (url.Scheme.Equals("file")) { return(true); } if (url.Scheme.Equals("http") || url.Scheme.Equals("https")) { var vm = new WebBrowserViewModel().Init(url.AbsoluteString); var view = new WebBrowserViewController(true, true) { ViewModel = vm }; view.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Images.Cancel, UIBarButtonItemStyle.Done, (s, e) => DismissViewController(true, null)); PresentViewController(new ThemedNavigationController(view), true, null); return(false); } return(false); }
bool UiWebView_ShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { if (this.Element == null) { return(false); } var dh = this.Element.HandleNavigationStartRequest(request.Url.ToString()); if (dh.Cancel) { this.Control.StopLoading(); return(false); } return(true); }
protected override bool ShouldStartLoad(Foundation.NSUrlRequest request, UIWebViewNavigationType navigationType) { //We're being redirected to our redirect URL so we must have been successful if (request.Url.Host == "dillonbuchanan.com") { ViewModel.Code = request.Url.Query.Split('=')[1]; ViewModel.LoginCommand.ExecuteIfCan(); return(false); } if (request.Url.AbsoluteString == "https://github.com/" || request.Url.AbsoluteString.StartsWith("https://github.com/join")) { return(false); } return(base.ShouldStartLoad(request, navigationType)); }
bool HandleShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { // If the URL is not our own custom scheme, just let the webView load the URL as usual const string scheme = "jsb"; if (request.Url.Scheme != null && request.Url.Scheme.Contains(scheme)) { string objName = request.Url.Host; string dataraw = request.Url.Query.Split('=')[1]; string json = System.Web.HttpUtility.UrlDecode(dataraw).Replace("&_", ""); JsReturn result = JSBridge.RaiseEvent(JsTelegram.DeserializeObject(json)); return(true); } return(true); }
public override bool ShouldStartLoad ( UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { Console.WriteLine (">>>>> URL {0}", request.Url.ToString ()); if (OnNavigating != null) { OnNavigating (webView, request, navigationType); } // // return OnNavigated(request.u // if (request.Url.AbsoluteString.EndsWith ("#close")) { // Controller.DismissViewController (true, () => { // }); // } Console.WriteLine ("@@@@@@ {0}", request.Url.AbsoluteString); return ForceLoading; }
bool OpenInSafari(UIWebView sender, NSUrlRequest request, UIWebViewNavigationType navType) { Console.Out.WriteLine( "Request {0}, Navigation type {1}", request.Url.AbsoluteUrl, navType ); if (navType == UIWebViewNavigationType.LinkClicked) { UIApplication.SharedApplication.OpenUrl(request.Url); return(false); } else { return(true); } }
protected virtual bool ShouldStartLoad (NSUrlRequest request, UIWebViewNavigationType navigationType) { var url = request.Url; if (url.Scheme.Equals("app")) { var func = url.Host; if (string.Equals(func, "buy", StringComparison.OrdinalIgnoreCase)) { // Purchase Activate(_featuresService.ActivatePro).ToBackground(); } else if (string.Equals(func, "restore", StringComparison.OrdinalIgnoreCase)) { // Restore Activate(_featuresService.RestorePro).ToBackground(); } return false; } if (url.Scheme.Equals("mailto", StringComparison.OrdinalIgnoreCase)) { UIApplication.SharedApplication.OpenUrl(url); return false; } if (url.Scheme.Equals("file")) { return true; } if (url.Scheme.Equals("http") || url.Scheme.Equals("https")) { var vm = new WebBrowserViewModel().Init(url.AbsoluteString); var view = new WebBrowserViewController(true, true) { ViewModel = vm }; view.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Images.Cancel, UIBarButtonItemStyle.Done, (s, e) => DismissViewController(true, null)); PresentViewController(new ThemedNavigationController(view), true, null); return false; } return false; }
protected override bool ShouldStartLoad(NSUrlRequest request, UIWebViewNavigationType navigationType) { var url = request.Url; if (url.Scheme.Equals("app")) { var func = url.Host; if (func.Equals("comment")) { PromptForComment(new RestSharp.Deserializers.JsonDeserializer().Deserialize <JavascriptCommentModel>(new RestSharp.RestResponse { Content = Decode(url.Fragment) })); return(false); } } return(base.ShouldStartLoad(request, navigationType)); }
public bool HandleLoadStarted (UIWebView webView, MonoTouch.Foundation.NSUrlRequest request, UIWebViewNavigationType navigationType) { if (navigationType == UIWebViewNavigationType.LinkClicked) { string scheme = request.Url.Scheme; if (scheme.StartsWith ("tel")) { DoAction (Action.Tel, request); return false; } else if (scheme.StartsWith ("mailto")) { DoAction (Action.Email, request); return false; } else if (scheme.StartsWith ("http")) { DoAction (Action.Http, request); return false; } else if (scheme.StartsWith ("fax")) { return false; } } return true; }
public override bool ShouldStartLoad (UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { if (this.controller != null && this.controller is TCRegisterViewController) { if (request.Url.ToString ().Equals (CoreSystem.HttpConstants.BASE_URL + "Account/Login")) { this.controller.NavigationController.PopViewController (true); this.controller.loadingView.dismiss (); } } else if (this.controller != null && this.controller is TCUpdateProfileViewController) { if (request.Url.ToString ().Contains ("/Booking/ListBooking")) { TCNotificationCenter.defaultCenter.postNotification (MConstants.kPostUpdateStatusCurrentUser, null); MApplication.getInstance ().isCompleteProfile = true; this.controller.NavigationController.PopViewController (true); this.controller.loadingView.dismiss (); } } return true; }
/// <summary> /// In order to listen to events, we need to handle the ShouldStartLoad event. If /// it's an event that we want to handle ourselves, rather than having the web view /// do it, we need to return false, so that the navigation doesn't happen. in this /// particular case we are checking for links that have //LOCAL/Action='whateverAction' /// </summary> public bool HandleStartLoad (UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { Console.WriteLine (navigationType.ToString ()); // first, we check to see if it's a link if (navigationType == UIWebViewNavigationType.LinkClicked) { // next, we check to see if it's a link with //LOCAL in it. if(request.Url.RelativeString.StartsWith("file://LOCAL")) { new UIAlertView ("Action!", "You clicked an action.", null, "OK", null).Show(); // return false so that the browser doesn't try to navigate return false; } } // if we got here, it's not a link we want to handle return true; }
protected override bool ShouldStartLoad(NSUrlRequest request, UIWebViewNavigationType navigationType) { try { if (navigationType == UIWebViewNavigationType.LinkClicked) { if (request.Url.ToString().Substring(0, 7).Equals("wiki://")) { GoToPage(request.Url.ToString().Substring(7)); return false; } } } catch { } return base.ShouldStartLoad(request, navigationType); }
/// <summary> /// In order to listen to events, we need to handle the ShouldStartLoad event. If /// it's an event that we want to handle ourselves, rather than having the web view /// do it, we need to return false, so that the navigation doesn't happen. in this /// particular case we are checking for links that have //LOCAL/Action='whateverAction' /// </summary> public bool HandleStartLoad (UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { Console.WriteLine (navigationType.ToString ()); // first, we check to see if it's a link if (navigationType == UIWebViewNavigationType.LinkClicked) { // next, we check to see if it's a link with //LOCAL in it. // note: up to iOS 5.1.1 the URL would start with "file://LOCAL" but later releases returns "file://local" const string prefix = "file://local"; if (String.Compare (request.Url.RelativeString, 0, prefix, 0, prefix.Length, StringComparison.InvariantCultureIgnoreCase) == 0) { new UIAlertView ("Action!", "You clicked an action.", null, "OK", null).Show(); // return false so that the browser doesn't try to navigate return false; } } // if we got here, it's not a link we want to handle return true; }
protected override bool ShouldStartLoad(NSUrlRequest request, UIWebViewNavigationType navigationType) { var url = request.Url; if(url != null && url.Scheme.Equals("app")) { var func = url.Host; if (func.Equals("ready")) { _domLoaded = true; foreach (var e in _toBeExecuted) Web.EvaluateJavascript(e); } else if(func.Equals("comment")) { var commentModel = JsonConvert.DeserializeObject<JavascriptCommentModel>(UrlDecode(url.Fragment)); PromptForComment(commentModel); } return false; } return base.ShouldStartLoad(request, navigationType); }
private bool ShouldStartHandler(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navType) { //If we use external browser //and if the user clicked a link in the view if (navType == UIWebViewNavigationType.LinkClicked) { UIApplication.SharedApplication.OpenUrl(request.Url); //To open return false; } return true; }
/// <summary> /// Allow links inside tweets to be viewed in a UIWebView /// </summary> public override bool ShouldStartLoad (UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { if (navigationType == UIWebViewNavigationType.LinkClicked) { if (AppDelegate.IsPhone) tweetScreen.NavigationController.PushViewController (new WebViewController (request), true); else tweetScreen.PresentModalViewController (new WebViewController(request), true); return false; } return true; }
public override bool ShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { if (navigationType == UIWebViewNavigationType.LinkClicked) { string path = request.Url.Path.Substring(1); string host = request.Url.Host.ToLower (); if (host == "tweet.monkeyspace.app") { var tweet = new TWTweetComposeViewController(); tweet.SetInitialText ("@" + path + " " + MonkeySpace.Core.Constants.TwitterHashTag); viewController.PresentModalViewController(tweet, true); } else if (host == "twitter.monkeyspace.app") { var nsurl = new NSUrl("twitter://user?screen_name="+viewController.speaker.TwitterHandle); UIApplication.SharedApplication.OpenUrl (nsurl); } else if (host == "session.monkeyspace.app") { if (sessVC == null) sessVC = new SessionViewController (path); else sessVC.Update (path); viewController.NavigationController.PushViewController (sessVC, true); } else { viewController.NavigationController.PushViewController (new WebViewController (request), true); return false; } } return true; }
public override bool ShouldStartLoad (UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { _loadStarted (request); return true; }
public override bool ShouldStartLoad (UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { var nsUrl = request.Url; if (nsUrl != null && !controller.authenticator.HasCompleted) { Uri url; if (Uri.TryCreate (nsUrl.AbsoluteString, UriKind.Absolute, out url)) { controller.authenticator.OnPageLoading (url); } } return true; }
public override bool ShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { if (!request.Url.AbsoluteUrl.ToString ().StartsWith (callbackUrl)) { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; return true; } var oauthVerifier = request.Url.Query.Split ('&') .Where (s => s.Split ('=') [0] == "oauth_verifier") .Select (s => s.Split ('=') [1]) .FirstOrDefault (); if (string.IsNullOrEmpty (oauthVerifier)) { Console.WriteLine ("Unable to find Verifier code in uri: " + request.Url.AbsoluteUrl); UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; return true; } var flickr = FlickrManager.GetInstance (); flickr.OAuthGetAccessTokenAsync (requestToken, oauthVerifier, r => { if (r.Error != null) { Console.WriteLine ("An error occurred getting access token: " + r.Error.Message); return; } OAuthAccessToken accessToken = r.Result; FlickrManager.OAuthToken = accessToken.Token; FlickrManager.OAuthTokenSecret = accessToken.TokenSecret; InvokeOnMainThread (() => { _avc.AuthenticationCompleted (accessToken.Token); }); }); return false; }
bool HandleShouldStartLoad (UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { var scheme = "hybrid:"; // If the URL is not our own custom scheme, just let the webView load the URL as usual if (request.Url.Scheme != scheme.Replace(":", "")) return true; // This handler will treat everything between the protocol and "?" // as the method name. The querystring has all of the parameters. var resources = request.Url.ResourceSpecifier.Split('?'); var method = resources [0]; var parameters = System.Web.HttpUtility.ParseQueryString(resources[1]); // breaks if ? not present (ie no params) if (method == "") { var template = new TodoView () { Model = new TodoItem() }; var page = template.GenerateString (); webView.LoadHtmlString (page, NSBundle.MainBundle.BundleUrl); } else if (method == "ViewTask") { var id = parameters ["todoid"]; var model = App.Database.GetItem (Convert.ToInt32 (id)); var template = new TodoView () { Model = model }; var page = template.GenerateString (); webView.LoadHtmlString (page, NSBundle.MainBundle.BundleUrl); } else if (method == "TweetAll") { var todos = App.Database.GetItemsNotDone (); var totweet = ""; foreach (var t in todos) totweet += t.Name + ","; if (totweet == "") totweet = "there are no tasks to tweet"; else totweet = "Still do to:" + totweet; var tweetController = new TWTweetComposeViewController (); tweetController.SetInitialText (totweet); PresentViewController (tweetController, true, null); } else if (method == "TextAll") { if (MFMessageComposeViewController.CanSendText) { var todos = App.Database.GetItemsNotDone (); var totext = ""; foreach (var t in todos) totext += t.Name + ","; if (totext == "") totext = "there are no tasks to text"; MFMessageComposeViewController message = new MFMessageComposeViewController (); message.Finished += (sender, e) => { e.Controller.DismissViewController (true, null); }; //message.Recipients = new string[] { receiver }; message.Body = totext; PresentViewController (message, true, null); } else { new UIAlertView ("Sorry", "Cannot text from this device", null, "OK", null).Show (); } } else if (method == "TodoView") { // the editing form var button = parameters ["Button"]; if (button == "Save") { var id = parameters ["id"]; var name = parameters ["name"]; var notes = parameters ["notes"]; var done = parameters ["done"]; var todo = new TodoItem { ID = Convert.ToInt32 (id), Name = name, Notes = notes, Done = (done == "on") }; App.Database.SaveItem (todo); NavigationController.PopToRootViewController (true); } else if (button == "Delete") { var id = parameters ["id"]; App.Database.DeleteItem (Convert.ToInt32 (id)); NavigationController.PopToRootViewController (true); } else if (button == "Cancel") { NavigationController.PopToRootViewController (true); } else if (button == "Speak") { var name = parameters ["name"]; var notes = parameters ["notes"]; Speech.Speak (name + " " + notes); } } return false; }
protected override bool ShouldStartLoad(NSUrlRequest request, UIWebViewNavigationType navigationType) { var url = request.Url; if(url.Scheme.Equals("app")) { var func = url.Host; if(func.Equals("comment")) { var r = new RestSharp.Deserializers.JsonDeserializer().Deserialize<CreateChangesetCommentModel>(new RestSharp.RestResponse { Content = Decode(url.Fragment) }); AddComment(r); return false; } } return base.ShouldStartLoad(request, navigationType); }