MOBILE-4616 loading: Create a service to have loading functions

main
Pau Ferrer Ocaña 2024-07-18 16:09:57 +02:00
parent 73f6a0e6b9
commit 3afa736cf4
106 changed files with 339 additions and 198 deletions

View File

@ -69,7 +69,7 @@ jobs:
cat circular-dependencies
lines=$(cat circular-dependencies | wc -l)
echo "Total circular dependencies: $lines"
test $lines -eq 129
test $lines -eq 131
- name: JavaScript code compatibility
run: |
npx check-es-compat www/*.js --polyfills="\{Array,String,TypedArray\}.prototype.at,Object.hasOwn"

View File

@ -20,7 +20,7 @@ import {
AddonBlockRecentlyAccessedItemsItemCalculatedData,
} from '../../services/recentlyaccesseditems';
import { CoreTextUtils } from '@services/utils/text';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreLoadings } from '@services/loadings';
import { CoreUtils } from '@services/utils/utils';
import { CoreSharedModule } from '@/core/shared.module';
@ -93,7 +93,7 @@ export class AddonBlockRecentlyAccessedItemsComponent extends CoreBlockBaseCompo
e.stopPropagation();
const url = CoreTextUtils.decodeHTMLEntities(item.viewurl);
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
await CoreSites.visitLink(url);

View File

@ -14,7 +14,7 @@
import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core';
import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreLoadings } from '@services/loadings';
import { CoreTextUtils } from '@services/utils/text';
import { CoreEnrolledCourseDataWithOptions } from '@features/courses/services/courses-helper';
import { AddonBlockTimelineDayEvents } from '@addons/block/timeline/classes/section';
@ -66,7 +66,7 @@ export class AddonBlockTimelineEventsComponent implements OnInit {
// Fix URL format.
url = CoreTextUtils.decodeHTMLEntities(url);
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
await CoreSites.visitLink(url);

View File

@ -33,6 +33,7 @@ import { CoreEditorComponentsModule } from '@features/editor/components/componen
import { CoreFileUploader } from '@features/fileuploader/services/fileuploader';
import { CoreTagComponentsModule } from '@features/tag/components/components.module';
import { CanLeave } from '@guards/can-leave';
import { CoreLoadings } from '@services/loadings';
import { CoreNavigator } from '@services/navigator';
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
@ -267,7 +268,7 @@ export class AddonBlogEditEntryPage implements CanLeave, OnInit {
return;
}
const loading = await CoreDomUtils.showModalLoading('core.sending', true);
const loading = await CoreLoadings.show('core.sending', true);
if (this.entry) {
try {

View File

@ -31,6 +31,7 @@ import { CoreArray } from '@singletons/array';
import { CoreEventObserver, CoreEvents } from '@singletons/events';
import { CoreTime } from '@singletons/time';
import { CorePopovers } from '@services/popovers';
import { CoreLoadings } from '@services/loadings';
/**
* Page that displays the list of blog entries.
@ -242,7 +243,7 @@ export class AddonBlogIndexPage implements OnInit, OnDestroy {
* @param enabled If true, filter my entries. False otherwise.
*/
async onlyMyEntriesToggleChanged(enabled: boolean): Promise<void> {
const loading = await CoreDomUtils.showModalLoading();
const loading = await CoreLoadings.show();
try {
this.filter.userid = !enabled ? undefined : this.currentUserId;
@ -307,7 +308,7 @@ export class AddonBlogIndexPage implements OnInit, OnDestroy {
* @param id Entry id.
*/
async deleteEntry(id: number): Promise<void> {
const loading = await CoreDomUtils.showModalLoading();
const loading = await CoreLoadings.show();
try {
await AddonBlog.deleteEntry({ entryid: id });
await this.refresh();

View File

@ -47,6 +47,7 @@ import moment from 'moment-timezone';
import { ADDON_CALENDAR_COMPONENT } from '@addons/calendar/constants';
import { ContextLevel } from '@/core/constants';
import { CorePopovers } from '@services/popovers';
import { CoreLoadings } from '@services/loadings';
/**
* Page that displays a form to create/edit an event.
@ -407,7 +408,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave {
return;
}
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
await this.loadGroups(courseId);
@ -513,7 +514,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave {
}
// Send the data.
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
let event: AddonCalendarEvent | AddonCalendarOfflineEventDBRecord;
try {

View File

@ -44,6 +44,7 @@ import { CorePlatform } from '@services/platform';
import { CoreConfig } from '@services/config';
import { CoreToasts, ToastDuration } from '@services/toasts';
import { CorePopovers } from '@services/popovers';
import { CoreLoadings } from '@services/loadings';
/**
* Page that displays a single calendar event.
@ -418,7 +419,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
try {
await CoreDomUtils.showDeleteConfirm();
const modal = await CoreDomUtils.showModalLoading('core.deleting', true);
const modal = await CoreLoadings.show('core.deleting', true);
try {
await CoreReminders.removeReminder(id);
@ -525,12 +526,11 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
try {
deleteAll = await CoreDomUtils.showConfirm(message, title, undefined, undefined, options);
} catch {
// User canceled.
return;
}
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
try {
let onlineEventDeleted = false;
@ -587,7 +587,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
return;
}
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
try {

View File

@ -19,6 +19,7 @@ import {
import { Component, OnInit } from '@angular/core';
import { CoreUser, CoreUserProfile } from '@features/user/services/user';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreLoadings } from '@services/loadings';
import { CoreNavigator } from '@services/navigator';
import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
@ -123,7 +124,7 @@ export class AddonCourseCompletionReportPage implements OnInit {
* Mark course as completed.
*/
async completeCourse(): Promise<void> {
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
try {
await AddonCourseCompletion.markCourseAsSelfCompleted(this.courseId);

View File

@ -22,7 +22,7 @@ import {
import { makeSingleton } from '@singletons';
import { AddonEnrolGuest } from './guest';
import { CorePasswordModalResponse } from '@components/password-modal/password-modal';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreLoadings } from '@services/loadings';
import { CoreWSError } from '@classes/errors/wserror';
import { CoreEnrol, CoreEnrolEnrolmentMethod } from '@features/enrol/services/enrol';
import { CoreModals } from '@services/modals';
@ -100,7 +100,7 @@ export class AddonEnrolGuestHandlerService implements CoreEnrolGuestHandler {
}
const validatePassword = async (password = ''): Promise<CorePasswordModalResponse> => {
const modal = await CoreDomUtils.showModalLoading('core.loading', true);
const modal = await CoreLoadings.show('core.loading', true);
try {
const response = await AddonEnrolGuest.validateGuestAccessPassword(method.id, password);

View File

@ -21,6 +21,7 @@ import { CoreCoursesProvider } from '@features/courses/services/courses';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreEnrol, CoreEnrolEnrolmentMethod } from '@features/enrol/services/enrol';
import { CoreModals } from '@services/modals';
import { CoreLoadings } from '@services/loadings';
/**
* Enrol handler.
@ -112,7 +113,7 @@ export class AddonEnrolSelfHandlerService implements CoreEnrolSelfHandler {
*/
protected async performEnrol(method: CoreEnrolEnrolmentMethod): Promise<boolean> {
const validatePassword = async (password = ''): Promise<CorePasswordModalResponse> => {
const modal = await CoreDomUtils.showModalLoading('core.loading', true);
const modal = await CoreLoadings.show('core.loading', true);
const response: CorePasswordModalResponse = {
password,

View File

@ -48,6 +48,7 @@ import { CoreKeyboard } from '@singletons/keyboard';
import { CoreText } from '@singletons/text';
import { CoreWait } from '@singletons/wait';
import { CoreModals } from '@services/modals';
import { CoreLoadings } from '@services/loadings';
/**
* Page that displays a message discussion page.
@ -232,7 +233,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
protected async fetchData(): Promise<void> {
let loader: CoreIonLoadingElement | undefined;
if (this.showLoadingModal) {
loader = await CoreDomUtils.showModalLoading();
loader = await CoreLoadings.show();
}
if (!this.groupMessagingEnabled && this.userId) {
@ -965,7 +966,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
options,
);
const modal = await CoreDomUtils.showModalLoading('core.deleting', true);
const modal = await CoreLoadings.show('core.deleting', true);
try {
await AddonMessages.deleteMessage(message, data && data[0]);
@ -1406,7 +1407,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
await CoreDomUtils.showConfirm(template, undefined, okText);
this.blockIcon = CoreConstants.ICON_LOADING;
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
this.showLoadingModal = true;
try {
@ -1488,7 +1489,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
this.blockIcon = CoreConstants.ICON_LOADING;
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
this.showLoadingModal = true;
try {
@ -1527,7 +1528,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
this.addRemoveIcon = CoreConstants.ICON_LOADING;
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
this.showLoadingModal = true;
try {
@ -1558,7 +1559,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
throw new CoreError('No member selected to be confirmed.');
}
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
this.showLoadingModal = true;
try {
@ -1584,7 +1585,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
throw new CoreError('No member selected to be declined.');
}
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
this.showLoadingModal = true;
try {
@ -1618,7 +1619,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
this.addRemoveIcon = CoreConstants.ICON_LOADING;
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
this.showLoadingModal = true;
try {

View File

@ -28,6 +28,7 @@ import { CoreConstants } from '@/core/constants';
import { AddonNotificationsPreferencesNotificationProcessorState } from '@addons/notifications/services/notifications';
import { CorePlatform } from '@services/platform';
import { CoreTextUtils } from '@services/utils/text';
import { CoreLoadings } from '@services/loadings';
/**
* Page that displays the messages settings page.
@ -155,7 +156,7 @@ export class AddonMessagesSettingsPage implements OnInit, OnDestroy {
return;
}
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
if (!this.advancedContactable) {
// Convert from boolean to number.

View File

@ -68,6 +68,7 @@ import {
ADDON_MOD_ASSIGN_UNLIMITED_ATTEMPTS,
} from '../../constants';
import { CoreViewer } from '@features/viewer/services/viewer';
import { CoreLoadings } from '@services/loadings';
/**
* Component that displays an assignment submission.
@ -321,7 +322,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
}
const previousSubmission = this.previousAttempt.submission;
let modal = await CoreDomUtils.showModalLoading();
let modal = await CoreLoadings.show();
const size = await CoreUtils.ignoreErrors(
AddonModAssignHelper.getSubmissionSizeForCopy(this.assign, previousSubmission),
@ -339,7 +340,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
}
// User confirmed, copy the attempt.
modal = await CoreDomUtils.showModalLoading('core.sending', true);
modal = await CoreLoadings.show('core.sending', true);
try {
await AddonModAssignHelper.copyPreviousAttempt(this.assign, previousSubmission);
@ -898,7 +899,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
// Ask for confirmation. @todo plugin precheck_submission
await CoreDomUtils.showConfirm(Translate.instant('addon.mod_assign.confirmsubmission'));
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
try {
await AddonModAssign.submitForGrading(
@ -949,7 +950,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
throw new CoreError(Translate.instant('core.grades.badgrade'));
}
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
(this.gradeInfo?.outcomes || []).forEach((outcome) => {
if (outcome.itemNumber && outcome.selectedId) {

View File

@ -46,6 +46,7 @@ import {
ADDON_MOD_ASSIGN_SUBMITTED_FOR_GRADING_EVENT,
} from '../../constants';
import { CoreToasts, ToastDuration } from '@services/toasts';
import { CoreLoadings } from '@services/loadings';
/**
* Page that allows adding or editing an assigment submission.
@ -314,7 +315,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave {
protected async hasDataChanged(): Promise<boolean> {
// Usually the hasSubmissionDataChanged call will be resolved inmediately, causing the modal to be shown just an instant.
// We'll wait a bit before showing it to prevent this "blink".
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
const data = this.getInputData();
@ -397,7 +398,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave {
throw Translate.instant('addon.mod_assign.acceptsubmissionstatement');
}
let modal = await CoreDomUtils.showModalLoading();
let modal = await CoreLoadings.show();
let size = -1;
// Get size to ask for confirmation.
@ -414,7 +415,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave {
// Confirm action.
await CoreFileUploaderHelper.confirmUploadFile(size, true, this.allowOffline);
modal = await CoreDomUtils.showModalLoading('core.sending', true);
modal = await CoreLoadings.show('core.sending', true);
const pluginData = await this.prepareSubmissionData(inputData);
if (!Object.keys(pluginData).length) {

View File

@ -32,6 +32,7 @@ import {
AddonModBBBRecordingPlaybackTypes,
} from '../../services/bigbluebuttonbn';
import { ADDON_MOD_BBB_COMPONENT } from '../../constants';
import { CoreLoadings } from '@services/loadings';
/**
* Component that displays a Big Blue Button activity.
@ -295,7 +296,7 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo
* @returns Promise resolved when done.
*/
async joinRoom(): Promise<void> {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
const joinUrl = await AddonModBBB.getJoinUrl(this.module.id, this.groupId);
@ -336,7 +337,7 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo
return;
}
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
await AddonModBBB.endMeeting(this.bbb.id, this.groupId);

View File

@ -32,6 +32,7 @@ import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreKeyboard } from '@singletons/keyboard';
import { CoreWait } from '@singletons/wait';
import { CoreModals } from '@services/modals';
import { CoreLoadings } from '@services/loadings';
/**
* Page that displays a chat session.
@ -342,7 +343,7 @@ export class AddonModChatChatPage implements OnInit, OnDestroy, CanLeave {
* @returns Promise resolved when done.
*/
async reconnect(): Promise<void> {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
// Call startPolling would take a while for the first execution, so we'll execute it manually to check if it works now.

View File

@ -25,6 +25,7 @@ import { CoreTime } from '@singletons/time';
import { Translate } from '@singletons';
import { AddonModChat } from '@addons/mod/chat/services/chat';
import { CoreUtils } from '@services/utils/utils';
import { CoreLoadings } from '@services/loadings';
/**
* Page that displays list of chat sessions.
@ -126,7 +127,7 @@ export class AddonModChatSessionsPage implements OnInit, AfterViewInit, OnDestro
* Reload chat sessions.
*/
async reloadSessions(): Promise<void> {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
await this.sessions.reload();

View File

@ -41,6 +41,7 @@ import {
ADDON_MOD_CHOICE_PUBLISH_ANONYMOUS,
AddonModChoiceShowResults,
} from '../../constants';
import { CoreLoadings } from '@services/loadings';
/**
* Component that displays a choice.
@ -383,7 +384,7 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo
responses.push(this.selectedOption.id);
}
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
try {
const online = await AddonModChoice.submitResponse(this.choice.id, this.choice.name, this.courseId, responses);
@ -421,7 +422,7 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo
return;
}
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
try {
await AddonModChoice.deleteResponses(this.choice.id, this.choice.name, this.courseId);

View File

@ -19,6 +19,7 @@ import { FormBuilder } from '@angular/forms';
import { SafeUrl } from '@angular/platform-browser';
import { CoreAnyError } from '@classes/errors/error';
import { CoreGeolocation, CoreGeolocationError, CoreGeolocationErrorReason } from '@services/geolocation';
import { CoreLoadings } from '@services/loadings';
import { CorePlatform } from '@services/platform';
import { CoreDomUtils } from '@services/utils/dom';
import { DomSanitizer } from '@singletons';
@ -118,7 +119,7 @@ export class AddonModDataFieldLatlongComponent extends AddonModDataFieldPluginBa
async getLocation(event: Event): Promise<void> {
event.preventDefault();
const modal = await CoreDomUtils.showModalLoading('addon.mod_data.gettinglocation', true);
const modal = await CoreLoadings.show('addon.mod_data.gettinglocation', true);
try {
const coordinates = await CoreGeolocation.getCoordinates();

View File

@ -44,6 +44,7 @@ import { CoreTextUtils } from '@services/utils/text';
import { CoreTime } from '@singletons/time';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { ADDON_MOD_DATA_COMPONENT, ADDON_MOD_DATA_ENTRY_CHANGED, AddonModDataTemplateType } from '../../constants';
import { CoreLoadings } from '@services/loadings';
/**
* Page that displays the view edit page.
@ -285,7 +286,7 @@ export class AddonModDataEditPage implements OnInit {
throw new CoreError(Translate.instant('addon.mod_data.emptyaddform'));
}
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
// Create an ID to assign files.
const entryTemp = this.entryId ? this.entryId : - (Date.now());

View File

@ -48,6 +48,7 @@ import {
AddonModDataTemplateMode,
} from '../constants';
import { CoreToasts, ToastDuration } from '@services/toasts';
import { CoreLoadings } from '@services/loadings';
/**
* Service that provides helper functions for datas.
@ -154,7 +155,7 @@ export class AddonModDataHelperProvider {
): Promise<void> {
siteId = siteId || CoreSites.getCurrentSiteId();
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
try {
courseId = await this.getActivityCourseIdIfNotSet(dataId, courseId, siteId);
@ -857,7 +858,7 @@ export class AddonModDataHelperProvider {
try {
await CoreDomUtils.showDeleteConfirm('addon.mod_data.confirmdeleterecord');
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
if (entryId > 0) {

View File

@ -17,7 +17,7 @@ import { Params } from '@angular/router';
import { CoreCourse } from '@features/course/services/course';
import { CoreNavigator } from '@services/navigator';
import { CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreLoadings } from '@services/loadings';
import { makeSingleton } from '@singletons';
import { ADDON_MOD_DATA_FEATURE_NAME, ADDON_MOD_DATA_PAGE_NAME } from '../../constants';
import { AddonModDataEditLinkHandlerService } from '@addons/mod/data/services/handlers/edit-link';
@ -37,7 +37,7 @@ export class AddonModDataEditLinkHandlerLazyService extends AddonModDataEditLink
* @inheritdoc
*/
async handleAction(siteId: string, params: Record<string, string>): Promise<void> {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
const dataId = parseInt(params.d, 10);
const rId = params.rid || '';

View File

@ -17,7 +17,7 @@ import { Params } from '@angular/router';
import { CoreCourse } from '@features/course/services/course';
import { CoreNavigator } from '@services/navigator';
import { CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreLoadings } from '@services/loadings';
import { makeSingleton } from '@singletons';
import { ADDON_MOD_DATA_PAGE_NAME } from '../../constants';
import { AddonModDataShowLinkHandlerService } from '@addons/mod/data/services/handlers/show-link';
@ -33,7 +33,7 @@ export class AddonModDataShowLinkHandlerLazyService extends AddonModDataShowLink
* @inheritdoc
*/
async handleAction(siteId: string, params: Record<string, string>): Promise<void> {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
const dataId = parseInt(params.d, 10);
const rId = params.rid || '';
const group = parseInt(params.group, 10) || false;

View File

@ -37,6 +37,7 @@ import { AddonModFeedbackFormItem, AddonModFeedbackHelper } from '../../services
import { AddonModFeedbackSync } from '../../services/feedback-sync';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { ADDON_MOD_FEEDBACK_COMPONENT, ADDON_MOD_FEEDBACK_FORM_SUBMITTED, ADDON_MOD_FEEDBACK_PAGE_NAME } from '../../constants';
import { CoreLoadings } from '@services/loadings';
/**
* Page that displays feedback form.
@ -423,7 +424,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave {
return CoreNavigator.back();
}
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
await CoreSites.visitLink(this.siteAfterSubmit, { siteId: this.currentSite.id });

View File

@ -40,6 +40,7 @@ import {
ADDON_MOD_FEEDBACK_MULTICHOICE_HIDENOSELECT,
ADDON_MOD_FEEDBACK_PAGE_NAME,
} from '../constants';
import { CoreLoadings } from '@services/loadings';
const MODE_RESPONSETIME = 1;
const MODE_COURSE = 2;
@ -179,7 +180,7 @@ export class AddonModFeedbackHelperProvider {
async handleShowEntriesLink(params: Record<string, string>, siteId?: string): Promise<void> {
siteId = siteId || CoreSites.getCurrentSiteId();
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
const module = await CoreCourse.getModuleBasicInfo(

View File

@ -20,6 +20,7 @@ import { CoreNavigator } from '@services/navigator';
import { CoreDomUtils } from '@services/utils/dom';
import { makeSingleton } from '@singletons';
import { ADDON_MOD_FEEDBACK_PAGE_NAME } from '../../constants';
import { CoreLoadings } from '@services/loadings';
/**
* Content links handler for a feedback analysis.
@ -38,7 +39,7 @@ export class AddonModFeedbackAnalysisLinkHandlerService extends CoreContentLinks
getActions(siteIds: string[], url: string, params: Record<string, string>): CoreContentLinksAction[] {
return [{
action: async (siteId: string) => {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
const moduleId = Number(params.id);

View File

@ -21,6 +21,7 @@ import { CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { makeSingleton } from '@singletons';
import { ADDON_MOD_FEEDBACK_PAGE_NAME } from '../../constants';
import { CoreLoadings } from '@services/loadings';
/**
* Content links handler for feedback complete questions.
@ -39,7 +40,7 @@ export class AddonModFeedbackCompleteLinkHandlerService extends CoreContentLinks
getActions(siteIds: string[], url: string, params: Record<string, string>): CoreContentLinksAction[] {
return [{
action: async (siteId: string) => {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
const moduleId = Number(params.id);

View File

@ -21,6 +21,7 @@ import { CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { makeSingleton } from '@singletons';
import { ADDON_MOD_FEEDBACK_PAGE_NAME } from '../../constants';
import { CoreLoadings } from '@services/loadings';
/**
* Content links handler for feedback print questions.
@ -39,7 +40,7 @@ export class AddonModFeedbackPrintLinkHandlerService extends CoreContentLinksHan
getActions(siteIds: string[], url: string, params: Record<string, string>): CoreContentLinksAction[] {
return [{
action: async (siteId: string) => {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
const moduleId = Number(params.id);

View File

@ -21,6 +21,7 @@ import { CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { makeSingleton } from '@singletons';
import { ADDON_MOD_FEEDBACK_PAGE_NAME } from '../../constants';
import { CoreLoadings } from '@services/loadings';
/**
* Content links handler for feedback show non respondents.
* Match mod/feedback/show_nonrespondents.php with a valid feedback id.
@ -38,7 +39,7 @@ export class AddonModFeedbackShowNonRespondentsLinkHandlerService extends CoreCo
getActions(siteIds: string[], url: string, params: Record<string, string>): CoreContentLinksAction[] {
return [{
action: async (siteId: string) => {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
const moduleId = Number(params.id);

View File

@ -21,6 +21,7 @@ import { AddonModForum, AddonModForumDiscussion } from '../../services/forum';
import { ADDON_MOD_FORUM_CHANGE_DISCUSSION_EVENT } from '../../constants';
import { CoreToasts } from '@services/toasts';
import { CoreSharedModule } from '@/core/shared.module';
import { CoreLoadings } from '@services/loadings';
/**
* This component is meant to display a popover with the discussion options.
@ -67,7 +68,7 @@ export class AddonModForumDiscussionOptionsMenuComponent implements OnInit {
* @param locked True to lock the discussion, false to unlock.
*/
async setLockState(locked: boolean): Promise<void> {
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
try {
const response = await AddonModForum.setLockState(this.forumId, this.discussion.discussion, locked);
@ -98,7 +99,7 @@ export class AddonModForumDiscussionOptionsMenuComponent implements OnInit {
* @param pinned True to pin the discussion, false to unpin it.
*/
async setPinState(pinned: boolean): Promise<void> {
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
try {
await AddonModForum.setPinState(this.discussion.discussion, pinned);
@ -130,7 +131,7 @@ export class AddonModForumDiscussionOptionsMenuComponent implements OnInit {
* @param starred True to star the discussion, false to unstar it.
*/
async toggleFavouriteState(starred: boolean): Promise<void> {
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
try {
await AddonModForum.toggleFavouriteState(this.discussion.discussion, starred);

View File

@ -66,6 +66,7 @@ import {
import { CoreSearchGlobalSearch } from '@features/search/services/global-search';
import { CoreToasts } from '@services/toasts';
import { CorePopovers } from '@services/popovers';
import { CoreLoadings } from '@services/loadings';
/**
* Component that displays a forum entry page.
*/
@ -669,7 +670,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom
* Group has changed.
*/
async groupChanged(): Promise<void> {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
await Promise.all([

View File

@ -55,6 +55,7 @@ import { ADDON_MOD_FORUM_CHANGE_DISCUSSION_EVENT, ADDON_MOD_FORUM_COMPONENT } fr
import { CoreToasts } from '@services/toasts';
import { toBoolean } from '@/core/transforms/boolean';
import { CorePopovers } from '@services/popovers';
import { CoreLoadings } from '@services/loadings';
/**
* Components that shows a discussion post, its attachments and the action buttons allowed (reply, etc.).
@ -150,7 +151,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
try {
await CoreDomUtils.showDeleteConfirm('addon.mod_forum.deletesure');
const modal = await CoreDomUtils.showModalLoading('core.deleting', true);
const modal = await CoreLoadings.show('core.deleting', true);
try {
const response = await AddonModForum.deletePost(this.post.id);
@ -366,7 +367,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
const replyingTo = this.formData.replyingTo!;
const files = this.formData.files || [];
const isEditOnline = this.formData.id && this.formData.id > 0;
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
// Add some HTML to the message if needed.
message = CoreTextUtils.formatHtmlLines(message);

View File

@ -60,6 +60,7 @@ import {
} from '../../constants';
import { CoreCourseContentsPage } from '@features/course/pages/contents/contents';
import { CoreToasts } from '@services/toasts';
import { CoreLoadings } from '@services/loadings';
type SortType = 'flat-newest' | 'flat-oldest' | 'nested';
@ -717,7 +718,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
return;
}
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
try {
const response = await AddonModForum.setLockState(this.forumId, this.discussionId, locked);
@ -752,7 +753,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
return;
}
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
try {
await AddonModForum.setPinState(this.discussionId, pinned);
@ -788,7 +789,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
return;
}
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
try {
await AddonModForum.toggleFavouriteState(this.discussionId, starred);

View File

@ -52,6 +52,7 @@ import {
ADDON_MOD_FORUM_NEW_DISCUSSION_EVENT,
} from '../../constants';
import { CoreCourseContentsPage } from '@features/course/pages/contents/contents';
import { CoreLoadings } from '@services/loadings';
type NewDiscussionData = {
subject: string;
@ -549,7 +550,7 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea
return;
}
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
// Add some HTML to the message if needed.
message = CoreTextUtils.formatHtmlLines(message);

View File

@ -18,7 +18,7 @@ import { CoreContentLinksAction } from '@features/contentlinks/services/contentl
import { CoreCourse } from '@features/course/services/course';
import { CoreNavigator } from '@services/navigator';
import { CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreLoadings } from '@services/loadings';
import { makeSingleton } from '@singletons';
import { ADDON_MOD_FORUM_PAGE_NAME } from '../../constants';
@ -43,7 +43,7 @@ export class AddonModForumPostLinkHandlerService extends CoreContentLinksHandler
): CoreContentLinksAction[] | Promise<CoreContentLinksAction[]> {
return [{
action: async (siteId): Promise<void> => {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
const forumId = parseInt(params.forum, 10);
try {

View File

@ -40,6 +40,7 @@ import { AddonModGlossaryHelper } from '../../services/glossary-helper';
import { AddonModGlossaryOffline } from '../../services/glossary-offline';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { ADDON_MOD_GLOSSARY_COMPONENT } from '../../constants';
import { CoreLoadings } from '@services/loadings';
/**
* Page that displays the edit form.
@ -211,7 +212,7 @@ export class AddonModGlossaryEditPage implements OnInit, CanLeave {
return;
}
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
try {
const savedOnline = await this.handler.save(this.glossary);

View File

@ -41,6 +41,7 @@ import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { ADDON_MOD_GLOSSARY_COMPONENT, ADDON_MOD_GLOSSARY_ENTRY_UPDATED, ADDON_MOD_GLOSSARY_PAGE_NAME } from '../../constants';
import { CoreCourseContentsPage } from '@features/course/pages/contents/contents';
import { CoreToasts, ToastDuration } from '@services/toasts';
import { CoreLoadings } from '@services/loadings';
/**
* Page that displays a glossary entry.
@ -191,7 +192,7 @@ export class AddonModGlossaryEntryPage implements OnInit, OnDestroy {
return;
}
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
if (this.onlineEntry) {

View File

@ -21,6 +21,7 @@ import { CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { makeSingleton } from '@singletons';
import { ADDON_MOD_GLOSSARY_PAGE_NAME } from '../../constants';
import { CoreLoadings } from '@services/loadings';
/**
* Content links handler for glossary new entry.
@ -40,7 +41,7 @@ export class AddonModGlossaryEditLinkHandlerService extends CoreContentLinksHand
getActions(siteIds: string[], url: string, params: Record<string, string>): CoreContentLinksAction[] {
return [{
action: async (siteId: string) => {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
const cmId = Number(params.cmid);

View File

@ -22,6 +22,7 @@ import { CoreDomUtils } from '@services/utils/dom';
import { makeSingleton } from '@singletons';
import { AddonModGlossary } from '../glossary';
import { ADDON_MOD_GLOSSARY_PAGE_NAME } from '../../constants';
import { CoreLoadings } from '@services/loadings';
/**
* Handler to treat links to glossary entries.
@ -39,7 +40,7 @@ export class AddonModGlossaryEntryLinkHandlerService extends CoreContentLinksHan
getActions(siteIds: string[], url: string, params: Record<string, string>): CoreContentLinksAction[] {
return [{
action: async (siteId: string) => {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
const entryId = params.mode == 'entry' ? Number(params.hook) : Number(params.eid);

View File

@ -24,6 +24,7 @@ import { CoreUtils } from '@services/utils/utils';
import { makeSingleton } from '@singletons';
import { AddonModH5PActivity } from '../h5pactivity';
import { ADDON_MOD_H5PACTIVITY_PAGE_NAME } from '../../constants';
import { CoreLoadings } from '@services/loadings';
/**
* Handler to treat links to H5P activity report.
@ -45,7 +46,7 @@ export class AddonModH5PActivityReportLinkHandlerService extends CoreContentLink
): CoreContentLinksAction[] | Promise<CoreContentLinksAction[]> {
return [{
action: async (siteId) => {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
const instanceId = Number(params.a);

View File

@ -23,6 +23,7 @@ import { CoreDomUtils } from '@services/utils/dom';
import { makeSingleton } from '@singletons';
import { AddonModLesson } from '../lesson';
import { ADDON_MOD_LESSON_PAGE_NAME } from '../../constants';
import { CoreLoadings } from '@services/loadings';
/**
* Handler to treat links to lesson grade.
@ -55,7 +56,7 @@ export class AddonModLessonGradeLinkHandlerService extends CoreContentLinksModul
const moduleId = Number(params.id);
const userId = Number(params.userid) || 0;
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
const module = await CoreCourse.getModuleBasicInfo(

View File

@ -19,7 +19,7 @@ import { CoreContentLinksAction } from '@features/contentlinks/services/contentl
import { CoreCourse } from '@features/course/services/course';
import { CoreCourseHelper } from '@features/course/services/course-helper';
import { CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreLoadings } from '@services/loadings';
import { CoreUtils } from '@services/utils/utils';
import { makeSingleton } from '@singletons';
import { AddonModLesson } from '../lesson';
@ -85,7 +85,7 @@ export class AddonModLessonIndexLinkHandlerService extends CoreContentLinksModul
password: string,
siteId: string,
): Promise<void> {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
// Get the module.

View File

@ -22,6 +22,7 @@ import { CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { makeSingleton } from '@singletons';
import { ADDON_MOD_LESSON_PAGE_NAME } from '../../constants';
import { CoreLoadings } from '@services/loadings';
/**
* Handler to treat links to lesson report.
@ -86,7 +87,7 @@ export class AddonModLessonReportLinkHandlerService extends CoreContentLinksHand
*/
protected async openReportOverview(moduleId: number, groupId?: number, siteId?: string): Promise<void> {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
// Get the module object.
@ -132,7 +133,7 @@ export class AddonModLessonReportLinkHandlerService extends CoreContentLinksHand
siteId: string,
): Promise<void> {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
// Get the module object.

View File

@ -23,6 +23,7 @@ import { makeSingleton } from '@singletons';
import { CoreEvents } from '@singletons/events';
import { AddonModLti, AddonModLtiLti } from './lti';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreLoadings } from '@services/loadings';
/**
* Service that provides some helper functions for LTI.
@ -62,7 +63,7 @@ export class AddonModLtiHelperProvider {
async getDataAndLaunch(courseId: number, module: CoreCourseModuleData, lti?: AddonModLtiLti, siteId?: string): Promise<void> {
siteId = siteId || CoreSites.getCurrentSiteId();
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
const openInBrowser = await AddonModLti.shouldLaunchInBrowser(siteId);

View File

@ -55,6 +55,7 @@ import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { ADDON_MOD_QUIZ_ATTEMPT_FINISHED_EVENT, AddonModQuizAttemptStates, ADDON_MOD_QUIZ_COMPONENT } from '../../constants';
import { CoreWait } from '@singletons/wait';
import { CoreModals } from '@services/modals';
import { CoreLoadings } from '@services/loadings';
/**
* Page that allows attempting a quiz.
@ -166,7 +167,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
}
// Save answers.
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
try {
await this.processAttempt(false, false);
@ -217,7 +218,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
// Confirm that the user really wants to do it.
await CoreDomUtils.showConfirm(Translate.instant('core.areyousure'));
modal = await CoreDomUtils.showModalLoading('core.sending', true);
modal = await CoreLoadings.show('core.sending', true);
// Get the answers.
const answers = await this.prepareAnswers(this.quiz.coursemodule);
@ -292,7 +293,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
// First try to save the attempt data. We only save it if we're not seeing the summary.
if (!this.showSummary) {
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
try {
await this.processAttempt(false, false);
@ -440,7 +441,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
);
}
modal = await CoreDomUtils.showModalLoading('core.sending', true);
modal = await CoreLoadings.show('core.sending', true);
await this.processAttempt(userFinish, timeUp);
@ -719,7 +720,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
if (this.reloadNavigation) {
// Some data has changed, reload the navigation.
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
await CoreUtils.ignoreErrors(this.loadNavigation());

View File

@ -41,6 +41,7 @@ import { QuestionDisplayOptionsMarks } from '@features/question/constants';
import { CoreGroups } from '@services/groups';
import { CoreTimeUtils } from '@services/utils/time';
import { CoreModals } from '@services/modals';
import { CoreLoadings } from '@services/loadings';
/**
* Helper service that provides some features for quiz.
@ -335,7 +336,7 @@ export class AddonModQuizHelperProvider {
async handleReviewLink(attemptId: number, page?: number, quizId?: number, siteId?: string): Promise<void> {
siteId = siteId || CoreSites.getCurrentSiteId();
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
if (!quizId) {

View File

@ -32,6 +32,7 @@ import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreTextUtils } from '@services/utils/text';
import { CoreTimeUtils } from '@services/utils/time';
import { ADDON_MOD_RESOURCE_COMPONENT } from '../constants';
import { CoreLoadings } from '@services/loadings';
/**
* Service that provides helper functions for resources.
@ -190,7 +191,7 @@ export class AddonModResourceHelperProvider {
* @returns Resolved when done.
*/
async openModuleFile(module: CoreCourseModuleData, courseId: number, options: CoreUtilsOpenFileOptions = {}): Promise<void> {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
// Download and open the file from the resource contents.

View File

@ -38,6 +38,7 @@ import {
} from '../../services/survey-sync';
import { CoreUtils } from '@services/utils/utils';
import { ADDON_MOD_SURVEY_AUTO_SYNCED, ADDON_MOD_SURVEY_COMPONENT } from '../../constants';
import { CoreLoadings } from '@services/loadings';
/**
* Component that displays a survey.
@ -197,7 +198,7 @@ export class AddonModSurveyIndexComponent extends CoreCourseModuleMainActivityCo
await CoreDomUtils.showConfirm(Translate.instant('core.areyousure'));
const answers: AddonModSurveySubmitAnswerData[] = [];
modal = await CoreDomUtils.showModalLoading('core.sending', true);
modal = await CoreLoadings.show('core.sending', true);
for (const x in this.answers) {
answers.push({

View File

@ -20,7 +20,7 @@ import { CoreCourse, CoreCourseModuleContentFile } from '@features/course/servic
import { CoreCourseModuleData } from '@features/course/services/course-helper';
import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@features/course/services/module-delegate';
import { CoreNavigationOptions } from '@services/navigator';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreLoadings } from '@services/loadings';
import { CoreUtils } from '@services/utils/utils';
import { makeSingleton } from '@singletons';
import { AddonModUrl } from '../url';
@ -82,7 +82,7 @@ export class AddonModUrlModuleHandlerService extends CoreModuleHandlerBase imple
class: 'addon-mod_url-handler',
showDownloadButton: false,
action: async (event: Event, module: CoreCourseModuleData, courseId: number, options?: CoreNavigationOptions) => {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
const shouldOpen = await this.shouldOpenLink(module);

View File

@ -13,8 +13,8 @@
// limitations under the License.
import { Injectable } from '@angular/core';
import { CoreLoadings } from '@services/loadings';
import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { makeSingleton } from '@singletons';
/**
@ -29,7 +29,7 @@ export class AddonModUrlHelperProvider {
* @param url The URL to go to.
*/
async open(url: string): Promise<void> {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
await CoreSites.visitLink(url, {

View File

@ -32,6 +32,7 @@ import { AddonModWikiOffline } from '../../services/wiki-offline';
import { AddonModWikiSync } from '../../services/wiki-sync';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { ADDON_MOD_WIKI_COMPONENT, ADDON_MOD_WIKI_PAGE_CREATED_EVENT, ADDON_MOD_WIKI_RENEW_LOCK_TIME } from '../../constants';
import { CoreLoadings } from '@services/loadings';
/**
* Page that allows adding or editing a wiki page.
@ -362,7 +363,7 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy, CanLeave {
const title = values.title;
let text = values.text ?? '';
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
text = CoreTextUtils.restorePluginfileUrls(text, this.subwikiFiles);
text = CoreTextUtils.formatHtmlLines(text);

View File

@ -22,6 +22,7 @@ import { makeSingleton } from '@singletons';
import { AddonModWiki } from '../wiki';
import { ADDON_MOD_WIKI_PAGE_NAME } from '../../constants';
import { AddonModWikiCreateLinkHandlerService } from '@addons/mod/wiki/services/handlers/create-link';
import { CoreLoadings } from '@services/loadings';
/**
* Handler to treat links to create a wiki page.
@ -84,7 +85,7 @@ export class AddonModWikiCreateLinkHandlerLazyService extends AddonModWikiCreate
* @inheritdoc
*/
async handleAction(siteId: string, courseId: number, params: Record<string, string>): Promise<void> {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
const { AddonModWikiIndexPage } = await import('../../pages/index');
try {

View File

@ -21,6 +21,7 @@ import { makeSingleton } from '@singletons';
import { AddonModWiki } from '../wiki';
import { ADDON_MOD_WIKI_PAGE_NAME } from '../../constants';
import { AddonModWikiEditLinkHandlerService } from '@addons/mod/wiki/services/handlers/edit-link';
import { CoreLoadings } from '@services/loadings';
/**
* Handler to treat links to edit a wiki page.
@ -32,7 +33,7 @@ export class AddonModWikiEditLinkHandlerLazyService extends AddonModWikiEditLink
* @inheritdoc
*/
async handleAction(siteId: string, params: Record<string, string>): Promise<void> {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
const pageId = Number(params.pageid);

View File

@ -22,6 +22,7 @@ import { Md5 } from 'ts-md5';
import { AddonModWiki } from '../wiki';
import { ADDON_MOD_WIKI_PAGE_NAME } from '../../constants';
import { AddonModWikiPageOrMapLinkHandlerService } from '@addons/mod/wiki/services/handlers/page-or-map-link';
import { CoreLoadings } from '@services/loadings';
/**
* Handler to treat links to a wiki page or the wiki map.
@ -33,7 +34,7 @@ export class AddonModWikiPageOrMapLinkHandlerLazyService extends AddonModWikiPag
* @inheritdoc
*/
async handleAction(url: string, siteId: string, params: Record<string, string>): Promise<void> {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
const pageId = parseInt(params.pageid, 10);
const action = url.indexOf('mod/wiki/map.php') != -1 ? 'map' : 'page';

View File

@ -43,6 +43,7 @@ import {
AddonModWorkshopOverallFeedbackMode,
} from '@addons/mod/workshop/constants';
import { toBoolean } from '@/core/transforms/boolean';
import { CoreLoadings } from '@services/loadings';
/**
* Component that displays workshop assessment strategy form.
@ -302,7 +303,7 @@ export class AddonModWorkshopAssessmentStrategyComponent implements OnInit, OnDe
let saveOffline = false;
let allowOffline = !files.length;
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
this.data.fieldErrors = {};

View File

@ -26,6 +26,7 @@ import {
AddonModWorkshopSubmissionDataWithOfflineData,
} from '../../services/workshop-helper';
import { AddonModWorkshopOffline } from '../../services/workshop-offline';
import { CoreLoadings } from '@services/loadings';
/**
* Component that displays workshop assessment.
@ -123,7 +124,7 @@ export class AddonModWorkshopAssessmentComponent implements OnInit {
};
if (!this.submission) {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
params.submission = await AddonModWorkshopHelper.getSubmissionById(

View File

@ -44,6 +44,7 @@ import {
ADDON_MOD_WORKSHOP_COMPONENT,
AddonModWorkshopPhase,
} from '@addons/mod/workshop/constants';
import { CoreLoadings } from '@services/loadings';
/**
* Page that displays a workshop assessment.
@ -372,7 +373,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy, CanLea
* @returns Resolved when done.
*/
protected async sendEvaluation(): Promise<void> {
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
const inputData: AddonModWorkshopAssessmentEvaluation = this.evaluateForm.value;
const grade = inputData.grade >= 0 ? String(inputData.grade) : '';

View File

@ -44,6 +44,7 @@ import {
AddonModWorkshopAction,
AddonModWorkshopSubmissionType,
} from '@addons/mod/workshop/constants';
import { CoreLoadings } from '@services/loadings';
/**
* Page that displays the workshop edit submission.
@ -353,7 +354,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca
let saveOffline = false;
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
const submissionId = this.submission?.id;
// Add some HTML to the message if needed.

View File

@ -55,6 +55,7 @@ import {
AddonModWorkshopAction,
AddonModWorkshopPhase,
} from '@addons/mod/workshop/constants';
import { CoreLoadings } from '@services/loadings';
/**
* Page that displays a workshop submission.
@ -510,7 +511,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy, CanLea
* @returns Resolved when done.
*/
protected async sendEvaluation(): Promise<void> {
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
const inputData: {
grade: number | string;
@ -559,7 +560,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy, CanLea
return;
}
const modal = await CoreDomUtils.showModalLoading('core.deleting', true);
const modal = await CoreLoadings.show('core.deleting', true);
let success = false;
try {

View File

@ -21,6 +21,7 @@ import { ModalController } from '@singletons';
import { CoreKeyboard } from '@singletons/keyboard';
import { CoreSharedModule } from '@/core/shared.module';
import { CoreToasts, ToastDuration } from '@services/toasts';
import { CoreLoadings } from '@services/loadings';
/**
* Component that displays a text area for composing a note.
@ -52,7 +53,7 @@ export class AddonNotesAddComponent {
e.stopPropagation();
CoreKeyboard.close();
const loadingModal = await CoreDomUtils.showModalLoading('core.sending', true);
const loadingModal = await CoreLoadings.show('core.sending', true);
// Freeze the add note button.
this.processing = true;

View File

@ -40,6 +40,7 @@ import { CoreTime } from '@singletons/time';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { Translate } from '@singletons';
import { CoreTextUtils } from '@services/utils/text';
import { CoreLoadings } from '@services/loadings';
/**
* Page that displays notifications settings.
@ -311,7 +312,7 @@ export class AddonNotificationsSettingsPage implements OnInit, OnDestroy {
return;
}
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
try {
CoreUser.updateUserPreferences([], !enable);

View File

@ -15,7 +15,7 @@
import { Injectable } from '@angular/core';
import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreLoadings } from '@services/loadings';
import { CoreFileUploaderHelper } from '@features/fileuploader/services/fileuploader-helper';
import { AddonPrivateFiles, AddonPrivateFilesGetUserInfoWSResult } from './privatefiles';
import { CoreError } from '@classes/errors/error';
@ -60,7 +60,7 @@ export class AddonPrivateFilesHelperProvider {
}
// File uploaded. Move it to private files.
const modal = await CoreDomUtils.showModalLoading('core.fileuploader.uploading', true);
const modal = await CoreLoadings.show('core.fileuploader.uploading', true);
try {
await AddonPrivateFiles.moveFromDraftToPrivate(result.itemid);

View File

@ -21,6 +21,7 @@ import { CoreDomUtils } from '@services/utils/dom';
import { makeSingleton, Translate } from '@singletons';
import { AddonReportInsights } from '../insights';
import { CoreToasts } from '@services/toasts';
import { CoreLoadings } from '@services/loadings';
// Bulk actions supported, along with the related lang string.
const BULK_ACTIONS = {
@ -51,7 +52,7 @@ export class AddonReportInsightsActionLinkHandlerService extends CoreContentLink
return [{
action: async (siteId?: string): Promise<void> => {
// Send the action.
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
try {
await AddonReportInsights.sendActionExecuted(params.action, [Number(params.predictionid)], siteId);

View File

@ -26,6 +26,7 @@ import {
CoreCourseModulePrefetchHandler } from '@features/course/services/module-prefetch-delegate';
import { CoreCourseAnyCourseData, CoreCourses } from '@features/courses/services/courses';
import { AccordionGroupChangeEventDetail, IonAccordionGroup } from '@ionic/angular';
import { CoreLoadings } from '@services/loadings';
import { CoreNavigator } from '@services/navigator';
import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
@ -469,7 +470,7 @@ export class AddonStorageManagerCourseStoragePage implements OnInit, OnDestroy {
* @returns Promise<void> Once deleting has finished
*/
protected async deleteModules(modules: AddonStorageManagerModule[], section?: AddonStorageManagerCourseSection): Promise<void> {
const modal = await CoreDomUtils.showModalLoading('core.deleting', true);
const modal = await CoreLoadings.show('core.deleting', true);
const promises: Promise<void>[] = [];
modules.forEach((module) => {

View File

@ -21,6 +21,7 @@ import { CoreCourseModulePrefetchDelegate } from '@features/course/services/modu
import { CoreCourses, CoreEnrolledCourseData } from '@features/courses/services/courses';
import { CoreSettingsHelper, CoreSiteSpaceUsage } from '@features/settings/services/settings-helper';
import { CoreSiteHome } from '@features/sitehome/services/sitehome';
import { CoreLoadings } from '@services/loadings';
import { CoreNavigator } from '@services/navigator';
import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
@ -121,7 +122,7 @@ export class AddonStorageManagerCoursesStoragePage implements OnInit, OnDestroy
return;
}
const modal = await CoreDomUtils.showModalLoading('core.deleting', true);
const modal = await CoreLoadings.show('core.deleting', true);
const deletedCourseIds = this.completelyDownloadedCourses.map((course) => course.id);
try {
@ -160,7 +161,7 @@ export class AddonStorageManagerCoursesStoragePage implements OnInit, OnDestroy
return;
}
const modal = await CoreDomUtils.showModalLoading('core.deleting', true);
const modal = await CoreLoadings.show('core.deleting', true);
try {
await CoreCourseHelper.deleteCourseFiles(course.id);

View File

@ -55,6 +55,7 @@ import { CoreSiteInfo } from './unauthenticated-site';
import { CoreAuthenticatedSite, CoreAuthenticatedSiteOptionalData, CoreSiteWSPreSets, WSObservable } from './authenticated-site';
import { firstValueFrom } from 'rxjs';
import { CorePlatform } from '@services/platform';
import { CoreLoadings } from '@services/loadings';
/**
* Class that represents a site (combination of site + user).
@ -703,7 +704,7 @@ export class CoreSite extends CoreAuthenticatedSite {
let modal: CoreIonLoadingElement | undefined;
if (showModal) {
modal = await CoreDomUtils.showModalLoading();
modal = await CoreLoadings.show();
}
try {

View File

@ -28,6 +28,7 @@ import { CoreForms } from '@singletons/form';
import { CorePath } from '@singletons/path';
import { CorePlatform } from '@services/platform';
import { toBoolean } from '@/core/transforms/boolean';
import { CoreLoadings } from '@services/loadings';
/**
* Component to handle a local file. Only files inside the app folder can be managed.
@ -180,7 +181,7 @@ export class CoreLocalFileComponent implements OnInit {
return;
}
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
const fileAndDir = CoreFile.getFileAndDirectoryFromPath(this.relativePath);
const newPath = CorePath.concatenatePaths(fileAndDir.directory, newName);
@ -224,7 +225,7 @@ export class CoreLocalFileComponent implements OnInit {
// Ask confirmation.
await CoreDomUtils.showDeleteConfirm('core.confirmdeletefile');
modal = await CoreDomUtils.showModalLoading('core.deleting', true);
modal = await CoreLoadings.show('core.deleting', true);
await CoreFile.removeFile(this.relativePath);

View File

@ -17,7 +17,7 @@ import { Component, ViewChild, ElementRef, Input } from '@angular/core';
import { CoreSites } from '@services/sites';
import { CoreForms } from '@singletons/form';
import { ModalController } from '@singletons';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreLoadings } from '@services/loadings';
/**
* Modal that asks the password.
@ -82,7 +82,7 @@ export class CorePasswordModalComponent {
return response;
}
const modal = await CoreDomUtils.showModalLoading('core.loading', true);
const modal = await CoreLoadings.show('core.loading', true);
try {
return await this.validator(password);
} catch (error) {

View File

@ -59,6 +59,7 @@ export async function getCoreServices(): Promise<Type<unknown>[]> {
const { CoreWSProvider } = await import('@services/ws');
const { CorePlatformService } = await import('@services/platform');
const { CoreQRScanService } = await import('@services/qrscan');
const { CoreLoadingsService } = await import('@services/loadings');
return [
CoreAppProvider,
@ -75,6 +76,7 @@ export async function getCoreServices(): Promise<Type<unknown>[]> {
CoreGroupsProvider,
CoreIframeUtilsProvider,
CoreLangProvider,
CoreLoadingsService,
CoreLocalNotificationsProvider,
CoreMimetypeUtilsProvider,
CoreNavigatorService,

View File

@ -14,6 +14,7 @@
import { Directive, Input, OnInit, ElementRef } from '@angular/core';
import { CoreFileHelper } from '@services/file-helper';
import { CoreLoadings } from '@services/loadings';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreWSFile } from '@services/ws';
@ -48,7 +49,7 @@ export class CoreDownloadFileDirective implements OnInit {
ev.preventDefault();
ev.stopPropagation();
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
await CoreFileHelper.downloadAndOpenFile(this.file, this.component, this.componentId);

View File

@ -28,6 +28,7 @@ import { DomSanitizer } from '@singletons';
import { CoreFilepool } from '@services/filepool';
import { CoreDom } from '@singletons/dom';
import { toBoolean } from '../transforms/boolean';
import { CoreLoadings } from '@services/loadings';
/**
* Directive to open a link in external browser or in the app.
@ -205,7 +206,7 @@ export class CoreLinkDirective implements OnInit {
if (isDownloading) {
// Wait for the download to finish before opening the file to prevent downloading it twice.
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
const path = await CoreFilepool.downloadUrl(currentSite.getId(), href);

View File

@ -44,6 +44,7 @@ import { Subscription } from 'rxjs';
import { CoreAnimations } from '@components/animations';
import { CoreKeyboard } from '@singletons/keyboard';
import { CoreToasts, ToastDuration } from '@services/toasts';
import { CoreLoadings } from '@services/loadings';
/**
* Page that displays comments.
@ -311,7 +312,7 @@ export class CoreCommentsViewerPage implements OnInit, OnDestroy {
*/
async addComment(text: string): Promise<void> {
CoreKeyboard.close();
const loadingModal = await CoreDomUtils.showModalLoading('core.sending', true);
const loadingModal = await CoreLoadings.show('core.sending', true);
// Freeze the add comment button.
this.sending = true;
try {

View File

@ -15,7 +15,7 @@
import { CoreContentLinksAction } from '../services/contentlinks-delegate';
import { CoreContentLinksHandlerBase } from './base-handler';
import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreLoadings } from '@services/loadings';
import { CoreCourseHelper } from '@features/course/services/course-helper';
/**
@ -72,7 +72,7 @@ export class CoreContentLinksModuleGradeHandler extends CoreContentLinksHandlerB
return [{
action: async (siteId): Promise<void> => {
// Check if userid is the site's current user.
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
const site = await CoreSites.getSite(siteId);
if (!params.userid || Number(params.userid) == site.getUserId()) {
// No user specified or current user. Navigate to module.

View File

@ -17,6 +17,7 @@ import { CoreCourse, CoreCourseWSSection } from '@features/course/services/cours
import { CoreCourseHelper, CoreCourseModuleData } from '@features/course/services/course-helper';
import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate';
import { IonContent } from '@ionic/angular';
import { CoreLoadings } from '@services/loadings';
import { CoreNavigationOptions, CoreNavigator } from '@services/navigator';
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
@ -204,7 +205,7 @@ export class CoreCourseModuleNavigationComponent implements OnInit, OnDestroy {
return;
}
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
// Re-calculate module in case a new module was made visible.
await CoreUtils.ignoreErrors(this.setNextAndPreviousModules(CoreSitesReadingStrategy.PREFER_NETWORK, next, !next));

View File

@ -18,6 +18,7 @@ import { CoreDomUtils } from '@services/utils/dom';
import { CoreCourse, CoreCourseModuleContentFile } from '@features/course/services/course';
import { CoreCourseHelper, CoreCourseModuleData } from '@features/course/services/course-helper';
import { CoreUtilsOpenFileOptions } from '@services/utils/utils';
import { CoreLoadings } from '@services/loadings';
/**
* Directive to allow downloading and open the main file of a module.
@ -57,7 +58,7 @@ export class CoreCourseDownloadModuleMainFileDirective implements OnInit {
ev.preventDefault();
ev.stopPropagation();
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
const courseId = this.courseId ? Number(this.courseId) : undefined;
try {

View File

@ -75,6 +75,7 @@ import { CoreEnrol } from '@features/enrol/services/enrol';
import { CoreEnrolAction, CoreEnrolDelegate } from '@features/enrol/services/enrol-delegate';
import { LazyRoutesModule } from '@/app/app-routing.module';
import { CoreModals } from '@services/modals';
import { CoreLoadings } from '@services/loadings';
/**
* Prefetch info of a module.
@ -1033,7 +1034,7 @@ export class CoreCourseHelperProvider {
* @returns Promise resolved when done.
*/
async getAndOpenCourse(courseId: number, params?: Params, siteId?: string): Promise<void> {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
let course: CoreCourseAnyCourseData | { id: number };
@ -1442,7 +1443,7 @@ export class CoreCourseHelperProvider {
options: CoreCourseNavigateToModuleByInstanceOptions = {},
): Promise<void> {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
const module = await CoreCourse.getModuleBasicInfoByInstance(instanceId, modName, { siteId: options.siteId });
@ -1478,7 +1479,7 @@ export class CoreCourseHelperProvider {
let courseId = options.courseId;
let sectionId = options.sectionId;
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
if (!courseId || !sectionId) {
@ -1962,7 +1963,7 @@ export class CoreCourseHelperProvider {
return;
}
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
completion.state = completion.state === CoreCourseModuleCompletionStatus.COMPLETION_COMPLETE
? CoreCourseModuleCompletionStatus.COMPLETION_INCOMPLETE
: CoreCourseModuleCompletionStatus.COMPLETION_COMPLETE;

View File

@ -61,6 +61,7 @@ import { asyncObservable } from '@/core/utils/rxjs';
import { firstValueFrom } from 'rxjs';
import { map } from 'rxjs/operators';
import { CoreSiteWSPreSets, WSObservable } from '@classes/sites/authenticated-site';
import { CoreLoadings } from '@services/loadings';
const ROOT_CACHE_KEY = 'mmCourse:';
@ -1360,7 +1361,7 @@ export class CoreCourseProvider {
return;
}
const loading = await CoreDomUtils.showModalLoading();
const loading = await CoreLoadings.show();
// Wait for site plugins to be fetched.
await CoreUtils.ignoreErrors(CoreSitePlugins.waitFetchPlugins());

View File

@ -29,6 +29,7 @@ import { CoreEnrolHelper } from '@features/enrol/services/enrol-helper';
import { CoreDownloadStatusTranslatable } from '@components/download-refresh/download-refresh';
import { toBoolean } from '@/core/transforms/boolean';
import { CorePopovers } from '@services/popovers';
import { CoreLoadings } from '@services/loadings';
/**
* This directive is meant to display an item for a list of courses.
@ -275,7 +276,7 @@ export class CoreCoursesCourseListItemComponent implements OnInit, OnDestroy, On
return;
}
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
await CoreCourseHelper.deleteCourseFiles(this.course.id);

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { CoreDomUtils } from '@services/utils/dom';
import { CoreLoadings } from '@services/loadings';
import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base-handler';
import { CoreCourseHelper } from '@features/course/services/course-helper';
import { CoreCourses } from '../courses';
@ -76,7 +76,7 @@ export class CoreCoursesLinksHandlerBase extends CoreContentLinksHandlerBase {
return;
}
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
// Check if user is enrolled in the course.
const hasAccess = await CoreCourseHelper.userHasAccessToCourse(courseId);

View File

@ -17,6 +17,7 @@ import { Params } from '@angular/router';
import { CoreCourseHelper } from '@features/course/services/course-helper';
import { CorePushNotificationsClickHandler } from '@features/pushnotifications/services/push-delegate';
import { CorePushNotificationsNotificationBasicData } from '@features/pushnotifications/services/pushnotifications';
import { CoreLoadings } from '@services/loadings';
import { CoreNavigator } from '@services/navigator';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreUtils } from '@services/utils/utils';
@ -51,7 +52,7 @@ export class CoreCoursesEnrolPushClickHandlerService implements CorePushNotifica
async handleClick(notification: CoreCoursesEnrolNotificationData): Promise<void> {
const courseId = notification.courseid;
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
const result = await CoreCourseHelper.getCourse(courseId, notification.site);

View File

@ -24,6 +24,7 @@ import { CoreUtils } from '@services/utils/utils';
import { makeSingleton } from '@singletons';
import { CorePath } from '@singletons/path';
import { CoreCourses } from '../courses';
import { CoreLoadings } from '@services/loadings';
/**
* Handler for course request push notifications clicks.
@ -66,7 +67,7 @@ export class CoreCoursesRequestPushClickHandlerService implements CorePushNotifi
}
// Open the course.
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
await CoreUtils.ignoreErrors(CoreCourses.invalidateUserCourses(notification.site));

View File

@ -23,6 +23,7 @@ import { CoreToasts, ToastDuration } from '@services/toasts';
import { CoreUtils } from '@services/utils/utils';
import { ModalController } from '@singletons';
import { CoreLoadings } from '@services/loadings';
/**
* Component that displays the contact DPO page.
@ -57,7 +58,7 @@ export class CoreDataPrivacyContactDPOComponent implements OnInit {
* @inheritdoc
*/
async ngOnInit(): Promise<void> {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
// Get current user email.
const userId = CoreSites.getCurrentSiteUserId();
@ -75,7 +76,7 @@ export class CoreDataPrivacyContactDPOComponent implements OnInit {
event.preventDefault();
event.stopPropagation();
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
// Send the message.

View File

@ -24,6 +24,7 @@ import { CoreDomUtils } from '@services/utils/dom';
import { CoreToasts, ToastDuration } from '@services/toasts';
import { ModalController } from '@singletons';
import { CoreLoadings } from '@services/loadings';
/**
* Component that displays the new request page.
@ -100,7 +101,7 @@ export class CoreDataPrivacyNewRequestComponent implements OnInit {
event.preventDefault();
event.stopPropagation();
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
// Send the message.

View File

@ -19,6 +19,7 @@ import {
CoreDataPrivacyGetAccessInformationWSResponse,
CoreDataPrivacyRequest,
} from '@features/dataprivacy/services/dataprivacy';
import { CoreLoadings } from '@services/loadings';
import { CoreModals } from '@services/modals';
import { CoreNavigator } from '@services/navigator';
import { CoreScreen } from '@services/screen';
@ -123,7 +124,7 @@ export class CoreDataPrivacyMainPage implements OnInit {
});
if (succeed) {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
await this.refreshContent();
} finally {
@ -149,7 +150,7 @@ export class CoreDataPrivacyMainPage implements OnInit {
});
if (succeed) {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
await this.refreshContent();
} finally {
@ -175,7 +176,7 @@ export class CoreDataPrivacyMainPage implements OnInit {
return;
}
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
await CoreDataPrivacy.cancelDataRequest(requestId);

View File

@ -25,6 +25,7 @@ import { CoreCaptureError } from '@classes/errors/captureerror';
import { CoreCanceledError } from '@classes/errors/cancelederror';
import { CorePath } from '@singletons/path';
import { toBoolean } from '@/core/transforms/boolean';
import { CoreLoadings } from '@services/loadings';
/**
* Page to capture media in browser.
@ -211,7 +212,7 @@ export class CoreEmulatorCaptureMediaComponent implements OnInit, OnDestroy {
// Get the image from the video and set it to the canvas, using video width/height.
const width = this.streamVideo?.nativeElement.videoWidth;
const height = this.streamVideo?.nativeElement.videoHeight;
const loadingModal = await CoreDomUtils.showModalLoading();
const loadingModal = await CoreLoadings.show();
this.imgCanvas.nativeElement.width = width;
this.imgCanvas.nativeElement.height = height;
@ -313,7 +314,7 @@ export class CoreEmulatorCaptureMediaComponent implements OnInit, OnDestroy {
return;
}
const loadingModal = await CoreDomUtils.showModalLoading();
const loadingModal = await CoreLoadings.show();
try {
// Capturing in browser. Write the blob in a file.

View File

@ -45,6 +45,7 @@ import { CorePromisedValue } from '@classes/promised-value';
import { CorePlatform } from '@services/platform';
import { Chooser } from '@features/native/plugins';
import { CoreToasts } from '@services/toasts';
import { CoreLoadings } from '@services/loadings';
/**
* Helper service to upload files.
@ -75,7 +76,7 @@ export class CoreFileUploaderHelperProvider {
mimetypes?: string[],
): Promise<CoreWSUploadFileResult | FileEntry> {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
const result = await Chooser.getFileMetadata(mimetypes ? mimetypes.join(',') : undefined);
@ -160,7 +161,7 @@ export class CoreFileUploaderHelperProvider {
async copyAndUploadFile(file: IFile | File, upload?: boolean, name?: string): Promise<CoreWSUploadFileResult | FileEntry> {
name = name || file.name;
const modal = await CoreDomUtils.showModalLoading('core.fileuploader.readingfile', true);
const modal = await CoreLoadings.show('core.fileuploader.readingfile', true);
let fileEntry: FileEntry | undefined;
try {
@ -821,7 +822,7 @@ export class CoreFileUploaderHelperProvider {
}
// File isn't too large and user confirmed, let's upload.
const modal = await CoreDomUtils.showModalLoading(uploadingStr);
const modal = await CoreLoadings.show(uploadingStr);
try {
return await CoreFileUploader.uploadFile(

View File

@ -43,6 +43,7 @@ import { CoreError } from '@classes/errors/error';
import { CoreCourseHelper } from '@features/course/services/course-helper';
import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate';
import { CoreCourseAccess } from '@features/course/services/course-options-delegate';
import { CoreLoadings } from '@services/loadings';
export const GRADES_PAGE_NAME = 'grades';
export const GRADES_PARTICIPANTS_PAGE_NAME = 'participant-grades';
@ -441,7 +442,7 @@ export class CoreGradesHelperProvider {
moduleId?: number,
siteId?: string,
): Promise<void> {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
const site = await CoreSites.getSite(siteId);

View File

@ -41,6 +41,7 @@ import {
import { CoreCustomURLSchemes } from '@services/urlschemes';
import { CoreSiteError } from '@classes/errors/siteerror';
import { CoreKeyboard } from '@singletons/keyboard';
import { CoreLoadings } from '@services/loadings';
/**
* Page to enter the user credentials.
@ -290,7 +291,7 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy {
return;
}
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
// Start the authentication process.
try {

View File

@ -37,6 +37,7 @@ import { CoreSitesFactory } from '@services/sites-factory';
import { EMAIL_SIGNUP_FEATURE_NAME } from '@features/login/constants';
import { CoreInputErrorsMessages } from '@components/input-errors/input-errors';
import { CoreViewer } from '@features/viewer/services/viewer';
import { CoreLoadings } from '@services/loadings';
/**
* Page to signup using email.
@ -306,7 +307,7 @@ export class CoreLoginEmailSignupPage implements OnInit {
return;
}
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
const params: SignupUserWSParams = {
username: this.signupForm.value.username.trim().toLowerCase(),
@ -415,7 +416,7 @@ export class CoreLoginEmailSignupPage implements OnInit {
return;
}
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
const params = this.ageVerificationForm.value;

View File

@ -25,6 +25,7 @@ import { CoreSitePublicConfigResponse, CoreUnauthenticatedSite } from '@classes/
import { CoreUserSupportConfig } from '@features/user/classes/support/support-config';
import { CoreUserGuestSupportConfig } from '@features/user/classes/support/guest-support-config';
import { CoreSitesFactory } from '@services/sites-factory';
import { CoreLoadings } from '@services/loadings';
/**
* Page to recover a forgotten password.
@ -90,7 +91,7 @@ export class CoreLoginForgottenPasswordPage implements OnInit {
return;
}
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
const isMail = field === 'email';
try {

View File

@ -33,6 +33,7 @@ import { SafeHtml } from '@angular/platform-browser';
import { CoreSitePublicConfigResponse } from '@classes/sites/unauthenticated-site';
import { ALWAYS_SHOW_LOGIN_FORM_CHANGED, FORGOTTEN_PASSWORD_FEATURE_NAME } from '@features/login/constants';
import { CoreKeyboard } from '@singletons/keyboard';
import { CoreLoadings } from '@services/loadings';
/**
* Page to enter the user password to reconnect to a site.
@ -243,7 +244,7 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
return;
}
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
// Start the authentication process.

View File

@ -48,6 +48,7 @@ import { CoreUnauthenticatedSite } from '@classes/sites/unauthenticated-site';
import { CoreKeyboard } from '@singletons/keyboard';
import { CoreModals } from '@services/modals';
import { CoreQRScan } from '@services/qrscan';
import { CoreLoadings } from '@services/loadings';
/**
* Site (url) chooser when adding a new site.
@ -322,7 +323,7 @@ export class CoreLoginSitePage implements OnInit {
} else {
// Not a demo site.
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
let checkResult: CoreSiteCheckResponse;
@ -361,7 +362,7 @@ export class CoreLoginSitePage implements OnInit {
* @returns Promise resolved when done.
*/
protected async loginDemoSite(siteData: CoreSitesDemoSiteData): Promise<void> {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
const data = await CoreSites.getUserToken(siteData.url, siteData.username, siteData.password);
@ -595,7 +596,7 @@ export class CoreLoginSitePage implements OnInit {
*/
protected async treatErrorInAuthenticationCustomURL(customURL: string, error: CoreCustomURLSchemesHandleError): Promise<void> {
const siteUrl = error.data?.siteUrl || '';
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
// Set the site URL in the input.
this.siteForm.controls.siteUrl.setValue(siteUrl);

View File

@ -20,6 +20,7 @@ import { CoreAccountsList, CoreLoginHelper } from '@features/login/services/logi
import { CoreNavigator } from '@services/navigator';
import { CoreFilter } from '@features/filter/services/filter';
import { CoreAnimations } from '@components/animations';
import { CoreLoadings } from '@services/loadings';
/**
* Page that displays the list of sites stored in the device.
@ -105,7 +106,7 @@ export class CoreLoginSitesPage implements OnInit {
* @returns Promise resolved when done.
*/
async login(site: CoreSiteBasicInfo): Promise<void> {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
const loggedIn = await CoreSites.loadSite(site.id);

View File

@ -59,6 +59,7 @@ import {
import { LazyRoutesModule } from '@/app/app-routing.module';
import { CoreSiteError, CoreSiteErrorDebug } from '@classes/errors/siteerror';
import { CoreQRScan } from '@services/qrscan';
import { CoreLoadings } from '@services/loadings';
/**
* Helper provider that provides some common features regarding authentication.
@ -175,7 +176,7 @@ export class CoreLoginHelperProvider {
}
// Check if password reset can be done through the app.
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
const canReset = await this.canRequestPasswordReset(siteUrl);
@ -649,7 +650,7 @@ export class CoreLoginHelperProvider {
return false;
}
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
const loginUrl = await this.prepareForSSOLogin(siteUrl, undefined, launchUrl, redirectData, {
@ -686,7 +687,7 @@ export class CoreLoginHelperProvider {
launchUrl?: string,
redirectData?: CoreRedirectPayload,
): Promise<void> {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
const loginUrl = await this.prepareForSSOLogin(siteUrl, service, launchUrl, redirectData);
@ -1082,7 +1083,7 @@ export class CoreLoginHelperProvider {
await CoreDomUtils.showConfirm(message, title, okText, cancelText);
// Call the WS to resend the confirmation email.
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
const data = { username, password };
const preSets = { siteUrl };
@ -1118,7 +1119,7 @@ export class CoreLoginHelperProvider {
* @returns Promise.
*/
protected async canResendEmail(siteUrl: string): Promise<boolean> {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
// We don't have site info before login, the only way to check if the WS is available is by calling it.
try {

View File

@ -27,6 +27,7 @@ import { CORE_DATAPRIVACY_FEATURE_NAME, CORE_DATAPRIVACY_PAGE_NAME } from '@feat
import { CoreNavigator } from '@services/navigator';
import { CoreDataPrivacy } from '@features/dataprivacy/services/dataprivacy';
import { CoreModals } from '@services/modals';
import { CoreLoadings } from '@services/loadings';
/**
* Page to view user acceptances.
@ -212,7 +213,7 @@ export class CorePolicyAcceptancesPage implements OnInit, OnDestroy {
event.preventDefault();
event.stopPropagation();
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
try {
await CorePolicy.setUserAcceptances({ [policy.versionid]: accept ? 1 : 0 });

View File

@ -32,6 +32,7 @@ import { Subscription } from 'rxjs';
import { CoreDom } from '@singletons/dom';
import { CoreWait } from '@singletons/wait';
import { CoreModals } from '@services/modals';
import { CoreLoadings } from '@services/loadings';
/**
* Page to accept a site policy.
@ -375,7 +376,7 @@ export class CorePolicySitePolicyPage implements OnInit, OnDestroy {
return;
}
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
try {
if (!this.isPoliciesURL) {

View File

@ -27,6 +27,7 @@ import { CoreDomUtils } from '@services/utils/dom';
import { CoreToasts, ToastDuration } from '@services/toasts';
import { Translate } from '@singletons';
import { CoreEventObserver, CoreEvents } from '@singletons/events';
import { CoreLoadings } from '@services/loadings';
/**
* Component that displays the user rating select.
@ -130,7 +131,7 @@ export class CoreRatingRateComponent implements OnChanges, OnDestroy {
return;
}
const modal = await CoreDomUtils.showModalLoading('core.sending', true);
const modal = await CoreLoadings.show('core.sending', true);
try {
const response = await CoreRating.addRating(

View File

@ -202,7 +202,7 @@ export class CoreSettingsDevPage implements OnInit {
* Invalidate app caches.
*/
async invalidateCaches(): Promise<void> {
const success = await CoreDomUtils.showOperationModals('Invalidating caches', true, async () => {
const success = await CoreDomUtils.showOperationModals('Invalidating caches', false, async () => {
await CoreCacheManager.invalidate();
return true;

View File

@ -20,6 +20,7 @@ import { Translate } from '@singletons';
import { CoreSitePluginsPluginContentComponent } from '../components/plugin-content/plugin-content';
import { CoreSitePluginsCallWSBaseDirective } from './call-ws-directive';
import { toBoolean } from '@/core/transforms/boolean';
import { CoreLoadings } from '@services/loadings';
/**
* Base class for directives to call a WS when the element is clicked.
@ -67,7 +68,7 @@ export class CoreSitePluginsCallWSOnClickBaseDirective extends CoreSitePluginsCa
* @inheritdoc
*/
protected async callWS(): Promise<void> {
const modal = await CoreDomUtils.showModalLoading();
const modal = await CoreLoadings.show();
try {
await super.callWS();

View File

@ -33,6 +33,7 @@ import { CoreFileUploaderHelper } from '@features/fileuploader/services/fileuplo
import { CoreMimetypeUtils } from '@services/utils/mimetype';
import { Translate } from '@singletons';
import { CoreUrl } from '@singletons/url';
import { CoreLoadings } from '@services/loadings';
/**
* Page that displays info about a user.
@ -176,7 +177,7 @@ export class CoreUserAboutPage implements OnInit, OnDestroy {
try {
const result = await CoreFileUploaderHelper.selectAndUploadFile(maxSize, title, mimetypes);
modal = await CoreDomUtils.showModalLoading('core.sending', true);
modal = await CoreLoadings.show('core.sending', true);
const profileImageURL = await CoreUser.changeProfilePicture(result.itemid, this.userId, this.site.getId());

Some files were not shown because too many files have changed in this diff Show More