Ejemplo n.º 1
0
        public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem)
        {
            Console.WriteLine("eeeeeeeeeee HandleShortcutItem ");
            var handled = false;

            // Anything to process?
            if (shortcutItem == null)
            {
                return(false);
            }

            // Take action based on the shortcut type
            switch (shortcutItem.Type)
            {
            case RestaurantGuide.iOS.ShortcutHelper.ShortcutIdentifiers.Random:
                Console.WriteLine("QUICKACTION: Choose Random Restaurant");

                //HACK: show the detail with a random restaurant showing
                ContinueNavigation("-1");

                handled = true;
                break;
            }

            Console.Write(handled);
            // Return results
            return(handled);
        }
Ejemplo n.º 2
0
 public override void PerformActionForShortcutItem(UIApplication application,
                                                   UIApplicationShortcutItem shortcutItem,
                                                   UIOperationHandler completionHandler)
 {
     // Store the fact that we've signed in. This is where the shortcuts get their notifications.
     // Look at the Info.plist file for more info
 }
Ejemplo n.º 3
0
        public override void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler)
        {
            IosDependencyContainer.Instance
            .AnalyticsService
            .ApplicationShortcut
            .Track(shortcutItem.LocalizedTitle);

            var shortcutUrlKey = new NSString(nameof(ApplicationShortcut.Url));

            if (!shortcutItem.UserInfo.ContainsKey(shortcutUrlKey))
            {
                return;
            }

            var shortcutUrlString = shortcutItem.UserInfo[shortcutUrlKey] as NSString;

            if (shortcutUrlString == null)
            {
                return;
            }

            var shortcutUrl = new NSUrl(shortcutUrlString);

            handleDeeplink(shortcutUrl);
        }
Ejemplo n.º 4
0
        public override void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler)
        {
            analyticsService.TrackAppShortcut(shortcutItem.LocalizedTitle);

            var shortcutType = (ShortcutType)(int)(NSNumber)shortcutItem.UserInfo[nameof(ApplicationShortcut.Type)];

            switch (shortcutType)
            {
            case ShortcutType.ContinueLastTimeEntry:
                var interactorFactory = Mvx.Resolve <IInteractorFactory>();
                if (interactorFactory == null)
                {
                    return;
                }
                IDisposable subscription = null;
                subscription = interactorFactory
                               .ContinueMostRecentTimeEntry()
                               .Execute()
                               .Subscribe(_ =>
                {
                    subscription.Dispose();
                    subscription = null;
                });
                break;

            case ShortcutType.Reports:
                navigationService.Navigate <ReportsViewModel>();
                break;

            case ShortcutType.StartTimeEntry:
                navigationService.Navigate <StartTimeEntryViewModel>();
                break;
            }
        }
Ejemplo n.º 5
0
        public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
        {
            var versionString = UIDevice.CurrentDevice.SystemVersion;
            systemVersion = Convert.ToInt32 ( versionString.Split ( new [] {"."}, StringSplitOptions.None)[0]);

            // Component initialisation.
            RegisterComponents ();

            // Setup Google sign in
            SetupGoogleServices ();

            Toggl.Ross.Theme.Style.Initialize ();

            // Start app
            window = new TogglWindow (UIScreen.MainScreen.Bounds);
            window.RootViewController = new MainViewController ();
            window.MakeKeyAndVisible ();

            // Make sure critical services are running are running:
            ServiceContainer.Resolve<UpgradeManger> ().TryUpgrade ();
            ServiceContainer.Resolve<ILoggerClient> ();
            ServiceContainer.Resolve<LoggerUserManager> ();
            ServiceContainer.Resolve<ITracker> ();
            ServiceContainer.Resolve<APNSManager> ();
            ServiceContainer.Resolve<QuickActions> ();

            if (launchOptions != null) {
                LaunchedShortcutItem = launchOptions [UIApplication.LaunchOptionsShortcutItemKey] as UIApplicationShortcutItem;
            }

            return LaunchedShortcutItem == null;
        }
Ejemplo n.º 6
0
 // if app is already running
 public override void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler)
 {
     Console.WriteLine("PerformActionForShortcutItem");
     // Perform action
     var handled = HandleShortcutItem(shortcutItem);
     completionHandler(handled);
 }
