// Called on the main thread after the NSUserActivity object is available. // Use the data you stored in the NSUserActivity object to re-create what the user was doing. // You can create/fetch any restorable objects associated with the user activity, and pass them to the restorationHandler. public override bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { var vc = PrimaryViewController; vc.HandleUserActivity (userActivity); completionHandler(new NSObject[]{ NavigationController, vc}); return true; }
public override bool ContinueUserActivity (UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { if (userActivity.ActivityType == CSSearchableItem.ActionType) { #region Spotlight var uuid = userActivity.UserInfo.ObjectForKey (CSSearchableItem.ActivityIdentifier); Xamarin.Insights.Track("SearchResult", new Dictionary<string, string> { {"Type", "CoreSpotlight"} }); System.Console.WriteLine ("Show the page for " + uuid); var restaurantName = SearchModel.Lookup (uuid.ToString ()); System.Console.WriteLine ("which is " + restaurantName); MessagingCenter.Send<RestaurantGuide.App, string> (App.Current as RestaurantGuide.App, "show", restaurantName); #endregion } else { #region NSUserActivity // dang it, the userInfo is blank unless I hack the UserActivity_iOS.Start() method // https://forums.developer.apple.com/thread/9690 if (userActivity.ActivityType == ActivityTypes.View) { Xamarin.Insights.Track("SearchResult", new Dictionary<string, string> { {"Type", "NSUserActivity"} }); var uid = "0"; if (userActivity.UserInfo.Count == 0) { // new item } else { uid = userActivity.UserInfo.ObjectForKey (ActivityKeys.Id).ToString (); if (uid == "0") { Console.WriteLine ("No userinfo found for " + ActivityTypes.View); } else { Console.WriteLine ("Should display id " + uid); // handled in DetailViewController.RestoreUserActivityState } } ContinueNavigation (uid); } if (userActivity.ActivityType == CSSearchableItem.ActionType) { Xamarin.Insights.Track("SearchResult", new Dictionary<string, string> { {"Type", "CoreSpotlight"} }); var uid = userActivity.UserInfo.ObjectForKey (CSSearchableItem.ActivityIdentifier).ToString(); System.Console.WriteLine ("Show the detail for id:" + uid); ContinueNavigation (uid); } completionHandler(null); // TODO: display UI in Forms somehow #endregion } return true; }
public override bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { if (userActivity.ActivityType == CSSearchableItem.ActionType) { string id = userActivity.UserInfo.ObjectForKey (CSSearchableItem.ActivityIdentifier).ToString (); if (!string.IsNullOrEmpty (id)) { MessagingCenter.Send<CoreSpotlightSearch.App, string> (Xamarin.Forms.Application.Current as CoreSpotlightSearch.App, "ShowItem", id); } } return true; }
public override bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { if (userActivity.ActivityType == ActivityTypes.View) { string id = userActivity.UserInfo.ObjectForKey (new NSString ("Id")).ToString (); if (!string.IsNullOrWhiteSpace (id)) { MessagingCenter.Send<NSUserActivitySearch.App, string> (Xamarin.Forms.Application.Current as NSUserActivitySearch.App, "ShowItem", id); } } return true; }
public override bool ContinueUserActivity (UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { /// Get any properties we want from UserInfo dictionary. string vin = userActivity.UserInfo ["VIN"].ToString (); /// Trigger event HandoffOccurred?.Invoke (this, new HandoffArgs (vin)); return true; }
public override bool ContinueUserActivity (UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { switch (userActivity.ActivityType) { case "com.micjames.beerdrinkin.mybeers": break; case "com.micjames.beerdrinkin.wishlist": break; case "com.micjames.beerdrinkin.search": break; case "com.micjames.beerdrinkin.profile": break; case "com.micjames.beerdrinkin.beerdetails": var info = userActivity.UserInfo; if (this.Window.RootViewController.ChildViewControllers[0] is UITabBarController) { var tabController = this.Window.RootViewController.ChildViewControllers[0] as UITabBarController; tabController.SelectedIndex = 2; var beerItem = new BeerItem(); var id = new NSObject(); info.TryGetValue(new NSString("id"), out id); var name = new NSObject(); info.TryGetValue(new NSString("name"), out name); var description = new NSObject(); info.TryGetValue(new NSString("description"), out description); var imageUrl = new NSObject(); info.TryGetValue(new NSString("imageUrl"), out imageUrl); var breweryDbId = new NSObject(); info.TryGetValue(new NSString("breweryDbId"), out breweryDbId); beerItem.Name = name.ToString(); beerItem.Description = description.ToString(); beerItem.ImageMedium = imageUrl.ToString(); beerItem.BreweryDbId = breweryDbId.ToString(); if (!string.IsNullOrEmpty(beerItem.BreweryDbId)) { var storyboard = UIStoryboard.FromName("Main", null); var vc = storyboard.InstantiateViewController ("beerDescriptionTableView") as BeerDescriptionTableView; vc.SetBeer (beerItem); var navigationControler = tabController.SelectedViewController as UINavigationController; navigationControler.PushViewController (vc, true); } } break; } return true; }
public override bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { //TODO Complete loading the beer - This is part of iOS 9 integration. var userInfo = userActivity.UserInfo; var beerID = userInfo.ValueForKey(new NSString("kCSSearchableItemActivityIdentifier")); Console.WriteLine(beerID); Window.RestoreUserActivityState(userActivity); return true; }
public override bool ContinueUserActivity (UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { // Take action based on the activity type switch (userActivity.ActivityType) { case "com.appracatappra.askquestion": // Pass question to Eliza to answer Controller.AskQuestion (userActivity.UserInfo.ValueForKey (new NSString ("question")).ToString(), true); break; } // Inform system this is handled return true; }
public override bool ContinueUserActivity (UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { if (userActivity.ActivityType == CSSearchableItem.ActionType) { var uuid = userActivity.UserInfo.ObjectForKey (CSSearchableItem.ActivityIdentifier); System.Console.WriteLine ("Show the page for " + uuid); var restaurantName = SearchModel.Lookup (uuid.ToString()); System.Console.WriteLine ("which is " + restaurantName); MessagingCenter.Send<RestaurantGuide.App, string> (App.Current as RestaurantGuide.App, "show", restaurantName); } return true; }
// http://www.raywenderlich.com/84174/ios-8-handoff-tutorial public override bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { Console.WriteLine ("ffffffff ContinueUserActivity"); UIViewController tvc = null; // NSUserActivity if ((userActivity.ActivityType == ActivityTypes.Add) || (userActivity.ActivityType == ActivityTypes.Detail)) { if (userActivity.UserInfo.Count == 0) { // new item } else { var uid = userActivity.UserInfo.ObjectForKey ((NSString)"id").ToString (); if (uid == "0") { Console.WriteLine ("No userinfo found for " + ActivityTypes.Detail); } else { Console.WriteLine ("Should display id " + uid); // handled in DetailViewController.RestoreUserActivityState } } tvc = ContinueNavigation (); Insights.Track("SearchResult", new Dictionary<string, string> { {"Type", "NSUserActivity"} }); } // CoreSpotlight if (userActivity.ActivityType == CSSearchableItem.ActionType) { var uid = userActivity.UserInfo.ObjectForKey (CSSearchableItem.ActivityIdentifier).ToString(); System.Console.WriteLine ("Show the detail for id:" + uid); tvc = ContinueNavigation (); Insights.Track("SearchResult", new Dictionary<string, string> { {"Type", "CoreSpotlight"} }); } completionHandler(new NSObject[] {tvc}); return true; }
/// <returns>To be added.</returns> /// <summary> /// Continues the user activity. /// </summary> /// <param name="application">Application.</param> /// <param name="userActivity">User activity.</param> /// /// <param name="completionHandler">Completion Handler.</param> public override bool ContinueUserActivity (UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { // Report Activity Console.WriteLine ("Continuing User Activity: {0}", userActivity.ToString()); // Get input and output streams from the Activity userActivity.GetContinuationStreams ((NSInputStream arg1, NSOutputStream arg2, NSError arg3) => { // Send required data via the streams // ... }); // Take action based on the Activity type switch (userActivity.ActivityType) { case "com.xamarin.monkeybrowser.tab1": // Preform handoff Tab1.PerformHandoff (userActivity); completionHandler (new NSObject[]{Tab1}); break; case "com.xamarin.monkeybrowser.tab2": // Preform handoff Tab2.PerformHandoff (userActivity); completionHandler (new NSObject[]{Tab2}); break; case "com.xamarin.monkeybrowser.tab3": // Preform handoff Tab3.PerformHandoff (userActivity); completionHandler (new NSObject[]{Tab3}); break; case "com.xamarin.monkeybrowser.tab4": // Preform handoff Tab4.PerformHandoff (userActivity); completionHandler (new NSObject[]{Tab4}); break; } // Inform system we handled this return true; }
public override bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) => TryHandleUniversalLinkFromUserActivity(userActivity);
public override bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { NSObject idObj; if (!userActivity.UserInfo.TryGetValue(new NSString("kCSSearchableItemActivityIdentifier"), out idObj)) { return(false); } var id = idObj.ToString(); PlaybackManager.Shared.PlaySong(id); return(true); }
// http://www.raywenderlich.com/84174/ios-8-handoff-tutorial public override bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { Console.WriteLine("ffffffff ContinueUserActivity"); UIViewController tvc = null; // NSUserActivity if ((userActivity.ActivityType == ActivityTypes.Add) || (userActivity.ActivityType == ActivityTypes.Detail)) { if (userActivity.UserInfo.Count == 0) { // new item } else { var uid = userActivity.UserInfo.ObjectForKey((NSString)"id").ToString(); if (uid == "0") { Console.WriteLine("No userinfo found for " + ActivityTypes.Detail); } else { Console.WriteLine("Should display id " + uid); // handled in DetailViewController.RestoreUserActivityState } } tvc = ContinueNavigation(); } // CoreSpotlight if (userActivity.ActivityType == CSSearchableItem.ActionType) { var uid = userActivity.UserInfo.ObjectForKey (CSSearchableItem.ActivityIdentifier).ToString(); System.Console.WriteLine("Show the detail for id:" + uid); tvc = ContinueNavigation(); } completionHandler(new NSObject[] { tvc }); return(true); }
public override bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { completionHandler (new [] { this.Window.RootViewController }); return true; }
//for when a user finds a goal via spotlight public override bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { SpotlightManager.HandleUserActivity(application, userActivity); return true; }
// Called on the main thread after the NSUserActivity object is available. // Use the data you stored in the NSUserActivity object to re-create what the user was doing. // You can create/fetch any restorable objects associated with the user activity, and pass them to the restorationHandler. public override bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { var vc = PrimaryViewController; vc.HandleUserActivity(userActivity); completionHandler(new NSObject[] { NavigationController, vc }); return(true); }
public static bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) => WebAuthenticator.OpenUrl(new Uri(userActivity?.WebPageUrl?.AbsoluteString));
public override bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { CheckForAppLink(userActivity); return true; }
public override bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { CheckForAppLink(userActivity); return(true); }
public override bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { Console.WriteLine("ContinueUserActivity called, App is being passed a task."); return(base.ContinueUserActivity(application, userActivity, completionHandler)); }
public override bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { if (Xamarin.Essentials.Platform.ContinueUserActivity(application, userActivity, completionHandler)) { return(true); } return(base.ContinueUserActivity(application, userActivity, completionHandler)); }
public override bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { return(BranchIOS.getInstance().ContinueUserActivity(userActivity)); }
public override bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { if (userActivity.ActivityType == NSUserActivityType.BrowsingWeb) { Console.WriteLine(userActivity.WebPageUrl.AbsoluteString); var detailsVC = new DetailsViewController { Gizmo = new Gizmo { Id = "Special", Name = "Universal Link Gizmo" } }; navController.PushViewController(detailsVC, true); } return(true); }
public override bool ContinueUserActivity (UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { var settingsService = ServiceLocator.Current.GetInstance<ISettingsService> (); var schedulesService = ServiceLocator.Current.GetInstance<ISchedulesService> (); if (userActivity.ActivityType == CSSearchableItem.ActionType) { var tabController = this.Window.RootViewController as UITabBarController; var navController = tabController.ViewControllers [0] as UINavigationController; var identifier = userActivity?.UserInfo?.ObjectForKey (CSSearchableItem.ActivityIdentifier); if (identifier != null && identifier.ToString ().Contains ("|\\/|")) { // This is a session or a speaker var parts = identifier.ToString ().Split (new [] { "|\\/|" }, StringSplitOptions.RemoveEmptyEntries); if (parts.Length == 2) { //This is a session var conferenceSlug = parts [0]; var sessionSlug = parts [1]; var conferencesViewModel = Application.Locator.Conferences; var task = Task.Run (async () => { await conferencesViewModel.LoadConferences (Priority.Explicit); }); task.Wait (); var conference = conferencesViewModel.Conferences.Single (c => c.Slug == conferenceSlug); var session = conference.Sessions.Single (s => s.Slug == sessionSlug); var conferenceVm = new ConferenceDetailViewModel (conference, schedulesService, settingsService); var sessionVm = new SessionDetailViewModel (session, conference.Name); Application.Locator.Conference = conferenceVm; Application.Locator.Session = sessionVm; var storyboard = UIStoryboard.FromName ("Main", null); var conferencesViewController = storyboard.InstantiateViewController ("ConferencesViewController") as ConferencesViewController; var conferenceDetailViewController = storyboard.InstantiateViewController ("ConferenceDetailViewController") as ConferenceDetailViewController; var sessionsViewController = storyboard.InstantiateViewController ("SessionsViewController") as SessionsViewController; var sessionDetailViewController = storyboard.InstantiateViewController ("SessionDetailViewController"); navController.SetViewControllers (new UIViewController[] { conferencesViewController, conferenceDetailViewController, sessionsViewController, sessionDetailViewController }, animated: false); } else if (parts.Length == 3) { //This is a speaker var conferenceSlug = parts [0]; var sessionSlug = parts [1]; var speakerSlug = parts [2]; var conferencesViewModel = Application.Locator.Conferences; var task = Task.Run (async () => { await conferencesViewModel.LoadConferences (Priority.Explicit); }); task.Wait (); var conference = conferencesViewModel.Conferences.Single (c => c.Slug == conferenceSlug); var session = conference.Sessions.Single (s => s.Slug == sessionSlug); var speaker = session.Speakers.Single (s => s.Slug == speakerSlug); var conferenceVm = new ConferenceDetailViewModel (conference, schedulesService, settingsService); var sessionVm = new SessionDetailViewModel (session, conference.Name); var speakerVm = new SpeakerDetailViewModel (session, speaker); Application.Locator.Conference = conferenceVm; Application.Locator.Session = sessionVm; Application.Locator.Speaker = speakerVm; var storyboard = UIStoryboard.FromName ("Main", null); var conferencesViewController = storyboard.InstantiateViewController ("ConferencesViewController") as ConferencesViewController; var conferenceDetailViewController = storyboard.InstantiateViewController ("ConferenceDetailViewController") as ConferenceDetailViewController; var sessionsViewController = storyboard.InstantiateViewController ("SessionsViewController") as SessionsViewController; var sessionDetailViewController = storyboard.InstantiateViewController ("SessionDetailViewController"); var speakerDetailViewController = storyboard.InstantiateViewController ("SpeakerDetailViewController"); navController.SetViewControllers (new UIViewController[] { conferencesViewController, conferenceDetailViewController, sessionsViewController, sessionDetailViewController, speakerDetailViewController }, animated: false); } } else { // This is a conference var conferenceSlug = identifier.ToString (); var conferencesViewModel = Application.Locator.Conferences; var task = Task.Run (async () => { await conferencesViewModel.LoadConferences (Priority.Explicit); }); task.Wait (); var conference = conferencesViewModel.Conferences.Single (c => c.Slug == conferenceSlug); var vm = new ConferenceDetailViewModel (conference, schedulesService, settingsService); Application.Locator.Conference = vm; var storyboard = UIStoryboard.FromName ("Main", null); var conferenceDetailViewController = storyboard.InstantiateViewController ("ConferenceDetailViewController") as ConferenceDetailViewController; ; navController.SetViewControllers (new UIViewController[] { conferenceDetailViewController }, animated: false); } } return true; }
public override bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { var intent = userActivity.GetInteraction()?.Intent as OrderSoupIntent; if (!(intent is null)) { HandleIntent(intent); return(true); }