private void workflowSelected(SiriWorkflow workflow) { var path = pathForWorkflow(workflow); var escapedPath = ((NSString)path).CreateStringByAddingPercentEncoding(NSUrlUtilities_NSCharacterSet .UrlQueryAllowedCharacterSet); var url = new NSUrl(escapedPath); if (!UIApplication.SharedApplication.CanOpenUrl(url)) { var alert = UIAlertController.Create(Resources.CantOpenWorkflowTitle, Resources.CantOpenWorkflowDescription, UIAlertControllerStyle.Alert); alert.AddAction(UIAlertAction.Create(Resources.Cancel, UIAlertActionStyle.Cancel, null)); alert.AddAction(UIAlertAction.Create(Resources.Download, UIAlertActionStyle.Default, (obj) => { UIApplication.SharedApplication.OpenUrl(new NSUrl("https://itunes.apple.com/app/shortcuts/id915249334")); })); PresentViewController(alert, true, null); return; } UIApplication.SharedApplication.OpenUrl(url); }
private string pathForWorkflow(SiriWorkflow workflow) { return($"shortcuts://import-workflow?url={baseURL}{workflow.FileName}&name={workflow.Title}"); }