Ejemplo n.º 7
0
        public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem)
        {
            Console.WriteLine("eeeeeeeeeee HandleShortcutItem ");
            var handled = false;

            // Anything to process?
            if (shortcutItem == null)
            {
                return(false);
            }

            // Take action based on the shortcut type
            switch (shortcutItem.Type)
            {
            case ShortcutIdentifiers.Add:
                Console.WriteLine("QUICKACTION: Add new item");

                handled = true;
                break;

            case ShortcutIdentifiers.Share:
                Console.WriteLine("QUICKACTION: Share summary of items");
                handled = true;
                break;
            }

            //HACK: show the detail viewcontroller
            ContinueNavigation();

            Console.Write(handled);
            // Return results
            return(handled);
        }
        public override void PerformActionForShortcutItem(UIApplication application, 
			UIApplicationShortcutItem shortcutItem, 
			UIOperationHandler completionHandler)
        {
            // Store the fact that we've signed in. This is where the shortcuts get their notifications.
            // Look at the Info.plist file for more info
        }
Ejemplo n.º 9
0
        public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem)
        {
            var handled = false;

            // Anything to process?
            if (shortcutItem == null)
            {
                return(false);
            }

            // Take action based on the shortcut type
            switch (shortcutItem.Type)
            {
            case ShortcutIdentifier.StopCommand:
                MessagingCenter.Send(myApp, "StopCommand");
                handled = true;
                break;

            case ShortcutIdentifier.StartCommand:
                MessagingCenter.Send(myApp, "StartCommand");
                handled = true;
                break;
            }

            // Return results
            return(handled);
        }
Ejemplo n.º 10
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            var shouldPerformAdditionalDelegateHandling = true;

            // If a shortcut was launched, display its information and take the appropriate action
            if (launchOptions != null)
            {
                var shortcutItem = launchOptions [UIApplication.LaunchOptionsShortcutItemKey] as UIApplicationShortcutItem;
                if (shortcutItem != null)
                {
                    launchedShortcutItem = shortcutItem;

                    // This will block "performActionForShortcutItem:completionHandler" from being called.
                    shouldPerformAdditionalDelegateHandling = false;
                }
            }

            // Install initial verstions of our two extra dynamic shortcuts.
            // Update the application providing the initial 'dynamic' shortcut items.
            if (application.ShortcutItems.Length == 0)
            {
                application.ShortcutItems = new [] { CreatePlayShortcut(), CreatePauseShortcut() }
            }
            ;

            return(shouldPerformAdditionalDelegateHandling);
        }
Ejemplo n.º 11
0
 public override void OnActivated(UIApplication application)
 {
     PlaybackManager.Shared.NativePlayer.EnableVideo();
     HandleShortcut(LaunchedShortcutItem);
     LaunchedShortcutItem = null;
     ScreenManager.Shared.OnActivated();
 }
Ejemplo n.º 12
0
        public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem)
        {
            var handled = false;

            // Anything to process?
            if (shortcutItem == null)
            {
                return(false);
            }

            // Take action based on the shortcut type
            switch (shortcutItem.Type)
            {
            case "com.ellyfield.compasspro.000":
                Handler.magnetic = true;
                //Console.WriteLine("First shortcut selected");
                handled = true;
                break;

            case "com.ellyfield.compasspro.001":
                Handler.magnetic = false;
                //Console.WriteLine("Second shortcut selected");
                handled = true;
                break;

            case "com.ellyfield.compasspro.002":
                //Console.WriteLine("Second shortcut selected");
                Handler.share();
                handled = true;
                break;
            }

            // Return results
            return(handled);
        }
Ejemplo n.º 13
0
        public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem)
        {
            Console.WriteLine("HandleShortcutItem ");
            var handled = false;

            // Anything to process?
            if (shortcutItem == null)
            {
                return(false);
            }

            // Take action based on the shortcut type
            switch (shortcutItem.Type)
            {
            case ShortcutIdentifier.Schedule:
                Console.WriteLine("QUICKACTION: Schedule");
                ContinueNavigation(AppPage.Schedule);
                handled = true;
                break;

            case ShortcutIdentifier.Lunch:
                Console.WriteLine("QUICKACTION: Lunch Locations");
                ContinueNavigation(AppPage.LunchLocations);
                handled = true;
                break;
            }

            Console.Write(handled);
            // Return results
            return(handled);
        }
Ejemplo n.º 14
0
 // if app is already running
 public override void PerformActionForShortcutItem (UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler)
 {
     Console.WriteLine ("dddddddd PerformActionForShortcutItem");
     // Perform action
     var handled = HandleShortcutItem(shortcutItem);
     completionHandler(handled);
 }
