MOBILE-4653 utils: Move promise related utils functions
parent
fe0d6a0979
commit
7ea188af49
|
@ -14,7 +14,7 @@
|
|||
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { CoreNavigator } from '@services/navigator';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
|
||||
|
@ -81,7 +81,7 @@ export class AddonBadgesBadgeClassPage implements OnInit {
|
|||
* @param refresher Refresher.
|
||||
*/
|
||||
async refreshBadgeClass(refresher?: HTMLIonRefresherElement): Promise<void> {
|
||||
await CoreUtils.ignoreErrors(AddonBadges.invalidateBadgeClass(this.badgeId));
|
||||
await CorePromiseUtils.ignoreErrors(AddonBadges.invalidateBadgeClass(this.badgeId));
|
||||
|
||||
await this.fetchBadgeClass();
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import { CoreDomUtils } from '@services/utils/dom';
|
|||
import { CoreSites } from '@services/sites';
|
||||
import { CoreUser } from '@features/user/services/user';
|
||||
import { AddonBadges, AddonBadgesUserBadge } from '../../services/badges';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { CoreCourses } from '@features/courses/services/courses';
|
||||
import { CoreNavigator } from '@services/navigator';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
@ -151,12 +151,12 @@ export class AddonBadgesIssuedBadgePage implements OnInit, OnDestroy {
|
|||
* @param refresher Refresher.
|
||||
*/
|
||||
async refreshBadges(refresher?: HTMLIonRefresherElement): Promise<void> {
|
||||
await CoreUtils.allPromisesIgnoringErrors([
|
||||
await CorePromiseUtils.allPromisesIgnoringErrors([
|
||||
AddonBadges.invalidateUserBadges(this.courseId, this.userId),
|
||||
AddonBadges.invalidateUserBadgeByHash(this.badgeHash),
|
||||
]);
|
||||
|
||||
await CoreUtils.ignoreErrors(Promise.all([
|
||||
await CorePromiseUtils.ignoreErrors(Promise.all([
|
||||
this.fetchIssuedBadge(),
|
||||
]));
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import { AddonBadges, AddonBadgesUserBadge } from '../../services/badges';
|
|||
import { CoreTimeUtils } from '@services/utils/time';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreSites } from '@services/sites';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { CoreSplitViewComponent } from '@components/split-view/split-view';
|
||||
import { CoreNavigator } from '@services/navigator';
|
||||
import { CoreListItemsManager } from '@classes/items-management/list-items-manager';
|
||||
|
@ -90,13 +90,13 @@ export class AddonBadgesUserBadgesPage implements AfterViewInit, OnDestroy {
|
|||
* @param refresher Refresher.
|
||||
*/
|
||||
async refreshBadges(refresher?: HTMLIonRefresherElement): Promise<void> {
|
||||
await CoreUtils.ignoreErrors(
|
||||
await CorePromiseUtils.ignoreErrors(
|
||||
AddonBadges.invalidateUserBadges(
|
||||
this.badges.getSource().COURSE_ID,
|
||||
this.badges.getSource().USER_ID,
|
||||
),
|
||||
);
|
||||
await CoreUtils.ignoreErrors(this.badges.reload());
|
||||
await CorePromiseUtils.ignoreErrors(this.badges.reload());
|
||||
|
||||
refresher?.complete();
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import { makeSingleton } from '@singletons';
|
|||
import { CorePushNotificationsNotificationBasicData } from '@features/pushnotifications/services/pushnotifications';
|
||||
import { CoreNavigator } from '@services/navigator';
|
||||
import { AddonBadgesHelper } from '../badges-helper';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Handler for badges push notifications clicks.
|
||||
|
@ -72,7 +73,7 @@ export class AddonBadgesPushClickHandlerService implements CorePushNotifications
|
|||
}
|
||||
|
||||
// No hash, open the list of user badges.
|
||||
await CoreUtils.ignoreErrors(
|
||||
await CorePromiseUtils.ignoreErrors(
|
||||
AddonBadges.invalidateUserBadges(
|
||||
0,
|
||||
Number(notification.usertoid),
|
||||
|
|
|
@ -26,7 +26,7 @@ import { CoreCourseHelper, CorePrefetchStatusInfo } from '@features/course/servi
|
|||
import { CoreCourseOptionsDelegate } from '@features/course/services/course-options-delegate';
|
||||
import { CoreBlockBaseComponent } from '@features/block/classes/base-block-component';
|
||||
import { CoreSite } from '@classes/sites/site';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreText } from '@singletons/text';
|
||||
import { AddonCourseCompletion } from '@addons/coursecompletion/services/coursecompletion';
|
||||
|
@ -243,7 +243,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem
|
|||
|
||||
// Invalidate course completion data.
|
||||
promises.push(this.invalidateCourseList().finally(() =>
|
||||
CoreUtils.allPromises(courseIds.map((courseId) =>
|
||||
CorePromiseUtils.allPromises(courseIds.map((courseId) =>
|
||||
AddonCourseCompletion.invalidateCourseCompletion(courseId)))));
|
||||
|
||||
if (courseIds.length == 1) {
|
||||
|
@ -255,7 +255,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem
|
|||
promises.push(CoreCourses.invalidateCoursesByField('ids', courseIds.join(',')));
|
||||
}
|
||||
|
||||
await CoreUtils.allPromises(promises).finally(() => {
|
||||
await CorePromiseUtils.allPromises(promises).finally(() => {
|
||||
this.prefetchIconsInitialized = false;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ import {
|
|||
CoreCoursesMyCoursesUpdatedEventAction,
|
||||
CORE_COURSES_STATE_FAVOURITE,
|
||||
} from '@features/courses/constants';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Component to render a recent courses block.
|
||||
|
@ -118,7 +119,7 @@ export class AddonBlockRecentlyAccessedCoursesComponent extends CoreBlockBaseCom
|
|||
|
||||
// Invalidate course completion data.
|
||||
promises.push(this.invalidateCourseList().finally(() =>
|
||||
CoreUtils.allPromises(courseIds.map((courseId) =>
|
||||
CorePromiseUtils.allPromises(courseIds.map((courseId) =>
|
||||
AddonCourseCompletion.invalidateCourseCompletion(courseId)))));
|
||||
|
||||
if (courseIds.length == 1) {
|
||||
|
@ -130,7 +131,7 @@ export class AddonBlockRecentlyAccessedCoursesComponent extends CoreBlockBaseCom
|
|||
promises.push(CoreCourses.invalidateCoursesByField('ids', courseIds.join(',')));
|
||||
}
|
||||
|
||||
await CoreUtils.allPromises(promises);
|
||||
await CorePromiseUtils.allPromises(promises);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -33,6 +33,7 @@ import {
|
|||
CoreCoursesMyCoursesUpdatedEventAction,
|
||||
CORE_COURSES_STATE_FAVOURITE,
|
||||
} from '@features/courses/constants';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Component to render a starred courses block.
|
||||
|
@ -113,7 +114,7 @@ export class AddonBlockStarredCoursesComponent extends CoreBlockBaseComponent im
|
|||
|
||||
// Invalidate course completion data.
|
||||
promises.push(this.invalidateCourseList().finally(() =>
|
||||
CoreUtils.allPromises(courseIds.map((courseId) =>
|
||||
CorePromiseUtils.allPromises(courseIds.map((courseId) =>
|
||||
AddonCourseCompletion.invalidateCourseCompletion(courseId)))));
|
||||
|
||||
if (courseIds.length == 1) {
|
||||
|
@ -125,7 +126,7 @@ export class AddonBlockStarredCoursesComponent extends CoreBlockBaseComponent im
|
|||
promises.push(CoreCourses.invalidateCoursesByField('ids', courseIds.join(',')));
|
||||
}
|
||||
|
||||
await CoreUtils.allPromises(promises);
|
||||
await CorePromiseUtils.allPromises(promises);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,7 +16,7 @@ import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
|||
import { CoreSites } from '@services/sites';
|
||||
import { ICoreBlockComponent } from '@features/block/classes/base-block-component';
|
||||
import { AddonBlockTimeline } from '../../services/timeline';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreCoursesHelper, CoreEnrolledCourseDataWithOptions } from '@features/courses/services/courses-helper';
|
||||
import { CoreCourses } from '@features/courses/services/courses';
|
||||
|
@ -122,7 +122,7 @@ export class AddonBlockTimelineComponent implements OnInit, ICoreBlockComponent
|
|||
* @inheritdoc
|
||||
*/
|
||||
async invalidateContent(): Promise<void> {
|
||||
await CoreUtils.allPromises([
|
||||
await CorePromiseUtils.allPromises([
|
||||
AddonBlockTimeline.invalidateActionEventsByTimesort(),
|
||||
AddonBlockTimeline.invalidateActionEventsByCourses(),
|
||||
CoreCourses.invalidateUserCourses(),
|
||||
|
|
|
@ -47,6 +47,7 @@ import { CoreEvents } from '@singletons/events';
|
|||
import { CoreForms } from '@singletons/form';
|
||||
import { CoreFileEntry } from '@services/file-helper';
|
||||
import { CoreTimeUtils } from '@services/utils/time';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
@Component({
|
||||
selector: 'addon-blog-edit-entry',
|
||||
|
@ -323,7 +324,7 @@ export default class AddonBlogEditEntryPage implements CanLeave, OnInit, OnDestr
|
|||
const filters: AddonBlogFilter | undefined = CoreNavigator.getRouteParam('filters');
|
||||
const entry = this.entry && 'attachment' in this.entry
|
||||
? this.entry
|
||||
: await CoreUtils.ignoreErrors(this.getEntry({ filters, lastModified, entryId: this.entry.id }));
|
||||
: await CorePromiseUtils.ignoreErrors(this.getEntry({ filters, lastModified, entryId: this.entry.id }));
|
||||
|
||||
const removedFiles = CoreFileUploader.getFilesToDelete(entry?.attachmentfiles ?? [], this.files);
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import { CoreNetwork } from '@services/network';
|
|||
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreUrl } from '@singletons/url';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { CoreArray } from '@singletons/array';
|
||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
||||
import { CoreTime } from '@singletons/time';
|
||||
|
@ -93,7 +93,7 @@ export class AddonBlogIndexPage implements OnInit, OnDestroy {
|
|||
this.isOnline.set(CoreNetwork.isOnline());
|
||||
|
||||
this.logView = CoreTime.once(async () => {
|
||||
await CoreUtils.ignoreErrors(AddonBlog.logView(this.filter));
|
||||
await CorePromiseUtils.ignoreErrors(AddonBlog.logView(this.filter));
|
||||
|
||||
CoreAnalytics.logEvent({
|
||||
type: CoreAnalyticsEventType.VIEW_ITEM_LIST,
|
||||
|
@ -113,7 +113,7 @@ export class AddonBlogIndexPage implements OnInit, OnDestroy {
|
|||
|
||||
this.entryUpdateObserver = CoreEvents.on(ADDON_BLOG_ENTRY_UPDATED, async () => {
|
||||
this.loaded.set(false);
|
||||
await CoreUtils.ignoreErrors(this.refresh());
|
||||
await CorePromiseUtils.ignoreErrors(this.refresh());
|
||||
this.loaded.set(true);
|
||||
});
|
||||
|
||||
|
@ -123,7 +123,7 @@ export class AddonBlogIndexPage implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
this.loaded.set(false);
|
||||
await CoreUtils.ignoreErrors(this.refresh(false));
|
||||
await CorePromiseUtils.ignoreErrors(this.refresh(false));
|
||||
this.loaded.set(true);
|
||||
});
|
||||
|
||||
|
@ -375,7 +375,7 @@ export class AddonBlogIndexPage implements OnInit, OnDestroy {
|
|||
* @param refresher Refresher instance.
|
||||
*/
|
||||
async refresh(sync = true, refresher?: HTMLIonRefresherElement): Promise<void> {
|
||||
const promises = this.entries.map((entry) => {
|
||||
const promises = this.entries.map(async (entry) => {
|
||||
if (this.isOnlineEntry(entry)) {
|
||||
return CoreComments.invalidateCommentsData(
|
||||
ContextLevel.USER,
|
||||
|
@ -399,7 +399,7 @@ export class AddonBlogIndexPage implements OnInit, OnDestroy {
|
|||
|
||||
}
|
||||
|
||||
await CoreUtils.allPromises(promises);
|
||||
await CorePromiseUtils.allPromises(promises);
|
||||
await this.fetchEntries(true, false, sync);
|
||||
refresher?.complete();
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import { CoreFileUploader } from '@features/fileuploader/services/fileuploader';
|
|||
import { CoreFile } from '@services/file';
|
||||
import { CoreFileEntry } from '@services/file-helper';
|
||||
import { CoreSites } from '@services/sites';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { CoreObject } from '@singletons/object';
|
||||
import { CorePath } from '@singletons/path';
|
||||
|
@ -108,7 +108,7 @@ export class AddonBlogOfflineService {
|
|||
*/
|
||||
async getOfflineEntry(filter: { id?: number; created?: number }, siteId?: string): Promise<AddonBlogOfflineEntry | undefined> {
|
||||
const site = await CoreSites.getSite(siteId);
|
||||
const record = await CoreUtils.ignoreErrors(
|
||||
const record = await CorePromiseUtils.ignoreErrors(
|
||||
site.getDb().getRecord<AddonBlogOfflineEntry>(OFFLINE_BLOG_ENTRIES_TABLE_NAME, filter),
|
||||
);
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import { CoreUtils } from '@services/utils/utils';
|
|||
import { CoreStatusWithWarningsWSResponse, CoreWSExternalFile, CoreWSExternalWarning } from '@services/ws';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { AddonBlogOffline, AddonBlogOfflineEntry } from './blog-offline';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
const ROOT_CACHE_KEY = 'addonBlog:';
|
||||
|
||||
|
@ -229,7 +230,7 @@ export class AddonBlogProvider {
|
|||
}
|
||||
|
||||
await this.deleteEntryOnline(params, siteId);
|
||||
await CoreUtils.ignoreErrors(AddonBlogOffline.unmarkEntryAsRemoved(params.entryid));
|
||||
await CorePromiseUtils.ignoreErrors(AddonBlogOffline.unmarkEntryAsRemoved(params.entryid));
|
||||
} catch (error) {
|
||||
if (!CoreUtils.isWebServiceError(error)) {
|
||||
// Couldn't connect to server, store in offline.
|
||||
|
@ -311,7 +312,7 @@ export class AddonBlogProvider {
|
|||
const tags = options?.find(option => option.name === 'tags')?.value as string | undefined;
|
||||
const publishState = options?.find(option => option.name === 'publishstate')?.value as AddonBlogPublishState
|
||||
?? AddonBlogPublishState.draft;
|
||||
const user = await CoreUtils.ignoreErrors(CoreUser.getProfile(offlineEntry.userid, courseId, true));
|
||||
const user = await CorePromiseUtils.ignoreErrors(CoreUser.getProfile(offlineEntry.userid, courseId, true));
|
||||
const folder = 'id' in offlineEntry && offlineEntry.id ? { id: offlineEntry.id } : { created: offlineEntry.created };
|
||||
const offlineFiles = await AddonBlogOffline.getOfflineFiles(folder);
|
||||
const optionsFiles = this.getAttachmentFilesFromOptions(options);
|
||||
|
@ -375,7 +376,7 @@ export class AddonBlogProvider {
|
|||
}
|
||||
|
||||
entry.summary = CoreFileHelper.replacePluginfileUrls(entry.summary, entry.summaryfiles || []);
|
||||
entry.user = await CoreUtils.ignoreErrors(CoreUser.getProfile(entry.userid, entry.courseid, true));
|
||||
entry.user = await CorePromiseUtils.ignoreErrors(CoreUser.getProfile(entry.userid, entry.courseid, true));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -53,6 +53,7 @@ import { ContextLevel } from '@/core/constants';
|
|||
import { CorePopovers } from '@services/popovers';
|
||||
import { CoreLoadings } from '@services/loadings';
|
||||
import { REMINDERS_DISABLED, CoreRemindersUnits } from '@features/reminders/constants';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Page that displays a form to create/edit an event.
|
||||
|
@ -164,7 +165,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave {
|
|||
try {
|
||||
const [types, accessInfo] = await Promise.all([
|
||||
AddonCalendar.getAllowedEventTypes(this.courseId),
|
||||
CoreUtils.ignoreErrors(AddonCalendar.getAccessInformation(this.courseId), {
|
||||
CorePromiseUtils.ignoreErrors(AddonCalendar.getAccessInformation(this.courseId), {
|
||||
canmanageentries: false,
|
||||
canmanageownentries: false,
|
||||
canmanagegroupentries: false,
|
||||
|
|
|
@ -31,7 +31,7 @@ import { CoreTimeUtils } from '@services/utils/time';
|
|||
import { NgZone, Translate } from '@singletons';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { CoreNavigator } from '@services/navigator';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { ActivatedRoute, ActivatedRouteSnapshot } from '@angular/router';
|
||||
import { CoreConstants } from '@/core/constants';
|
||||
import { CoreRoutedItemsManagerSourcesTracker } from '@classes/items-management/routed-items-manager-sources-tracker';
|
||||
|
@ -480,7 +480,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
|
|||
}
|
||||
promises.push(AddonCalendar.invalidateTimeFormat());
|
||||
|
||||
await CoreUtils.allPromisesIgnoringErrors(promises);
|
||||
await CorePromiseUtils.allPromisesIgnoringErrors(promises);
|
||||
|
||||
await this.fetchEvent(sync, showErrors);
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ import {
|
|||
} from '../constants';
|
||||
import { AddonCalendarSyncInvalidateEvent } from './calendar-sync';
|
||||
import { REMINDERS_DISABLED, REMINDERS_DEFAULT_REMINDER_TIMEBEFORE } from '@features/reminders/constants';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Service that provides some features regarding lists of courses and categories.
|
||||
|
@ -638,7 +639,7 @@ export class AddonCalendarHelperProvider {
|
|||
const repeatedEvents =
|
||||
await AddonCalendar.getLocalEventsByRepeatIdFromLocalDb(eventData.repeatid, site.id);
|
||||
|
||||
await CoreUtils.allPromises(repeatedEvents.map((event) =>
|
||||
await CorePromiseUtils.allPromises(repeatedEvents.map((event) =>
|
||||
AddonCalendar.invalidateEvent(event.id)));
|
||||
|
||||
return;
|
||||
|
@ -659,7 +660,7 @@ export class AddonCalendarHelperProvider {
|
|||
}));
|
||||
|
||||
try {
|
||||
await CoreUtils.allPromisesIgnoringErrors(promises);
|
||||
await CorePromiseUtils.allPromisesIgnoringErrors(promises);
|
||||
} finally {
|
||||
const treatedMonths = {};
|
||||
const treatedDays = {};
|
||||
|
@ -727,7 +728,7 @@ export class AddonCalendarHelperProvider {
|
|||
}
|
||||
});
|
||||
|
||||
await CoreUtils.allPromisesIgnoringErrors(finalPromises);
|
||||
await CorePromiseUtils.allPromisesIgnoringErrors(finalPromises);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ import {
|
|||
ADDON_CALENDAR_MANUAL_SYNCED,
|
||||
ADDON_CALENDAR_SYNC_ID,
|
||||
} from '../constants';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Service to sync calendar.
|
||||
|
@ -132,7 +133,7 @@ export class AddonCalendarSyncProvider extends CoreSyncBaseProvider<AddonCalenda
|
|||
updated: false,
|
||||
};
|
||||
|
||||
const eventIds: number[] = await CoreUtils.ignoreErrors(AddonCalendarOffline.getAllEventsIds(siteId), []);
|
||||
const eventIds: number[] = await CorePromiseUtils.ignoreErrors(AddonCalendarOffline.getAllEventsIds(siteId), []);
|
||||
|
||||
if (eventIds.length > 0) {
|
||||
if (!CoreNetwork.isOnline()) {
|
||||
|
@ -142,7 +143,7 @@ export class AddonCalendarSyncProvider extends CoreSyncBaseProvider<AddonCalenda
|
|||
|
||||
const promises = eventIds.map((eventId) => this.syncOfflineEvent(eventId, result, siteId));
|
||||
|
||||
await CoreUtils.allPromises(promises);
|
||||
await CorePromiseUtils.allPromises(promises);
|
||||
|
||||
if (result.updated) {
|
||||
|
||||
|
@ -152,12 +153,12 @@ export class AddonCalendarSyncProvider extends CoreSyncBaseProvider<AddonCalenda
|
|||
AddonCalendarHelper.refreshAfterChangeEvents(result.toinvalidate, siteId),
|
||||
];
|
||||
|
||||
await CoreUtils.ignoreErrors(Promise.all(promises));
|
||||
await CorePromiseUtils.ignoreErrors(Promise.all(promises));
|
||||
}
|
||||
}
|
||||
|
||||
// Sync finished, set sync time.
|
||||
await CoreUtils.ignoreErrors(this.setSyncTime(ADDON_CALENDAR_SYNC_ID, siteId));
|
||||
await CorePromiseUtils.ignoreErrors(this.setSyncTime(ADDON_CALENDAR_SYNC_ID, siteId));
|
||||
|
||||
// All done, return the result.
|
||||
return result;
|
||||
|
|
|
@ -61,6 +61,7 @@ import {
|
|||
} from '../constants';
|
||||
import { REMINDERS_DEFAULT_REMINDER_TIMEBEFORE } from '@features/reminders/constants';
|
||||
import { AddonCalendarFilter } from './calendar-helper';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
declare module '@singletons/events' {
|
||||
|
||||
|
@ -242,7 +243,7 @@ export class AddonCalendarProvider {
|
|||
component: ADDON_CALENDAR_COMPONENT,
|
||||
} , siteId));
|
||||
|
||||
await CoreUtils.ignoreErrors(Promise.all(promises));
|
||||
await CorePromiseUtils.ignoreErrors(Promise.all(promises));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1437,7 +1438,7 @@ export class AddonCalendarProvider {
|
|||
*/
|
||||
protected async addDefaultEventReminder(event: AddonCalendarEventDBRecord, siteId?: string): Promise<void> {
|
||||
// Add default reminder if the event isn't stored already and doesn't have any reminder.
|
||||
const eventExist = await CoreUtils.promiseWorks(this.getEventFromLocalDb(event.id, siteId));
|
||||
const eventExist = await CorePromiseUtils.promiseWorks(this.getEventFromLocalDb(event.id, siteId));
|
||||
if (eventExist) {
|
||||
return;
|
||||
}
|
||||
|
@ -1508,7 +1509,7 @@ export class AddonCalendarProvider {
|
|||
|
||||
// Now save the reminders if any.
|
||||
if (options.reminders?.length) {
|
||||
await CoreUtils.ignoreErrors(
|
||||
await CorePromiseUtils.ignoreErrors(
|
||||
Promise.all(options.reminders.map((reminder) =>
|
||||
this.addEventReminder(event, reminder.time, siteId))),
|
||||
);
|
||||
|
@ -1531,7 +1532,7 @@ export class AddonCalendarProvider {
|
|||
|
||||
// Now save the reminders if any.
|
||||
if (options.reminders?.length) {
|
||||
await CoreUtils.ignoreErrors(
|
||||
await CorePromiseUtils.ignoreErrors(
|
||||
Promise.all(options.reminders.map((reminder) =>
|
||||
this.addEventReminder(event, reminder.time, siteId))),
|
||||
);
|
||||
|
@ -1592,7 +1593,7 @@ export class AddonCalendarProvider {
|
|||
|
||||
if (eventId < 0) {
|
||||
// Offline event has been sent. Change reminders instanceId if any.
|
||||
await CoreUtils.ignoreErrors(
|
||||
await CorePromiseUtils.ignoreErrors(
|
||||
CoreReminders.updateReminders(
|
||||
{ instanceId: result.event.id },
|
||||
{
|
||||
|
@ -1606,7 +1607,7 @@ export class AddonCalendarProvider {
|
|||
|
||||
if (formData.id === 0) {
|
||||
// Store the new event in local DB.
|
||||
await CoreUtils.ignoreErrors(this.storeEventInLocalDb(result.event, { addDefaultReminder: false, siteId }));
|
||||
await CorePromiseUtils.ignoreErrors(this.storeEventInLocalDb(result.event, { addDefaultReminder: false, siteId }));
|
||||
}
|
||||
|
||||
return result.event;
|
||||
|
|
|
@ -18,7 +18,7 @@ import { REMINDERS_DISABLED } from '@features/reminders/constants';
|
|||
import { CoreReminders } from '@features/reminders/services/reminders';
|
||||
import { CoreConfig } from '@services/config';
|
||||
import { CoreSiteSchema } from '@services/sites';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Database variables for AddonCalendarProvider service.
|
||||
|
@ -199,7 +199,7 @@ const migrateDefaultTime = async (siteId: string, convertToSeconds = false): Pro
|
|||
const key = 'mmaCalendarDefaultNotifTime#' + siteId;
|
||||
try {
|
||||
let defaultTime = await CoreConfig.get<number>(key);
|
||||
await CoreUtils.ignoreErrors(CoreConfig.delete(key));
|
||||
await CorePromiseUtils.ignoreErrors(CoreConfig.delete(key));
|
||||
|
||||
if (defaultTime <= 0) {
|
||||
defaultTime = REMINDERS_DISABLED;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
import { CoreRoutedItemsManagerSource } from '@classes/items-management/routed-items-manager-source';
|
||||
import { CoreUserProfile } from '@features/user/services/user';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import {
|
||||
AddonCompetency,
|
||||
AddonCompetencyDataForCourseCompetenciesPageCompetency,
|
||||
|
@ -70,7 +70,7 @@ export class AddonCompetencyCourseCompetenciesSource
|
|||
* Invalidate course cache.
|
||||
*/
|
||||
async invalidateCache(): Promise<void> {
|
||||
await CoreUtils.ignoreErrors(AddonCompetency.invalidateCourseCompetencies(this.COURSE_ID, this.USER_ID));
|
||||
await CorePromiseUtils.ignoreErrors(AddonCompetency.invalidateCourseCompetencies(this.COURSE_ID, this.USER_ID));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
import { CoreRoutedItemsManagerSource } from '@classes/items-management/routed-items-manager-source';
|
||||
import { CoreUserProfile } from '@features/user/services/user';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import {
|
||||
AddonCompetency,
|
||||
AddonCompetencyDataForPlanPageCompetency,
|
||||
|
@ -60,7 +60,7 @@ export class AddonCompetencyPlanCompetenciesSource extends CoreRoutedItemsManage
|
|||
* Invalidate plan cache.
|
||||
*/
|
||||
async invalidateCache(): Promise<void> {
|
||||
await CoreUtils.ignoreErrors(AddonCompetency.invalidateLearningPlan(this.PLAN_ID));
|
||||
await CorePromiseUtils.ignoreErrors(AddonCompetency.invalidateLearningPlan(this.PLAN_ID));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,7 +31,7 @@ import {
|
|||
} from '@addons/competency/services/competency';
|
||||
import { CoreNavigator } from '@services/navigator';
|
||||
import { ContextLevel } from '@/core/constants';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { ADDON_COMPETENCY_SUMMARY_PAGE } from '@addons/competency/constants';
|
||||
import { CoreSwipeNavigationItemsManager } from '@classes/items-management/swipe-navigation-items-manager';
|
||||
import { CoreRoutedItemsManagerSourcesTracker } from '@classes/items-management/routed-items-manager-sources-tracker';
|
||||
|
@ -175,7 +175,7 @@ export class AddonCompetencyCompetencyPage implements OnInit, OnDestroy {
|
|||
async refreshCompetency(refresher: HTMLIonRefresherElement): Promise<void> {
|
||||
const source = this.competencies.getSource();
|
||||
|
||||
await CoreUtils.ignoreErrors(
|
||||
await CorePromiseUtils.ignoreErrors(
|
||||
source instanceof AddonCompetencyPlanCompetenciesSource
|
||||
? AddonCompetency.invalidateCompetencyInPlan(source.PLAN_ID, this.requireCompetencyId())
|
||||
: AddonCompetency.invalidateCompetencyInCourse(source.COURSE_ID, this.requireCompetencyId(), source.USER_ID),
|
||||
|
@ -287,7 +287,7 @@ export class AddonCompetencyCompetencyPage implements OnInit, OnDestroy {
|
|||
return;
|
||||
}
|
||||
|
||||
await CoreUtils.ignoreErrors(
|
||||
await CorePromiseUtils.ignoreErrors(
|
||||
AddonCompetency.logCompetencyInPlanView(source.PLAN_ID, compId, this.planStatus, name, userId),
|
||||
);
|
||||
|
||||
|
@ -316,7 +316,9 @@ export class AddonCompetencyCompetencyPage implements OnInit, OnDestroy {
|
|||
return;
|
||||
}
|
||||
|
||||
await CoreUtils.ignoreErrors(AddonCompetency.logCompetencyInCourseView(source.COURSE_ID, compId, name, source.USER_ID));
|
||||
await CorePromiseUtils.ignoreErrors(
|
||||
AddonCompetency.logCompetencyInCourseView(source.COURSE_ID, compId, name, source.USER_ID),
|
||||
);
|
||||
|
||||
CoreAnalytics.logEvent({
|
||||
type: CoreAnalyticsEventType.VIEW_ITEM,
|
||||
|
|
|
@ -17,7 +17,7 @@ import { ContextLevel } from '@/core/constants';
|
|||
import { AddonCompetencySummary, AddonCompetency } from '@addons/competency/services/competency';
|
||||
import { CoreNavigator } from '@services/navigator';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { ADDON_COMPETENCY_SUMMARY_PAGE } from '@addons/competency/constants';
|
||||
import { CoreTime } from '@singletons/time';
|
||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
|
||||
|
@ -45,7 +45,7 @@ export class AddonCompetencyCompetencySummaryPage implements OnInit {
|
|||
return;
|
||||
}
|
||||
|
||||
await CoreUtils.ignoreErrors(
|
||||
await CorePromiseUtils.ignoreErrors(
|
||||
AddonCompetency.logCompetencyView(this.competencyId, this.competency.competency.shortname),
|
||||
);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import { CoreCommentsArea } from '@features/comments/services/comments';
|
|||
import { CoreCourseSummary } from '@features/course/services/course';
|
||||
import { CoreUserSummary } from '@features/user/services/user';
|
||||
import { CoreSites } from '@services/sites';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { makeSingleton } from '@singletons';
|
||||
|
||||
const ROOT_CACHE_KEY = 'mmaCompetency:';
|
||||
|
@ -189,7 +189,7 @@ export class AddonCompetencyProvider {
|
|||
return false;
|
||||
}
|
||||
|
||||
return CoreUtils.promiseWorks(this.getCourseCompetencies(courseId, undefined, siteId));
|
||||
return CorePromiseUtils.promiseWorks(this.getCourseCompetencies(courseId, undefined, siteId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,6 +22,7 @@ import { CoreUrl } from '@singletons/url';
|
|||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { AddonCompetency } from '../competency';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Handler for competencies push notifications clicks.
|
||||
|
@ -55,7 +56,7 @@ export class AddonCompetencyPushClickHandlerService implements CorePushNotificat
|
|||
// Open the learning plan.
|
||||
const planId = Number(contextUrlParams.id);
|
||||
|
||||
await CoreUtils.ignoreErrors(AddonCompetency.invalidateLearningPlan(planId, notification.site));
|
||||
await CorePromiseUtils.ignoreErrors(AddonCompetency.invalidateLearningPlan(planId, notification.site));
|
||||
|
||||
await CoreNavigator.navigateToSitePath(`${ADDON_COMPETENCY_LEARNING_PLANS_PAGE}/${planId}`, {
|
||||
siteId: notification.site,
|
||||
|
@ -71,7 +72,9 @@ export class AddonCompetencyPushClickHandlerService implements CorePushNotificat
|
|||
const planId = Number(contextUrlParams.planid);
|
||||
const userId = Number(contextUrlParams.userid);
|
||||
|
||||
await CoreUtils.ignoreErrors(AddonCompetency.invalidateCompetencyInPlan(planId, competencyId, notification.site));
|
||||
await CorePromiseUtils.ignoreErrors(
|
||||
AddonCompetency.invalidateCompetencyInPlan(planId, competencyId, notification.site),
|
||||
);
|
||||
|
||||
if (courseId) {
|
||||
await CoreNavigator.navigateToSitePath(
|
||||
|
@ -101,7 +104,7 @@ export class AddonCompetencyPushClickHandlerService implements CorePushNotificat
|
|||
// Open the list of plans.
|
||||
const userId = Number(contextUrlParams.userid);
|
||||
|
||||
await CoreUtils.ignoreErrors(AddonCompetency.invalidateLearningPlans(userId, notification.site));
|
||||
await CorePromiseUtils.ignoreErrors(AddonCompetency.invalidateLearningPlans(userId, notification.site));
|
||||
|
||||
await CoreNavigator.navigateToSitePath(ADDON_COMPETENCY_LEARNING_PLANS_PAGE, {
|
||||
params: { userId },
|
||||
|
|
|
@ -19,7 +19,7 @@ import { CoreFilterFilter, CoreFilterFormatTextOptions } from '@features/filter/
|
|||
import { CoreLang } from '@services/lang';
|
||||
import { CoreSites } from '@services/sites';
|
||||
import { CoreText } from '@singletons/text';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { CoreEvents } from '@singletons/events';
|
||||
import { CoreSite } from '@classes/sites/site';
|
||||
import { makeSingleton } from '@singletons';
|
||||
|
@ -180,7 +180,7 @@ export class AddonFilterMathJaxLoaderHandlerService extends CoreFilterDefaultHan
|
|||
|
||||
// Make sure the element is in DOM, otherwise some equations don't work.
|
||||
// Automatically timeout the promise after a certain time, we don't want to wait forever.
|
||||
await CoreUtils.ignoreErrors(CoreUtils.timeoutPromise(CoreDom.waitToBeInDOM(container), 15000));
|
||||
await CorePromiseUtils.ignoreErrors(CorePromiseUtils.timeoutPromise(CoreDom.waitToBeInDOM(container), 15000));
|
||||
|
||||
await this.window.M!.filter_mathjaxloader!.typeset(container);
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ export class AddonFilterMathJaxLoaderHandlerService extends CoreFilterDefaultHan
|
|||
}
|
||||
|
||||
await CoreWait.wait(250);
|
||||
await CoreUtils.ignoreErrors(this.waitForReady(retries + 1));
|
||||
await CorePromiseUtils.ignoreErrors(this.waitForReady(retries + 1));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,7 +17,7 @@ import { Component, OnDestroy, OnInit } from '@angular/core';
|
|||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CorePushNotifications } from '@features/pushnotifications/services/pushnotifications';
|
||||
import { AddonMessageOutputAirnotifier, AddonMessageOutputAirnotifierDevice } from '../../services/airnotifier';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Page that displays the list of devices.
|
||||
|
@ -112,7 +112,7 @@ export class AddonMessageOutputAirnotifierDevicesPage implements OnInit, OnDestr
|
|||
* Fetch devices. The purpose is to store the updated data, it won't be reflected in the view.
|
||||
*/
|
||||
protected async updateDevices(): Promise<void> {
|
||||
await CoreUtils.ignoreErrors(AddonMessageOutputAirnotifier.invalidateUserDevices());
|
||||
await CorePromiseUtils.ignoreErrors(AddonMessageOutputAirnotifier.invalidateUserDevices());
|
||||
|
||||
await AddonMessageOutputAirnotifier.getUserDevices();
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ export class AddonMessageOutputAirnotifierDevicesPage implements OnInit, OnDestr
|
|||
*/
|
||||
async refreshDevices(refresher: HTMLIonRefresherElement): Promise<void> {
|
||||
try {
|
||||
await CoreUtils.ignoreErrors(AddonMessageOutputAirnotifier.invalidateUserDevices());
|
||||
await CorePromiseUtils.ignoreErrors(AddonMessageOutputAirnotifier.invalidateUserDevices());
|
||||
|
||||
await this.fetchDevices();
|
||||
} finally {
|
||||
|
|
|
@ -29,7 +29,7 @@ import { AddonMessagesOffline, AddonMessagesOfflineMessagesDBRecordFormatted } f
|
|||
import { AddonMessagesSync } from '../../services/messages-sync';
|
||||
import { CoreUser } from '@features/user/services/user';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { CoreLogger } from '@singletons/logger';
|
||||
import { CoreInfiniteLoadingComponent } from '@components/infinite-loading/infinite-loading';
|
||||
import { Md5 } from 'ts-md5/dist/md5';
|
||||
|
@ -897,7 +897,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
|
|||
}
|
||||
|
||||
await CoreWait.wait(400);
|
||||
await CoreUtils.ignoreErrors(this.waitForFetch());
|
||||
await CorePromiseUtils.ignoreErrors(this.waitForFetch());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -33,6 +33,7 @@ import { CorePlatform } from '@services/platform';
|
|||
import { CoreSplitViewComponent } from '@components/split-view/split-view';
|
||||
import { CoreKeyboard } from '@singletons/keyboard';
|
||||
import { ADDON_MESSAGES_NEW_MESSAGE_EVENT, ADDON_MESSAGES_READ_CHANGED_EVENT } from '@addons/messages/constants';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Page that displays the list of discussions.
|
||||
|
@ -170,7 +171,7 @@ export class AddonMessagesDiscussions35Page implements OnInit, OnDestroy {
|
|||
promises.push(AddonMessages.invalidateUnreadConversationCounts(this.siteId));
|
||||
}
|
||||
|
||||
await CoreUtils.allPromises(promises).finally(() => this.fetchData().finally(() => {
|
||||
await CorePromiseUtils.allPromises(promises).finally(() => this.fetchData().finally(() => {
|
||||
if (refresher) {
|
||||
refresher?.complete();
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ import {
|
|||
AddonMessagesMessagePrivacy,
|
||||
AddonMessagesUpdateConversationAction,
|
||||
} from '../constants';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
declare module '@singletons/events' {
|
||||
|
||||
|
@ -240,7 +241,7 @@ export class AddonMessagesProvider {
|
|||
|
||||
await site.write('core_message_confirm_contact_request', params);
|
||||
|
||||
await CoreUtils.allPromises([
|
||||
await CorePromiseUtils.allPromises([
|
||||
this.invalidateAllMemberInfo(userId, site),
|
||||
this.invalidateContactsCache(site.id),
|
||||
this.invalidateUserContacts(site.id),
|
||||
|
@ -305,7 +306,7 @@ export class AddonMessagesProvider {
|
|||
|
||||
await site.write('core_message_decline_contact_request', params);
|
||||
|
||||
await CoreUtils.allPromises([
|
||||
await CorePromiseUtils.allPromises([
|
||||
this.invalidateAllMemberInfo(userId, site),
|
||||
this.refreshContactRequestsCount(site.id),
|
||||
]).finally(() => {
|
||||
|
@ -1934,7 +1935,7 @@ export class AddonMessagesProvider {
|
|||
* @returns Promise resolved when done.
|
||||
*/
|
||||
protected async invalidateAllMemberInfo(userId: number, site: CoreSite): Promise<void> {
|
||||
await CoreUtils.allPromises([
|
||||
await CorePromiseUtils.allPromises([
|
||||
this.invalidateMemberInfo(userId, site.id),
|
||||
this.invalidateUserContacts(site.id),
|
||||
this.invalidateBlockedContactsCache(site.id),
|
||||
|
@ -1952,7 +1953,7 @@ export class AddonMessagesProvider {
|
|||
site.id,
|
||||
undefined,
|
||||
true,
|
||||
).then((conversation) => CoreUtils.allPromises([
|
||||
).then((conversation) => CorePromiseUtils.allPromises([
|
||||
this.invalidateConversation(conversation.id),
|
||||
this.invalidateConversationMembers(conversation.id, site.id),
|
||||
])).catch(() => {
|
||||
|
@ -2314,7 +2315,7 @@ export class AddonMessagesProvider {
|
|||
|
||||
await site.write('core_message_delete_contacts', params, preSets);
|
||||
|
||||
return CoreUtils.allPromises([
|
||||
return CorePromiseUtils.allPromises([
|
||||
this.invalidateUserContacts(site.id),
|
||||
this.invalidateAllMemberInfo(userId, site),
|
||||
this.invalidateContactsCache(site.id),
|
||||
|
|
|
@ -16,7 +16,7 @@ import { Params } from '@angular/router';
|
|||
import { CoreRoutedItemsManagerSource } from '@classes/items-management/routed-items-manager-source';
|
||||
import { CoreGroupInfo, CoreGroups } from '@services/groups';
|
||||
import { CoreSites } from '@services/sites';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { Translate } from '@singletons';
|
||||
import { CoreIonicColorNames } from '@singletons/colors';
|
||||
import { CoreEvents } from '@singletons/events';
|
||||
|
@ -194,7 +194,7 @@ export class AddonModAssignSubmissionsSource extends CoreRoutedItemsManagerSourc
|
|||
const showSubmissions: AddonModAssignSubmissionForList[] = await Promise.all(
|
||||
submissions.map(async (submission: AddonModAssignSubmissionForList) => {
|
||||
const gradeData =
|
||||
await CoreUtils.ignoreErrors(AddonModAssignOffline.getSubmissionGrade(assign.id, submission.userid));
|
||||
await CorePromiseUtils.ignoreErrors(AddonModAssignOffline.getSubmissionGrade(assign.id, submission.userid));
|
||||
|
||||
// Load offline grades.
|
||||
const notSynced = !!gradeData && submission.timemodified < gradeData.timemodified;
|
||||
|
|
|
@ -16,7 +16,7 @@ import { Component, Input, ViewChild, ElementRef } from '@angular/core';
|
|||
import { CoreSites } from '@services/sites';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreFormFields, CoreForms } from '@singletons/form';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { ModalController, Translate } from '@singletons';
|
||||
import { AddonModAssignAssign, AddonModAssignPlugin, AddonModAssignSubmission } from '../../services/assign';
|
||||
import { AddonModAssignFeedbackDelegate } from '../../services/feedback-delegate';
|
||||
|
@ -88,7 +88,7 @@ export class AddonModAssignEditFeedbackModalComponent {
|
|||
* @returns Promise resolved with boolean: whether the data has changed.
|
||||
*/
|
||||
protected async hasDataChanged(): Promise<boolean> {
|
||||
const changed = await CoreUtils.ignoreErrors(
|
||||
const changed = await CorePromiseUtils.ignoreErrors(
|
||||
AddonModAssignFeedbackDelegate.hasPluginDataChanged(
|
||||
this.assign,
|
||||
this.submission,
|
||||
|
|
|
@ -24,7 +24,7 @@ import { CoreNavigator } from '@services/navigator';
|
|||
import { CoreSites } from '@services/sites';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreTimeUtils } from '@services/utils/time';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { Translate } from '@singletons';
|
||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
||||
import { CoreTime } from '@singletons/time';
|
||||
|
@ -182,7 +182,7 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo
|
|||
|
||||
if (sync) {
|
||||
// Try to synchronize the assign.
|
||||
await CoreUtils.ignoreErrors(this.syncActivity(showErrors));
|
||||
await CorePromiseUtils.ignoreErrors(this.syncActivity(showErrors));
|
||||
}
|
||||
|
||||
// Check if there's any offline data for this assign.
|
||||
|
@ -250,18 +250,18 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo
|
|||
return; // Shouldn't happen.
|
||||
}
|
||||
|
||||
await CoreUtils.ignoreErrors(AddonModAssign.logView(this.assign.id));
|
||||
await CorePromiseUtils.ignoreErrors(AddonModAssign.logView(this.assign.id));
|
||||
|
||||
this.analyticsLogEvent('mod_assign_view_assign');
|
||||
|
||||
if (this.canViewAllSubmissions) {
|
||||
// User can see all submissions, log grading view.
|
||||
await CoreUtils.ignoreErrors(AddonModAssign.logGradingView(this.assign.id));
|
||||
await CorePromiseUtils.ignoreErrors(AddonModAssign.logGradingView(this.assign.id));
|
||||
|
||||
this.analyticsLogEvent('mod_assign_view_grading_table', { sendUrl: false });
|
||||
} else if (this.canViewOwnSubmission) {
|
||||
// User can only see their own submission, log view the user submission.
|
||||
await CoreUtils.ignoreErrors(AddonModAssign.logSubmissionView(this.assign.id));
|
||||
await CorePromiseUtils.ignoreErrors(AddonModAssign.logSubmissionView(this.assign.id));
|
||||
|
||||
this.analyticsLogEvent('mod_assign_view_submission_status', { sendUrl: false });
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ import {
|
|||
} from '../../constants';
|
||||
import { CoreViewer } from '@features/viewer/services/viewer';
|
||||
import { CoreLoadings } from '@services/loadings';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Component that displays an assignment submission.
|
||||
|
@ -327,7 +328,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
|
|||
const previousSubmission = this.previousAttempt.submission;
|
||||
let modal = await CoreLoadings.show();
|
||||
|
||||
const size = await CoreUtils.ignoreErrors(
|
||||
const size = await CorePromiseUtils.ignoreErrors(
|
||||
AddonModAssignHelper.getSubmissionSizeForCopy(this.assign, previousSubmission),
|
||||
-1,
|
||||
); // Error calculating size, return -1.
|
||||
|
@ -548,7 +549,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
|
|||
});
|
||||
}
|
||||
|
||||
await CoreUtils.ignoreErrors(Promise.all(promises));
|
||||
await CorePromiseUtils.ignoreErrors(Promise.all(promises));
|
||||
|
||||
await this.loadData(sync);
|
||||
}
|
||||
|
@ -716,7 +717,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
|
|||
|
||||
// If we have data about the grader, get its profile.
|
||||
if (feedback.grade && feedback.grade.grader > 0) {
|
||||
this.grader = await CoreUtils.ignoreErrors(CoreUser.getProfile(feedback.grade.grader, this.courseId));
|
||||
this.grader = await CorePromiseUtils.ignoreErrors(CoreUser.getProfile(feedback.grade.grader, this.courseId));
|
||||
} else {
|
||||
delete this.grader;
|
||||
}
|
||||
|
@ -803,7 +804,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
|
|||
|
||||
// Submission grades aren't identified by attempt number so it can retrieve the feedback for a previous attempt.
|
||||
// The app will not treat that as an special case.
|
||||
const submissionGrade = await CoreUtils.ignoreErrors(
|
||||
const submissionGrade = await CorePromiseUtils.ignoreErrors(
|
||||
AddonModAssignOffline.getSubmissionGrade(assign.id, this.submitId),
|
||||
);
|
||||
|
||||
|
@ -1075,7 +1076,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
|
|||
const [gradebookGrades, assignGrades] = await Promise.all([
|
||||
CoreGradesHelper.getGradeModuleItems(this.courseId, this.moduleId, this.submitId),
|
||||
gradeNotReleased ?
|
||||
CoreUtils.ignoreErrors(AddonModAssign.getAssignmentGrades(assign.id, { cmId: assign.cmid })) :
|
||||
CorePromiseUtils.ignoreErrors(AddonModAssign.getAssignmentGrades(assign.id, { cmId: assign.cmid })) :
|
||||
undefined,
|
||||
]);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import {
|
|||
} from '../services/handler';
|
||||
import { AddonModAssignFeedbackDelegate } from '@addons/mod/assign/services/feedback-delegate';
|
||||
import { AddonModAssignOffline } from '@addons/mod/assign/services/assign-offline';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { AddonModAssignFeedbackPluginBaseComponent } from '@addons/mod/assign/classes/base-feedback-plugin-component';
|
||||
import { ContextLevel } from '@/core/constants';
|
||||
import { ADDON_MOD_ASSIGN_COMPONENT } from '@addons/mod/assign/constants';
|
||||
|
@ -124,7 +124,7 @@ export class AddonModAssignFeedbackCommentsComponent extends AddonModAssignFeedb
|
|||
}
|
||||
|
||||
// There is no draft saved. Check if we have anything offline.
|
||||
const offlineData = await CoreUtils.ignoreErrors(
|
||||
const offlineData = await CorePromiseUtils.ignoreErrors(
|
||||
AddonModAssignOffline.getSubmissionGrade(this.assign.id, this.userId),
|
||||
undefined,
|
||||
);
|
||||
|
|
|
@ -25,7 +25,7 @@ import { AddonModAssignFeedbackHandler } from '@addons/mod/assign/services/feedb
|
|||
import { Injectable, Type } from '@angular/core';
|
||||
import { CoreSites } from '@services/sites';
|
||||
import { CoreText } from '@singletons/text';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { CoreWSFile } from '@services/ws';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { CoreFileHelper } from '@services/file-helper';
|
||||
|
@ -125,7 +125,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss
|
|||
userId: number,
|
||||
): Promise<boolean> {
|
||||
// Get it from plugin or offline.
|
||||
const offlineData = await CoreUtils.ignoreErrors(
|
||||
const offlineData = await CorePromiseUtils.ignoreErrors(
|
||||
AddonModAssignOffline.getSubmissionGrade(assign.id, userId),
|
||||
undefined,
|
||||
);
|
||||
|
|
|
@ -47,6 +47,7 @@ import {
|
|||
} from '../../constants';
|
||||
import { CoreToasts, ToastDuration } from '@services/toasts';
|
||||
import { CoreLoadings } from '@services/loadings';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Page that allows adding or editing an assigment submission.
|
||||
|
@ -232,7 +233,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave {
|
|||
}
|
||||
|
||||
// Check if there's any offline data for this submission.
|
||||
this.hasOffline = await CoreUtils.promiseWorks(AddonModAssignOffline.getSubmission(this.assign.id, this.userId));
|
||||
this.hasOffline = await CorePromiseUtils.promiseWorks(AddonModAssignOffline.getSubmission(this.assign.id, this.userId));
|
||||
|
||||
CoreAnalytics.logEvent({
|
||||
type: CoreAnalyticsEventType.VIEW_ITEM,
|
||||
|
|
|
@ -37,6 +37,7 @@ import { makeSingleton } from '@singletons';
|
|||
import { CoreFormFields } from '@singletons/form';
|
||||
import { CoreFileEntry } from '@services/file-helper';
|
||||
import { ADDON_MOD_ASSIGN_COMPONENT } from '../constants';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Service that provides some helper functions for assign.
|
||||
|
@ -81,7 +82,7 @@ export class AddonModAssignHelperProvider {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (await CoreUtils.promiseWorks(AddonModAssignOffline.getSubmission(assign.id, submission.userid))) {
|
||||
if (await CorePromiseUtils.promiseWorks(AddonModAssignOffline.getSubmission(assign.id, submission.userid))) {
|
||||
// Submission was saved or deleted offline, allow editing it or creating a new one.
|
||||
return true;
|
||||
}
|
||||
|
@ -530,7 +531,7 @@ export class AddonModAssignHelperProvider {
|
|||
|
||||
const promises = feedback.plugins.map((plugin) =>
|
||||
this.prepareFeedbackPluginData(assign.id, userId, feedback).then(async (inputData) => {
|
||||
const changed = await CoreUtils.ignoreErrors(
|
||||
const changed = await CorePromiseUtils.ignoreErrors(
|
||||
AddonModAssignFeedbackDelegate.hasPluginDataChanged(assign, submission, plugin, inputData, userId),
|
||||
false,
|
||||
);
|
||||
|
@ -541,7 +542,7 @@ export class AddonModAssignHelperProvider {
|
|||
return;
|
||||
}));
|
||||
|
||||
await CoreUtils.allPromises(promises);
|
||||
await CorePromiseUtils.allPromises(promises);
|
||||
|
||||
return hasChanged;
|
||||
}
|
||||
|
@ -579,7 +580,7 @@ export class AddonModAssignHelperProvider {
|
|||
}))
|
||||
: [];
|
||||
|
||||
await CoreUtils.allPromises(promises);
|
||||
await CorePromiseUtils.allPromises(promises);
|
||||
|
||||
return hasChanged;
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ import { CoreGradesFormattedItem, CoreGradesHelper } from '@features/grades/serv
|
|||
import { AddonModAssignSubmissionDelegate } from './submission-delegate';
|
||||
import { AddonModAssignFeedbackDelegate } from './feedback-delegate';
|
||||
import { ADDON_MOD_ASSIGN_AUTO_SYNCED, ADDON_MOD_ASSIGN_COMPONENT, ADDON_MOD_ASSIGN_MANUAL_SYNCED } from '../constants';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Service to sync assigns.
|
||||
|
@ -189,7 +190,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid
|
|||
*/
|
||||
protected async performSyncAssign(assignId: number, siteId: string): Promise<AddonModAssignSyncResult> {
|
||||
// Sync offline logs.
|
||||
await CoreUtils.ignoreErrors(
|
||||
await CorePromiseUtils.ignoreErrors(
|
||||
CoreCourseLogHelper.syncActivity(ADDON_MOD_ASSIGN_COMPONENT, assignId, siteId),
|
||||
);
|
||||
|
||||
|
@ -207,7 +208,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid
|
|||
|
||||
if (!submissions.length && !grades.length) {
|
||||
// Nothing to sync.
|
||||
await CoreUtils.ignoreErrors(this.setSyncTime(assignId, siteId));
|
||||
await CorePromiseUtils.ignoreErrors(this.setSyncTime(assignId, siteId));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -246,15 +247,15 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid
|
|||
}
|
||||
}));
|
||||
|
||||
await CoreUtils.allPromises(promises);
|
||||
await CorePromiseUtils.allPromises(promises);
|
||||
|
||||
if (result.updated) {
|
||||
// Data has been sent to server. Now invalidate the WS calls.
|
||||
await CoreUtils.ignoreErrors(AddonModAssign.invalidateContent(assign.cmid, courseId, siteId));
|
||||
await CorePromiseUtils.ignoreErrors(AddonModAssign.invalidateContent(assign.cmid, courseId, siteId));
|
||||
}
|
||||
|
||||
// Sync finished, set sync time.
|
||||
await CoreUtils.ignoreErrors(this.setSyncTime(assignId, siteId));
|
||||
await CorePromiseUtils.ignoreErrors(this.setSyncTime(assignId, siteId));
|
||||
|
||||
// All done, return the result.
|
||||
return result;
|
||||
|
@ -272,7 +273,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid
|
|||
siteId: string,
|
||||
): Promise<AddonModAssignSubmissionsGradingDBRecordFormatted[]> {
|
||||
// If no offline data found, return empty array.
|
||||
return CoreUtils.ignoreErrors(AddonModAssignOffline.getAssignSubmissionsGrade(assignId, siteId), []);
|
||||
return CorePromiseUtils.ignoreErrors(AddonModAssignOffline.getAssignSubmissionsGrade(assignId, siteId), []);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -287,7 +288,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid
|
|||
siteId: string,
|
||||
): Promise<AddonModAssignSubmissionsDBRecordFormatted[]> {
|
||||
// If no offline data found, return empty array.
|
||||
return CoreUtils.ignoreErrors(AddonModAssignOffline.getAssignSubmissions(assignId, siteId), []);
|
||||
return CorePromiseUtils.ignoreErrors(AddonModAssignOffline.getAssignSubmissions(assignId, siteId), []);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -508,7 +509,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid
|
|||
// Update cached data.
|
||||
promises.push(AddonModAssign.getSubmissionStatus(assign.id, options));
|
||||
|
||||
await CoreUtils.allPromises(promises);
|
||||
await CorePromiseUtils.allPromises(promises);
|
||||
} catch (error) {
|
||||
if (!error || !CoreUtils.isWebServiceError(error)) {
|
||||
// Local error, reject.
|
||||
|
|
|
@ -27,7 +27,7 @@ import { CoreCourseActivityPrefetchHandlerBase } from '@features/course/classes/
|
|||
import { CoreCourse, CoreCourseAnyModuleData, CoreCourseCommonModWSOptions } from '@features/course/services/course';
|
||||
import { CoreWSFile } from '@services/ws';
|
||||
import { AddonModAssignHelper, AddonModAssignSubmissionFormatted } from '../assign-helper';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { CoreFilepool } from '@services/filepool';
|
||||
import { CoreGroups } from '@services/groups';
|
||||
import { AddonModAssignSync, AddonModAssignSyncResult } from '../assign-sync';
|
||||
|
@ -252,7 +252,7 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref
|
|||
|
||||
if (blindMarking) {
|
||||
promises.push(
|
||||
CoreUtils.ignoreErrors(AddonModAssign.getAssignmentUserMappings(assign.id, -1, modOptions)),
|
||||
CorePromiseUtils.ignoreErrors(AddonModAssign.getAssignmentUserMappings(assign.id, -1, modOptions)),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -260,7 +260,7 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref
|
|||
|
||||
promises.push(CoreCourse.getModuleBasicInfoByInstance(assign.id, 'assign', { siteId }));
|
||||
// Get course data, needed to determine upload max size if it's configured to be course limit.
|
||||
promises.push(CoreUtils.ignoreErrors(CoreCourses.getCourseByField('id', courseId, siteId)));
|
||||
promises.push(CorePromiseUtils.ignoreErrors(CoreCourses.getCourseByField('id', courseId, siteId)));
|
||||
|
||||
// Download intro files and attachments. Do not call getFiles because it'd call some WS twice.
|
||||
let files: CoreWSFile[] = assign.introattachments || [];
|
||||
|
|
|
@ -21,6 +21,7 @@ import { CoreUtils } from '@services/utils/utils';
|
|||
import { makeSingleton } from '@singletons';
|
||||
import { AddonModAssign } from '../assign';
|
||||
import { ADDON_MOD_ASSIGN_FEATURE_NAME } from '../../constants';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Handler for assign push notifications clicks.
|
||||
|
@ -54,7 +55,7 @@ export class AddonModAssignPushClickHandlerService implements CorePushNotificati
|
|||
const courseId = Number(notification.courseid);
|
||||
const moduleId = Number(contextUrlParams.id);
|
||||
|
||||
await CoreUtils.ignoreErrors(AddonModAssign.invalidateContent(moduleId, courseId, notification.site));
|
||||
await CorePromiseUtils.ignoreErrors(AddonModAssign.invalidateContent(moduleId, courseId, notification.site));
|
||||
await CoreCourseHelper.navigateToModule(moduleId, {
|
||||
courseId,
|
||||
siteId: notification.site,
|
||||
|
|
|
@ -18,7 +18,7 @@ import { AddonModAssignOffline } from '@addons/mod/assign/services/assign-offlin
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { CoreFileUploaderStoreFilesResult } from '@features/fileuploader/services/fileuploader';
|
||||
import { CoreFileSession } from '@services/file-session';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { AddonModAssignSubmissionFileHandlerService } from '../services/handler';
|
||||
import { FileEntry } from '@awesome-cordova-plugins/file/ngx';
|
||||
import { AddonModAssignSubmissionPluginBaseComponent } from '@addons/mod/assign/classes/base-submission-plugin-component';
|
||||
|
@ -54,7 +54,7 @@ export class AddonModAssignSubmissionFileComponent extends AddonModAssignSubmiss
|
|||
: undefined;
|
||||
|
||||
// Get the offline data.
|
||||
const offlineData = await CoreUtils.ignoreErrors(
|
||||
const offlineData = await CorePromiseUtils.ignoreErrors(
|
||||
AddonModAssignOffline.getSubmission(this.assign.id),
|
||||
undefined,
|
||||
);
|
||||
|
@ -67,7 +67,7 @@ export class AddonModAssignSubmissionFileComponent extends AddonModAssignSubmiss
|
|||
// It has offline data.
|
||||
let offlineFiles: FileEntry[] = [];
|
||||
if (offlineDataFiles.offline) {
|
||||
offlineFiles = <FileEntry[]>await CoreUtils.ignoreErrors(
|
||||
offlineFiles = <FileEntry[]>await CorePromiseUtils.ignoreErrors(
|
||||
AddonModAssignHelper.getStoredSubmissionFiles(
|
||||
this.assign.id,
|
||||
AddonModAssignSubmissionFileHandlerService.FOLDER_NAME,
|
||||
|
|
|
@ -31,6 +31,7 @@ import { makeSingleton } from '@singletons';
|
|||
import { FileEntry } from '@awesome-cordova-plugins/file/ngx';
|
||||
import type { AddonModAssignSubmissionPluginBaseComponent } from '@addons/mod/assign/classes/base-submission-plugin-component';
|
||||
import { ADDON_MOD_ASSIGN_COMPONENT } from '@addons/mod/assign/constants';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Handler for file submission plugin.
|
||||
|
@ -117,7 +118,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig
|
|||
siteId?: string,
|
||||
): Promise<void> {
|
||||
|
||||
await CoreUtils.ignoreErrors(
|
||||
await CorePromiseUtils.ignoreErrors(
|
||||
AddonModAssignHelper.deleteStoredSubmissionFiles(
|
||||
assign.id,
|
||||
AddonModAssignSubmissionFileHandlerService.FOLDER_NAME,
|
||||
|
@ -175,7 +176,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig
|
|||
submission: AddonModAssignSubmission,
|
||||
plugin: AddonModAssignPlugin,
|
||||
): Promise<boolean> {
|
||||
const offlineData = await CoreUtils.ignoreErrors(
|
||||
const offlineData = await CorePromiseUtils.ignoreErrors(
|
||||
// Check if there's any offline data.
|
||||
AddonModAssignOffline.getSubmission(assign.id, submission.userid),
|
||||
undefined,
|
||||
|
@ -303,7 +304,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig
|
|||
|
||||
if (filesData.offline) {
|
||||
// Has offline files, get them and add them to the list.
|
||||
const storedFiles = <FileEntry[]> await CoreUtils.ignoreErrors(
|
||||
const storedFiles = <FileEntry[]> await CorePromiseUtils.ignoreErrors(
|
||||
AddonModAssignHelper.getStoredSubmissionFiles(
|
||||
assign.id,
|
||||
AddonModAssignSubmissionFileHandlerService.FOLDER_NAME,
|
||||
|
|
|
@ -19,7 +19,7 @@ import { Component, OnInit, ElementRef } from '@angular/core';
|
|||
import { FormBuilder, FormControl } from '@angular/forms';
|
||||
import { CoreSites } from '@services/sites';
|
||||
import { CoreText } from '@singletons/text';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { AddonModAssignSubmissionOnlineTextPluginData } from '../services/handler';
|
||||
import { ContextLevel } from '@/core/constants';
|
||||
import { ADDON_MOD_ASSIGN_COMPONENT } from '@addons/mod/assign/constants';
|
||||
|
@ -60,7 +60,7 @@ export class AddonModAssignSubmissionOnlineTextComponent extends AddonModAssignS
|
|||
*/
|
||||
async ngOnInit(): Promise<void> {
|
||||
// Get the text. Check if we have anything offline.
|
||||
const offlineData = await CoreUtils.ignoreErrors(
|
||||
const offlineData = await CorePromiseUtils.ignoreErrors(
|
||||
AddonModAssignOffline.getSubmission(this.assign.id),
|
||||
undefined,
|
||||
);
|
||||
|
|
|
@ -26,7 +26,7 @@ import { Injectable, Type } from '@angular/core';
|
|||
import { CoreError } from '@classes/errors/error';
|
||||
import { CoreFileHelper } from '@services/file-helper';
|
||||
import { CoreText } from '@singletons/text';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { CoreWSFile } from '@services/ws';
|
||||
import { makeSingleton, Translate } from '@singletons';
|
||||
|
||||
|
@ -178,7 +178,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo
|
|||
|
||||
// Get the original text from plugin or offline.
|
||||
const offlineData =
|
||||
await CoreUtils.ignoreErrors(AddonModAssignOffline.getSubmission(assign.id, submission.userid));
|
||||
await CorePromiseUtils.ignoreErrors(AddonModAssignOffline.getSubmission(assign.id, submission.userid));
|
||||
|
||||
let initialText = '';
|
||||
if (offlineData && offlineData.plugindata && offlineData.plugindata.onlinetext_editor) {
|
||||
|
|
|
@ -34,6 +34,7 @@ import {
|
|||
import { ADDON_MOD_BBB_COMPONENT } from '../../constants';
|
||||
import { CoreLoadings } from '@services/loadings';
|
||||
import { convertTextToHTMLElement } from '@/core/utils/create-html-element';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Component that displays a Big Blue Button activity.
|
||||
|
@ -228,7 +229,7 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo
|
|||
return; // Shouldn't happen.
|
||||
}
|
||||
|
||||
await CoreUtils.ignoreErrors(AddonModBBB.logView(this.bbb.id));
|
||||
await CorePromiseUtils.ignoreErrors(AddonModBBB.logView(this.bbb.id));
|
||||
|
||||
this.analyticsLogEvent('mod_bigbluebuttonbn_view_bigbluebuttonbn');
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import { AddonModBook, AddonModBookBookWSData, AddonModBookTocChapter } from '..
|
|||
import { CoreCourseContentsPage } from '@features/course/pages/contents/contents';
|
||||
import { CoreCourse } from '@features/course/services/course';
|
||||
import { CoreNavigator } from '@services/navigator';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { ADDON_MOD_BOOK_PAGE_NAME, AddonModBookNumbering } from '../../constants';
|
||||
|
||||
/**
|
||||
|
@ -104,7 +104,7 @@ export class AddonModBookIndexComponent extends CoreCourseModuleMainResourceComp
|
|||
* @inheritdoc
|
||||
*/
|
||||
protected async logActivity(): Promise<void> {
|
||||
await CoreUtils.ignoreErrors(AddonModBook.logView(this.module.instance));
|
||||
await CorePromiseUtils.ignoreErrors(AddonModBook.logView(this.module.instance));
|
||||
|
||||
this.analyticsLogEvent('mod_book_view_book');
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import { CoreNetwork } from '@services/network';
|
|||
import { CoreNavigator } from '@services/navigator';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreErrorHelper } from '@services/error-helper';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { Translate } from '@singletons';
|
||||
import {
|
||||
AddonModBook,
|
||||
|
@ -163,13 +163,13 @@ export class AddonModBookContentsPage implements OnInit, OnDestroy {
|
|||
*/
|
||||
async doRefresh(refresher?: HTMLIonRefresherElement): Promise<void> {
|
||||
if (this.manager) {
|
||||
await CoreUtils.ignoreErrors(Promise.all([
|
||||
await CorePromiseUtils.ignoreErrors(Promise.all([
|
||||
this.manager.getSource().invalidateContent(),
|
||||
CoreCourseModulePrefetchDelegate.invalidateCourseUpdates(this.courseId), // To detect if book was updated.
|
||||
]));
|
||||
}
|
||||
|
||||
await CoreUtils.ignoreErrors(this.fetchContent(true));
|
||||
await CorePromiseUtils.ignoreErrors(this.fetchContent(true));
|
||||
|
||||
refresher?.complete();
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ export class AddonModBookContentsPage implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
// Chapter loaded, log view.
|
||||
await CoreUtils.ignoreErrors(AddonModBook.logView(this.module.instance, chapterId));
|
||||
await CorePromiseUtils.ignoreErrors(AddonModBook.logView(this.module.instance, chapterId));
|
||||
|
||||
CoreAnalytics.logEvent({
|
||||
type: CoreAnalyticsEventType.VIEW_ITEM,
|
||||
|
|
|
@ -19,7 +19,7 @@ import { CoreWSExternalWarning, CoreWSExternalFile, CoreWS } from '@services/ws'
|
|||
import { makeSingleton, Translate } from '@singletons';
|
||||
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
|
||||
import { CoreCourse, CoreCourseModuleContentFile } from '@features/course/services/course';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { CoreFilepool } from '@services/filepool';
|
||||
import { CoreText } from '@singletons/text';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
|
@ -311,7 +311,7 @@ export class AddonModBookProvider {
|
|||
promises.push(CoreFilepool.invalidateFilesByComponent(siteId, ADDON_MOD_BOOK_COMPONENT, moduleId));
|
||||
promises.push(CoreCourse.invalidateModule(moduleId, siteId));
|
||||
|
||||
return CoreUtils.allPromises(promises);
|
||||
return CorePromiseUtils.allPromises(promises);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,7 +16,7 @@ import { Injectable } from '@angular/core';
|
|||
import { CoreCourseResourcePrefetchHandlerBase } from '@features/course/classes/resource-prefetch-handler';
|
||||
import { CoreCourseAnyModuleData } from '@features/course/services/course';
|
||||
import { CoreCourseModuleData } from '@features/course/services/course-helper';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { CoreWSFile } from '@services/ws';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { AddonModBook } from '../book';
|
||||
|
@ -46,7 +46,7 @@ export class AddonModBookPrefetchHandlerService extends CoreCourseResourcePrefet
|
|||
|
||||
promises.push(super.downloadOrPrefetch(module, courseId, prefetch));
|
||||
// Ignore errors since this WS isn't available in some Moodle versions.
|
||||
promises.push(CoreUtils.ignoreErrors(AddonModBook.getBook(courseId, module.id)));
|
||||
promises.push(CorePromiseUtils.ignoreErrors(AddonModBook.getBook(courseId, module.id)));
|
||||
await Promise.all(promises);
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ export class AddonModBookPrefetchHandlerService extends CoreCourseResourcePrefet
|
|||
* @returns Promise resolved with list of intro files.
|
||||
*/
|
||||
async getIntroFiles(module: CoreCourseAnyModuleData, courseId: number): Promise<CoreWSFile[]> {
|
||||
const book = await CoreUtils.ignoreErrors(AddonModBook.getBook(courseId, module.id));
|
||||
const book = await CorePromiseUtils.ignoreErrors(AddonModBook.getBook(courseId, module.id));
|
||||
|
||||
return this.getIntroFilesFromInstance(module, book);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import { Params } from '@angular/router';
|
|||
import { CoreRoutedItemsManagerSource } from '@classes/items-management/routed-items-manager-source';
|
||||
import { CoreUser } from '@features/user/services/user';
|
||||
import { CoreGroupInfo, CoreGroups } from '@services/groups';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { Translate } from '@singletons';
|
||||
import { AddonModChat, AddonModChatSession, AddonModChatSessionUser } from '../services/chat';
|
||||
|
||||
|
@ -45,10 +45,10 @@ export class AddonModChatSessionsSource extends CoreRoutedItemsManagerSource<Add
|
|||
* Invalidate chat cache.
|
||||
*/
|
||||
async invalidateCache(): Promise<void> {
|
||||
await CoreUtils.ignoreErrors(CoreUtils.allPromises([
|
||||
await CorePromiseUtils.allPromisesIgnoringErrors([
|
||||
CoreGroups.invalidateActivityGroupInfo(this.CM_ID),
|
||||
AddonModChat.invalidateSessions(this.CHAT_ID, this.groupId, this.showAll),
|
||||
]));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,7 +20,7 @@ import { CoreNetwork } from '@services/network';
|
|||
import { CoreNavigator } from '@services/navigator';
|
||||
import { CoreSites } from '@services/sites';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { NgZone, Translate } from '@singletons';
|
||||
import { CoreEvents } from '@singletons/events';
|
||||
import { Subscription } from 'rxjs';
|
||||
|
@ -258,7 +258,7 @@ export class AddonModChatChatPage implements OnInit, OnDestroy, CanLeave {
|
|||
|
||||
// Start polling.
|
||||
this.polling = window.setInterval(() => {
|
||||
CoreUtils.ignoreErrors(this.fetchMessagesInterval());
|
||||
CorePromiseUtils.ignoreErrors(this.fetchMessagesInterval());
|
||||
}, AddonModChatChatPage.POLL_INTERVAL);
|
||||
}
|
||||
|
||||
|
@ -324,7 +324,7 @@ export class AddonModChatChatPage implements OnInit, OnDestroy, CanLeave {
|
|||
await AddonModChat.sendMessage(this.sessionId!, text, beep);
|
||||
|
||||
// Update messages to show the sent message.
|
||||
CoreUtils.ignoreErrors(this.fetchMessagesInterval());
|
||||
CorePromiseUtils.ignoreErrors(this.fetchMessagesInterval());
|
||||
} catch (error) {
|
||||
// Only close the keyboard if an error happens, we want the user to be able to send multiple
|
||||
// messages without the keyboard being closed.
|
||||
|
|
|
@ -17,7 +17,7 @@ import { CoreUser } from '@features/user/services/user';
|
|||
import { CoreNavigator } from '@services/navigator';
|
||||
import { CoreSites } from '@services/sites';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { AddonModChat } from '../../services/chat';
|
||||
import { AddonModChatFormattedSessionMessage, AddonModChatHelper } from '../../services/chat-helper';
|
||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
|
||||
|
@ -48,7 +48,7 @@ export class AddonModChatSessionMessagesPage implements OnInit {
|
|||
|
||||
constructor() {
|
||||
this.logView = CoreTime.once(async () => {
|
||||
await CoreUtils.ignoreErrors(AddonModChat.logViewSessions(this.cmId, {
|
||||
await CorePromiseUtils.ignoreErrors(AddonModChat.logViewSessions(this.cmId, {
|
||||
start: this.sessionStart,
|
||||
end: this.sessionEnd,
|
||||
}));
|
||||
|
@ -159,7 +159,9 @@ export class AddonModChatSessionMessagesPage implements OnInit {
|
|||
*/
|
||||
async refreshMessages(refresher: HTMLIonRefresherElement): Promise<void> {
|
||||
try {
|
||||
await CoreUtils.ignoreErrors(AddonModChat.invalidateSessionMessages(this.chatId, this.sessionStart, this.groupId));
|
||||
await CorePromiseUtils.ignoreErrors(
|
||||
AddonModChat.invalidateSessionMessages(this.chatId, this.sessionStart, this.groupId),
|
||||
);
|
||||
|
||||
await this.fetchMessages();
|
||||
} finally {
|
||||
|
|
|
@ -24,7 +24,7 @@ import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
|
|||
import { CoreTime } from '@singletons/time';
|
||||
import { Translate } from '@singletons';
|
||||
import { AddonModChat } from '@addons/mod/chat/services/chat';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { CoreLoadings } from '@services/loadings';
|
||||
|
||||
/**
|
||||
|
@ -46,7 +46,7 @@ export class AddonModChatSessionsPage implements OnInit, AfterViewInit, OnDestro
|
|||
this.logView = CoreTime.once(async () => {
|
||||
const source = this.sessions.getSource();
|
||||
|
||||
await CoreUtils.ignoreErrors(AddonModChat.logViewSessions(this.sessions.getSource().CM_ID));
|
||||
await CorePromiseUtils.ignoreErrors(AddonModChat.logViewSessions(this.sessions.getSource().CM_ID));
|
||||
|
||||
CoreAnalytics.logEvent({
|
||||
type: CoreAnalyticsEventType.VIEW_ITEM_LIST,
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { AddonModChatPrefetchHandlerService } from './prefetch';
|
||||
import { AddonModChat, AddonModChatSession } from '../chat';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { CoreCourse, CoreCourseAnyModuleData, CoreCourseCommonModWSOptions } from '@features/course/services/course';
|
||||
import { CoreSitesReadingStrategy } from '@services/sites';
|
||||
import { CoreGroups } from '@services/groups';
|
||||
|
@ -34,7 +34,7 @@ export class AddonModChatPrefetchHandlerLazyService extends AddonModChatPrefetch
|
|||
async invalidateContent(moduleId: number, courseId: number): Promise<void> {
|
||||
const chat = await AddonModChat.getChat(courseId, moduleId);
|
||||
|
||||
await CoreUtils.allPromises([
|
||||
await CorePromiseUtils.allPromises([
|
||||
AddonModChat.invalidateAllSessions(chat.id),
|
||||
AddonModChat.invalidateAllSessionMessages(chat.id),
|
||||
]);
|
||||
|
@ -44,7 +44,7 @@ export class AddonModChatPrefetchHandlerLazyService extends AddonModChatPrefetch
|
|||
* @inheritdoc
|
||||
*/
|
||||
async invalidateModule(module: CoreCourseAnyModuleData, courseId: number): Promise<void> {
|
||||
await CoreUtils.allPromises([
|
||||
await CorePromiseUtils.allPromises([
|
||||
AddonModChat.invalidateChats(courseId),
|
||||
CoreCourse.invalidateModule(module.id),
|
||||
]);
|
||||
|
|
|
@ -27,6 +27,7 @@ import { AddonModChoice } from './choice';
|
|||
import { AddonModChoiceOffline } from './choice-offline';
|
||||
import { AddonModChoicePrefetchHandler } from './handlers/prefetch';
|
||||
import { ADDON_MOD_CHOICE_AUTO_SYNCED, ADDON_MOD_CHOICE_COMPONENT } from '../constants';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
declare module '@singletons/events' {
|
||||
|
||||
|
@ -162,9 +163,9 @@ export class AddonModChoiceSyncProvider extends CoreCourseActivitySyncBaseProvid
|
|||
};
|
||||
|
||||
// Sync offline logs.
|
||||
await CoreUtils.ignoreErrors(CoreCourseLogHelper.syncActivity(ADDON_MOD_CHOICE_COMPONENT, choiceId, siteId));
|
||||
await CorePromiseUtils.ignoreErrors(CoreCourseLogHelper.syncActivity(ADDON_MOD_CHOICE_COMPONENT, choiceId, siteId));
|
||||
|
||||
const data = await CoreUtils.ignoreErrors(AddonModChoiceOffline.getResponse(choiceId, siteId, userId));
|
||||
const data = await CorePromiseUtils.ignoreErrors(AddonModChoiceOffline.getResponse(choiceId, siteId, userId));
|
||||
|
||||
if (!data || !data.choiceid) {
|
||||
// Nothing to sync. Set sync time.
|
||||
|
|
|
@ -27,6 +27,7 @@ import { AddonModChoiceOffline } from './choice-offline';
|
|||
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
|
||||
import { ADDON_MOD_CHOICE_COMPONENT, AddonModChoiceShowResults } from '../constants';
|
||||
import { CoreCacheUpdateFrequency } from '@/core/constants';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Service that provides some features for choices.
|
||||
|
@ -158,7 +159,7 @@ export class AddonModChoiceProvider {
|
|||
}
|
||||
|
||||
// Invalidate related data.
|
||||
await CoreUtils.ignoreErrors(Promise.all([
|
||||
await CorePromiseUtils.ignoreErrors(Promise.all([
|
||||
this.invalidateOptions(choiceId, site.id),
|
||||
this.invalidateResults(choiceId, site.id),
|
||||
]));
|
||||
|
@ -462,7 +463,7 @@ export class AddonModChoiceProvider {
|
|||
await site.write('mod_choice_submit_choice_response', params);
|
||||
|
||||
// Invalidate related data.
|
||||
await CoreUtils.ignoreErrors(Promise.all([
|
||||
await CorePromiseUtils.ignoreErrors(Promise.all([
|
||||
this.invalidateOptions(choiceId, siteId),
|
||||
this.invalidateResults(choiceId, siteId),
|
||||
]));
|
||||
|
|
|
@ -18,7 +18,7 @@ import { CoreCourseAnyModuleData, CoreCourseCommonModWSOptions } from '@features
|
|||
import { CoreUser } from '@features/user/services/user';
|
||||
import { CoreFilepool } from '@services/filepool';
|
||||
import { CoreSitesReadingStrategy } from '@services/sites';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { CoreWSFile } from '@services/ws';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { AddonModChoice } from '../choice';
|
||||
|
@ -117,7 +117,7 @@ export class AddonModChoicePrefetchHandlerService extends CoreCourseActivityPref
|
|||
* @inheritdoc
|
||||
*/
|
||||
async getIntroFiles(module: CoreCourseAnyModuleData, courseId: number): Promise<CoreWSFile[]> {
|
||||
const choice = await CoreUtils.ignoreErrors(AddonModChoice.getChoice(courseId, module.id));
|
||||
const choice = await CorePromiseUtils.ignoreErrors(AddonModChoice.getChoice(courseId, module.id));
|
||||
|
||||
return this.getIntroFilesFromInstance(module, choice);
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ import {
|
|||
AddonModDataTemplateMode,
|
||||
} from '../../constants';
|
||||
import { CoreModals } from '@services/modals';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
const contentToken = '<!-- CORE-DATABASE-CONTENT-GOES-HERE -->';
|
||||
|
||||
|
@ -223,7 +224,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp
|
|||
|
||||
if (sync) {
|
||||
// Try to synchronize the data.
|
||||
await CoreUtils.ignoreErrors(this.syncActivity(showErrors));
|
||||
await CorePromiseUtils.ignoreErrors(this.syncActivity(showErrors));
|
||||
}
|
||||
|
||||
this.groupInfo = await CoreGroups.getActivityGroupInfo(this.database.coursemodule);
|
||||
|
|
|
@ -43,6 +43,7 @@ import {
|
|||
AddonModDataTemplateType,
|
||||
AddonModDataTemplateMode,
|
||||
} from '../../constants';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Page that displays the view entry page.
|
||||
|
@ -432,7 +433,7 @@ export class AddonModDataEntryPage implements OnInit, OnDestroy {
|
|||
return;
|
||||
}
|
||||
|
||||
await CoreUtils.ignoreErrors(AddonModData.logView(this.database.id));
|
||||
await CorePromiseUtils.ignoreErrors(AddonModData.logView(this.database.id));
|
||||
|
||||
// Store module viewed because this page also updates recent accessed items block.
|
||||
CoreCourse.storeModuleViewed(this.courseId, this.moduleId);
|
||||
|
|
|
@ -22,7 +22,7 @@ import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
|
|||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreFormFields } from '@singletons/form';
|
||||
import { CoreText } from '@singletons/text';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { makeSingleton, Translate } from '@singletons';
|
||||
import { CoreEvents } from '@singletons/events';
|
||||
import {
|
||||
|
@ -174,7 +174,7 @@ export class AddonModDataHelperProvider {
|
|||
promises.push(AddonModData.invalidateEntryData(dataId, entryId, siteId));
|
||||
promises.push(AddonModData.invalidateEntriesData(dataId, siteId));
|
||||
|
||||
await CoreUtils.ignoreErrors(Promise.all(promises));
|
||||
await CorePromiseUtils.ignoreErrors(Promise.all(promises));
|
||||
|
||||
CoreEvents.trigger(ADDON_MOD_DATA_ENTRY_CHANGED, { dataId: dataId, entryId: entryId }, siteId);
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import { CoreFileUploader, CoreFileUploaderStoreFilesResult } from '@features/fi
|
|||
import { CoreFile } from '@services/file';
|
||||
import { CoreSites } from '@services/sites';
|
||||
import { CoreText } from '@singletons/text';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { CorePath } from '@singletons/path';
|
||||
import { AddonModDataEntryWSField } from './data';
|
||||
|
@ -80,7 +80,7 @@ export class AddonModDataOfflineProvider {
|
|||
*/
|
||||
protected async deleteEntryFiles(dataId: number, entryId: number, action: AddonModDataAction, siteId?: string): Promise<void> {
|
||||
const site = await CoreSites.getSite(siteId);
|
||||
const entry = await CoreUtils.ignoreErrors(this.getEntry(dataId, entryId, action, site.id));
|
||||
const entry = await CorePromiseUtils.ignoreErrors(this.getEntry(dataId, entryId, action, site.id));
|
||||
|
||||
if (!entry || !entry.fields) {
|
||||
// Entry not found or no fields, ignore.
|
||||
|
@ -191,7 +191,7 @@ export class AddonModDataOfflineProvider {
|
|||
async hasOfflineData(dataId: number, siteId?: string): Promise<boolean> {
|
||||
const site = await CoreSites.getSite(siteId);
|
||||
|
||||
return CoreUtils.promiseWorks(
|
||||
return CorePromiseUtils.promiseWorks(
|
||||
site.getDb().recordExists(DATA_ENTRY_TABLE, { dataid: dataId }),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import { AddonModDataHelper } from './data-helper';
|
|||
import { AddonModDataOffline, AddonModDataOfflineAction } from './data-offline';
|
||||
import { ADDON_MOD_DATA_AUTO_SYNCED, ADDON_MOD_DATA_COMPONENT, AddonModDataAction } from '../constants';
|
||||
import { CoreText } from '@singletons/text';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Service to sync databases.
|
||||
|
@ -164,7 +165,7 @@ export class AddonModDataSyncProvider extends CoreCourseActivitySyncBaseProvider
|
|||
*/
|
||||
protected async performSyncDatabase(dataId: number, siteId: string): Promise<AddonModDataSyncResult> {
|
||||
// Sync offline logs.
|
||||
await CoreUtils.ignoreErrors(
|
||||
await CorePromiseUtils.ignoreErrors(
|
||||
CoreCourseLogHelper.syncActivity(ADDON_MOD_DATA_COMPONENT, dataId, siteId),
|
||||
);
|
||||
|
||||
|
@ -175,11 +176,11 @@ export class AddonModDataSyncProvider extends CoreCourseActivitySyncBaseProvider
|
|||
|
||||
// Get answers to be sent.
|
||||
const offlineActions: AddonModDataOfflineAction[] =
|
||||
await CoreUtils.ignoreErrors(AddonModDataOffline.getDatabaseEntries(dataId, siteId), []);
|
||||
await CorePromiseUtils.ignoreErrors(AddonModDataOffline.getDatabaseEntries(dataId, siteId), []);
|
||||
|
||||
if (!offlineActions.length) {
|
||||
// Nothing to sync.
|
||||
await CoreUtils.ignoreErrors(this.setSyncTime(dataId, siteId));
|
||||
await CorePromiseUtils.ignoreErrors(this.setSyncTime(dataId, siteId));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -211,11 +212,11 @@ export class AddonModDataSyncProvider extends CoreCourseActivitySyncBaseProvider
|
|||
|
||||
if (result.updated) {
|
||||
// Data has been sent to server. Now invalidate the WS calls.
|
||||
await CoreUtils.ignoreErrors(AddonModData.invalidateContent(database.coursemodule, courseId, siteId));
|
||||
await CorePromiseUtils.ignoreErrors(AddonModData.invalidateContent(database.coursemodule, courseId, siteId));
|
||||
}
|
||||
|
||||
// Sync finished, set sync time.
|
||||
await CoreUtils.ignoreErrors(this.setSyncTime(dataId, siteId));
|
||||
await CorePromiseUtils.ignoreErrors(this.setSyncTime(dataId, siteId));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -453,7 +454,7 @@ export class AddonModDataSyncProvider extends CoreCourseActivitySyncBaseProvider
|
|||
});
|
||||
}
|
||||
|
||||
return CoreUtils.allPromises(subPromises);
|
||||
return CorePromiseUtils.allPromises(subPromises);
|
||||
}));
|
||||
|
||||
await Promise.all(promises);
|
||||
|
|
|
@ -35,6 +35,7 @@ import {
|
|||
AddonModDataAction,
|
||||
} from '../constants';
|
||||
import { CoreCacheUpdateFrequency } from '@/core/constants';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
declare module '@singletons/events' {
|
||||
|
||||
|
@ -823,7 +824,7 @@ export class AddonModDataProvider {
|
|||
|
||||
promises.push(this.invalidateFiles(moduleId, siteId));
|
||||
|
||||
await CoreUtils.allPromises(promises);
|
||||
await CorePromiseUtils.allPromises(promises);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,6 +27,7 @@ import { AddonModDataEntry, AddonModData, AddonModDataData } from '../data';
|
|||
import { AddonModDataSync, AddonModDataSyncResult } from '../data-sync';
|
||||
import { ContextLevel } from '@/core/constants';
|
||||
import { AddonModDataPrefetchHandlerService } from '@addons/mod/data/services/handlers/prefetch';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Handler to prefetch databases.
|
||||
|
@ -151,7 +152,7 @@ export class AddonModDataPrefetchHandlerLazyService extends AddonModDataPrefetch
|
|||
* @inheritdoc
|
||||
*/
|
||||
async getIntroFiles(module: CoreCourseAnyModuleData, courseId: number): Promise<CoreWSFile[]> {
|
||||
const data = await CoreUtils.ignoreErrors(AddonModData.getDatabase(courseId, module.id));
|
||||
const data = await CorePromiseUtils.ignoreErrors(AddonModData.getDatabase(courseId, module.id));
|
||||
|
||||
return this.getIntroFilesFromInstance(module, data);
|
||||
}
|
||||
|
@ -260,7 +261,7 @@ export class AddonModDataPrefetchHandlerLazyService extends AddonModDataPrefetch
|
|||
promises.push(CoreCourse.getModuleBasicInfoByInstance(database.id, 'data', { siteId }));
|
||||
|
||||
// Get course data, needed to determine upload max size if it's configured to be course limit.
|
||||
promises.push(CoreUtils.ignoreErrors(CoreCourses.getCourseByField('id', courseId, siteId)));
|
||||
promises.push(CorePromiseUtils.ignoreErrors(CoreCourses.getCourseByField('id', courseId, siteId)));
|
||||
|
||||
await Promise.all(promises);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import { CoreNavigator } from '@services/navigator';
|
|||
import { CoreSites } from '@services/sites';
|
||||
import { CoreText } from '@singletons/text';
|
||||
import { CoreTimeUtils } from '@services/utils/time';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
||||
import {
|
||||
AddonModFeedback,
|
||||
|
@ -108,7 +108,7 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity
|
|||
|
||||
// Prefetch data if needed.
|
||||
if (!data.offline && this.isPrefetched()) {
|
||||
await CoreUtils.ignoreErrors(AddonModFeedbackSync.prefetchAfterUpdate(
|
||||
await CorePromiseUtils.ignoreErrors(AddonModFeedbackSync.prefetchAfterUpdate(
|
||||
AddonModFeedbackPrefetchHandler.instance,
|
||||
this.module,
|
||||
this.courseId,
|
||||
|
|
|
@ -21,7 +21,7 @@ import { CoreSplitViewComponent } from '@components/split-view/split-view';
|
|||
import { CoreGroupInfo } from '@services/groups';
|
||||
import { CoreNavigator } from '@services/navigator';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { AddonModFeedbackAttemptItem, AddonModFeedbackAttemptsSource } from '../../classes/feedback-attempts-source';
|
||||
import { AddonModFeedbackWSAnonAttempt, AddonModFeedbackWSAttempt } from '../../services/feedback';
|
||||
import { CoreTime } from '@singletons/time';
|
||||
|
@ -180,7 +180,7 @@ export class AddonModFeedbackAttemptsPage implements AfterViewInit, OnDestroy {
|
|||
try {
|
||||
this.fetchFailed = false;
|
||||
|
||||
await CoreUtils.ignoreErrors(attempts.getSource().invalidateCache());
|
||||
await CorePromiseUtils.ignoreErrors(attempts.getSource().invalidateCache());
|
||||
await attempts.getSource().loadFeedback();
|
||||
await attempts.reload();
|
||||
} catch (error) {
|
||||
|
|
|
@ -44,6 +44,7 @@ import {
|
|||
} from '../../constants';
|
||||
import { CoreLoadings } from '@services/loadings';
|
||||
import { CoreError } from '@classes/errors/error';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Page that displays feedback form.
|
||||
|
@ -349,7 +350,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave {
|
|||
|
||||
try {
|
||||
// Sync other pages first.
|
||||
await CoreUtils.ignoreErrors(AddonModFeedbackSync.syncFeedback(this.feedback.id));
|
||||
await CorePromiseUtils.ignoreErrors(AddonModFeedbackSync.syncFeedback(this.feedback.id));
|
||||
|
||||
const response = await AddonModFeedback.processPage(this.feedback.id, this.currentPage, responses, {
|
||||
goPrevious,
|
||||
|
|
|
@ -16,7 +16,7 @@ import { Component, OnInit } from '@angular/core';
|
|||
import { CoreGroupInfo, CoreGroups } from '@services/groups';
|
||||
import { CoreNavigator } from '@services/navigator';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { AddonModFeedback, AddonModFeedbackWSFeedback } from '../../services/feedback';
|
||||
import { AddonModFeedbackHelper, AddonModFeedbackNonRespondent } from '../../services/feedback-helper';
|
||||
import { CoreTime } from '@singletons/time';
|
||||
|
@ -182,7 +182,7 @@ export class AddonModFeedbackNonRespondentsPage implements OnInit {
|
|||
promises.push(AddonModFeedback.invalidateNonRespondentsData(this.feedback.id));
|
||||
}
|
||||
|
||||
await CoreUtils.ignoreErrors(Promise.all(promises));
|
||||
await CorePromiseUtils.ignoreErrors(Promise.all(promises));
|
||||
|
||||
await this.fetchData(true);
|
||||
} finally {
|
||||
|
|
|
@ -28,6 +28,7 @@ import { AddonModFeedback, AddonModFeedbackWSFeedback } from './feedback';
|
|||
import { AddonModFeedbackOffline, AddonModFeedbackOfflineResponse } from './feedback-offline';
|
||||
import { AddonModFeedbackPrefetchHandler, AddonModFeedbackPrefetchHandlerService } from './handlers/prefetch';
|
||||
import { ADDON_MOD_FEEDBACK_AUTO_SYNCED, ADDON_MOD_FEEDBACK_COMPONENT } from '../constants';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Service to sync feedbacks.
|
||||
|
@ -161,14 +162,14 @@ export class AddonModFeedbackSyncProvider extends CoreCourseActivitySyncBaseProv
|
|||
};
|
||||
|
||||
// Sync offline logs.
|
||||
await CoreUtils.ignoreErrors(CoreCourseLogHelper.syncActivity(ADDON_MOD_FEEDBACK_COMPONENT, feedbackId, siteId));
|
||||
await CorePromiseUtils.ignoreErrors(CoreCourseLogHelper.syncActivity(ADDON_MOD_FEEDBACK_COMPONENT, feedbackId, siteId));
|
||||
|
||||
// Get offline responses to be sent.
|
||||
const responses = await CoreUtils.ignoreErrors(AddonModFeedbackOffline.getFeedbackResponses(feedbackId, siteId));
|
||||
const responses = await CorePromiseUtils.ignoreErrors(AddonModFeedbackOffline.getFeedbackResponses(feedbackId, siteId));
|
||||
|
||||
if (!responses || !responses.length) {
|
||||
// Nothing to sync.
|
||||
await CoreUtils.ignoreErrors(this.setSyncTime(feedbackId, siteId));
|
||||
await CorePromiseUtils.ignoreErrors(this.setSyncTime(feedbackId, siteId));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -198,7 +199,7 @@ export class AddonModFeedbackSyncProvider extends CoreCourseActivitySyncBaseProv
|
|||
Translate.instant('addon.mod_feedback.this_feedback_is_already_submitted'),
|
||||
);
|
||||
|
||||
await CoreUtils.ignoreErrors(this.setSyncTime(feedbackId, siteId));
|
||||
await CorePromiseUtils.ignoreErrors(this.setSyncTime(feedbackId, siteId));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -217,7 +218,7 @@ export class AddonModFeedbackSyncProvider extends CoreCourseActivitySyncBaseProv
|
|||
}));
|
||||
|
||||
// Execute all the processes in order to solve dependencies.
|
||||
await CoreUtils.executeOrderedPromises(orderedData);
|
||||
await CorePromiseUtils.executeOrderedPromises(orderedData);
|
||||
|
||||
if (result.updated) {
|
||||
// Data has been sent to server, update data.
|
||||
|
@ -231,7 +232,7 @@ export class AddonModFeedbackSyncProvider extends CoreCourseActivitySyncBaseProv
|
|||
}
|
||||
|
||||
// Sync finished, set sync time.
|
||||
await CoreUtils.ignoreErrors(this.setSyncTime(feedbackId, siteId));
|
||||
await CorePromiseUtils.ignoreErrors(this.setSyncTime(feedbackId, siteId));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ import {
|
|||
AddonModFeedbackIndexTabName,
|
||||
} from '../constants';
|
||||
import { CoreCacheUpdateFrequency } from '@/core/constants';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Service that provides some features for feedbacks.
|
||||
|
@ -156,7 +157,7 @@ export class AddonModFeedbackProvider {
|
|||
}
|
||||
|
||||
// Merge with offline data.
|
||||
const offlineResponses = await CoreUtils.ignoreErrors(
|
||||
const offlineResponses = await CorePromiseUtils.ignoreErrors(
|
||||
AddonModFeedbackOffline.getFeedbackResponses(feedbackId, options.siteId),
|
||||
);
|
||||
|
||||
|
@ -1086,7 +1087,7 @@ export class AddonModFeedbackProvider {
|
|||
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
|
||||
};
|
||||
|
||||
return CoreUtils.promiseWorks(site.read('mod_feedback_get_last_completed', params, preSets));
|
||||
return CorePromiseUtils.promiseWorks(site.read('mod_feedback_get_last_completed', params, preSets));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1233,9 +1234,9 @@ export class AddonModFeedbackProvider {
|
|||
const response = await site.write<AddonModFeedbackProcessPageWSResponse>('mod_feedback_process_page', params);
|
||||
|
||||
// Invalidate and update current values because they will change.
|
||||
await CoreUtils.ignoreErrors(this.invalidateCurrentValuesData(feedbackId, site.getId()));
|
||||
await CorePromiseUtils.ignoreErrors(this.invalidateCurrentValuesData(feedbackId, site.getId()));
|
||||
|
||||
await CoreUtils.ignoreErrors(this.getCurrentValues(feedbackId, { siteId: site.getId() }));
|
||||
await CorePromiseUtils.ignoreErrors(this.getCurrentValues(feedbackId, { siteId: site.getId() }));
|
||||
|
||||
return response;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import { CoreFilepool } from '@services/filepool';
|
|||
import { CoreGroups } from '@services/groups';
|
||||
import { CoreSitesReadingStrategy } from '@services/sites';
|
||||
import { CoreTimeUtils } from '@services/utils/time';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { CoreWSFile } from '@services/ws';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import {
|
||||
|
@ -70,7 +70,7 @@ export class AddonModFeedbackPrefetchHandlerService extends CoreCourseActivityPr
|
|||
* @inheritdoc
|
||||
*/
|
||||
async getIntroFiles(module: CoreCourseAnyModuleData, courseId: number): Promise<CoreWSFile[]> {
|
||||
const feedback = await CoreUtils.ignoreErrors(AddonModFeedback.getFeedback(courseId, module.id));
|
||||
const feedback = await CorePromiseUtils.ignoreErrors(AddonModFeedback.getFeedback(courseId, module.id));
|
||||
|
||||
return this.getIntroFilesFromInstance(module, feedback);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import { CoreNavigator } from '@services/navigator';
|
|||
import { Md5 } from 'ts-md5';
|
||||
import { AddonModFolder, AddonModFolderFolder } from '../../services/folder';
|
||||
import { AddonModFolderFolderFormattedData, AddonModFolderHelper } from '../../services/folder-helper';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { ADDON_MOD_FOLDER_COMPONENT, ADDON_MOD_FOLDER_PAGE_NAME } from '../../constants';
|
||||
|
||||
/**
|
||||
|
@ -121,7 +121,7 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo
|
|||
* @inheritdoc
|
||||
*/
|
||||
protected async logActivity(): Promise<void> {
|
||||
await CoreUtils.ignoreErrors(AddonModFolder.logView(this.module.instance));
|
||||
await CorePromiseUtils.ignoreErrors(AddonModFolder.logView(this.module.instance));
|
||||
|
||||
this.analyticsLogEvent('mod_folder_view_folder');
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
|
|||
import { CoreCourse } from '@features/course/services/course';
|
||||
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
|
||||
import { CoreSites, CoreSitesCommonWSOptions } from '@services/sites';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { CoreWSExternalFile, CoreWSExternalWarning } from '@services/ws';
|
||||
import { makeSingleton, Translate } from '@singletons';
|
||||
import { ADDON_MOD_FOLDER_COMPONENT } from '../constants';
|
||||
|
@ -106,7 +106,7 @@ export class AddonModFolderProvider {
|
|||
promises.push(this.invalidateFolderData(courseId, siteId));
|
||||
promises.push(CoreCourse.invalidateModule(moduleId, siteId));
|
||||
|
||||
await CoreUtils.allPromises(promises);
|
||||
await CorePromiseUtils.allPromises(promises);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,6 +27,7 @@ import {
|
|||
import { AddonModForumOffline, AddonModForumOfflineDiscussion } from '../services/forum-offline';
|
||||
import { ADDON_MOD_FORUM_DISCUSSIONS_PER_PAGE, AddonModForumType } from '../constants';
|
||||
import { CoreSites } from '@services/sites';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
export class AddonModForumDiscussionsSource extends CoreRoutedItemsManagerSource<AddonModForumDiscussionItem> {
|
||||
|
||||
|
@ -157,7 +158,7 @@ export class AddonModForumDiscussionsSource extends CoreRoutedItemsManagerSource
|
|||
async loadGroupInfo(forumId: number): Promise<void> {
|
||||
[this.groupInfo, this.allPartsPermissions] = await Promise.all([
|
||||
CoreGroups.getActivityGroupInfo(this.CM_ID, false),
|
||||
CoreUtils.ignoreErrors(AddonModForum.canAddDiscussionToAll(forumId, { cmId: this.CM_ID })),
|
||||
CorePromiseUtils.ignoreErrors(AddonModForum.canAddDiscussionToAll(forumId, { cmId: this.CM_ID })),
|
||||
]);
|
||||
|
||||
this.supportsChangeGroup = AddonModForum.isGetDiscussionPostsAvailable();
|
||||
|
|
|
@ -58,6 +58,7 @@ import { toBoolean } from '@/core/transforms/boolean';
|
|||
import { CorePopovers } from '@services/popovers';
|
||||
import { CoreLoadings } from '@services/loadings';
|
||||
import { CoreWSFile } from '@services/ws';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Components that shows a discussion post, its attachments and the action buttons allowed (reply, etc.).
|
||||
|
@ -599,7 +600,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
|
|||
}));
|
||||
}
|
||||
|
||||
await CoreUtils.ignoreErrors(Promise.all(promises));
|
||||
await CorePromiseUtils.ignoreErrors(Promise.all(promises));
|
||||
|
||||
// Reset data.
|
||||
this.setFormData();
|
||||
|
|
|
@ -62,6 +62,7 @@ import {
|
|||
import { CoreCourseContentsPage } from '@features/course/pages/contents/contents';
|
||||
import { CoreToasts } from '@services/toasts';
|
||||
import { CoreLoadings } from '@services/loadings';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
type SortType = 'flat-newest' | 'flat-oldest' | 'nested';
|
||||
|
||||
|
@ -414,7 +415,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
|
|||
try {
|
||||
if (sync) {
|
||||
// Try to synchronize the forum.
|
||||
await CoreUtils.ignoreErrors(this.syncDiscussion(!!showErrors));
|
||||
await CorePromiseUtils.ignoreErrors(this.syncDiscussion(!!showErrors));
|
||||
}
|
||||
|
||||
const response = await AddonModForum.getDiscussionPosts(this.discussionId, { cmId: this.cmId });
|
||||
|
@ -689,7 +690,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
|
|||
this.forumId && promises.push(AddonModForum.invalidateAccessInformation(this.forumId));
|
||||
this.forumId && promises.push(AddonModForum.invalidateCanAddDiscussion(this.forumId));
|
||||
|
||||
await CoreUtils.ignoreErrors(CoreUtils.allPromises(promises));
|
||||
await CorePromiseUtils.allPromisesIgnoringErrors(promises);
|
||||
|
||||
await this.fetchPosts(sync, showErrors);
|
||||
}
|
||||
|
@ -872,7 +873,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
|
|||
* @param logAnalytics Whether to log analytics too or not.
|
||||
*/
|
||||
protected async logDiscussionView(logAnalytics = false): Promise<void> {
|
||||
await CoreUtils.ignoreErrors(AddonModForum.logDiscussionView(this.discussionId, this.forumId || -1));
|
||||
await CorePromiseUtils.ignoreErrors(AddonModForum.logDiscussionView(this.discussionId, this.forumId || -1));
|
||||
|
||||
if (logAnalytics) {
|
||||
CoreAnalytics.logEvent({
|
||||
|
|
|
@ -53,6 +53,7 @@ import {
|
|||
} from '../../constants';
|
||||
import { CoreCourseContentsPage } from '@features/course/pages/contents/contents';
|
||||
import { CoreLoadings } from '@services/loadings';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
type NewDiscussionData = {
|
||||
subject: string;
|
||||
|
@ -242,7 +243,7 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea
|
|||
|
||||
// Use the canAddDiscussion WS to check if the user can add attachments and pin discussions.
|
||||
promises.push(
|
||||
CoreUtils.ignoreErrors(
|
||||
CorePromiseUtils.ignoreErrors(
|
||||
AddonModForum.instance
|
||||
.canAddDiscussionToAll(this.forumId, { cmId: this.cmId })
|
||||
.then((response) => {
|
||||
|
@ -611,7 +612,7 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea
|
|||
|
||||
promises.push(AddonModForumOffline.deleteNewDiscussion(this.forumId, this.timeCreated));
|
||||
promises.push(
|
||||
CoreUtils.ignoreErrors(
|
||||
CorePromiseUtils.ignoreErrors(
|
||||
AddonModForumHelper.deleteNewDiscussionStoredFiles(this.forumId, this.timeCreated),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -30,6 +30,7 @@ import { CoreDomUtils } from '@services/utils/dom';
|
|||
import { CoreUrl } from '@singletons/url';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { Translate } from '@singletons';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
@Component({
|
||||
selector: 'page-addon-mod-forum-search',
|
||||
|
@ -104,7 +105,7 @@ export class AddonModForumSearchPage implements OnInit {
|
|||
|
||||
await CoreDomUtils.showOperationModals('core.searching', true, async () => {
|
||||
await this.resultsSource.reload();
|
||||
await CoreUtils.ignoreErrors(
|
||||
await CorePromiseUtils.ignoreErrors(
|
||||
CoreSearchGlobalSearch.logViewResults(this.resultsSource.getQuery(), this.resultsSource.getFilters()),
|
||||
);
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ import {
|
|||
import { AddonModForumDiscussionOptions, AddonModForumOffline, AddonModForumOfflineReply } from './forum-offline';
|
||||
import { CoreFileEntry } from '@services/file-helper';
|
||||
import { ADDON_MOD_FORUM_ALL_GROUPS, ADDON_MOD_FORUM_COMPONENT } from '../constants';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Service that provides some features for forums.
|
||||
|
@ -224,7 +225,7 @@ export class AddonModForumHelperProvider {
|
|||
|
||||
// Get user data.
|
||||
promises.push(
|
||||
CoreUtils.ignoreErrors(
|
||||
CorePromiseUtils.ignoreErrors(
|
||||
CoreUser.instance
|
||||
.getProfile(offlineReply.userid, offlineReply.courseid, true)
|
||||
.then(user => {
|
||||
|
@ -255,7 +256,7 @@ export class AddonModForumHelperProvider {
|
|||
const folderPath = await AddonModForumOffline.getNewDiscussionFolder(forumId, timecreated, siteId);
|
||||
|
||||
// Ignore any errors, CoreFile.removeDir fails if folder doesn't exist.
|
||||
await CoreUtils.ignoreErrors(CoreFile.removeDir(folderPath));
|
||||
await CorePromiseUtils.ignoreErrors(CoreFile.removeDir(folderPath));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -271,7 +272,7 @@ export class AddonModForumHelperProvider {
|
|||
const folderPath = await AddonModForumOffline.getReplyFolder(forumId, postId, siteId, userId);
|
||||
|
||||
// Ignore any errors, CoreFile.removeDir fails if folder doesn't exist.
|
||||
await CoreUtils.ignoreErrors(CoreFile.removeDir(folderPath));
|
||||
await CorePromiseUtils.ignoreErrors(CoreFile.removeDir(folderPath));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,6 +38,7 @@ import {
|
|||
ADDON_MOD_FORUM_COMPONENT,
|
||||
ADDON_MOD_FORUM_MANUAL_SYNCED,
|
||||
} from '../constants';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
declare module '@singletons/events' {
|
||||
|
||||
|
@ -224,12 +225,12 @@ export class AddonModForumSyncProvider extends CoreCourseActivitySyncBaseProvide
|
|||
|
||||
// Sync offline logs.
|
||||
const syncDiscussions = async (): Promise<AddonModForumSyncResult> => {
|
||||
await CoreUtils.ignoreErrors(
|
||||
await CorePromiseUtils.ignoreErrors(
|
||||
CoreCourseLogHelper.syncActivity(ADDON_MOD_FORUM_COMPONENT, forumId, siteId),
|
||||
);
|
||||
|
||||
// Get offline responses to be sent.
|
||||
const discussions = await CoreUtils.ignoreErrors(
|
||||
const discussions = await CorePromiseUtils.ignoreErrors(
|
||||
AddonModForumOffline.getNewDiscussions(forumId, siteId, userId),
|
||||
[] as AddonModForumOfflineDiscussion[],
|
||||
);
|
||||
|
@ -298,11 +299,11 @@ export class AddonModForumSyncProvider extends CoreCourseActivitySyncBaseProvide
|
|||
AddonModForum.invalidateCanAddDiscussion(forumId, siteId),
|
||||
];
|
||||
|
||||
await CoreUtils.ignoreErrors(Promise.all(promises));
|
||||
await CorePromiseUtils.ignoreErrors(Promise.all(promises));
|
||||
}
|
||||
|
||||
// Sync finished, set sync time.
|
||||
await CoreUtils.ignoreErrors(this.setSyncTime(syncId, siteId));
|
||||
await CorePromiseUtils.ignoreErrors(this.setSyncTime(syncId, siteId));
|
||||
|
||||
return result;
|
||||
};
|
||||
|
@ -350,7 +351,7 @@ export class AddonModForumSyncProvider extends CoreCourseActivitySyncBaseProvide
|
|||
}
|
||||
});
|
||||
|
||||
await CoreUtils.allPromises(promises);
|
||||
await CorePromiseUtils.allPromises(promises);
|
||||
|
||||
return { updated, warnings };
|
||||
}
|
||||
|
@ -365,7 +366,7 @@ export class AddonModForumSyncProvider extends CoreCourseActivitySyncBaseProvide
|
|||
*/
|
||||
async syncForumReplies(forumId: number, userId?: number, siteId?: string): Promise<AddonModForumSyncResult> {
|
||||
// Get offline forum replies to be sent.
|
||||
const replies = await CoreUtils.ignoreErrors(
|
||||
const replies = await CorePromiseUtils.ignoreErrors(
|
||||
AddonModForumOffline.getForumReplies(forumId, siteId, userId),
|
||||
[] as AddonModForumOfflineReply[],
|
||||
);
|
||||
|
@ -457,7 +458,7 @@ export class AddonModForumSyncProvider extends CoreCourseActivitySyncBaseProvide
|
|||
|
||||
// Get offline responses to be sent.
|
||||
const syncReplies = async () => {
|
||||
const replies = await CoreUtils.ignoreErrors(
|
||||
const replies = await CorePromiseUtils.ignoreErrors(
|
||||
AddonModForumOffline.getDiscussionReplies(discussionId, siteId, userId),
|
||||
[] as AddonModForumOfflineReply[],
|
||||
);
|
||||
|
@ -515,10 +516,10 @@ export class AddonModForumSyncProvider extends CoreCourseActivitySyncBaseProvide
|
|||
|
||||
invalidationPromises.push(AddonModForum.invalidateDiscussionPosts(discussionId, forumId, siteId));
|
||||
|
||||
await CoreUtils.ignoreErrors(CoreUtils.allPromises(invalidationPromises));
|
||||
await CorePromiseUtils.allPromisesIgnoringErrors(invalidationPromises);
|
||||
|
||||
// Sync finished, set sync time.
|
||||
await CoreUtils.ignoreErrors(this.setSyncTime(syncId, siteId));
|
||||
await CorePromiseUtils.ignoreErrors(this.setSyncTime(syncId, siteId));
|
||||
|
||||
// All done, return the warnings.
|
||||
return result;
|
||||
|
@ -539,7 +540,7 @@ export class AddonModForumSyncProvider extends CoreCourseActivitySyncBaseProvide
|
|||
protected async deleteNewDiscussion(forumId: number, timecreated: number, siteId?: string, userId?: number): Promise<void> {
|
||||
await Promise.all([
|
||||
AddonModForumOffline.deleteNewDiscussion(forumId, timecreated, siteId, userId),
|
||||
CoreUtils.ignoreErrors(
|
||||
CorePromiseUtils.ignoreErrors(
|
||||
AddonModForumHelper.deleteNewDiscussionStoredFiles(forumId, timecreated, siteId),
|
||||
),
|
||||
]);
|
||||
|
@ -557,7 +558,7 @@ export class AddonModForumSyncProvider extends CoreCourseActivitySyncBaseProvide
|
|||
protected async deleteReply(forumId: number, postId: number, siteId?: string, userId?: number): Promise<void> {
|
||||
await Promise.all([
|
||||
AddonModForumOffline.deleteReply(postId, siteId, userId),
|
||||
CoreUtils.ignoreErrors(AddonModForumHelper.deleteReplyStoredFiles(forumId, postId, siteId, userId)),
|
||||
CorePromiseUtils.ignoreErrors(AddonModForumHelper.deleteReplyStoredFiles(forumId, postId, siteId, userId)),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ import {
|
|||
AddonModForumType,
|
||||
} from '../constants';
|
||||
import { CoreCacheUpdateFrequency } from '@/core/constants';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
declare module '@singletons/events' {
|
||||
|
||||
|
@ -733,7 +734,7 @@ export class AddonModForumProvider {
|
|||
let sortOrderValue: number | null = null;
|
||||
|
||||
if (this.isDiscussionListSortingAvailable()) {
|
||||
const preferenceValue = await CoreUtils.ignoreErrors(
|
||||
const preferenceValue = await CorePromiseUtils.ignoreErrors(
|
||||
CoreUser.getUserPreference(ADDON_MOD_FORUM_PREFERENCE_SORTORDER),
|
||||
);
|
||||
|
||||
|
@ -931,7 +932,7 @@ export class AddonModForumProvider {
|
|||
promises.push(this.invalidateDiscussionPosts(discussion.discussion, forum.id));
|
||||
});
|
||||
|
||||
return CoreUtils.allPromises(promises);
|
||||
return CorePromiseUtils.allPromises(promises);
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
@ -940,7 +941,7 @@ export class AddonModForumProvider {
|
|||
promises.push(CoreUser.invalidateUserPreference(ADDON_MOD_FORUM_PREFERENCE_SORTORDER));
|
||||
}
|
||||
|
||||
return CoreUtils.allPromises(promises);
|
||||
return CorePromiseUtils.allPromises(promises);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -972,7 +973,7 @@ export class AddonModForumProvider {
|
|||
promises.push(site.invalidateWsCacheForKeyStartingWith(this.getForumDiscussionDataCacheKey(forumId, discussionId)));
|
||||
}
|
||||
|
||||
await CoreUtils.allPromises(promises);
|
||||
await CorePromiseUtils.allPromises(promises);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -21,7 +21,7 @@ import { CoreWSFile } from '@services/ws';
|
|||
import { CoreCourse, CoreCourseAnyModuleData, CoreCourseCommonModWSOptions } from '@features/course/services/course';
|
||||
import { CoreUser } from '@features/user/services/user';
|
||||
import { CoreGroups, CoreGroupsProvider } from '@services/groups';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { AddonModForumSync, AddonModForumSyncResult } from '../forum-sync';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { CoreCourses } from '@features/courses/services/courses';
|
||||
|
@ -251,7 +251,7 @@ export class AddonModForumPrefetchHandlerService extends CoreCourseActivityPrefe
|
|||
promises.push(AddonModForum.getAccessInformation(forum.id, modOptions));
|
||||
|
||||
// Get course data, needed to determine upload max size if it's configured to be course limit.
|
||||
promises.push(CoreUtils.ignoreErrors(CoreCourses.getCourseByField('id', courseId, siteId)));
|
||||
promises.push(CorePromiseUtils.ignoreErrors(CoreCourses.getCourseByField('id', courseId, siteId)));
|
||||
|
||||
await Promise.all(promises);
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ export class AddonModForumPrefetchHandlerService extends CoreCourseActivityPrefe
|
|||
|
||||
if (mode !== CoreGroupsProvider.SEPARATEGROUPS && mode !== CoreGroupsProvider.VISIBLEGROUPS) {
|
||||
// Activity doesn't use groups. Prefetch canAddDiscussionToAll to determine if user can pin/attach.
|
||||
await CoreUtils.ignoreErrors(AddonModForum.canAddDiscussionToAll(forum.id, options));
|
||||
await CorePromiseUtils.ignoreErrors(AddonModForum.canAddDiscussionToAll(forum.id, options));
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -291,11 +291,11 @@ export class AddonModForumPrefetchHandlerService extends CoreCourseActivityPrefe
|
|||
const result = await CoreGroups.getActivityAllowedGroups(forum.cmid, undefined, siteId);
|
||||
await Promise.all(
|
||||
result.groups.map(
|
||||
async (group) => CoreUtils.ignoreErrors(
|
||||
async (group) => CorePromiseUtils.ignoreErrors(
|
||||
AddonModForum.canAddDiscussion(forum.id, group.id, options),
|
||||
),
|
||||
).concat(
|
||||
CoreUtils.ignoreErrors(AddonModForum.canAddDiscussionToAll(forum.id, options)),
|
||||
CorePromiseUtils.ignoreErrors(AddonModForum.canAddDiscussionToAll(forum.id, options)),
|
||||
),
|
||||
);
|
||||
} catch (error) {
|
||||
|
|
|
@ -25,6 +25,7 @@ import { makeSingleton } from '@singletons';
|
|||
|
||||
import { isSafeNumber } from '@/core/utils/types';
|
||||
import { ADDON_MOD_FORUM_PAGE_NAME } from '../../constants';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Handler for forum push notifications clicks.
|
||||
|
@ -75,7 +76,7 @@ export class AddonModForumPushClickHandlerService implements CorePushNotificatio
|
|||
pageParams.postId = Number(data.postid || contextUrlParams.urlHash.replace('p', ''));
|
||||
}
|
||||
|
||||
await CoreUtils.ignoreErrors(
|
||||
await CorePromiseUtils.ignoreErrors(
|
||||
AddonModForum.invalidateDiscussionPosts(discussionId, undefined, notification.site),
|
||||
);
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ import { FileEntry } from '@awesome-cordova-plugins/file/ngx';
|
|||
import { CoreNavigator } from '@services/navigator';
|
||||
import { CoreNetwork } from '@services/network';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { Translate } from '@singletons';
|
||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
||||
import { AddonModGlossaryEntriesSource, AddonModGlossaryEntryItem } from '../../classes/glossary-entries-source';
|
||||
|
@ -86,7 +86,7 @@ export class AddonModGlossaryEntryPage implements OnInit, OnDestroy {
|
|||
return;
|
||||
}
|
||||
|
||||
await CoreUtils.ignoreErrors(AddonModGlossary.logEntryView(this.onlineEntry.id, this.componentId));
|
||||
await CorePromiseUtils.ignoreErrors(AddonModGlossary.logEntryView(this.onlineEntry.id, this.componentId));
|
||||
|
||||
this.analyticsLogEvent('mod_glossary_get_entry_by_id', `/mod/glossary/showentry.php?eid=${this.onlineEntry.id}`);
|
||||
});
|
||||
|
@ -184,7 +184,7 @@ export class AddonModGlossaryEntryPage implements OnInit, OnDestroy {
|
|||
);
|
||||
|
||||
const glossaryId = this.glossary?.id;
|
||||
const cancelled = await CoreUtils.promiseFails(
|
||||
const cancelled = await CorePromiseUtils.promiseFails(
|
||||
CoreDomUtils.showConfirm(Translate.instant('addon.mod_glossary.areyousuredelete')),
|
||||
);
|
||||
|
||||
|
@ -200,13 +200,13 @@ export class AddonModGlossaryEntryPage implements OnInit, OnDestroy {
|
|||
|
||||
await AddonModGlossary.deleteEntry(glossaryId, entryId);
|
||||
await Promise.all([
|
||||
CoreUtils.ignoreErrors(AddonModGlossary.invalidateEntry(entryId)),
|
||||
CoreUtils.ignoreErrors(AddonModGlossary.invalidateEntriesByLetter(glossaryId)),
|
||||
CoreUtils.ignoreErrors(AddonModGlossary.invalidateEntriesByAuthor(glossaryId)),
|
||||
CoreUtils.ignoreErrors(AddonModGlossary.invalidateEntriesByCategory(glossaryId)),
|
||||
CoreUtils.ignoreErrors(AddonModGlossary.invalidateEntriesByDate(glossaryId, 'CREATION')),
|
||||
CoreUtils.ignoreErrors(AddonModGlossary.invalidateEntriesByDate(glossaryId, 'UPDATE')),
|
||||
CoreUtils.ignoreErrors(this.entries.getSource().invalidateCache(false)),
|
||||
CorePromiseUtils.ignoreErrors(AddonModGlossary.invalidateEntry(entryId)),
|
||||
CorePromiseUtils.ignoreErrors(AddonModGlossary.invalidateEntriesByLetter(glossaryId)),
|
||||
CorePromiseUtils.ignoreErrors(AddonModGlossary.invalidateEntriesByAuthor(glossaryId)),
|
||||
CorePromiseUtils.ignoreErrors(AddonModGlossary.invalidateEntriesByCategory(glossaryId)),
|
||||
CorePromiseUtils.ignoreErrors(AddonModGlossary.invalidateEntriesByDate(glossaryId, 'CREATION')),
|
||||
CorePromiseUtils.ignoreErrors(AddonModGlossary.invalidateEntriesByDate(glossaryId, 'UPDATE')),
|
||||
CorePromiseUtils.ignoreErrors(this.entries.getSource().invalidateCache(false)),
|
||||
]);
|
||||
} else if (this.offlineEntry) {
|
||||
const concept = this.offlineEntry.concept;
|
||||
|
@ -239,12 +239,12 @@ export class AddonModGlossaryEntryPage implements OnInit, OnDestroy {
|
|||
async doRefresh(refresher?: HTMLIonRefresherElement): Promise<void> {
|
||||
if (this.onlineEntry && this.glossary?.allowcomments && this.onlineEntry.id > 0 && this.commentsEnabled && this.comments) {
|
||||
// Refresh comments asynchronously (without blocking the current promise).
|
||||
CoreUtils.ignoreErrors(this.comments.doRefresh());
|
||||
CorePromiseUtils.ignoreErrors(this.comments.doRefresh());
|
||||
}
|
||||
|
||||
try {
|
||||
if (this.onlineEntry) {
|
||||
await CoreUtils.ignoreErrors(AddonModGlossary.invalidateEntry(this.onlineEntry.id));
|
||||
await CorePromiseUtils.ignoreErrors(AddonModGlossary.invalidateEntry(this.onlineEntry.id));
|
||||
await this.loadOnlineEntry(this.onlineEntry.id);
|
||||
} else if (this.offlineEntry) {
|
||||
const timecreated = Number(this.entrySlug.slice(4));
|
||||
|
|
|
@ -16,7 +16,7 @@ import { Injectable } from '@angular/core';
|
|||
import { FileEntry } from '@awesome-cordova-plugins/file/ngx';
|
||||
import { CoreFileUploader, CoreFileUploaderStoreFilesResult } from '@features/fileuploader/services/fileuploader';
|
||||
import { CoreFile } from '@services/file';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { AddonModGlossaryOffline } from './glossary-offline';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { CoreFileEntry } from '@services/file-helper';
|
||||
|
@ -39,7 +39,7 @@ export class AddonModGlossaryHelperProvider {
|
|||
async deleteStoredFiles(glossaryId: number, entryName: string, timeCreated: number, siteId?: string): Promise<void> {
|
||||
const folderPath = await AddonModGlossaryOffline.getEntryFolder(glossaryId, entryName, timeCreated, siteId);
|
||||
|
||||
await CoreUtils.ignoreErrors(CoreFile.removeDir(folderPath));
|
||||
await CorePromiseUtils.ignoreErrors(CoreFile.removeDir(folderPath));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,6 +31,7 @@ import { AddonModGlossaryOffline, AddonModGlossaryOfflineEntry } from './glossar
|
|||
import { CoreFileUploader } from '@features/fileuploader/services/fileuploader';
|
||||
import { CoreFileEntry } from '@services/file-helper';
|
||||
import { ADDON_MOD_GLOSSARY_COMPONENT, GLOSSARY_AUTO_SYNCED } from '../constants';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Service to sync glossaries.
|
||||
|
@ -172,17 +173,17 @@ export class AddonModGlossarySyncProvider extends CoreCourseActivitySyncBaseProv
|
|||
const syncId = this.getGlossarySyncId(glossaryId, userId);
|
||||
|
||||
// Sync offline logs.
|
||||
await CoreUtils.ignoreErrors(CoreCourseLogHelper.syncActivity(ADDON_MOD_GLOSSARY_COMPONENT, glossaryId, siteId));
|
||||
await CorePromiseUtils.ignoreErrors(CoreCourseLogHelper.syncActivity(ADDON_MOD_GLOSSARY_COMPONENT, glossaryId, siteId));
|
||||
|
||||
// Get offline responses to be sent.
|
||||
const entries = await CoreUtils.ignoreErrors(
|
||||
const entries = await CorePromiseUtils.ignoreErrors(
|
||||
AddonModGlossaryOffline.getGlossaryOfflineEntries(glossaryId, siteId, userId),
|
||||
<AddonModGlossaryOfflineEntry[]> [],
|
||||
);
|
||||
|
||||
if (!entries.length) {
|
||||
// Nothing to sync.
|
||||
await CoreUtils.ignoreErrors(this.setSyncTime(syncId, siteId));
|
||||
await CorePromiseUtils.ignoreErrors(this.setSyncTime(syncId, siteId));
|
||||
|
||||
return result;
|
||||
} else if (!CoreNetwork.isOnline()) {
|
||||
|
@ -233,7 +234,7 @@ export class AddonModGlossarySyncProvider extends CoreCourseActivitySyncBaseProv
|
|||
}
|
||||
|
||||
// Sync finished, set sync time.
|
||||
await CoreUtils.ignoreErrors(this.setSyncTime(syncId, siteId));
|
||||
await CorePromiseUtils.ignoreErrors(this.setSyncTime(syncId, siteId));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -254,7 +255,7 @@ export class AddonModGlossarySyncProvider extends CoreCourseActivitySyncBaseProv
|
|||
let updated = false;
|
||||
const warnings: string[] = [];
|
||||
|
||||
await CoreUtils.allPromises(results.map(async (result) => {
|
||||
await CorePromiseUtils.allPromises(results.map(async (result) => {
|
||||
if (result.updated.length) {
|
||||
updated = true;
|
||||
|
||||
|
@ -308,7 +309,7 @@ export class AddonModGlossarySyncProvider extends CoreCourseActivitySyncBaseProv
|
|||
|
||||
if (entry.attachments.offline) {
|
||||
// Has offline files.
|
||||
const storedFiles = await CoreUtils.ignoreErrors(
|
||||
const storedFiles = await CorePromiseUtils.ignoreErrors(
|
||||
AddonModGlossaryHelper.getStoredFiles(glossaryId, entry.concept, entry.timecreated, siteId),
|
||||
[], // Folder not found, no files to add.
|
||||
);
|
||||
|
|
|
@ -38,6 +38,7 @@ import {
|
|||
ADDON_MOD_GLOSSARY_LIMIT_ENTRIES,
|
||||
} from '../constants';
|
||||
import { CoreCacheUpdateFrequency } from '@/core/constants';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Service that provides some features for glossaries.
|
||||
|
@ -320,7 +321,7 @@ export class AddonModGlossaryProvider {
|
|||
|
||||
if (limit === ADDON_MOD_GLOSSARY_LIMIT_ENTRIES) {
|
||||
// Store entries in background, don't block the user for this.
|
||||
CoreUtils.ignoreErrors(this.storeEntries(glossaryId, result.entries, from, site.getId()));
|
||||
CorePromiseUtils.ignoreErrors(this.storeEntries(glossaryId, result.entries, from, site.getId()));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -529,7 +530,7 @@ export class AddonModGlossaryProvider {
|
|||
const data = await this.getStoredDataForEntry(entryId, site.getId());
|
||||
|
||||
if (data.from !== undefined) {
|
||||
const response = await CoreUtils.ignoreErrors(
|
||||
const response = await CorePromiseUtils.ignoreErrors(
|
||||
this.getEntryFromList(data.glossaryId, entryId, data.from, false, options),
|
||||
);
|
||||
|
||||
|
@ -703,9 +704,9 @@ export class AddonModGlossaryProvider {
|
|||
async invalidateContent(moduleId: number, courseId: number): Promise<void> {
|
||||
const glossary = await this.getGlossary(courseId, moduleId);
|
||||
|
||||
await CoreUtils.ignoreErrors(this.invalidateGlossaryEntries(glossary));
|
||||
await CorePromiseUtils.ignoreErrors(this.invalidateGlossaryEntries(glossary));
|
||||
|
||||
await CoreUtils.allPromises([
|
||||
await CorePromiseUtils.allPromises([
|
||||
this.invalidateCourseGlossaries(courseId),
|
||||
this.invalidateCategories(glossary.id),
|
||||
]);
|
||||
|
@ -751,7 +752,7 @@ export class AddonModGlossaryProvider {
|
|||
}
|
||||
});
|
||||
|
||||
await CoreUtils.allPromises(promises);
|
||||
await CorePromiseUtils.allPromises(promises);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,7 +20,7 @@ import { CoreCourses } from '@features/courses/services/courses';
|
|||
import { CoreUser } from '@features/user/services/user';
|
||||
import { CoreFilepool } from '@services/filepool';
|
||||
import { CoreSitesReadingStrategy } from '@services/sites';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { CoreWSFile } from '@services/ws';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { AddonModGlossary, AddonModGlossaryEntry, AddonModGlossaryGlossary } from '../glossary';
|
||||
|
@ -191,7 +191,7 @@ export class AddonModGlossaryPrefetchHandlerService extends CoreCourseActivityPr
|
|||
promises.push(CoreCourse.getModuleBasicInfoByInstance(glossary.id, 'glossary', { siteId }));
|
||||
|
||||
// Get course data, needed to determine upload max size if it's configured to be course limit.
|
||||
promises.push(CoreUtils.ignoreErrors(CoreCourses.getCourseByField('id', courseId, siteId)));
|
||||
promises.push(CorePromiseUtils.ignoreErrors(CoreCourses.getCourseByField('id', courseId, siteId)));
|
||||
|
||||
await Promise.all(promises);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ import {
|
|||
} from '../../services/h5pactivity-sync';
|
||||
import { CoreFileHelper } from '@services/file-helper';
|
||||
import { CoreText } from '@singletons/text';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import {
|
||||
ADDON_MOD_H5PACTIVITY_AUTO_SYNCED,
|
||||
ADDON_MOD_H5PACTIVITY_COMPONENT,
|
||||
|
@ -699,7 +699,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv
|
|||
return;
|
||||
}
|
||||
|
||||
await CoreUtils.ignoreErrors(CoreXAPIOffline.deleteStates(ADDON_MOD_H5PACTIVITY_TRACK_COMPONENT, {
|
||||
await CorePromiseUtils.ignoreErrors(CoreXAPIOffline.deleteStates(ADDON_MOD_H5PACTIVITY_TRACK_COMPONENT, {
|
||||
itemId: this.h5pActivity.context,
|
||||
}));
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import { Component, OnInit } from '@angular/core';
|
|||
import { CoreUser, CoreUserProfile } from '@features/user/services/user';
|
||||
import { CoreNavigator } from '@services/navigator';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import {
|
||||
AddonModH5PActivity,
|
||||
AddonModH5PActivityData,
|
||||
|
@ -54,7 +54,7 @@ export class AddonModH5PActivityAttemptResultsPage implements OnInit {
|
|||
return;
|
||||
}
|
||||
|
||||
await CoreUtils.ignoreErrors(AddonModH5PActivity.logViewReport(
|
||||
await CorePromiseUtils.ignoreErrors(AddonModH5PActivity.logViewReport(
|
||||
this.h5pActivity.id,
|
||||
{ attemptId: this.attemptId },
|
||||
));
|
||||
|
@ -153,7 +153,7 @@ export class AddonModH5PActivityAttemptResultsPage implements OnInit {
|
|||
promises.push(AddonModH5PActivity.invalidateAttemptResults(this.h5pActivity.id, this.attemptId));
|
||||
}
|
||||
|
||||
await CoreUtils.ignoreErrors(Promise.all(promises));
|
||||
await CorePromiseUtils.ignoreErrors(Promise.all(promises));
|
||||
|
||||
await this.fetchData();
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import { CoreUser, CoreUserProfile } from '@features/user/services/user';
|
|||
import { CoreNavigator } from '@services/navigator';
|
||||
import { CoreSites } from '@services/sites';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import {
|
||||
AddonModH5PActivity,
|
||||
AddonModH5PActivityAttempt,
|
||||
|
@ -55,7 +55,7 @@ export class AddonModH5PActivityUserAttemptsPage implements OnInit {
|
|||
return;
|
||||
}
|
||||
|
||||
await CoreUtils.ignoreErrors(AddonModH5PActivity.logViewReport(
|
||||
await CorePromiseUtils.ignoreErrors(AddonModH5PActivity.logViewReport(
|
||||
this.h5pActivity.id,
|
||||
{ userId: this.userId },
|
||||
));
|
||||
|
@ -167,7 +167,7 @@ export class AddonModH5PActivityUserAttemptsPage implements OnInit {
|
|||
promises.push(AddonModH5PActivity.invalidateUserAttempts(this.h5pActivity.id, this.userId));
|
||||
}
|
||||
|
||||
await CoreUtils.ignoreErrors(Promise.all(promises));
|
||||
await CorePromiseUtils.ignoreErrors(Promise.all(promises));
|
||||
|
||||
await this.fetchData();
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import { CoreUser, CoreUserProfile } from '@features/user/services/user';
|
|||
|
||||
import { CoreNavigator } from '@services/navigator';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import {
|
||||
AddonModH5PActivity,
|
||||
AddonModH5PActivityData,
|
||||
|
@ -54,7 +54,7 @@ export class AddonModH5PActivityUsersAttemptsPage implements OnInit {
|
|||
return;
|
||||
}
|
||||
|
||||
await CoreUtils.ignoreErrors(AddonModH5PActivity.logViewReport(this.h5pActivity.id));
|
||||
await CorePromiseUtils.ignoreErrors(AddonModH5PActivity.logViewReport(this.h5pActivity.id));
|
||||
|
||||
CoreAnalytics.logEvent({
|
||||
type: CoreAnalyticsEventType.VIEW_ITEM_LIST,
|
||||
|
@ -214,7 +214,7 @@ export class AddonModH5PActivityUsersAttemptsPage implements OnInit {
|
|||
promises.push(AddonModH5PActivity.invalidateAllUsersAttempts(this.h5pActivity.id));
|
||||
}
|
||||
|
||||
await CoreUtils.ignoreErrors(Promise.all(promises));
|
||||
await CorePromiseUtils.ignoreErrors(Promise.all(promises));
|
||||
|
||||
await this.fetchData(true);
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ import {
|
|||
ADDON_MOD_H5PACTIVITY_COMPONENT,
|
||||
ADDON_MOD_H5PACTIVITY_TRACK_COMPONENT,
|
||||
} from '../constants';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
|
||||
/**
|
||||
* Service to sync H5P activities.
|
||||
|
@ -208,7 +209,7 @@ export class AddonModH5PActivitySyncProvider extends CoreCourseActivitySyncBaseP
|
|||
}
|
||||
|
||||
// Sync offline logs.
|
||||
await CoreUtils.ignoreErrors(
|
||||
await CorePromiseUtils.ignoreErrors(
|
||||
CoreCourseLogHelper.syncActivity(ADDON_MOD_H5PACTIVITY_COMPONENT, h5pActivity.id, siteId),
|
||||
);
|
||||
|
||||
|
@ -268,7 +269,7 @@ export class AddonModH5PActivitySyncProvider extends CoreCourseActivitySyncBaseP
|
|||
|
||||
if (result.updated) {
|
||||
// Data has been sent to server, invalidate attempts.
|
||||
await CoreUtils.ignoreErrors(AddonModH5PActivity.invalidateUserAttempts(id, undefined, siteId));
|
||||
await CorePromiseUtils.ignoreErrors(AddonModH5PActivity.invalidateUserAttempts(id, undefined, siteId));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -25,7 +25,7 @@ import { CoreXAPI } from '@features/xapi/services/xapi';
|
|||
import { CoreFileHelper } from '@services/file-helper';
|
||||
import { CoreFilepool } from '@services/filepool';
|
||||
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { CoreWSFile } from '@services/ws';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import {
|
||||
|
@ -149,7 +149,7 @@ export class AddonModH5PActivityPrefetchHandlerService extends CoreCourseActivit
|
|||
const fileState = await CoreFilepool.getFileStateByUrl(siteId, CoreFileHelper.getFileUrl(deployedFile));
|
||||
|
||||
if (fileState !== DownloadStatus.DOWNLOADED) {
|
||||
await CoreUtils.ignoreErrors(CoreXAPIOffline.deleteStates(ADDON_MOD_H5PACTIVITY_TRACK_COMPONENT, {
|
||||
await CorePromiseUtils.ignoreErrors(CoreXAPIOffline.deleteStates(ADDON_MOD_H5PACTIVITY_TRACK_COMPONENT, {
|
||||
itemId: h5pActivity.context,
|
||||
siteId,
|
||||
}));
|
||||
|
|
|
@ -20,7 +20,7 @@ import { CoreCourse } from '@features/course/services/course';
|
|||
import { CoreNavigator } from '@services/navigator';
|
||||
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { AddonModH5PActivity } from '../h5pactivity';
|
||||
import { ADDON_MOD_H5PACTIVITY_PAGE_NAME } from '../../constants';
|
||||
|
@ -115,7 +115,7 @@ export class AddonModH5PActivityReportLinkHandlerService extends CoreContentLink
|
|||
canViewAllAttempts = await AddonModH5PActivity.canGetUsersAttempts(siteId);
|
||||
|
||||
if (canViewAllAttempts) {
|
||||
const accessInfo = await CoreUtils.ignoreErrors(AddonModH5PActivity.getAccessInformation(id, {
|
||||
const accessInfo = await CorePromiseUtils.ignoreErrors(AddonModH5PActivity.getAccessInformation(id, {
|
||||
cmId,
|
||||
siteId,
|
||||
}));
|
||||
|
|
|
@ -18,7 +18,7 @@ import { CoreCourseContentsPage } from '@features/course/pages/contents/contents
|
|||
import { CoreCourse } from '@features/course/services/course';
|
||||
import { CoreNavigator } from '@services/navigator';
|
||||
import { AddonModImscp, AddonModImscpTocItem } from '../../services/imscp';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { ADDON_MOD_IMSCP_COMPONENT, ADDON_MOD_IMSCP_PAGE_NAME } from '../../constants';
|
||||
|
||||
/**
|
||||
|
@ -103,7 +103,7 @@ export class AddonModImscpIndexComponent extends CoreCourseModuleMainResourceCom
|
|||
* @inheritdoc
|
||||
*/
|
||||
protected async logActivity(): Promise<void> {
|
||||
await CoreUtils.ignoreErrors(AddonModImscp.logView(this.module.instance));
|
||||
await CorePromiseUtils.ignoreErrors(AddonModImscp.logView(this.module.instance));
|
||||
|
||||
this.analyticsLogEvent('mod_imscp_view_imscp');
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import { CoreNetwork } from '@services/network';
|
|||
import { CoreNavigator } from '@services/navigator';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreErrorHelper } from '@services/error-helper';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { Translate } from '@singletons';
|
||||
import { AddonModImscp, AddonModImscpImscp, AddonModImscpTocItem } from '../../services/imscp';
|
||||
import { CoreModals } from '@services/modals';
|
||||
|
@ -214,12 +214,12 @@ export class AddonModImscpViewPage implements OnInit {
|
|||
* @returns Promise resolved when done.
|
||||
*/
|
||||
async doRefresh(refresher?: HTMLIonRefresherElement): Promise<void> {
|
||||
await CoreUtils.ignoreErrors(Promise.all([
|
||||
await CorePromiseUtils.ignoreErrors(Promise.all([
|
||||
AddonModImscp.invalidateContent(this.cmId, this.courseId),
|
||||
CoreCourseModulePrefetchDelegate.invalidateCourseUpdates(this.courseId), // To detect if IMSCP was updated.
|
||||
]));
|
||||
|
||||
await CoreUtils.ignoreErrors(this.fetchContent(true));
|
||||
await CorePromiseUtils.ignoreErrors(this.fetchContent(true));
|
||||
|
||||
refresher?.complete();
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import {
|
|||
import { CoreCourseModuleData } from '@features/course/services/course-helper';
|
||||
import { CoreFilepool } from '@services/filepool';
|
||||
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { CoreWSFile } from '@services/ws';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { AddonModImscp } from '../imscp';
|
||||
|
@ -61,7 +61,7 @@ export class AddonModImscpPrefetchHandlerService extends CoreCourseResourcePrefe
|
|||
*/
|
||||
async getIntroFiles(module: CoreCourseAnyModuleData, courseId: number): Promise<CoreWSFile[]> {
|
||||
// If not found, use undefined so module description is used.
|
||||
const imscp = await CoreUtils.ignoreErrors(AddonModImscp.getImscp(courseId, module.id));
|
||||
const imscp = await CorePromiseUtils.ignoreErrors(AddonModImscp.getImscp(courseId, module.id));
|
||||
|
||||
return this.getIntroFilesFromInstance(module, imscp);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import { CoreNetwork } from '@services/network';
|
|||
import { CoreFilepool } from '@services/filepool';
|
||||
import { CoreSitesCommonWSOptions, CoreSites } from '@services/sites';
|
||||
import { CoreText } from '@singletons/text';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { CoreWSExternalFile, CoreWSExternalWarning } from '@services/ws';
|
||||
import { makeSingleton, Translate } from '@singletons';
|
||||
import { CorePath } from '@singletons/path';
|
||||
|
@ -228,7 +228,7 @@ export class AddonModImscpProvider {
|
|||
promises.push(CoreFilepool.invalidateFilesByComponent(siteId, ADDON_MOD_IMSCP_COMPONENT, moduleId));
|
||||
promises.push(CoreCourse.invalidateModule(moduleId, siteId));
|
||||
|
||||
await CoreUtils.allPromises(promises);
|
||||
await CorePromiseUtils.allPromises(promises);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,7 +16,7 @@ import { Injectable } from '@angular/core';
|
|||
import { CoreCourseResourcePrefetchHandlerBase } from '@features/course/classes/resource-prefetch-handler';
|
||||
import { CoreCourse, CoreCourseAnyModuleData } from '@features/course/services/course';
|
||||
import { CoreSitesReadingStrategy } from '@services/sites';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CorePromiseUtils } from '@singletons/promise-utils';
|
||||
import { CoreWSFile } from '@services/ws';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { AddonModLabel } from '../label';
|
||||
|
@ -60,7 +60,7 @@ export class AddonModLabelPrefetchHandlerService extends CoreCourseResourcePrefe
|
|||
promises.push(AddonModLabel.invalidateLabelData(courseId));
|
||||
promises.push(CoreCourse.invalidateModule(module.id));
|
||||
|
||||
await CoreUtils.allPromises(promises);
|
||||
await CorePromiseUtils.allPromises(promises);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue