예제 #1
0
        private async Task showReports(DeeplinkShowReportsParameters reportsParameters)
        {
            var presenter = IosDependencyContainer.Instance.ViewPresenter;
            var change    = new ShowReportsPresentationChange(reportsParameters.WorkspaceId, reportsParameters.StartDate, reportsParameters.EndDate);

            presenter.ChangePresentation(change);
        }
예제 #2
0
        public override bool ContinueUserActivity(
            UIApplication application,
            NSUserActivity userActivity,
            UIApplicationRestorationHandler completionHandler)
        {
            var navigationService = IosDependencyContainer.Instance.NavigationService;

            var interaction = userActivity.GetInteraction();

            if (interaction == null ||
                (interaction.IntentHandlingStatus != INIntentHandlingStatus.DeferredToApplication &&
                 interaction.IntentHandlingStatus != INIntentHandlingStatus.Unspecified))
            {
                return(false);
            }

            var intent = interaction?.Intent;

            switch (intent)
            {
            case StopTimerIntent _:
                handleDeeplink(new Uri(ApplicationUrls.TimeEntry.Stop.FromSiri));
                return(true);

            case ShowReportIntent _:
                handleDeeplink(new Uri(ApplicationUrls.Reports.Default));
                return(true);

            case ShowReportPeriodIntent periodIntent:
                long?parseLong(string val) => long.TryParse(val, out var i) ? i : (long?)null;

                long?workspaceId   = parseLong(periodIntent.Workspace?.Identifier);
                var  period        = periodIntent.Period.ToReportPeriod();
                var  viewPresenter = IosDependencyContainer.Instance.ViewPresenter;
                var  change        = new ShowReportsPresentationChange(workspaceId, period);
                viewPresenter.ChangePresentation(change);
                return(true);

            case StartTimerIntent startTimerIntent:
                var timeEntryParams = createStartTimeEntryParameters(startTimerIntent);
                navigationService.Navigate <MainViewModel>(null);
                navigationService.Navigate <StartTimeEntryViewModel, StartTimeEntryParameters>(timeEntryParams, null);
                return(true);

            default:
                return(false);
            }
        }