Ejemplo n.º 15
0
        bool HandleShortCutItem(UIApplicationShortcutItem shortcutItem)
        {
            // Verify that the provided `shortcutItem`'s `type` is one handled by the application.
            var shortcutIdentifier = ShortcutIdentifier.Create(shortcutItem.Type);

            if (shortcutIdentifier == null)
            {
                return(false);
            }

            // Construct an alert using the details of the shortcut used to open the application.
            var alertController = UIAlertController.Create("Shortcut Handled", shortcutItem.LocalizedTitle, UIAlertControllerStyle.Alert);
            var okAction        = UIAlertAction.Create("OK", UIAlertActionStyle.Default, null);

            alertController.AddAction(okAction);

            // Display an alert indicating the shortcut selected from the home screen.
            var rootViewController = Window.RootViewController;

            if (rootViewController != null)
            {
                rootViewController.PresentViewController(alertController, true, null);
            }

            return(true);
        }
Ejemplo n.º 16
0
        public override void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler)
        {
            analyticsService.TrackAppShortcut(shortcutItem.LocalizedTitle);
            var url = shortcutItem.UserInfo[nameof(ApplicationShortcut.Url)].ToString();

            navigationService.Navigate(url);
        }
Ejemplo n.º 17
0
        bool HandleShortcut(UIApplicationShortcutItem shortcutItem)
        {
            if (shortcutItem == null)
            {
                return(false);
            }

            switch (shortcutItem.Type)
            {
            //play
            case "com.IIS.MusicPlayer.iOS.000":
                PlaybackManager.Shared.Play();
                return(true);

            case "com.IIS.MusicPlayer.iOS.001":

                var vm = new MusicPlayer.ViewModels.RadioStationViewModel {
                    IsIncluded = false
                };
                var items = vm.RowsInSection(0);
                if (items == 0)
                {
                    return(true);
                }
                var radio = vm.ItemFor(0, 0);
                Settings.ShowOfflineOnly = false;
                PlaybackManager.Shared.Play(radio);
                return(true);
            }

            return(false);
        }
Ejemplo n.º 18
0
		// Handle force touch shortcuts being clicked.
		public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem) {
			var handled = false;

			// Anything to process?
			if (shortcutItem == null)
				return false;

			// Take action based on the shortcut type
			switch (shortcutItem.Type) {
			case "edu.usf.smartlab.000":
				if (UIDevice.CurrentDevice.CheckSystemVersion(9,0)) {
					var sfViewCtrl = new SFSafariViewController (new NSUrl(Api.SCHEDULE_URL));
					this._Controller.PresentViewControllerAsync (sfViewCtrl, true);
				} else {
					UIApplication.SharedApplication.OpenUrl(new NSUrl(Api.SCHEDULE_URL));
				}
				handled = true;
				break;
			case "edu.usf.smartlab.001":
				this._Controller.NavigationController.PushViewController(new CalloutViewCtrl(), true);
				handled = true;
				break;
			}

			// Return results
			return handled;
		}
Ejemplo n.º 19
0
        public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem)
        {
            var handled = false;

            // Anything to process?
            if (shortcutItem == null)
            {
                return(false);
            }

            // Take action based on the shortcut type
            switch (shortcutItem.Type)
            {
            case ShortcutIdentifier.Continue:
                Console.WriteLine("Continue shortcut selected");
                handled = true;
                break;

            case ShortcutIdentifier.Search:
                Console.WriteLine("Search shortcut selected");
                handled = true;
                break;
            }

            // Return results
            return(handled);
        }
Ejemplo n.º 20
0
        public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem)
        {
            var handled = false;

            // Anything to process?
            if (shortcutItem == null)
            {
                return(false);
            }

            // Take action based on the shortcut type
            switch (shortcutItem.Type)
            {
            //TODO: Need to handle force touch menu options
            case ShortcutIdentifier.NewReport:
                //Handle New Report Force Touch
                Console.WriteLine("New Report Handle");
                handled = true;
                break;

            case ShortcutIdentifier.NewExpense:
                //Handle New Report Force Touch
                Console.WriteLine("New Expense Handle");
                handled = true;
                break;
            }

            // Return results
            return(handled);
        }
Ejemplo n.º 21
0
        internal static UIApplicationShortcutItem ToShortcutItem(this JumpListItem jumpListItem)
        {
            var dictionary = new Dictionary <string, string>()
            {
                { JumpListItem.UnoShortcutKey, "true" }
            };

            if (jumpListItem.Logo != null)
            {
                dictionary[JumpListItem.ImagePathKey] = jumpListItem.Logo.ToString();
            }

            var displayName = jumpListItem.DisplayName;

            if (string.IsNullOrEmpty(displayName))
            {
                displayName = " ";                 //use single space to make sure item is displayed
            }

            var shortcut =
                new UIApplicationShortcutItem(
                    jumpListItem.Arguments,
                    displayName,
                    jumpListItem.Description,
                    jumpListItem.Logo != null ? UIApplicationShortcutIcon.FromTemplateImageName(jumpListItem.Logo.LocalPath) : null,
                    NSDictionary <NSString, NSObject> .FromObjectsAndKeys(
                        dictionary.Values.Cast <object>().ToArray(),
                        dictionary.Keys.Cast <object>().ToArray()));

            return(shortcut);
        }
Ejemplo n.º 22
0
 internal static bool IsUnoShortcut(this UIApplicationShortcutItem shortcut)
 {
     if (shortcut == null)
     {
         throw new ArgumentNullException(nameof(shortcut));
     }
     return(shortcut.UserInfo?[JumpListItem.UnoShortcutKey] != null);
 }
Ejemplo n.º 23
0
        public override void OnActivated(UIApplication application)
        {
            // Handle any shortcut item being selected
            HandleShortcutItem(LaunchedShortcutItem);

            // Clear shortcut after it's been handled
            LaunchedShortcutItem = null;
        }
Ejemplo n.º 24
0
        private bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem)
        {
            if (shortcutItem == null)
            {
                return(false);
            }

            return((App.Current as App).ManageMenuAction(shortcutItem.Type));
        }
Ejemplo n.º 25
0
        public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem)
        {
            Console.WriteLine("HandleShortcutItem ");
            var handled = false;

            // Anything to process?
            if (shortcutItem == null)
                return false;


            // Take action based on the shortcut type
            switch (shortcutItem.Type)
            {
                case ShortcutIdentifier.Tweet:
                    Console.WriteLine("QUICKACTION: Tweet");
                    var slComposer = SLComposeViewController.FromService(SLServiceType.Twitter);
                    if (slComposer == null)
                    {
                        new UIAlertView("Unavailable", "Twitter is not available, please sign in on your devices settings screen.", null, "OK").Show();
                    }
                    else
                    {
                        slComposer.SetInitialText("#UtahOpenSource");
                        if (slComposer.EditButtonItem != null)
                        {
                            slComposer.EditButtonItem.TintColor = UIColor.FromRGB(118, 53, 235);
                        }
                        slComposer.CompletionHandler += (result) =>
                        {
                            InvokeOnMainThread(() => UIApplication.SharedApplication.KeyWindow.RootViewController.DismissViewController(true, null));
                        };
                        
                        UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewControllerAsync(slComposer, true);
                    }
                    handled = true;
                    break;
                case ShortcutIdentifier.Announcements:
                    Console.WriteLine("QUICKACTION: Accouncements");
                    ContinueNavigation(AppPage.Notification);
                    handled = true;
                    break;
                case ShortcutIdentifier.MiniHacks:
                    Console.WriteLine("QUICKACTION: MiniHacks");
                    ContinueNavigation(AppPage.MiniHacks);
                    handled = true;
                    break;
                case ShortcutIdentifier.Events:
                    Console.WriteLine("QUICKACTION: Events");
                    ContinueNavigation(AppPage.Events);
                    handled = true;
                    break;
            }

            Console.Write(handled);
            // Return results
            return handled;
        }
Ejemplo n.º 26
0
        public override void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler)
        {
            ShortcutAction?action = ConvertShortcutItem(shortcutItem);

            if (action != null)
            {
                HandleShortcutAction(action.Value);
            }
        }
Ejemplo n.º 27
0
        // Shourcut Plugin.AppShortcut
        public override void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler)
        {
            var uri = Plugin.AppShortcuts.iOS.ArgumentsHelper.GetUriFromApplicationShortcutItem(shortcutItem);

            if (uri != null)
            {
                Xamarin.Forms.Application.Current.SendOnAppLinkRequestReceived(uri);
            }
        }
        public override void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler)
        {
            base.PerformActionForShortcutItem(application, shortcutItem, completionHandler);

            if (_useDefaultConfiguration)
            {
                Xamarin.Essentials.Platform.PerformActionForShortcutItem(application, shortcutItem, completionHandler);
            }
        }
Ejemplo n.º 29
0
        public static void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler)
        {
            if (shortcutItem.Type == AppActions.Type)
            {
                var appAction = shortcutItem.ToAppAction();

                AppActions.InvokeOnAppAction(application, shortcutItem.ToAppAction());
            }
        }
Ejemplo n.º 30
0
        public void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler)
        {
            if (shortcutItem.Type == ShortcutType)
            {
                var appAction = shortcutItem.ToAppAction();

                AppActionActivated?.Invoke(null, new AppActionEventArgs(appAction));
            }
        }
Ejemplo n.º 31
0
		public override void OnActivated (UIApplication application)
		{
			var shortcut = launchedShortcutItem;
			if (shortcut == null)
				return;

			HandleShortCutItem (shortcut);
			launchedShortcutItem = null;
		}
        public static Uri GetUriFromApplicationShortcutItem(UIApplicationShortcutItem shortcutItem)
        {
            if (shortcutItem.UserInfo.ContainsKey(new NSString(ShortcutUriKey)))
            {
                var shortcutUri = shortcutItem.UserInfo[ShortcutUriKey].ToString();
                return(new Uri(shortcutUri));
            }

            return(null);
        }
Ejemplo n.º 33
0
        public override void OnActivated (UIApplication application)
        {
            Console.WriteLine ("ccccccc OnActivated");

            // Handle any shortcut item being selected
            HandleShortcutItem(LaunchedShortcutItem);

            // Clear shortcut after it's been handled
            LaunchedShortcutItem = null;
        }
Ejemplo n.º 34
0
 public override void PerformActionForShortcutItem(
     UIApplication application,
     UIApplicationShortcutItem shortcutItem,
     UIOperationHandler completionHandler)
 {
     if (!_preventSecondaryActivationHandling)
     {
         OnLaunched(new LaunchActivatedEventArgs(ActivationKind.Launch, shortcutItem.Type));
     }
     _preventSecondaryActivationHandling = false;
 }
Ejemplo n.º 35
0
        public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem)
        {
            var handled = false;

            // Anything to process?
            if (shortcutItem == null)
            {
                return(false);
            }

            // Take action based on the shortcut type
            switch (shortcutItem.Type)
            {
            case ShortcutIdentifier.MyBeers:
                if (this.Window.RootViewController.ChildViewControllers[0] is UITabBarController)
                {
                    var tabController = this.Window.RootViewController.ChildViewControllers[0] as UITabBarController;
                    tabController.SelectedIndex = 0;
                }
                handled = true;
                break;

            case ShortcutIdentifier.WishList:
                if (this.Window.RootViewController.ChildViewControllers[0] is UITabBarController)
                {
                    var tabController = this.Window.RootViewController.ChildViewControllers[0] as UITabBarController;
                    tabController.SelectedIndex = 1;
                }
                handled = true;
                break;

            case ShortcutIdentifier.Search:
                if (this.Window.RootViewController.ChildViewControllers[0] is UITabBarController)
                {
                    var tabController = this.Window.RootViewController.ChildViewControllers[0] as UITabBarController;
                    tabController.SelectedIndex = 2;
                }
                handled = true;
                break;

            case ShortcutIdentifier.Me:
                if (this.Window.RootViewController.ChildViewControllers[0] is UITabBarController)
                {
                    var tabController = this.Window.RootViewController.ChildViewControllers[0] as UITabBarController;
                    tabController.SelectedIndex = 3;
                }
                handled = true;
                break;
            }

            Console.Write(handled);
            // Return results
            return(handled);
        }
Ejemplo n.º 36
0
        public override void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler)
        {
            analyticsService.ApplicationShortcut.Track(shortcutItem.LocalizedTitle);

            var key = new NSString(nameof(ApplicationShortcut.Type));

            if (!shortcutItem.UserInfo.ContainsKey(key))
            {
                return;
            }

            var shortcutNumber = shortcutItem.UserInfo[key] as NSNumber;

            if (shortcutNumber == null)
            {
                return;
            }

            var shortcutType = (ShortcutType)(int)shortcutNumber;

            switch (shortcutType)
            {
            case ShortcutType.ContinueLastTimeEntry:
                navigationService.Navigate <MainViewModel>();
                var interactorFactory = IosDependencyContainer.Instance.InteractorFactory;
                if (interactorFactory == null)
                {
                    return;
                }
                IDisposable subscription = null;
                subscription = interactorFactory
                               .ContinueMostRecentTimeEntry()
                               .Execute()
                               .Subscribe(_ =>
                {
                    subscription.Dispose();
                    subscription = null;
                });
                break;

            case ShortcutType.Reports:
                navigationService.Navigate <ReportsViewModel>();
                break;

            case ShortcutType.StartTimeEntry:
                navigationService.Navigate <MainViewModel>();
                navigationService.Navigate <StartTimeEntryViewModel>();
                break;

            case ShortcutType.Calendar:
                navigationService.Navigate <CalendarViewModel>();
                break;
            }
        }
