MOBILE-4059 login: Add help button in header

main
Noel De Martin 2022-10-05 14:14:11 +02:00
parent d0f28162da
commit 734f1c6323
4 changed files with 33 additions and 0 deletions

View File

@ -12,6 +12,9 @@
<ion-button fill="clear" (click)="openSettings()" [attr.aria-label]="'core.settings.appsettings' | translate"> <ion-button fill="clear" (click)="openSettings()" [attr.aria-label]="'core.settings.appsettings' | translate">
<ion-icon slot="icon-only" name="fas-cog" aria-hidden="true"></ion-icon> <ion-icon slot="icon-only" name="fas-cog" aria-hidden="true"></ion-icon>
</ion-button> </ion-button>
<ion-button *ngIf="canContactSupport" fill="clear" (click)="contactSupport()" [attr.aria-label]="'core.help' | translate">
<ion-icon slot="icon-only" name="far-question-circle" aria-hidden="true"></ion-icon>
</ion-button>
</ion-buttons> </ion-buttons>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>

View File

@ -28,6 +28,7 @@ import { CoreSiteIdentityProvider, CoreSitePublicConfigResponse } from '@classes
import { CoreEvents } from '@singletons/events'; import { CoreEvents } from '@singletons/events';
import { CoreNavigator } from '@services/navigator'; import { CoreNavigator } from '@services/navigator';
import { CoreForms } from '@singletons/form'; import { CoreForms } from '@singletons/form';
import { CoreUserSupport } from '@features/user/services/support';
/** /**
* Page to enter the user credentials. * Page to enter the user credentials.
@ -56,6 +57,7 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy {
showScanQR = false; showScanQR = false;
loginAttempts = 0; loginAttempts = 0;
siteConfig?: CoreSitePublicConfigResponse; siteConfig?: CoreSitePublicConfigResponse;
canContactSupport?: boolean;
protected eventThrown = false; protected eventThrown = false;
protected viewLeft = false; protected viewLeft = false;
@ -78,6 +80,7 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy {
this.logoUrl = !CoreConstants.CONFIG.forceLoginLogo && CoreNavigator.getRouteParam('logoUrl') || undefined; this.logoUrl = !CoreConstants.CONFIG.forceLoginLogo && CoreNavigator.getRouteParam('logoUrl') || undefined;
this.siteConfig = CoreNavigator.getRouteParam('siteConfig'); this.siteConfig = CoreNavigator.getRouteParam('siteConfig');
this.urlToOpen = CoreNavigator.getRouteParam('urlToOpen'); this.urlToOpen = CoreNavigator.getRouteParam('urlToOpen');
this.canContactSupport = this.siteConfig && CoreUserSupport.canContactSupport(this.siteConfig);
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModal(error); CoreDomUtils.showErrorModal(error);
@ -125,6 +128,15 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy {
} }
} }
/**
* Contact site support.
*/
async contactSupport(): Promise<void> {
const supportPageUrl = this.siteConfig && CoreUserSupport.getSupportPageUrl(this.siteConfig);
await CoreUserSupport.contact({ supportPageUrl });
}
/** /**
* Get site config and check if it requires SSO login. * Get site config and check if it requires SSO login.
* This should be used only if a fixed URL is set, otherwise this check is already performed in CoreLoginSitePage. * This should be used only if a fixed URL is set, otherwise this check is already performed in CoreLoginSitePage.

View File

@ -7,6 +7,12 @@
<ion-title> <ion-title>
<h1>{{ 'core.login.reconnect' | translate }}</h1> <h1>{{ 'core.login.reconnect' | translate }}</h1>
</ion-title> </ion-title>
<ion-buttons slot="end">
<ion-button *ngIf="canContactSupport" fill="clear" (click)="contactSupport()" [attr.aria-label]="'core.help' | translate">
<ion-icon slot="icon-only" name="far-question-circle" aria-hidden="true"></ion-icon>
</ion-button>
</ion-buttons>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content class="ion-padding" (keydown)="keyDown($event)" (keyup)="keyUp($event)"> <ion-content class="ion-padding" (keydown)="keyDown($event)" (keyup)="keyUp($event)">

View File

@ -26,6 +26,7 @@ import { CoreEvents } from '@singletons/events';
import { CoreError } from '@classes/errors/error'; import { CoreError } from '@classes/errors/error';
import { CoreNavigator, CoreRedirectPayload } from '@services/navigator'; import { CoreNavigator, CoreRedirectPayload } from '@services/navigator';
import { CoreForms } from '@singletons/form'; import { CoreForms } from '@singletons/form';
import { CoreUserSupport } from '@features/user/services/support';
/** /**
* Page to enter the user password to reconnect to a site. * Page to enter the user password to reconnect to a site.
@ -57,6 +58,7 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
showLoading = true; showLoading = true;
reconnectAttempts = 0; reconnectAttempts = 0;
siteConfig?: CoreSitePublicConfigResponse; siteConfig?: CoreSitePublicConfigResponse;
canContactSupport?: boolean;
protected viewLeft = false; protected viewLeft = false;
protected eventThrown = false; protected eventThrown = false;
@ -102,6 +104,7 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
this.userAvatar = site.infos.userpictureurl; this.userAvatar = site.infos.userpictureurl;
this.siteUrl = site.infos.siteurl; this.siteUrl = site.infos.siteurl;
this.siteName = site.getSiteName(); this.siteName = site.getSiteName();
this.canContactSupport = site.canContactSupport();
// If login was OAuth we should only reach this page if the OAuth method ID has changed. // If login was OAuth we should only reach this page if the OAuth method ID has changed.
this.isOAuth = site.isOAuth(); this.isOAuth = site.isOAuth();
@ -134,6 +137,15 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
); );
} }
/**
* Contact site support.
*/
async contactSupport(): Promise<void> {
const supportPageUrl = this.siteConfig && CoreUserSupport.getSupportPageUrl(this.siteConfig);
await CoreUserSupport.contact({ supportPageUrl });
}
/** /**
* Get some data (like identity providers) from the site config. * Get some data (like identity providers) from the site config.
*/ */