public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation) { var rurl = new Rivets.AppLinkUrl (url.ToString ()); var id = string.Empty; if (rurl.InputQueryParameters.ContainsKey("id")) id = rurl.InputQueryParameters ["id"]; if (rurl.InputUrl.Host.Equals ("products") && !string.IsNullOrEmpty (id)) { var c = new ProductViewController (id, rurl.Referrer); navController.PushViewController (c, true); return true; } else { navController.PopToRootViewController (true); return true; } }
public MainViewController() : base(UITableViewStyle.Grouped, null) { Root = new RootElement("Rivets Sample") { new Section() { new StyledStringElement("Show Product: widget", () => { productViewController = new ProductViewController("widget"); NavigationController.PushViewController(productViewController, true); }), new StyledStringElement("App Link to widget", async() => { var url = "https://rawgit.com/Redth/Rivets/master/Rivets.Tests/Html/SimpleiOSMetaData.html"; var result = await Rivets.AppLinks.Navigator.Navigate(url); Console.WriteLine(result); }), new StyledStringElement("App Link to widget with Referer", async() => { var url = "https://rawgit.com/Redth/Rivets/master/Rivets.Tests/Html/SimpleiOSMetaData.html"; var referer = new Rivets.RefererAppLink { TargetUrl = new Uri(url), Url = new Uri("example://"), AppName = "Example Store" }; var result = await Rivets.AppLinks.Navigator.Navigate(url, referer); Console.WriteLine(result); }), new StyledStringElement("Web Fallback Link", async() => { var url = "https://rawgit.com/Redth/Rivets/master/Rivets.Tests/Html/WebFallbackMetaData.html"; var result = await Rivets.AppLinks.Navigator.Navigate(url); Console.WriteLine(result); }) }, }; }
public MainViewController() : base(UITableViewStyle.Grouped, null) { Root = new RootElement ("Rivets Sample") { new Section () { new StyledStringElement("Show Product: widget", () => { productViewController = new ProductViewController("widget"); NavigationController.PushViewController(productViewController, true); }), new StyledStringElement("App Link to widget", async () => { var url = "https://rawgit.com/Redth/Rivets/master/Rivets.Tests/Html/SimpleiOSMetaData.html"; var result = await Rivets.AppLinks.Navigator.Navigate(url); Console.WriteLine(result); }), new StyledStringElement("App Link to widget with Referer", async () => { var url = "https://rawgit.com/Redth/Rivets/master/Rivets.Tests/Html/SimpleiOSMetaData.html"; var referer = new Rivets.RefererAppLink { TargetUrl = new Uri(url), Url = new Uri("example://"), AppName = "Example Store" }; var result = await Rivets.AppLinks.Navigator.Navigate(url, referer); Console.WriteLine(result); }), new StyledStringElement("Web Fallback Link", async () => { var url = "https://rawgit.com/Redth/Rivets/master/Rivets.Tests/Html/WebFallbackMetaData.html"; var result = await Rivets.AppLinks.Navigator.Navigate(url); Console.WriteLine(result); }) }, }; }
public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation) { var rurl = new Rivets.AppLinkUrl(url.ToString()); var id = string.Empty; if (rurl.InputQueryParameters.ContainsKey("id")) { id = rurl.InputQueryParameters ["id"]; } if (rurl.InputUrl.Host.Equals("products") && !string.IsNullOrEmpty(id)) { var c = new ProductViewController(id, rurl.Referrer); navController.PushViewController(c, true); return(true); } else { navController.PopToRootViewController(true); return(true); } }