Ejemplo n.º 37
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Lets create some dynamic shortcut items
            var shortcuts = new List<UIApplicationShortcutItem> ();

            for (int counter = 1; counter <= 5; counter++) {
                var item = new UIApplicationShortcutItem ("com.xamarin.university.dynamicshortcutdemo", "Item " + counter);
                shortcuts.Add (item);
            }

            UIApplication.SharedApplication.ShortcutItems = shortcuts.ToArray ();

            return true;
        }
Ejemplo n.º 38
0
		bool HandleShortCutItem(UIApplicationShortcutItem shortcutItem)
		{
			// Verify that the provided `shortcutItem`'s `type` is one handled by the application.
			var shortcutIdentifier = ShortcutIdentifier.Create (shortcutItem.Type);
			if (shortcutIdentifier == null)
				return false;

			// Construct an alert using the details of the shortcut used to open the application.
			var alertController = UIAlertController.Create ("Shortcut Handled", shortcutItem.LocalizedTitle, UIAlertControllerStyle.Alert);
			var okAction = UIAlertAction.Create ("OK", UIAlertActionStyle.Default, null);
			alertController.AddAction (okAction);

			// Display an alert indicating the shortcut selected from the home screen.
			var rootViewController = Window.RootViewController;
			if (rootViewController != null)
				rootViewController.PresentViewController (alertController, true, null);

			return true;
		}
Ejemplo n.º 39
0
        public bool HandleShortcut (UIApplicationShortcutItem shortcut, bool shouldHandleAfterSync = false)
        {
            this.shouldHandleAfterSync = shouldHandleAfterSync;
            if (shortcut == null) {
                return true;
            }

            if (shouldHandleAfterSync) {
                scheduledShortcut = shortcut;
                return true;
            }

            if (shortcut.Type == QuickActionsIdentifier.QuickStart) {
                StartNewEntry ();
                return true;
            }

            return false;
        }
Ejemplo n.º 40
0
		public override async void PerformActionForShortcutItem (UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler)
		{
			try {
				await HandleShortcutItemAsync (shortcutItem);
			} catch (Exception ex) {
				Log.Error (ex);
			}
			try {
				completionHandler (true);
			} catch (Exception ex) {
				Log.Error (ex);
			}
		}
Ejemplo n.º 41
0
 public override void PerformActionForShortcutItem (UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler)
 {
     var quickActions = ServiceContainer.Resolve<QuickActions> ();
     completionHandler (quickActions.HandleShortcut (shortcutItem));
 }
Ejemplo n.º 42
0
        public override void OnActivated (UIApplication application)
        {
            // Make sure the user data is refreshed when the application becomes active
            ServiceContainer.Resolve<ISyncManager> ().Run ();
            ServiceContainer.Resolve<NetworkIndicatorManager> ();

            if (systemVersion > minVersionWidget) {
                ServiceContainer.Resolve<WidgetSyncManager>();
                var widgetService = ServiceContainer.Resolve<WidgetUpdateService>();
                widgetService.SetAppOnBackground (false);
            }

            if (LaunchedShortcutItem != null) {
                ServiceContainer.Resolve<QuickActions> ().HandleShortcut (LaunchedShortcutItem, true);
                LaunchedShortcutItem = null;
            }
        }
Ejemplo n.º 43
0
		// if app is already running
		public override void PerformActionForShortcutItem (UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler)
		{
			var handled = HandleShortcutItem(shortcutItem);
			completionHandler(handled);
		}
Ejemplo n.º 44
0
        public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem)
        {
            Console.WriteLine ("eeeeeeeeeee HandleShortcutItem ");
            var handled = false;

            // Anything to process?
            if (shortcutItem == null) return false;

            // Take action based on the shortcut type
            switch (shortcutItem.Type) {
            case ShortcutIdentifiers.Add:
                Console.WriteLine ("QUICKACTION: Add new item");

                Insights.Track("3DTouch", new Dictionary<string, string> {
                    {"Type", "NewItem"}
                });

                handled = true;
                break;
            case ShortcutIdentifiers.Share:
                Console.WriteLine ("QUICKACTION: Share summary of items");
                handled = true;
                break;
            }

            //HACK: show the detail viewcontroller
            ContinueNavigation ();

            Console.Write (handled);
            // Return results
            return handled;
        }
		public override void PrepareForSegue (UIStoryboardSegue segue, NSObject sender)
		{
			var selectedShortcutItem = ShortcutItem;
			if (selectedShortcutItem == null)
				throw new InvalidProgramException ("The `selectedShortcutItem` was not set.");

			if (segue.Identifier == "ShortcutDetailUpdated") {
				// In the updated case, create a shortcut item to represent the final state of the view controller.
				UIApplicationShortcutIconType iconType = IconTypeForSelectedRow ((int)PickerView.SelectedRowInComponent (0));
				var icon = UIApplicationShortcutIcon.FromType (iconType);

				var userInfo = new NSDictionary<NSString, NSObject> (AppDelegate.ApplicationShortcutUserInfoIconKey, new NSNumber (PickerView.SelectedRowInComponent (0)));
				ShortcutItem = new UIApplicationShortcutItem (selectedShortcutItem.Type, TitleTextField.Text ?? string.Empty, SubtitleTextField.Text, icon, userInfo);
			}
		}
		public override void OnActivated (UIApplication application)
		{
			Console.WriteLine ("ccccccc OnActivated");

			// Handle any shortcut item being selected
			HandleShortcutItem(LaunchedShortcutItem);

			Xamarin.Insights.Track("3DTouch", new Dictionary<string, string> {
				{"Type", "Random"}
			});

			// Clear shortcut after it's been handled
			LaunchedShortcutItem = null;
		}
Ejemplo n.º 47
0
 // if app is already running
 public override void PerformActionForShortcutItem(UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler)
 {
     // Perform action
     completionHandler(HandleShortcutItem(shortcutItem));
 }
Ejemplo n.º 48
0
        public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem)
        {
            var handled = false;

            // Anything to process?
            if (shortcutItem == null) return false;

            // Take action based on the shortcut type
            switch (shortcutItem.Type)
            {
                case ShortcutHelper.ShortcutIdentifiers.Appointments:
                    Tabs.SelectedIndex = 2;
                    Tabs.Title = "Appointments";
                    handled = true;
                    break;
                case ShortcutHelper.ShortcutIdentifiers.Treatments:
                    Tabs.SelectedIndex = 3;
                    Tabs.Title = "Treatments";
                    handled = true;
                    break;
                case ShortcutHelper.ShortcutIdentifiers.User:
                    Tabs.SelectedIndex = 1;
                    Tabs.Title = "User";
                    // Show user
                    handled = true;
                    break;
            }

            // Return results
            return handled;
        }
		public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem) {
			Console.WriteLine ("eeeeeeeeeee HandleShortcutItem ");
			var handled = false;

			// Anything to process?
			if (shortcutItem == null) return false;

			// Take action based on the shortcut type
			switch (shortcutItem.Type) {
			case RestaurantGuide.iOS.ShortcutHelper.ShortcutIdentifiers.Random:
				Console.WriteLine ("QUICKACTION: Choose Random Restaurant");

				//HACK: show the detail with a random restaurant showing
				ContinueNavigation ("-1");

				handled = true;
				break;
			}

			Console.Write (handled);
			// Return results
			return handled;
		}
Ejemplo n.º 50
0
        public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem)
        {
            Console.WriteLine("HandleShortcutItem ");
            var handled = false;

            // Anything to process?
            if (shortcutItem == null)
                return false;


            // Take action based on the shortcut type
            switch (shortcutItem.Type)
            {
                case ShortcutIdentifier.Tweet:
                    Console.WriteLine("QUICKACTION: Tweet");
                    var slComposer = SLComposeViewController.FromService(SLServiceType.Twitter);
                    if (slComposer == null)
                    {
                        new UIAlertView("Unavailable", "Twitter is not available, please sign in on your devices settings screen.", null, "OK").Show();
                    }
                    else
                    {
                        slComposer.SetInitialText("#XamarinEvolve");
                        if (slComposer.EditButtonItem != null)
                        {
                            slComposer.EditButtonItem.TintColor = UIColor.FromRGB(118, 53, 235);
                        }
                        slComposer.CompletionHandler += (result) =>
                        {
                            InvokeOnMainThread(() => UIApplication.SharedApplication.KeyWindow.RootViewController.DismissViewController(true, null));
                        };
                        
                        UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewControllerAsync(slComposer, true);
                    }
                    handled = true;
                    break;
                case ShortcutIdentifier.Announcements:
                    Console.WriteLine("QUICKACTION: Accouncements");
                    ContinueNavigation(AppPage.Notification);
                    handled = true;
                    break;
                case ShortcutIdentifier.MiniHacks:
                    Console.WriteLine("QUICKACTION: MiniHacks");
                    ContinueNavigation(AppPage.MiniHacks);
                    handled = true;
                    break;
                case ShortcutIdentifier.Events:
                    Console.WriteLine("QUICKACTION: Events");
                    ContinueNavigation(AppPage.Events);
                    handled = true;
                    break;
            }

            Console.Write(handled);
            // Return results
            return handled;
        }
