MOBILE-4059 core: Consolidate help modals
parent
e5fcf769f1
commit
9b0200c3bf
|
@ -1920,6 +1920,8 @@
|
|||
"core.login.createaccount": "moodle",
|
||||
"core.login.createuserandpass": "moodle",
|
||||
"core.login.credentialsdescription": "local_moodlemobileapp",
|
||||
"core.login.credentialshelp": "local_moodlemobileapp",
|
||||
"core.login.credentialssupportsubject": "local_moodlemobileapp",
|
||||
"core.login.emailconfirmsent": "moodle",
|
||||
"core.login.emailconfirmsentnoemail": "local_moodlemobileapp",
|
||||
"core.login.emailconfirmsentsuccess": "moodle",
|
||||
|
@ -1997,7 +1999,9 @@
|
|||
"core.login.recaptchaexpired": "local_moodlemobileapp",
|
||||
"core.login.recaptchaincorrect": "local_moodlemobileapp",
|
||||
"core.login.reconnect": "local_moodlemobileapp",
|
||||
"core.login.reconnecthelp": "local_moodlemobileapp",
|
||||
"core.login.reconnectssodescription": "local_moodlemobileapp",
|
||||
"core.login.reconnectsupportsubject": "local_moodlemobileapp",
|
||||
"core.login.reconnecttosite": "local_moodlemobileapp",
|
||||
"core.login.removeaccount": "local_moodlemobileapp",
|
||||
"core.login.resendemail": "moodle",
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"cancel": "Cancel",
|
||||
"changepassword": "Change password",
|
||||
"changepasswordbutton": "Change password",
|
||||
"changepasswordhelp": "If you have problems changing your password, please contact your school or learning provider.",
|
||||
"changepasswordhelp": "If you have problems changing your password, try again later or contact your school or learning provider.",
|
||||
"changepasswordreconnectinstructions": "If you didn't change your password correctly, you'll be asked to do it again.",
|
||||
"changepasswordsupportsubject": "Need help changing my password",
|
||||
"confirmdeletesite": "Are you sure you want to remove the account on {{sitename}}?",
|
||||
|
@ -17,6 +17,8 @@
|
|||
"createaccount": "Create my new account",
|
||||
"createuserandpass": "Choose your username and password",
|
||||
"credentialsdescription": "Please provide your username and password to log in.",
|
||||
"credentialshelp": "If you have problems logging in, try again later or contact your school or learning provider.",
|
||||
"credentialssupportsubject": "Need help logging in",
|
||||
"emailconfirmsent": "<p>An email should have been sent to your address at <b>{{$a}}</b></p><p>It contains easy instructions to complete your registration.</p>",
|
||||
"emailconfirmsentnoemail": "<p>An email should have been sent to your address.</p><p>It contains easy instructions to complete your registration.</p>",
|
||||
"emailconfirmsentsuccess": "Confirmation email sent successfully",
|
||||
|
@ -94,7 +96,9 @@
|
|||
"recaptchaexpired": "Verification expired. Answer the security question again.",
|
||||
"recaptchaincorrect": "The security question answer is incorrect.",
|
||||
"reconnect": "Reconnect",
|
||||
"reconnecthelp": "If you have problems reconnecting, try again later or contact your school or learning provider.",
|
||||
"reconnectssodescription": "Your authentication token is invalid or has expired. You have to reconnect to the site. You need to log in to the site in a browser window.",
|
||||
"reconnectsupportsubject": "Need help reconnecting",
|
||||
"reconnecttosite": "Reconnect to the site",
|
||||
"removeaccount": "Remove account",
|
||||
"resendemail": "Resend email",
|
||||
|
|
|
@ -15,15 +15,12 @@
|
|||
import { Component, OnDestroy } from '@angular/core';
|
||||
|
||||
import { CoreSites } from '@services/sites';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreLoginHelper } from '@features/login/services/login-helper';
|
||||
import { Translate } from '@singletons';
|
||||
import { CoreNavigator } from '@services/navigator';
|
||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CoreUserSupport } from '@features/user/services/support';
|
||||
import { AlertButton } from '@ionic/angular';
|
||||
import { CoreUserAuthenticatedSupportConfig } from '@features/user/classes/support/authenticated-support-config';
|
||||
|
||||
/**
|
||||
* Page that shows instructions to change the password.
|
||||
|
@ -46,29 +43,13 @@ export class CoreLoginChangePasswordPage implements OnDestroy {
|
|||
}
|
||||
|
||||
/**
|
||||
* Show a help modal.
|
||||
* Show help modal.
|
||||
*/
|
||||
showHelp(): void {
|
||||
const supportConfig = CoreUserAuthenticatedSupportConfig.forCurrentSite();
|
||||
const buttons: (AlertButton | string)[] = [];
|
||||
|
||||
if (supportConfig.canContactSupport()) {
|
||||
buttons.push({
|
||||
text: Translate.instant('core.contactsupport'),
|
||||
handler: () => CoreUserSupport.contact({
|
||||
supportConfig,
|
||||
subject: Translate.instant('core.login.changepasswordsupportsubject'),
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
buttons.push(Translate.instant('core.ok'));
|
||||
|
||||
CoreDomUtils.showAlertWithOptions({
|
||||
header: Translate.instant('core.help'),
|
||||
message: Translate.instant('core.login.changepasswordhelp'),
|
||||
buttons,
|
||||
});
|
||||
CoreUserSupport.showHelp(
|
||||
Translate.instant('core.login.changepasswordhelp'),
|
||||
Translate.instant('core.login.changepasswordsupportsubject'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<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-button>
|
||||
<ion-button *ngIf="canContactSupport" fill="clear" (click)="contactSupport()" [attr.aria-label]="'core.help' | translate">
|
||||
<ion-button fill="clear" (click)="showHelp()" [attr.aria-label]="'core.help' | translate">
|
||||
<ion-icon slot="icon-only" name="far-question-circle" aria-hidden="true"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-buttons>
|
||||
|
|
|
@ -59,7 +59,6 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy {
|
|||
showScanQR = false;
|
||||
loginAttempts = 0;
|
||||
supportConfig?: CoreUserSupportConfig;
|
||||
canContactSupport?: boolean;
|
||||
|
||||
protected siteConfig?: CoreSitePublicConfigResponse;
|
||||
protected eventThrown = false;
|
||||
|
@ -83,7 +82,6 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy {
|
|||
this.siteConfig = CoreNavigator.getRouteParam<CoreSitePublicConfigResponse>('siteConfig');
|
||||
this.urlToOpen = CoreNavigator.getRouteParam('urlToOpen');
|
||||
this.supportConfig = this.siteConfig && new CoreUserGuestSupportConfig(this.siteConfig);
|
||||
this.canContactSupport = this.supportConfig?.canContactSupport();
|
||||
} catch (error) {
|
||||
CoreDomUtils.showErrorModal(error);
|
||||
|
||||
|
@ -132,14 +130,13 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
/**
|
||||
* Contact site support.
|
||||
* Show help modal.
|
||||
*/
|
||||
async contactSupport(): Promise<void> {
|
||||
if (!this.supportConfig) {
|
||||
throw new Error('can\'t contact support');
|
||||
}
|
||||
|
||||
await CoreUserSupport.contact({ supportConfig: this.supportConfig });
|
||||
showHelp(): void {
|
||||
CoreUserSupport.showHelp(
|
||||
Translate.instant('core.login.credentialshelp'),
|
||||
Translate.instant('core.login.credentialssupportsubject'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
</ion-title>
|
||||
|
||||
<ion-buttons slot="end">
|
||||
<ion-button *ngIf="canContactSupport" fill="clear" (click)="contactSupport()" [attr.aria-label]="'core.help' | translate">
|
||||
<ion-button fill="clear" (click)="showHelp()" [attr.aria-label]="'core.help' | translate">
|
||||
<ion-icon slot="icon-only" name="far-question-circle" aria-hidden="true"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-buttons>
|
||||
|
|
|
@ -29,6 +29,7 @@ import { CoreForms } from '@singletons/form';
|
|||
import { CoreUserSupport } from '@features/user/services/support';
|
||||
import { CoreUserSupportConfig } from '@features/user/classes/support/support-config';
|
||||
import { CoreUserAuthenticatedSupportConfig } from '@features/user/classes/support/authenticated-support-config';
|
||||
import { Translate } from '@singletons';
|
||||
|
||||
/**
|
||||
* Page to enter the user password to reconnect to a site.
|
||||
|
@ -60,7 +61,6 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
|
|||
showLoading = true;
|
||||
reconnectAttempts = 0;
|
||||
supportConfig?: CoreUserSupportConfig;
|
||||
canContactSupport?: boolean;
|
||||
|
||||
protected siteConfig?: CoreSitePublicConfigResponse;
|
||||
protected viewLeft = false;
|
||||
|
@ -108,7 +108,6 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
|
|||
this.siteUrl = site.infos.siteurl;
|
||||
this.siteName = site.getSiteName();
|
||||
this.supportConfig = new CoreUserAuthenticatedSupportConfig(site);
|
||||
this.canContactSupport = this.supportConfig.canContactSupport();
|
||||
|
||||
// If login was OAuth we should only reach this page if the OAuth method ID has changed.
|
||||
this.isOAuth = site.isOAuth();
|
||||
|
@ -142,10 +141,13 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
/**
|
||||
* Contact site support.
|
||||
* Show help modal.
|
||||
*/
|
||||
async contactSupport(): Promise<void> {
|
||||
await CoreUserSupport.contact({ supportConfig: this.supportConfig });
|
||||
showHelp(): void {
|
||||
CoreUserSupport.showHelp(
|
||||
Translate.instant('core.login.reconnecthelp'),
|
||||
Translate.instant('core.login.reconnectsupportsubject'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"useraccount": "User account",
|
||||
"city": "City/town",
|
||||
"completeprofile": "Complete profile",
|
||||
"completeprofilehelp": "If you have problems completing your profile, please contact your school or learning provider.",
|
||||
"completeprofilehelp": "If you have problems completing your profile, try again later or contact your school or learning provider.",
|
||||
"completeprofilenotice": "Before you continue, please fill in the required fields in your user profile.",
|
||||
"completeprofilereconnectinstructions": "If you didn't complete your profile correctly, you'll be asked to do it again.",
|
||||
"completeprofilesupportsubject": "Need help completing my profile",
|
||||
|
|
|
@ -15,15 +15,12 @@
|
|||
import { Component, OnDestroy } from '@angular/core';
|
||||
|
||||
import { CoreSites } from '@services/sites';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreLoginHelper } from '@features/login/services/login-helper';
|
||||
import { Translate } from '@singletons';
|
||||
import { CoreNavigator } from '@services/navigator';
|
||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { AlertButton } from '@ionic/angular';
|
||||
import { CoreUserSupport } from '@features/user/services/support';
|
||||
import { CoreUserAuthenticatedSupportConfig } from '@features/user/classes/support/authenticated-support-config';
|
||||
|
||||
/**
|
||||
* Page that shows instructions to complete the profile.
|
||||
|
@ -45,29 +42,13 @@ export class CoreUserCompleteProfilePage implements OnDestroy {
|
|||
}
|
||||
|
||||
/**
|
||||
* Show a help modal.
|
||||
* Show help modal.
|
||||
*/
|
||||
showHelp(): void {
|
||||
const supportConfig = CoreUserAuthenticatedSupportConfig.forCurrentSite();
|
||||
const buttons: (AlertButton | string)[] = [];
|
||||
|
||||
if (supportConfig.canContactSupport()) {
|
||||
buttons.push({
|
||||
text: Translate.instant('core.contactsupport'),
|
||||
handler: () => CoreUserSupport.contact({
|
||||
supportConfig,
|
||||
subject: Translate.instant('core.login.completeprofilesupportsubject'),
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
buttons.push(Translate.instant('core.ok'));
|
||||
|
||||
CoreDomUtils.showAlertWithOptions({
|
||||
header: Translate.instant('core.help'),
|
||||
message: Translate.instant('core.user.completeprofilehelp'),
|
||||
buttons,
|
||||
});
|
||||
CoreUserSupport.showHelp(
|
||||
Translate.instant('core.user.completeprofilehelp'),
|
||||
Translate.instant('core.user.completeprofilesupportsubject'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,9 +19,11 @@ import { InAppBrowserObject } from '@ionic-native/in-app-browser';
|
|||
import { CorePlatform } from '@services/platform';
|
||||
import { CoreSites } from '@services/sites';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { makeSingleton, Translate } from '@singletons';
|
||||
import { CoreEvents } from '@singletons/events';
|
||||
import { CoreSubscriptions } from '@singletons/subscriptions';
|
||||
import { AlertButton } from '@ionic/angular';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
|
||||
/**
|
||||
* Handle site support.
|
||||
|
@ -47,6 +49,35 @@ export class CoreUserSupportService {
|
|||
await CoreEvents.waitUntil(CoreEvents.IAB_EXIT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a help modal that suggests contacting support if available.
|
||||
*
|
||||
* @param message Help message.
|
||||
* @param supportSubject Support subject.
|
||||
*/
|
||||
showHelp(message: string, supportSubject: string): void {
|
||||
const supportConfig = CoreUserAuthenticatedSupportConfig.forCurrentSite();
|
||||
const buttons: (AlertButton | string)[] = [];
|
||||
|
||||
if (supportConfig.canContactSupport()) {
|
||||
buttons.push({
|
||||
text: Translate.instant('core.contactsupport'),
|
||||
handler: () => CoreUserSupport.contact({
|
||||
supportConfig,
|
||||
subject: supportSubject,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
buttons.push(Translate.instant('core.close'));
|
||||
|
||||
CoreDomUtils.showAlertWithOptions({
|
||||
header: Translate.instant('core.help'),
|
||||
message,
|
||||
buttons,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Inject error details into contact support form.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue