MOBILE-3320 navigation: Review pending TODOs

main
Noel De Martin 2021-06-10 14:55:09 +02:00
parent e2987a44b7
commit 4b2b1c1e3e
6 changed files with 7 additions and 23 deletions

View File

@ -261,7 +261,6 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy {
this.siteId = id;
// @todo test that this is working properly.
await CoreNavigator.navigateToSiteHome({ params: { urlToOpen: this.urlToOpen } });
} catch (error) {
CoreLoginHelper.treatUserTokenError(siteUrl, error, username, password);

View File

@ -23,7 +23,7 @@ import { CoreLoginHelper } from '@features/login/services/login-helper';
import { CoreSiteIdentityProvider, CoreSitePublicConfigResponse } from '@classes/site';
import { CoreEvents } from '@singletons/events';
import { CoreError } from '@classes/errors/error';
import { CoreNavigationOptions, CoreNavigator, CoreRedirectPayload } from '@services/navigator';
import { CoreNavigationOptions, CoreNavigator } from '@services/navigator';
import { CoreForms } from '@singletons/form';
/**
@ -208,13 +208,9 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
this.credForm.controls['password'].reset();
// Go to the site initial page.
// @todo test that this is working properly (could we use navigateToSitePath instead?).
await CoreNavigator.navigateToSiteHome({
params: {
redirectPath: this.page,
redirectOptions: this.pageOptions,
} as CoreRedirectPayload,
});
this.page
? await CoreNavigator.navigateToSitePath(this.page, { params: this.pageOptions })
: await CoreNavigator.navigateToSiteHome();
} catch (error) {
CoreLoginHelper.treatUserTokenError(this.siteUrl, error, this.username, password);

View File

@ -59,7 +59,7 @@ export class CoreMainMenuHomePage implements OnInit {
*/
ngOnInit(): void {
this.route.queryParams.subscribe((params: Partial<CoreRedirectPayload> & { urlToOpen?: string }) => {
this.urlToOpen = params.urlToOpen;
this.urlToOpen = params.urlToOpen ?? this.urlToOpen;
if (params.redirectPath) {
this.pendingRedirect = {

View File

@ -455,7 +455,6 @@ export class CoreSettingsHelperProvider {
*/
canIUsePrefersColorScheme(): boolean {
// The following check will check browser support but system may differ from that.
// @todo Detect SO support to watch media query.
return window.matchMedia('(prefers-color-scheme)').media !== 'not all';
}

View File

@ -199,8 +199,6 @@ export class CoreNavigatorService {
const siteId = options.siteId ?? CoreSites.getCurrentSiteId();
const navigationOptions: CoreNavigationOptions = CoreObject.without(options, ['siteId']);
// @todo: When this function was in ContentLinksHelper, this code was inside NgZone. Check if it's needed.
// If the path doesn't belong to a site, call standard navigation.
if (siteId === CoreConstants.NO_SITE_ID) {
return this.navigate(path, {
@ -408,10 +406,6 @@ export class CoreNavigatorService {
* @return Whether navigation suceeded.
*/
protected async navigateToMainMenuPath(path: string, options: CoreNavigationOptions = {}): Promise<boolean> {
// Due to DeepLinker, we need to remove the path from the URL before going to main menu.
// IonTabs checks the URL to determine which path to load for deep linking, so we clear the URL.
// @todo this.location.replaceState('');
options = {
preferCurrentTab: true,
...options,
@ -441,7 +435,6 @@ export class CoreNavigatorService {
}
// Open the path within the default main tab.
// @todo test that this is working as expected
return this.navigate(`/main/${DEFAULT_MAIN_MENU_TAB}`, {
...options,
params: {

View File

@ -752,7 +752,6 @@ export class CoreSitesProvider {
};
const siteId = this.getCurrentSiteId();
const downloadUrl = CoreApp.getAppStoreUrl(storesConfig);
if (downloadUrl != null) {
@ -773,10 +772,8 @@ export class CoreSitesProvider {
}
if (siteId) {
// Logout if it's the currentSite.
if (siteId == this.getCurrentSiteId()) {
await this.logout();
}
// Logout the currentSite.
await this.logout();
// Always expire the token.
await this.setSiteLoggedOut(siteId, true);