Ejemplo n.º 51
0
		async Task HandleShortcutItemAsync (UIApplicationShortcutItem scitem)
		{
			switch (scitem.Type) {
			case "new":
				{
					await AddAndOpenNewDocument ();
				}
				break;
			case "open":
				{
					var path = scitem.UserInfo ["path"].ToString ();
					var fsId = scitem.UserInfo ["fsId"].ToString ();
					if (FileSystem.Id != fsId) {
						var fs = FileSystemManager.Shared.ChooseFileSystem (fsId);
						await SetFileSystemAsync (fs, false);
					}
					await OpenDocument (path, false);
				}
				break;
			}
		}
Ejemplo n.º 52
0
		//for when a user chooses a quick launch shortcut
		public override void PerformActionForShortcutItem (UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler)
		{
			completionHandler (ShortcutManager.HandleShortcut (application, shortcutItem));
		}
Ejemplo n.º 53
0
		public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem)
		{
			var handled = false;

			// Anything to process?
			if (shortcutItem == null) 
				return false;
             
			// Take action based on the shortcut type
			switch (shortcutItem.Type) 
			{
				case ShortcutIdentifier.MyBeers:
					if (this.Window.RootViewController.ChildViewControllers[0] is UITabBarController)
					{
						var tabController = this.Window.RootViewController.ChildViewControllers[0] as UITabBarController;
						tabController.SelectedIndex = 0;
					}
					handled = true;
				break;
				case ShortcutIdentifier.WishList:
					if (this.Window.RootViewController.ChildViewControllers[0] is UITabBarController)
					{
						var tabController = this.Window.RootViewController.ChildViewControllers[0] as UITabBarController;
						tabController.SelectedIndex = 1;
					}
					handled = true;
				break;
				case ShortcutIdentifier.Search:
					if (this.Window.RootViewController.ChildViewControllers[0] is UITabBarController)
					{
						var tabController = this.Window.RootViewController.ChildViewControllers[0] as UITabBarController;
						tabController.SelectedIndex = 2;
					}
					handled = true;
				break;
				case ShortcutIdentifier.Me:
					if (this.Window.RootViewController.ChildViewControllers[0] is UITabBarController)
					{
						var tabController = this.Window.RootViewController.ChildViewControllers[0] as UITabBarController;
						tabController.SelectedIndex = 3;
					}
					handled = true;
				break;
			}

			Console.Write (handled);
			// Return results
			return handled;
		}
Ejemplo n.º 54
0
        public bool HandleShortcutItem(UIApplicationShortcutItem shortcutItem) {
            Console.WriteLine ("eeeeeeeeeee HandleShortcutItem ");
            var handled = false;

            // Anything to process?
            if (shortcutItem == null) 
                return false;

            // Take action based on the shortcut type
            switch (shortcutItem.Type) {
                case First:
                    App.GoToRoot();
                    ((RootTabPage)App.Current.MainPage).CurrentPage = ((RootTabPage)App.Current.MainPage).Children[0];
                    handled = true;
                    break;
                case Second:
                    App.GoToRoot();
                    ((RootTabPage)App.Current.MainPage).CurrentPage = ((RootTabPage)App.Current.MainPage).Children[1];

                    handled = true;
                    break;

                case Third:
                    App.GoToRoot();
                    ((RootTabPage)App.Current.MainPage).CurrentPage = ((RootTabPage)App.Current.MainPage).Children[2];

                    handled = true;
                    break;
            }

            Console.Write (handled);
            // Return results
            return handled;
        }
Ejemplo n.º 55
0
		public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
		{
			// Override point for customization after application launch.
			var shouldPerformAdditionalDelegateHandling = true;

			// If a shortcut was launched, display its information and take the appropriate action
			if(launchOptions != null) {
				var shortcutItem = launchOptions [UIApplication.LaunchOptionsShortcutItemKey] as UIApplicationShortcutItem;
				if (shortcutItem != null) {
					launchedShortcutItem = shortcutItem;

					// This will block "performActionForShortcutItem:completionHandler" from being called.
					shouldPerformAdditionalDelegateHandling = false;
				}
			}

			// Install initial verstions of our two extra dynamic shortcuts.
			// Update the application providing the initial 'dynamic' shortcut items.
			if (application.ShortcutItems.Length == 0)
				application.ShortcutItems = new [] { CreatePlayShortcut (), CreatePauseShortcut () };

			return shouldPerformAdditionalDelegateHandling;
		}