MOBILE-3626 calendar: Adapt navigation to new CoreNavigator

main
Pau Ferrer Ocaña 2021-01-19 11:41:30 +01:00
parent d9991bea06
commit 0ffd5af386
6 changed files with 23 additions and 24 deletions

View File

@ -36,7 +36,7 @@ import { CoreCoursesHelper } from '@features/courses/services/courses-helper';
import { AddonCalendarFilterPopoverComponent } from '../../components/filter/filter'; import { AddonCalendarFilterPopoverComponent } from '../../components/filter/filter';
import moment from 'moment'; import moment from 'moment';
import { Network, NgZone } from '@singletons'; import { Network, NgZone } from '@singletons';
import { CoreNavHelper } from '@services/nav-helper'; import { CoreNavigator } from '@services/navigator';
import { ActivatedRoute, Params } from '@angular/router'; import { ActivatedRoute, Params } from '@angular/router';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
import { CoreUtils } from '@services/utils/utils'; import { CoreUtils } from '@services/utils/utils';
@ -529,9 +529,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
// It's an offline event, go to the edit page. // It's an offline event, go to the edit page.
this.openEdit(eventId); this.openEdit(eventId);
} else { } else {
CoreNavHelper.instance.goInCurrentMainMenuTab('/calendar/event', { CoreNavigator.instance.navigateToSitePath('/calendar/event', { params: { id: eventId } });
id: eventId,
});
} }
} }
@ -571,7 +569,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
params.courseId = this.filter.courseId; params.courseId = this.filter.courseId;
} }
CoreNavHelper.instance.goInCurrentMainMenuTab('/calendar/edit', params); CoreNavigator.instance.navigateToSitePath('/calendar/edit', { params });
} }
/** /**

View File

@ -40,7 +40,7 @@ import { CoreGroups } from '@services/groups';
// @todo import { CoreSplitViewComponent } from '@components/split-view/split-view'; // @todo import { CoreSplitViewComponent } from '@components/split-view/split-view';
import { Network, NgZone, Translate } from '@singletons'; import { Network, NgZone, Translate } from '@singletons';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
import { CoreNavHelper } from '@services/nav-helper'; import { CoreNavigator } from '@services/navigator';
import { CoreUtils } from '@services/utils/utils'; import { CoreUtils } from '@services/utils/utils';
import { AddonCalendarReminderDBRecord } from '../../services/database/calendar'; import { AddonCalendarReminderDBRecord } from '../../services/database/calendar';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
@ -422,8 +422,8 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
*/ */
openEdit(): void { openEdit(): void {
// Decide which navCtrl to use. If this page is inside a split view, use the split view's master nav. // Decide which navCtrl to use. If this page is inside a split view, use the split view's master nav.
// const navCtrl = this.svComponent ? this.svComponent.getMasterNav() : this.navCtrl; // @todo const navCtrl = this.svComponent ? this.svComponent.getMasterNav() : this.navCtrl;
CoreNavHelper.instance.goInCurrentMainMenuTab('/edit', { eventId: this.eventId }); CoreNavigator.instance.navigateToSitePath('/calendar/edit', { params: { eventId: this.eventId } });
} }
/** /**

View File

@ -30,7 +30,7 @@ import { ActivatedRoute, Params } from '@angular/router';
import { AddonCalendarCalendarComponent } from '../../components/calendar/calendar'; import { AddonCalendarCalendarComponent } from '../../components/calendar/calendar';
import { AddonCalendarUpcomingEventsComponent } from '../../components/upcoming-events/upcoming-events'; import { AddonCalendarUpcomingEventsComponent } from '../../components/upcoming-events/upcoming-events';
import { AddonCalendarFilterPopoverComponent } from '../../components/filter/filter'; import { AddonCalendarFilterPopoverComponent } from '../../components/filter/filter';
import { CoreNavHelper } from '@services/nav-helper'; import { CoreNavigator } from '@services/navigator';
import { CoreLocalNotifications } from '@services/local-notifications'; import { CoreLocalNotifications } from '@services/local-notifications';
@ -312,9 +312,7 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy {
// It's an offline event, go to the edit page. // It's an offline event, go to the edit page.
this.openEdit(eventId); this.openEdit(eventId);
} else { } else {
CoreNavHelper.instance.goInCurrentMainMenuTab('/calendar/event', { CoreNavigator.instance.navigateToSitePath('/calendar/event', { params: { id: eventId } });
id: eventId,
});
} }
} }
@ -334,7 +332,7 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy {
params[key] = this.filter[key]; params[key] = this.filter[key];
}); });
CoreNavHelper.instance.goInCurrentMainMenuTab('/calendar/day', params); CoreNavigator.instance.navigateToSitePath('/calendar/day', { params });
} }
/** /**
@ -369,14 +367,14 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy {
params.courseId = this.filter.courseId; params.courseId = this.filter.courseId;
} }
CoreNavHelper.instance.goInCurrentMainMenuTab('/calendar/edit', params); CoreNavigator.instance.navigateToSitePath('/calendar/edit', { params });
} }
/** /**
* Open calendar events settings. * Open calendar events settings.
*/ */
openSettings(): void { openSettings(): void {
CoreNavHelper.instance.goInCurrentMainMenuTab('/calendar/settings'); CoreNavigator.instance.navigateToSitePath('/calendar/settings');
} }
/** /**

View File

@ -39,7 +39,7 @@ import { Subscription } from 'rxjs';
import { Network, NgZone } from '@singletons'; import { Network, NgZone } from '@singletons';
import { CoreCoursesHelper } from '@features/courses/services/courses-helper'; import { CoreCoursesHelper } from '@features/courses/services/courses-helper';
import { CoreUtils } from '@services/utils/utils'; import { CoreUtils } from '@services/utils/utils';
import { CoreNavHelper } from '@services/nav-helper'; import { CoreNavigator } from '@services/navigator';
/** /**
* Page that displays the list of calendar events. * Page that displays the list of calendar events.
@ -643,14 +643,14 @@ export class AddonCalendarListPage implements OnInit, OnDestroy {
params.courseId = this.filter.courseId; params.courseId = this.filter.courseId;
} }
// CoreNavHelper.instance.push('/calendar/edit', params, this.splitviewCtrl); CoreNavigator.instance.navigateToSitePath('/calendar/edit', { params }); // @todo , this.splitviewCtrl);
} }
/** /**
* Open calendar events settings. * Open calendar events settings.
*/ */
openSettings(): void { openSettings(): void {
CoreNavHelper.instance.goInCurrentMainMenuTab('/calendar/settings'); CoreNavigator.instance.navigateToSitePath('/calendar/settings');
} }
/** /**

View File

@ -36,7 +36,7 @@ import { ApplicationInit, makeSingleton, Translate, Platform } from '@singletons
import { AddonCalendarOfflineEventDBRecord } from './database/calendar-offline'; import { AddonCalendarOfflineEventDBRecord } from './database/calendar-offline';
import { AddonCalendarMainMenuHandlerService } from './handlers/mainmenu'; import { AddonCalendarMainMenuHandlerService } from './handlers/mainmenu';
import { SafeUrl } from '@angular/platform-browser'; import { SafeUrl } from '@angular/platform-browser';
import { CoreNavHelper } from '@services/nav-helper'; import { CoreNavigator } from '@services/navigator';
const ROOT_CACHE_KEY = 'mmaCalendar:'; const ROOT_CACHE_KEY = 'mmaCalendar:';
@ -350,7 +350,10 @@ export class AddonCalendarProvider {
const site = await CoreSites.instance.getSite(notification.siteId); const site = await CoreSites.instance.getSite(notification.siteId);
const pageName = this.getMainCalendarPagePath(site); const pageName = this.getMainCalendarPagePath(site);
CoreNavHelper.instance.openInSiteMainMenu(pageName, { eventId: notification.eventId }, notification.siteId); CoreNavigator.instance.navigateToSitePath(
pageName,
{ params: { eventId: notification.eventId }, siteId: notification.siteId },
);
} }
}, },
); );

View File

@ -16,7 +16,7 @@ import { Injectable } from '@angular/core';
import { Params } from '@angular/router'; import { Params } from '@angular/router';
import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base-handler'; import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base-handler';
import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate'; import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate';
import { CoreNavHelper } from '@services/nav-helper'; import { CoreNavigator } from '@services/navigator';
import { makeSingleton } from '@singletons'; import { makeSingleton } from '@singletons';
import { AddonCalendar } from '../calendar'; import { AddonCalendar } from '../calendar';
@ -54,7 +54,7 @@ export class AddonCalendarViewLinkHandlerService extends CoreContentLinksHandler
stateParams.month = date.getMonth() + 1; stateParams.month = date.getMonth() + 1;
// @todo: Add checkMenu param. // @todo: Add checkMenu param.
CoreNavHelper.instance.goInSite('/calendar/index', stateParams, siteId, true); CoreNavigator.instance.navigateToSitePath('/calendar/index', { params: stateParams, siteId });
} else if (params.view == 'day') { } else if (params.view == 'day') {
// Daily view, open the page. // Daily view, open the page.
@ -68,7 +68,7 @@ export class AddonCalendarViewLinkHandlerService extends CoreContentLinksHandler
stateParams.month = date.getMonth() + 1; stateParams.month = date.getMonth() + 1;
stateParams.day = date.getDate(); stateParams.day = date.getDate();
CoreNavHelper.instance.goInSite('/calendar/day', stateParams, siteId); CoreNavigator.instance.navigateToSitePath('/calendar/day', { params: stateParams, siteId });
} else if (params.view == 'upcoming' || params.view == 'upcoming_mini') { } else if (params.view == 'upcoming' || params.view == 'upcoming_mini') {
// Upcoming view, open the calendar tab. // Upcoming view, open the calendar tab.
@ -78,7 +78,7 @@ export class AddonCalendarViewLinkHandlerService extends CoreContentLinksHandler
}; };
// @todo: Add checkMenu param. // @todo: Add checkMenu param.
CoreNavHelper.instance.goInSite('/calendar/index', stateParams, siteId, true); CoreNavigator.instance.navigateToSitePath('/calendar/index', { params: stateParams, siteId });
} }
}, },