Merge pull request #4131 from crazyserver/MOBILE-4616

Mobile 4616
main
Dani Palou 2024-07-29 16:44:20 +02:00 committed by GitHub
commit ee4527b72c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
118 changed files with 795 additions and 499 deletions

View File

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

View File

@ -18,13 +18,11 @@ import { CoreSharedModule } from '@/core/shared.module';
import { AddonCalendarCalendarComponent } from './calendar/calendar';
import { AddonCalendarUpcomingEventsComponent } from './upcoming-events/upcoming-events';
import { AddonCalendarFilterComponent } from './filter/filter';
@NgModule({
declarations: [
AddonCalendarCalendarComponent,
AddonCalendarUpcomingEventsComponent,
AddonCalendarFilterComponent,
],
imports: [
CoreSharedModule,
@ -32,7 +30,6 @@ import { AddonCalendarFilterComponent } from './filter/filter';
exports: [
AddonCalendarCalendarComponent,
AddonCalendarUpcomingEventsComponent,
AddonCalendarFilterComponent,
],
})
export class AddonCalendarComponentsModule {}

View File

@ -20,6 +20,7 @@ import { CoreEvents } from '@singletons/events';
import { AddonCalendarEventType, AddonCalendarProvider } from '../../services/calendar';
import { AddonCalendarFilter, AddonCalendarEventIcons } from '../../services/calendar-helper';
import { ALL_COURSES_ID } from '@features/courses/services/courses-helper';
import { CoreSharedModule } from '@/core/shared.module';
/**
* Component to display the events filter that includes events types and a list of courses.
@ -28,6 +29,10 @@ import { ALL_COURSES_ID } from '@features/courses/services/courses-helper';
selector: 'addon-calendar-filter',
templateUrl: 'filter.html',
styleUrls: ['../../calendar-common.scss', 'filter.scss'],
standalone: true,
imports: [
CoreSharedModule,
],
})
export class AddonCalendarFilterComponent implements OnInit {

View File

@ -30,7 +30,6 @@ import { AddonCalendarFilter, AddonCalendarHelper } from '../../services/calenda
import { AddonCalendarSync, AddonCalendarSyncProvider } from '../../services/calendar-sync';
import { CoreCategoryData, CoreCourses, CoreEnrolledCourseData } from '@features/courses/services/courses';
import { CoreCoursesHelper } from '@features/courses/services/courses-helper';
import { AddonCalendarFilterComponent } from '../../components/filter/filter';
import moment from 'moment-timezone';
import { NgZone, Translate } from '@singletons';
import { CoreNavigator } from '@services/navigator';
@ -49,6 +48,7 @@ import { AddonCalendarEventsSource } from '@addons/calendar/classes/events-sourc
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreUrl } from '@singletons/url';
import { CoreTime } from '@singletons/time';
import { CoreModals } from '@services/modals';
/**
* Page that displays the calendar events for a certain day.
@ -375,7 +375,9 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
* Show the filter menu.
*/
async openFilter(): Promise<void> {
await CoreDomUtils.openSideModal({
const { AddonCalendarFilterComponent } = await import('../../components/filter/filter');
await CoreModals.openSideModal({
component: AddonCalendarFilterComponent,
componentProps: {
courses: this.manager?.getSource().courses,

View File

@ -24,7 +24,7 @@ import { AddonCalendarOffline } from '../../services/calendar-offline';
import { AddonCalendarSync, AddonCalendarSyncEvents, AddonCalendarSyncProvider } from '../../services/calendar-sync';
import { CoreNetwork } from '@services/network';
import { CoreEventObserver, CoreEvents } from '@singletons/events';
import { CoreDomUtils, ToastDuration } from '@services/utils/dom';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreTextUtils } from '@services/utils/text';
import { CoreSites } from '@services/sites';
import { CoreCourse } from '@features/course/services/course';
@ -43,6 +43,7 @@ import { CoreRemindersSetReminderMenuComponent } from '@features/reminders/compo
import { CoreLocalNotifications } from '@services/local-notifications';
import { CorePlatform } from '@services/platform';
import { CoreConfig } from '@services/config';
import { CoreToasts, ToastDuration } from '@services/toasts';
/**
* Page that displays a single calendar event.
@ -556,7 +557,11 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
}
if (onlineEventDeleted || this.event.id < 0) {
CoreDomUtils.showToast('addon.calendar.eventcalendareventdeleted', true, ToastDuration.LONG);
CoreToasts.show({
message: 'addon.calendar.eventcalendareventdeleted',
translateMessage: true,
duration: ToastDuration.LONG,
});
// Event deleted, close the view.
CoreNavigator.back();
@ -611,7 +616,11 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
}
if (data.deleted && data.deleted.indexOf(this.eventId) != -1) {
CoreDomUtils.showToast('addon.calendar.eventcalendareventdeleted', true, ToastDuration.LONG);
CoreToasts.show({
message: 'addon.calendar.eventcalendareventdeleted',
translateMessage: true,
duration: ToastDuration.LONG,
});
// Event was deleted, close the view.
CoreNavigator.back();

View File

@ -28,10 +28,10 @@ import { CoreEnrolledCourseData } from '@features/courses/services/courses';
import { ActivatedRoute, Params } from '@angular/router';
import { AddonCalendarCalendarComponent } from '../../components/calendar/calendar';
import { AddonCalendarUpcomingEventsComponent } from '../../components/upcoming-events/upcoming-events';
import { AddonCalendarFilterComponent } from '../../components/filter/filter';
import { CoreNavigator } from '@services/navigator';
import { CoreConstants } from '@/core/constants';
import { CoreMainMenuDeepLinkManager } from '@features/mainmenu/classes/deep-link-manager';
import { CoreModals } from '@services/modals';
/**
* Page that displays the calendar events.
@ -330,7 +330,9 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy {
* Show the filter menu.
*/
async openFilter(): Promise<void> {
await CoreDomUtils.openSideModal({
const { AddonCalendarFilterComponent } = await import('../../components/filter/filter');
await CoreModals.openSideModal({
component: AddonCalendarFilterComponent,
componentProps: {
courses: this.courses,

View File

@ -25,6 +25,7 @@ import { CorePasswordModalResponse } from '@components/password-modal/password-m
import { CoreDomUtils } from '@services/utils/dom';
import { CoreWSError } from '@classes/errors/wserror';
import { CoreEnrol, CoreEnrolEnrolmentMethod } from '@features/enrol/services/enrol';
import { CoreModals } from '@services/modals';
/**
* Enrol handler.
@ -118,7 +119,7 @@ export class AddonEnrolGuestHandlerService implements CoreEnrolGuestHandler {
};
try {
const response = await CoreDomUtils.promptPassword<CorePasswordModalResponse>({
const response = await CoreModals.promptPassword<CorePasswordModalResponse>({
title: method.name,
validator: validatePassword,
});

View File

@ -20,6 +20,7 @@ import { CorePasswordModalResponse } from '@components/password-modal/password-m
import { CoreCoursesProvider } from '@features/courses/services/courses';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreEnrol, CoreEnrolEnrolmentMethod } from '@features/enrol/services/enrol';
import { CoreModals } from '@services/modals';
/**
* Enrol handler.
@ -145,7 +146,7 @@ export class AddonEnrolSelfHandlerService implements CoreEnrolSelfHandler {
if (!response.validated) {
try {
const response = await CoreDomUtils.promptPassword({
const response = await CoreModals.promptPassword({
validator: validatePassword,
title: method.name,
placeholder: 'addon.enrol_self.password',

View File

@ -47,6 +47,7 @@ import { CoreDom } from '@singletons/dom';
import { CoreKeyboard } from '@singletons/keyboard';
import { CoreText } from '@singletons/text';
import { CoreWait } from '@singletons/wait';
import { CoreModals } from '@services/modals';
/**
* Page that displays a message discussion page.
@ -1250,7 +1251,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
await import('@addons/messages/components/conversation-info/conversation-info.module');
// Display the group information.
const userId = await CoreDomUtils.openSideModal<number>({
const userId = await CoreModals.openSideModal<number>({
component: AddonMessagesConversationInfoComponent,
componentProps: {
conversationId: this.conversationId,

View File

@ -15,7 +15,7 @@
import { Component, Input } from '@angular/core';
import { CoreCanceledError } from '@classes/errors/cancelederror';
import { CoreError } from '@classes/errors/error';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreModals } from '@services/modals';
import { AddonModAssignFeedbackCommentsTextData } from '../feedback/comments/services/handler';
import { AddonModAssignAssign, AddonModAssignPlugin, AddonModAssignSubmission } from '../services/assign';
@ -49,7 +49,7 @@ export class AddonModAssignFeedbackPluginBaseComponent implements IAddonModAssig
await import('@addons/mod/assign/components/edit-feedback-modal/edit-feedback-modal');
// Create the navigation modal.
const modalData = await CoreDomUtils.openModal<AddonModAssignFeedbackCommentsTextData>({
const modalData = await CoreModals.openModal<AddonModAssignFeedbackCommentsTextData>({
component: AddonModAssignEditFeedbackModalComponent,
componentProps: {
assign: this.assign,

View File

@ -20,7 +20,7 @@ import { CanLeave } from '@guards/can-leave';
import { CoreNavigator } from '@services/navigator';
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
import { CoreSync } from '@services/sync';
import { CoreDomUtils, ToastDuration } from '@services/utils/dom';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreFormFields, CoreForms } from '@singletons/form';
import { Translate } from '@singletons';
import { CoreEvents } from '@singletons/events';
@ -45,6 +45,7 @@ import {
ADDON_MOD_ASSIGN_SUBMISSION_SAVED_EVENT,
ADDON_MOD_ASSIGN_SUBMITTED_FOR_GRADING_EVENT,
} from '../../constants';
import { CoreToasts, ToastDuration } from '@services/toasts';
/**
* Page that allows adding or editing an assigment submission.
@ -488,7 +489,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave {
* Function called when the time is up.
*/
async timeUp(): Promise<void> {
this.timeUpToast = await CoreDomUtils.showToastWithOptions({
this.timeUpToast = await CoreToasts.show({
message: Translate.instant('addon.mod_assign.caneditsubmission'),
duration: ToastDuration.STICKY,
buttons: [Translate.instant('core.dismiss')],

View File

@ -25,8 +25,6 @@ import { CoreCourseComponentsModule } from '@features/course/components/componen
CoreSharedModule,
CoreCourseComponentsModule,
],
providers: [
],
exports: [
AddonModBBBIndexComponent,
],

View File

@ -18,12 +18,10 @@ import { CoreSharedModule } from '@/core/shared.module';
import { CoreCourseComponentsModule } from '@features/course/components/components.module';
import { AddonModBookIndexComponent } from './index/index';
import { AddonModBookTocComponent } from './toc/toc';
@NgModule({
declarations: [
AddonModBookIndexComponent,
AddonModBookTocComponent,
],
imports: [
CoreSharedModule,
@ -31,7 +29,6 @@ import { AddonModBookTocComponent } from './toc/toc';
],
exports: [
AddonModBookIndexComponent,
AddonModBookTocComponent,
],
})
export class AddonModBookComponentsModule {}

View File

@ -16,6 +16,7 @@ import { Component, Input, OnInit } from '@angular/core';
import { ModalController } from '@singletons';
import { AddonModBookTocChapter, AddonModBookBookWSData } from '../../services/book';
import { AddonModBookNumbering } from '../../constants';
import { CoreSharedModule } from '@/core/shared.module';
/**
* Modal to display the TOC of a book.
@ -23,7 +24,11 @@ import { AddonModBookNumbering } from '../../constants';
@Component({
selector: 'addon-mod-book-toc',
templateUrl: 'toc.html',
styleUrls: ['toc.scss'],
styleUrl: 'toc.scss',
standalone: true,
imports: [
CoreSharedModule,
],
})
export class AddonModBookTocComponent implements OnInit {

View File

@ -30,7 +30,6 @@ import { CoreDomUtils } from '@services/utils/dom';
import { CoreTextUtils } from '@services/utils/text';
import { CoreUtils } from '@services/utils/utils';
import { Translate } from '@singletons';
import { AddonModBookTocComponent } from '../../components/toc/toc';
import {
AddonModBook,
AddonModBookBookWSData,
@ -40,6 +39,7 @@ import {
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreUrl } from '@singletons/url';
import { ADDON_MOD_BOOK_COMPONENT, AddonModBookNavStyle } from '../../constants';
import { CoreModals } from '@services/modals';
/**
* Page that displays a book contents.
@ -250,7 +250,9 @@ export class AddonModBookContentsPage implements OnInit, OnDestroy {
// Create the toc modal.
const visibleChapter = this.manager?.getSelectedItem();
const modalData = await CoreDomUtils.openSideModal<number>({
const { AddonModBookTocComponent } = await import('../../components/toc/toc');
const modalData = await CoreModals.openSideModal<number>({
component: AddonModBookTocComponent,
componentProps: {
moduleId: this.cmId,

View File

@ -16,12 +16,10 @@ import { NgModule } from '@angular/core';
import { AddonModChatIndexComponent } from './index/index';
import { CoreSharedModule } from '@/core/shared.module';
import { CoreCourseComponentsModule } from '@features/course/components/components.module';
import { AddonModChatUsersModalComponent } from './users-modal/users-modal';
@NgModule({
declarations: [
AddonModChatIndexComponent,
AddonModChatUsersModalComponent,
],
imports: [
CoreSharedModule,
@ -29,7 +27,6 @@ import { AddonModChatUsersModalComponent } from './users-modal/users-modal';
],
exports: [
AddonModChatIndexComponent,
AddonModChatUsersModalComponent,
],
})
export class AddonModChatComponentsModule {}

View File

@ -11,7 +11,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
import { CoreNetwork } from '@services/network';
import { CoreSites } from '@services/sites';
@ -19,6 +18,7 @@ import { CoreDomUtils } from '@services/utils/dom';
import { ModalController, NgZone } from '@singletons';
import { Subscription } from 'rxjs';
import { AddonModChat, AddonModChatUser } from '../../services/chat';
import { CoreSharedModule } from '@/core/shared.module';
/**
* MMdal that displays the chat session users.
@ -26,6 +26,10 @@ import { AddonModChat, AddonModChatUser } from '../../services/chat';
@Component({
selector: 'addon-mod-chat-users-modal',
templateUrl: 'users-modal.html',
standalone: true,
imports: [
CoreSharedModule,
],
})
export class AddonModChatUsersModalComponent implements OnInit, OnDestroy {

View File

@ -24,13 +24,14 @@ import { CoreUtils } from '@services/utils/utils';
import { NgZone, Translate } from '@singletons';
import { CoreEvents } from '@singletons/events';
import { Subscription } from 'rxjs';
import { AddonModChatUsersModalComponent, AddonModChatUsersModalResult } from '../../components/users-modal/users-modal';
import { AddonModChatUsersModalResult } from '../../components/users-modal/users-modal';
import { AddonModChat, AddonModChatUser } from '../../services/chat';
import { AddonModChatFormattedMessage, AddonModChatHelper } from '../../services/chat-helper';
import { CoreTime } from '@singletons/time';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreKeyboard } from '@singletons/keyboard';
import { CoreWait } from '@singletons/wait';
import { CoreModals } from '@services/modals';
/**
* Page that displays a chat session.
@ -186,8 +187,10 @@ export class AddonModChatChatPage implements OnInit, OnDestroy, CanLeave {
* Display the chat users modal.
*/
async showChatUsers(): Promise<void> {
const { AddonModChatUsersModalComponent } = await import('../../components/users-modal/users-modal');
// Create the toc modal.
const modalData = await CoreDomUtils.openSideModal<AddonModChatUsersModalResult>({
const modalData = await CoreModals.openSideModal<AddonModChatUsersModalResult>({
component: AddonModChatUsersModalComponent,
componentProps: {
sessionId: this.sessionId,

View File

@ -25,8 +25,6 @@ import { AddonModChoiceIndexComponent } from './index/index';
CoreSharedModule,
CoreCourseComponentsModule,
],
providers: [
],
exports: [
AddonModChoiceIndexComponent,
],

View File

@ -51,6 +51,7 @@ import {
AddonModDataTemplateType,
AddonModDataTemplateMode,
} from '../../constants';
import { CoreModals } from '@services/modals';
const contentToken = '<!-- CORE-DATABASE-CONTENT-GOES-HERE -->';
@ -401,7 +402,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp
async showSearch(): Promise<void> {
const { AddonModDataSearchModalComponent } = await import('@addons/mod/data/components/search-modal/search-modal');
const modalData = await CoreDomUtils.openModal<AddonModDataSearchDataParams>({
const modalData = await CoreModals.openModal<AddonModDataSearchDataParams>({
component: AddonModDataSearchModalComponent,
componentProps: {
search: this.search,

View File

@ -19,7 +19,7 @@ import { CoreFileUploader, CoreFileUploaderStoreFilesResult } from '@features/fi
import { CoreRatingOffline } from '@features/rating/services/rating-offline';
import { FileEntry } from '@awesome-cordova-plugins/file/ngx';
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils, ToastDuration } from '@services/utils/dom';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreFormFields } from '@singletons/form';
import { CoreTextUtils } from '@services/utils/text';
import { CoreUtils } from '@services/utils/utils';
@ -47,6 +47,7 @@ import {
AddonModDataTemplateType,
AddonModDataTemplateMode,
} from '../constants';
import { CoreToasts, ToastDuration } from '@services/toasts';
/**
* Service that provides helper functions for datas.
@ -176,11 +177,11 @@ export class AddonModDataHelperProvider {
CoreEvents.trigger(ADDON_MOD_DATA_ENTRY_CHANGED, { dataId: dataId, entryId: entryId }, siteId);
CoreDomUtils.showToast(
approve ? 'addon.mod_data.recordapproved' : 'addon.mod_data.recorddisapproved',
true,
ToastDuration.LONG,
);
CoreToasts.show({
message: approve ? 'addon.mod_data.recordapproved' : 'addon.mod_data.recorddisapproved',
translateMessage: true,
duration: ToastDuration.LONG,
});
} catch {
// Ignore error, it was already displayed.
} finally {
@ -883,7 +884,11 @@ export class AddonModDataHelperProvider {
CoreEvents.trigger(ADDON_MOD_DATA_ENTRY_CHANGED, { dataId, entryId, deleted: true }, siteId);
CoreDomUtils.showToast('addon.mod_data.recorddeleted', true, ToastDuration.LONG);
CoreToasts.show({
message: 'addon.mod_data.recorddeleted',
translateMessage: true,
duration: ToastDuration.LONG,
});
modal.dismiss();
} catch {

View File

@ -25,8 +25,6 @@ import { AddonModFeedbackIndexComponent } from './index/index';
CoreSharedModule,
CoreCourseComponentsModule,
],
providers: [
],
exports: [
AddonModFeedbackIndexComponent,
],

View File

@ -19,6 +19,7 @@ import { PopoverController } from '@singletons';
import { CoreEvents } from '@singletons/events';
import { AddonModForum, AddonModForumDiscussion } from '../../services/forum';
import { ADDON_MOD_FORUM_CHANGE_DISCUSSION_EVENT } from '../../constants';
import { CoreToasts } from '@services/toasts';
/**
* This component is meant to display a popover with the discussion options.
@ -74,7 +75,10 @@ export class AddonModForumDiscussionOptionsMenuComponent implements OnInit {
CoreEvents.trigger(ADDON_MOD_FORUM_CHANGE_DISCUSSION_EVENT, data, CoreSites.getCurrentSiteId());
PopoverController.dismiss({ action: 'lock', value: locked });
CoreDomUtils.showToast('addon.mod_forum.lockupdated', true);
CoreToasts.show({
message: 'addon.mod_forum.lockupdated',
translateMessage: true,
});
} catch (error) {
CoreDomUtils.showErrorModal(error);
PopoverController.dismiss();
@ -103,7 +107,10 @@ export class AddonModForumDiscussionOptionsMenuComponent implements OnInit {
CoreEvents.trigger(ADDON_MOD_FORUM_CHANGE_DISCUSSION_EVENT, data, CoreSites.getCurrentSiteId());
PopoverController.dismiss({ action: 'pin', value: pinned });
CoreDomUtils.showToast('addon.mod_forum.pinupdated', true);
CoreToasts.show({
message: 'addon.mod_forum.pinupdated',
translateMessage: true,
});
} catch (error) {
CoreDomUtils.showErrorModal(error);
PopoverController.dismiss();
@ -132,7 +139,10 @@ export class AddonModForumDiscussionOptionsMenuComponent implements OnInit {
CoreEvents.trigger(ADDON_MOD_FORUM_CHANGE_DISCUSSION_EVENT, data, CoreSites.getCurrentSiteId());
PopoverController.dismiss({ action: 'star', value: starred });
CoreDomUtils.showToast('addon.mod_forum.favouriteupdated', true);
CoreToasts.show({
message: 'addon.mod_forum.favouriteupdated',
translateMessage: true,
});
} catch (error) {
CoreDomUtils.showErrorModal(error);
PopoverController.dismiss();

View File

@ -65,6 +65,7 @@ import {
ADDON_MOD_FORUM_SEARCH_PAGE_NAME,
} from '@addons/mod/forum/constants';
import { CoreSearchGlobalSearch } from '@features/search/services/global-search';
import { CoreToasts } from '@services/toasts';
/**
* Component that displays a forum entry page.
*/
@ -554,7 +555,10 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom
try {
if (isNewDiscussion) {
CoreDomUtils.showToast('addon.mod_forum.postaddedsuccess', true);
CoreToasts.show({
message: 'addon.mod_forum.postaddedsuccess',
translateMessage: true,
});
const newDiscGroupId = (data as AddonModForumNewDiscussionData).groupId;

View File

@ -53,6 +53,7 @@ import { AddonModForumSharedPostFormData } from '../../pages/discussion/discussi
import { CoreDom } from '@singletons/dom';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { ADDON_MOD_FORUM_CHANGE_DISCUSSION_EVENT, ADDON_MOD_FORUM_COMPONENT } from '../../constants';
import { CoreToasts } from '@services/toasts';
/**
* Components that shows a discussion post, its attachments and the action buttons allowed (reply, etc.).
@ -167,7 +168,10 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
CoreSites.getCurrentSiteId(),
);
CoreDomUtils.showToast('addon.mod_forum.deletedpost', true);
CoreToasts.show({
message: 'addon.mod_forum.deletedpost',
translateMessage: true,
});
} catch (error) {
CoreDomUtils.showErrorModal(error);
} finally {

View File

@ -59,6 +59,7 @@ import {
ADDON_MOD_FORUM_REPLY_DISCUSSION_EVENT,
} from '../../constants';
import { CoreCourseContentsPage } from '@features/course/pages/contents/contents';
import { CoreToasts } from '@services/toasts';
type SortType = 'flat-newest' | 'flat-oldest' | 'nested';
@ -730,7 +731,10 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
};
CoreEvents.trigger(ADDON_MOD_FORUM_CHANGE_DISCUSSION_EVENT, data, CoreSites.getCurrentSiteId());
CoreDomUtils.showToast('addon.mod_forum.lockupdated', true);
CoreToasts.show({
message: 'addon.mod_forum.lockupdated',
translateMessage: true,
});
} catch (error) {
CoreDomUtils.showErrorModal(error);
} finally {
@ -763,7 +767,10 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
};
CoreEvents.trigger(ADDON_MOD_FORUM_CHANGE_DISCUSSION_EVENT, data, CoreSites.getCurrentSiteId());
CoreDomUtils.showToast('addon.mod_forum.pinupdated', true);
CoreToasts.show({
message: 'addon.mod_forum.pinupdated',
translateMessage: true,
});
} catch (error) {
CoreDomUtils.showErrorModal(error);
} finally {
@ -796,7 +803,10 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
};
CoreEvents.trigger(ADDON_MOD_FORUM_CHANGE_DISCUSSION_EVENT, data, CoreSites.getCurrentSiteId());
CoreDomUtils.showToast('addon.mod_forum.favouriteupdated', true);
CoreToasts.show({
message: 'addon.mod_forum.favouriteupdated',
translateMessage: true,
});
} catch (error) {
CoreDomUtils.showErrorModal(error);
} finally {

View File

@ -29,8 +29,6 @@ import { CoreSearchComponentsModule } from '@features/search/components/componen
CoreCourseComponentsModule,
CoreSearchComponentsModule,
],
providers: [
],
exports: [
AddonModGlossaryIndexComponent,
AddonModGlossaryModePickerPopoverComponent,

View File

@ -26,7 +26,7 @@ import { CoreTag } from '@features/tag/services/tag';
import { FileEntry } from '@awesome-cordova-plugins/file/ngx';
import { CoreNavigator } from '@services/navigator';
import { CoreNetwork } from '@services/network';
import { CoreDomUtils, ToastDuration } from '@services/utils/dom';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreUtils } from '@services/utils/utils';
import { Translate } from '@singletons';
import { CoreEventObserver, CoreEvents } from '@singletons/events';
@ -40,6 +40,7 @@ import { CoreTime } from '@singletons/time';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { ADDON_MOD_GLOSSARY_COMPONENT, ADDON_MOD_GLOSSARY_ENTRY_UPDATED, ADDON_MOD_GLOSSARY_PAGE_NAME } from '../../constants';
import { CoreCourseContentsPage } from '@features/course/pages/contents/contents';
import { CoreToasts, ToastDuration } from '@services/toasts';
/**
* Page that displays a glossary entry.
@ -214,7 +215,11 @@ export class AddonModGlossaryEntryPage implements OnInit, OnDestroy {
await AddonModGlossaryHelper.deleteStoredFiles(glossaryId, concept, timecreated);
}
CoreDomUtils.showToast('addon.mod_glossary.entrydeleted', true, ToastDuration.LONG);
CoreToasts.show({
message: 'addon.mod_glossary.entrydeleted',
translateMessage: true,
duration: ToastDuration.LONG,
});
await this.goBack();
} catch (error) {

View File

@ -28,8 +28,6 @@ import { CoreH5PComponentsModule } from '@features/h5p/components/components.mod
CoreCourseComponentsModule,
CoreH5PComponentsModule,
],
providers: [
],
exports: [
AddonModH5PActivityIndexComponent,
],

View File

@ -18,12 +18,10 @@ import { CoreSharedModule } from '@/core/shared.module';
import { CoreCourseComponentsModule } from '@features/course/components/components.module';
import { AddonModImscpIndexComponent } from './index';
import { AddonModImscpTocComponent } from './toc/toc';
@NgModule({
declarations: [
AddonModImscpIndexComponent,
AddonModImscpTocComponent,
],
imports: [
CoreSharedModule,
@ -31,7 +29,6 @@ import { AddonModImscpTocComponent } from './toc/toc';
],
exports: [
AddonModImscpIndexComponent,
AddonModImscpTocComponent,
],
})
export class AddonModImscpComponentsModule {}

View File

@ -15,6 +15,7 @@
import { Component, Input } from '@angular/core';
import { ModalController } from '@singletons';
import { AddonModImscpTocItem } from '../../services/imscp';
import { CoreSharedModule } from '@/core/shared.module';
/**
* Modal to display the TOC of a imscp.
@ -22,6 +23,10 @@ import { AddonModImscpTocItem } from '../../services/imscp';
@Component({
selector: 'addon-mod-imscp-toc',
templateUrl: 'toc.html',
standalone: true,
imports: [
CoreSharedModule,
],
})
export class AddonModImscpTocComponent {

View File

@ -26,8 +26,8 @@ import { CoreDomUtils } from '@services/utils/dom';
import { CoreTextUtils } from '@services/utils/text';
import { CoreUtils } from '@services/utils/utils';
import { Translate } from '@singletons';
import { AddonModImscpTocComponent } from '../../components/toc/toc';
import { AddonModImscp, AddonModImscpImscp, AddonModImscpTocItem } from '../../services/imscp';
import { CoreModals } from '@services/modals';
/**
* Page that displays a IMSCP content.
@ -272,8 +272,10 @@ export class AddonModImscpViewPage implements OnInit {
* Show the TOC.
*/
async showToc(): Promise<void> {
const { AddonModImscpTocComponent } = await import('../../components/toc/toc');
// Create the toc modal.
const itemHref = await CoreDomUtils.openSideModal<string>({
const itemHref = await CoreModals.openSideModal<string>({
component: AddonModImscpTocComponent,
componentProps: {
items: this.items,

View File

@ -17,22 +17,17 @@ import { NgModule } from '@angular/core';
import { CoreSharedModule } from '@/core/shared.module';
import { CoreCourseComponentsModule } from '@features/course/components/components.module';
import { AddonModLessonIndexComponent } from './index/index';
import { AddonModLessonMenuModalPage } from './menu-modal/menu-modal';
@NgModule({
declarations: [
AddonModLessonIndexComponent,
AddonModLessonMenuModalPage,
],
imports: [
CoreSharedModule,
CoreCourseComponentsModule,
],
providers: [
],
exports: [
AddonModLessonIndexComponent,
AddonModLessonMenuModalPage,
],
})
export class AddonModLessonComponentsModule {}

View File

@ -16,6 +16,7 @@ import { Component, Input } from '@angular/core';
import { ModalController } from '@singletons';
import { AddonModLessonPlayerPage } from '../../pages/player/player';
import { CoreSharedModule } from '@/core/shared.module';
/**
* Modal that renders the lesson menu and media file.
@ -23,6 +24,10 @@ import { AddonModLessonPlayerPage } from '../../pages/player/player';
@Component({
selector: 'page-addon-mod-lesson-menu-modal',
templateUrl: 'menu-modal.html',
standalone: true,
imports: [
CoreSharedModule,
],
})
export class AddonModLessonMenuModalPage {

View File

@ -28,7 +28,6 @@ import { CoreUtils } from '@services/utils/utils';
import { CoreWSExternalFile } from '@services/ws';
import { ModalController, Translate } from '@singletons';
import { CoreEvents } from '@singletons/events';
import { AddonModLessonMenuModalPage } from '../../components/menu-modal/menu-modal';
import {
AddonModLesson,
AddonModLessonEOLPageDataEntry,
@ -55,6 +54,7 @@ import { AddonModLessonSync } from '../../services/lesson-sync';
import { CoreFormFields, CoreForms } from '@singletons/form';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { ADDON_MOD_LESSON_COMPONENT, AddonModLessonJumpTo } from '../../constants';
import { CoreModals } from '@services/modals';
/**
* Page that allows attempting and reviewing a lesson.
@ -829,7 +829,9 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
async showMenu(): Promise<void> {
this.menuShown = true;
await CoreDomUtils.openSideModal({
const { AddonModLessonMenuModalPage } = await import('../../components/menu-modal/menu-modal');
await CoreModals.openSideModal({
component: AddonModLessonMenuModalPage,
componentProps: {
pageInstance: this,

View File

@ -21,7 +21,7 @@ import { CoreFilepool } from '@services/filepool';
import { CoreGroups } from '@services/groups';
import { CoreFileSizeSum, CorePluginFileDelegate } from '@services/plugin-file-delegate';
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreModals } from '@services/modals';
import { CoreUtils } from '@services/utils/utils';
import { CoreWSFile } from '@services/ws';
import { makeSingleton, Translate } from '@singletons';
@ -136,7 +136,7 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref
}
// Create and show the modal.
const response = await CoreDomUtils.promptPassword({
const response = await CoreModals.promptPassword({
title: 'addon.mod_lesson.enterpassword',
placeholder: 'core.login.password',
submit: 'addon.mod_lesson.continue',

View File

@ -18,7 +18,6 @@ import { CoreSharedModule } from '@/core/shared.module';
import { CoreCourseComponentsModule } from '@features/course/components/components.module';
import { AddonModQuizConnectionErrorComponent } from './connection-error/connection-error';
import { AddonModQuizIndexComponent } from './index/index';
import { AddonModQuizNavigationModalComponent } from './navigation-modal/navigation-modal';
import { AddonModQuizAttemptInfoComponent } from './attempt-info/attempt-info';
import { AddonModQuizAttemptStateComponent } from './attempt-state/attempt-state';
import { AddonModQuizQuestionCardComponent } from './question-card/question-card';
@ -29,7 +28,6 @@ import { AddonModQuizQuestionCardComponent } from './question-card/question-card
AddonModQuizAttemptStateComponent,
AddonModQuizIndexComponent,
AddonModQuizConnectionErrorComponent,
AddonModQuizNavigationModalComponent,
AddonModQuizQuestionCardComponent,
],
imports: [
@ -41,7 +39,6 @@ import { AddonModQuizQuestionCardComponent } from './question-card/question-card
AddonModQuizAttemptStateComponent,
AddonModQuizIndexComponent,
AddonModQuizConnectionErrorComponent,
AddonModQuizNavigationModalComponent,
AddonModQuizQuestionCardComponent,
],

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { CoreSharedModule } from '@/core/shared.module';
import { Component, Input } from '@angular/core';
import { CoreQuestionQuestionParsed } from '@features/question/services/question';
@ -23,6 +24,10 @@ import { ModalController } from '@singletons';
@Component({
selector: 'addon-mod-quiz-navigation-modal',
templateUrl: 'navigation-modal.html',
standalone: true,
imports: [
CoreSharedModule,
],
})
export class AddonModQuizNavigationModalComponent {

View File

@ -33,7 +33,6 @@ import { ModalController, Translate } from '@singletons';
import { CoreEvents } from '@singletons/events';
import { AddonModQuizAutoSave } from '../../classes/auto-save';
import {
AddonModQuizNavigationModalComponent,
AddonModQuizNavigationModalReturn,
AddonModQuizNavigationQuestion,
} from '../../components/navigation-modal/navigation-modal';
@ -55,6 +54,7 @@ import { CoreWSError } from '@classes/errors/wserror';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { ADDON_MOD_QUIZ_ATTEMPT_FINISHED_EVENT, AddonModQuizAttemptStates, ADDON_MOD_QUIZ_COMPONENT } from '../../constants';
import { CoreWait } from '@singletons/wait';
import { CoreModals } from '@services/modals';
/**
* Page that allows attempting a quiz.
@ -727,8 +727,10 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
this.reloadNavigation = false;
}
const { AddonModQuizNavigationModalComponent } = await import('../../components/navigation-modal/navigation-modal');
// Create the navigation modal.
const modalData = await CoreDomUtils.openSideModal<AddonModQuizNavigationModalReturn>({
const modalData = await CoreModals.openSideModal<AddonModQuizNavigationModalReturn>({
component: AddonModQuizNavigationModalComponent,
componentProps: {
navigation: this.navigation,

View File

@ -22,7 +22,6 @@ import { CoreUtils } from '@services/utils/utils';
import { CoreDom } from '@singletons/dom';
import { CoreTime } from '@singletons/time';
import {
AddonModQuizNavigationModalComponent,
AddonModQuizNavigationModalReturn,
AddonModQuizNavigationQuestion,
} from '../../components/navigation-modal/navigation-modal';
@ -36,6 +35,7 @@ import {
import { AddonModQuizHelper } from '../../services/quiz-helper';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { ADDON_MOD_QUIZ_COMPONENT } from '../../constants';
import { CoreModals } from '@services/modals';
/**
* Page that allows reviewing a quiz attempt.
@ -265,8 +265,10 @@ export class AddonModQuizReviewPage implements OnInit {
}
async openNavigation(): Promise<void> {
const { AddonModQuizNavigationModalComponent } = await import('../../components/navigation-modal/navigation-modal');
// Create the navigation modal.
const modalData = await CoreDomUtils.openSideModal<AddonModQuizNavigationModalReturn>({
const modalData = await CoreModals.openSideModal<AddonModQuizNavigationModalReturn>({
component: AddonModQuizNavigationModalComponent,
componentProps: {
navigation: this.navigation,

View File

@ -474,7 +474,6 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet
* @param accessInfo Quiz access info.
* @param attempt Attempt.
* @param modOptions Other options.
* @param siteId Site ID.
* @returns Promise resolved when done.
*/
protected async prefetchAttemptReview(

View File

@ -40,6 +40,7 @@ import {
import { QuestionDisplayOptionsMarks } from '@features/question/constants';
import { CoreGroups } from '@services/groups';
import { CoreTimeUtils } from '@services/utils/time';
import { CoreModals } from '@services/modals';
/**
* Helper service that provides some features for quiz.
@ -272,7 +273,7 @@ export class AddonModQuizHelperProvider {
await import('@addons/mod/quiz/components/preflight-modal/preflight-modal');
// Create and show the modal.
const modalData = await CoreDomUtils.openModal<Record<string, string>>({
const modalData = await CoreModals.openModal<Record<string, string>>({
component: AddonModQuizPreflightModalComponent,
componentProps: {
title: options.title,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

@ -27,8 +27,6 @@ import { AddonModResourceIndexComponent } from './index/index';
CoreSharedModule,
CoreCourseComponentsModule,
],
providers: [
],
exports: [
AddonModResourceIndexComponent,
],

View File

@ -16,22 +16,17 @@ import { NgModule } from '@angular/core';
import { AddonModScormIndexComponent } from './index/index';
import { CoreSharedModule } from '@/core/shared.module';
import { CoreCourseComponentsModule } from '@features/course/components/components.module';
import { AddonModScormTocComponent } from './toc/toc';
@NgModule({
declarations: [
AddonModScormIndexComponent,
AddonModScormTocComponent,
],
imports: [
CoreSharedModule,
CoreCourseComponentsModule,
],
providers: [
],
exports: [
AddonModScormIndexComponent,
AddonModScormTocComponent,
],
})
export class AddonModScormComponentsModule {}

View File

@ -17,6 +17,7 @@ import { ModalController } from '@singletons';
import { AddonModScormGetScormAccessInformationWSResponse } from '../../services/scorm';
import { AddonModScormTOCScoWithIcon } from '../../services/scorm-helper';
import { AddonModScormMode } from '../../constants';
import { CoreSharedModule } from '@/core/shared.module';
/**
* Modal to display the TOC of a SCORM.
@ -24,6 +25,10 @@ import { AddonModScormMode } from '../../constants';
@Component({
selector: 'addon-mod-scorm-toc',
templateUrl: 'toc.html',
standalone: true,
imports: [
CoreSharedModule,
],
})
export class AddonModScormTocComponent implements OnInit {

View File

@ -23,7 +23,6 @@ import { CoreTimeUtils } from '@services/utils/time';
import { CoreUtils } from '@services/utils/utils';
import { CoreEventObserver, CoreEvents } from '@singletons/events';
import { AddonModScormDataModel12 } from '../../classes/data-model-12';
import { AddonModScormTocComponent } from '../../components/toc/toc';
import {
AddonModScorm,
AddonModScormAttemptCountResult,
@ -44,6 +43,7 @@ import {
ADDON_MOD_SCORM_UPDATE_TOC_EVENT,
} from '../../constants';
import { CoreWait } from '@singletons/wait';
import { CoreModals } from '@services/modals';
/**
* Page that allows playing a SCORM.
@ -513,7 +513,9 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy {
* Show the TOC.
*/
async openToc(): Promise<void> {
const modalData = await CoreDomUtils.openSideModal<AddonModScormScoWithData>({
const { AddonModScormTocComponent } = await import('../../components/toc/toc');
const modalData = await CoreModals.openSideModal<AddonModScormScoWithData>({
component: AddonModScormTocComponent,
componentProps: {
toc: this.toc,

View File

@ -17,14 +17,10 @@ import { NgModule } from '@angular/core';
import { CoreCourseComponentsModule } from '@features/course/components/components.module';
import { CoreTagComponentsModule } from '@features/tag/components/components.module';
import { AddonModWikiIndexComponent } from './index/index';
import { AddonModWikiMapModalComponent } from './map/map';
import { AddonModWikiSubwikiPickerComponent } from './subwiki-picker/subwiki-picker';
@NgModule({
declarations: [
AddonModWikiIndexComponent,
AddonModWikiSubwikiPickerComponent,
AddonModWikiMapModalComponent,
],
imports: [
CoreSharedModule,
@ -33,8 +29,6 @@ import { AddonModWikiSubwikiPickerComponent } from './subwiki-picker/subwiki-pic
],
exports: [
AddonModWikiIndexComponent,
AddonModWikiSubwikiPickerComponent,
AddonModWikiMapModalComponent,
],
})
export class AddonModWikiComponentsModule {}

View File

@ -58,6 +58,7 @@ import {
ADDON_MOD_WIKI_PAGE_CREATED_EVENT,
ADDON_MOD_WIKI_PAGE_NAME,
} from '../../constants';
import { CoreModals } from '@services/modals';
/**
* Component that displays a wiki entry page.
@ -663,9 +664,10 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp
* Show the map.
*/
async openMap(): Promise<void> {
// Create the toc modal.
const { AddonModWikiMapModalComponent } = await import('../map/map');
const modalData = await CoreDomUtils.openSideModal<AddonModWikiMapModalReturn>({
// Create the map modal.
const modalData = await CoreModals.openSideModal<AddonModWikiMapModalReturn>({
component: AddonModWikiMapModalComponent,
componentProps: {
pages: this.subwikiPages,
@ -884,6 +886,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp
*/
async showSubwikiPicker(event: MouseEvent): Promise<void> {
const { AddonModWikiSubwikiPickerComponent } = await import('../subwiki-picker/subwiki-picker');
const subwiki = await CoreDomUtils.openPopover<AddonModWikiSubwiki>({
component: AddonModWikiSubwikiPickerComponent,
componentProps: {

View File

@ -17,6 +17,7 @@ import { ModalController } from '@singletons';
import { AddonModWikiPageDBRecord } from '../../services/database/wiki';
import { AddonModWikiSubwikiPage, AddonModWikiWiki } from '../../services/wiki';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreSharedModule } from '@/core/shared.module';
/**
* Modal to display the map of a Wiki.
@ -24,6 +25,10 @@ import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
@Component({
selector: 'page-addon-mod-wiki-map',
templateUrl: 'map.html',
standalone: true,
imports: [
CoreSharedModule,
],
})
export class AddonModWikiMapModalComponent implements OnInit {

View File

@ -15,6 +15,7 @@
import { Component, Input } from '@angular/core';
import { PopoverController } from '@singletons';
import { AddonModWikiSubwiki, AddonModWikiSubwikiListGrouping } from '../../services/wiki';
import { CoreSharedModule } from '@/core/shared.module';
/**
* Component to display the a list of subwikis in a wiki.
@ -22,6 +23,10 @@ import { AddonModWikiSubwiki, AddonModWikiSubwikiListGrouping } from '../../serv
@Component({
selector: 'addon-mod-wiki-subwiki-picker',
templateUrl: 'addon-mod-wiki-subwiki-picker.html',
standalone: true,
imports: [
CoreSharedModule,
],
})
export class AddonModWikiSubwikiPickerComponent {

View File

@ -21,7 +21,7 @@ import { IonContent } from '@ionic/angular';
import { CoreGroupInfo, CoreGroups } from '@services/groups';
import { CoreNavigator } from '@services/navigator';
import { CorePlatform } from '@services/platform';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreModals } from '@services/modals';
import { CoreUtils } from '@services/utils/utils';
import { CoreEventObserver, CoreEvents } from '@singletons/events';
import { Subscription } from 'rxjs';
@ -400,7 +400,7 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity
const { AddonModWorkshopPhaseInfoModalComponent } =
await import('@addons/mod/workshop/components/phase-modal/phase-modal');
const modalData = await CoreDomUtils.openModal<boolean>({
const modalData = await CoreModals.openModal<boolean>({
component: AddonModWorkshopPhaseInfoModalComponent,
componentProps: {
phases: CoreUtils.objectToArray(this.phases),

View File

@ -15,11 +15,12 @@
import { AddonNotes, AddonNotesPublishState } from '@addons/notes/services/notes';
import { Component, ViewChild, ElementRef, Input } from '@angular/core';
import { CoreSites } from '@services/sites';
import { CoreDomUtils, ToastDuration } from '@services/utils/dom';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreForms } from '@singletons/form';
import { ModalController } from '@singletons';
import { CoreKeyboard } from '@singletons/keyboard';
import { CoreSharedModule } from '@/core/shared.module';
import { CoreToasts, ToastDuration } from '@services/toasts';
/**
* Component that displays a text area for composing a note.
@ -62,7 +63,11 @@ export class AddonNotesAddComponent {
CoreForms.triggerFormSubmittedEvent(this.formElement, sent, CoreSites.getCurrentSiteId());
ModalController.dismiss(<AddonNotesAddModalReturn>{ type: this.type, sent: true }).finally(() => {
CoreDomUtils.showToast(sent ? 'addon.notes.eventnotecreated' : 'core.datastoredoffline', true, ToastDuration.LONG);
CoreToasts.show({
message: sent ? 'addon.notes.eventnotecreated' : 'core.datastoredoffline',
translateMessage: true,
duration: ToastDuration.LONG,
});
});
} catch (error){
CoreDomUtils.showErrorModal(error);

View File

@ -24,13 +24,15 @@ import { IonContent } from '@ionic/angular';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreNavigator } from '@services/navigator';
import { CoreSites } from '@services/sites';
import { CoreDomUtils, ToastDuration } from '@services/utils/dom';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreTextUtils } from '@services/utils/text';
import { CoreUrl } from '@singletons/url';
import { CoreUtils } from '@services/utils/utils';
import { Translate } from '@singletons';
import { CoreEventObserver, CoreEvents } from '@singletons/events';
import { CoreTime } from '@singletons/time';
import { CoreToasts, ToastDuration } from '@services/toasts';
import { CoreModals } from '@services/modals';
/**
* Page that displays a list of notes.
@ -196,7 +198,7 @@ export class AddonNotesListPage implements OnInit, OnDestroy {
const { AddonNotesAddComponent } = await import('@addons/notes/components/add/add-modal');
const modalData = await CoreDomUtils.openModal<AddonNotesAddModalReturn>({
const modalData = await CoreModals.openModal<AddonNotesAddModalReturn>({
component: AddonNotesAddComponent,
componentProps: {
userId: this.userId,
@ -240,7 +242,11 @@ export class AddonNotesListPage implements OnInit, OnDestroy {
this.refreshNotes(false);
CoreDomUtils.showToast('addon.notes.eventnotedeleted', true, ToastDuration.LONG);
CoreToasts.show({
message: 'addon.notes.eventnotedeleted',
translateMessage: true,
duration: ToastDuration.LONG,
});
} catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Delete note failed.');

View File

@ -20,6 +20,7 @@ import { CoreFileUploaderHelper } from '@features/fileuploader/services/fileuplo
import { AddonPrivateFiles, AddonPrivateFilesGetUserInfoWSResult } from './privatefiles';
import { CoreError } from '@classes/errors/error';
import { makeSingleton, Translate } from '@singletons';
import { CoreToasts } from '@services/toasts';
/**
* Service that provides some helper functions regarding private and site files.
@ -64,7 +65,11 @@ export class AddonPrivateFilesHelperProvider {
try {
await AddonPrivateFiles.moveFromDraftToPrivate(result.itemid);
CoreDomUtils.showToast('core.fileuploader.fileuploaded', true, undefined, 'core-toast-success');
CoreToasts.show({
message: 'core.fileuploader.fileuploaded',
translateMessage: true,
cssClass: 'core-toast-success',
});
} finally {
modal.dismiss();
}

View File

@ -13,7 +13,7 @@
// limitations under the License.
import { CoreDomUtils } from '@services/utils/dom';
import { CoreTextUtils } from '@services/utils/text';
import { CoreText } from '@singletons/text';
import { CoreCoordinates, CoreDom } from '@singletons/dom';
import { CoreEventObserver } from '@singletons/events';
import { CoreLogger } from '@singletons/logger';
@ -267,7 +267,7 @@ export class AddonQtypeDdMarkerQuestion {
}
// Check that a function to draw this shape exists.
const drawFunc = 'drawShape' + CoreTextUtils.ucFirst(shape);
const drawFunc = 'drawShape' + CoreText.capitalize(shape);
if (!(this[drawFunc] instanceof Function)) {
return;
}

View File

@ -20,6 +20,7 @@ import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { makeSingleton, Translate } from '@singletons';
import { AddonReportInsights } from '../insights';
import { CoreToasts } from '@services/toasts';
// Bulk actions supported, along with the related lang string.
const BULK_ACTIONS = {
@ -64,12 +65,17 @@ export class AddonReportInsightsActionLinkHandlerService extends CoreContentLink
if (BULK_ACTIONS[params.action]) {
// Done, display a toast.
CoreDomUtils.showToast(Translate.instant('addon.report_insights.actionsaved', {
$a: Translate.instant(BULK_ACTIONS[params.action]),
}));
CoreToasts.show({
message: Translate.instant('addon.report_insights.actionsaved', {
$a: Translate.instant(BULK_ACTIONS[params.action]),
}),
});
} else if (!params.forwardurl) {
// Forward URL not defined, display a toast.
CoreDomUtils.showToast('core.success', true);
CoreToasts.show({
message: 'core.success',
translateMessage: true,
});
} else {
// Try to open the link in the app.
const forwardUrl = decodeURIComponent(params.forwardurl);

View File

@ -13,7 +13,7 @@
// limitations under the License.
import { CoreNavigator } from '@services/navigator';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreModals } from '@services/modals';
import { Subject } from 'rxjs';
import { AsyncDirective } from './async-directive';
import { PageLoadWatcher } from './page-load-watcher';
@ -131,7 +131,7 @@ export class PageLoadsManager {
const { CoreRefreshButtonModalComponent }
= await import('@components/refresh-button-modal/refresh-button-modal');
await CoreDomUtils.openModal<boolean>({
await CoreModals.openModal<boolean>({
component: CoreRefreshButtonModalComponent,
cssClass: 'core-modal-no-background core-modal-fullscreen',
closeOnNavigate: true,

View File

@ -21,7 +21,7 @@ import {
CoreWSPreSetsSplitRequest,
CoreWSTypeExpected,
} from '@services/ws';
import { CoreDomUtils, ToastDuration } from '@services/utils/dom';
import { CoreToasts, ToastDuration } from '@services/toasts';
import { CoreTextUtils } from '@services/utils/text';
import { CoreUtils } from '@services/utils/utils';
import { CoreConstants } from '@/core/constants';
@ -420,7 +420,11 @@ export class CoreAuthenticatedSite extends CoreUnauthenticatedSite {
if (wsPreSets.cleanUnicode && CoreTextUtils.hasUnicodeData(data)) {
// Data will be cleaned, notify the user.
CoreDomUtils.showToast('core.unicodenotsupported', true, ToastDuration.LONG);
CoreToasts.show({
message: 'core.unicodenotsupported',
translateMessage: true,
duration: ToastDuration.LONG,
});
} else {
// No need to clean data in this call.
wsPreSets.cleanUnicode = false;

View File

@ -15,7 +15,7 @@
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Translate } from '@singletons';
import { ModalOptions } from '@ionic/core';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreModals } from '@services/modals';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
/**
@ -123,7 +123,7 @@ export class CoreComboboxComponent implements ControlValueAccessor {
this.modalOptions.id = this.listboxId;
}
const data = await CoreDomUtils.openModal(this.modalOptions);
const data = await CoreModals.openModal(this.modalOptions);
this.expanded = false;
if (data) {

View File

@ -34,6 +34,7 @@ export async function getCoreServices(): Promise<Type<unknown>[]> {
const { CoreCustomURLSchemesProvider } = await import('@services/urlschemes');
const { CoreDbProvider } = await import('@services/db');
const { CoreDomUtilsProvider } = await import('@services/utils/dom');
const { CoreToastsService } = await import('@services/toasts');
const { CoreFileHelperProvider } = await import('@services/file-helper');
const { CoreFilepoolProvider } = await import('@services/filepool');
const { CoreFileProvider } = await import('@services/file');
@ -82,6 +83,7 @@ export async function getCoreServices(): Promise<Type<unknown>[]> {
CoreSyncProvider,
CoreTextUtilsProvider,
CoreTimeUtilsProvider,
CoreToastsService,
CoreUpdateManagerProvider,
CoreUrlUtilsProvider,
CoreUtilsProvider,

View File

@ -17,7 +17,6 @@ import { CoreBlockComponent } from './block/block';
import { CoreBlockOnlyTitleComponent } from './only-title-block/only-title-block';
import { CoreBlockPreRenderedComponent } from './pre-rendered-block/pre-rendered-block';
import { CoreSharedModule } from '@/core/shared.module';
import { CoreBlockSideBlocksComponent } from './side-blocks/side-blocks';
import { CoreBlockSideBlocksButtonComponent } from './side-blocks-button/side-blocks-button';
import { CoreBlockSideBlocksTourComponent } from './side-blocks-tour/side-blocks-tour';
@ -26,7 +25,6 @@ import { CoreBlockSideBlocksTourComponent } from './side-blocks-tour/side-blocks
CoreBlockComponent,
CoreBlockOnlyTitleComponent,
CoreBlockPreRenderedComponent,
CoreBlockSideBlocksComponent,
CoreBlockSideBlocksButtonComponent,
CoreBlockSideBlocksTourComponent,
],
@ -37,7 +35,6 @@ import { CoreBlockSideBlocksTourComponent } from './side-blocks-tour/side-blocks
CoreBlockComponent,
CoreBlockOnlyTitleComponent,
CoreBlockPreRenderedComponent,
CoreBlockSideBlocksComponent,
CoreBlockSideBlocksButtonComponent,
CoreBlockSideBlocksTourComponent,
],

View File

@ -16,10 +16,9 @@ import { Component, ElementRef, Input, OnDestroy, OnInit } from '@angular/core';
import { CoreCancellablePromise } from '@classes/cancellable-promise';
import { CoreUserTourDirectiveOptions } from '@directives/user-tour';
import { CoreUserToursAlignment, CoreUserToursSide } from '@features/usertours/services/user-tours';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreModals } from '@services/modals';
import { CoreDom } from '@singletons/dom';
import { CoreBlockSideBlocksTourComponent } from '../side-blocks-tour/side-blocks-tour';
import { CoreBlockSideBlocksComponent } from '../side-blocks/side-blocks';
import { ContextLevel } from '@/core/constants';
/**
@ -67,8 +66,10 @@ export class CoreBlockSideBlocksButtonComponent implements OnInit, OnDestroy {
/**
* Open side blocks.
*/
openBlocks(): void {
CoreDomUtils.openSideModal({
async openBlocks(): Promise<void> {
const { CoreBlockSideBlocksComponent } = await import('@features/block/components/side-blocks/side-blocks');
CoreModals.openSideModal({
component: CoreBlockSideBlocksComponent,
componentProps: {
contextLevel: this.contextLevel,

View File

@ -24,6 +24,8 @@ import { CoreTextUtils } from '@services/utils/text';
import { CoreDom } from '@singletons/dom';
import { ContextLevel } from '@/core/constants';
import { CoreWait } from '@singletons/wait';
import { CoreSharedModule } from '@/core/shared.module';
import { CoreBlockComponentsModule } from '../components.module';
/**
* Component that displays the list of side blocks.
@ -31,7 +33,12 @@ import { CoreWait } from '@singletons/wait';
@Component({
selector: 'core-block-side-blocks',
templateUrl: 'side-blocks.html',
styleUrls: ['side-blocks.scss'],
styleUrl: 'side-blocks.scss',
standalone: true,
imports: [
CoreSharedModule,
CoreBlockComponentsModule,
],
})
export class CoreBlockSideBlocksComponent implements OnInit {

View File

@ -31,7 +31,7 @@ import { ContextLevel, CoreConstants } from '@/core/constants';
import { CoreNavigator } from '@services/navigator';
import { NgZone, Translate } from '@singletons';
import { CoreUtils } from '@services/utils/utils';
import { CoreDomUtils, ToastDuration } from '@services/utils/dom';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreUser } from '@features/user/services/user';
import { CoreTextUtils } from '@services/utils/text';
import { CoreError } from '@classes/errors/error';
@ -43,6 +43,7 @@ import moment from 'moment-timezone';
import { Subscription } from 'rxjs';
import { CoreAnimations } from '@components/animations';
import { CoreKeyboard } from '@singletons/keyboard';
import { CoreToasts, ToastDuration } from '@services/toasts';
/**
* Page that displays comments.
@ -323,11 +324,11 @@ export class CoreCommentsViewerPage implements OnInit, OnDestroy {
this.area,
);
CoreDomUtils.showToast(
commentsResponse ? 'core.comments.eventcommentcreated' : 'core.datastoredoffline',
true,
ToastDuration.LONG,
);
CoreToasts.show({
message: commentsResponse ? 'core.comments.eventcommentcreated' : 'core.datastoredoffline',
translateMessage: true,
duration: ToastDuration.LONG,
});
if (commentsResponse) {
this.invalidateComments();
@ -426,7 +427,11 @@ export class CoreCommentsViewerPage implements OnInit, OnDestroy {
this.invalidateComments();
CoreDomUtils.showToast('core.comments.eventcommentdeleted', true, ToastDuration.LONG);
CoreToasts.show({
message: 'core.comments.eventcommentdeleted',
translateMessage: true,
duration: ToastDuration.LONG,
});
} catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Delete comment failed.');
}

View File

@ -20,6 +20,7 @@ import { CoreSite } from '@classes/sites/site';
import { makeSingleton, Translate } from '@singletons';
import { CoreNavigator } from '@services/navigator';
import { CoreCustomURLSchemes } from '@services/urlschemes';
import { CoreModals } from '@services/modals';
/**
* Service that provides some features regarding content links.
@ -98,7 +99,7 @@ export class CoreContentLinksHelperProvider {
const { CoreContentLinksChooseSiteModalComponent }
= await import('@features/contentlinks/components/choose-site-modal/choose-site-modal');
await CoreDomUtils.openModal({
await CoreModals.openModal({
component: CoreContentLinksChooseSiteModalComponent,
componentProps: {
url: url,

View File

@ -24,7 +24,7 @@ import { CoreUtils } from '@services/utils/utils';
import { Translate } from '@singletons';
import { CoreEventObserver, CoreEvents } from '@singletons/events';
import { CoreLogger } from '@singletons/logger';
import { CoreCourseModuleSummaryComponent, CoreCourseModuleSummaryResult } from '../components/module-summary/module-summary';
import { CoreCourseModuleSummaryResult } from '../components/module-summary/module-summary';
import { CoreCourseContentsPage } from '../pages/contents/contents';
import { CoreCourse } from '../services/course';
import { CoreCourseHelper, CoreCourseModuleData } from '../services/course-helper';
@ -33,6 +33,8 @@ import { CoreCourseModulePrefetchDelegate } from '../services/module-prefetch-de
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreUrl } from '@singletons/url';
import { CoreTime } from '@singletons/time';
import { CoreText } from '@singletons/text';
import { CoreModals } from '@services/modals';
/**
* Result of a resource download.
@ -232,7 +234,7 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy,
const lastDownloaded =
await CoreCourseHelper.getModulePackageLastDownloaded(this.module, this.component);
this.downloadTimeReadable = CoreTextUtils.ucFirst(lastDownloaded.downloadTimeReadable);
this.downloadTimeReadable = CoreText.capitalize(lastDownloaded.downloadTimeReadable);
}
/**
@ -423,7 +425,9 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy,
return;
}
const data = await CoreDomUtils.openSideModal<CoreCourseModuleSummaryResult>({
const { CoreCourseModuleSummaryComponent } = await import('@features/course/components/module-summary/module-summary');
const data = await CoreModals.openSideModal<CoreCourseModuleSummaryResult>({
component: CoreCourseModuleSummaryComponent,
componentProps: {
moduleId: this.module.id,

View File

@ -24,7 +24,6 @@ import { CoreCourseUnsupportedModuleComponent } from './unsupported-module/unsup
import { CoreCourseModuleCompletionLegacyComponent } from './module-completion-legacy/module-completion-legacy';
import { CoreCourseModuleInfoComponent } from './module-info/module-info';
import { CoreCourseModuleNavigationComponent } from './module-navigation/module-navigation';
import { CoreCourseModuleSummaryComponent } from './module-summary/module-summary';
import { CoreCourseCourseIndexTourComponent } from './course-index-tour/course-index-tour';
import { CoreRemindersComponentsModule } from '@features/reminders/components/components.module';
import { CoreCourseModuleCompletionDetailsComponent } from './module-completion-details/module-completion-details';
@ -40,7 +39,6 @@ import { CoreCourseModuleCompletionDetailsComponent } from './module-completion-
CoreCourseTagAreaComponent,
CoreCourseUnsupportedModuleComponent,
CoreCourseModuleNavigationComponent,
CoreCourseModuleSummaryComponent,
CoreCourseModuleCompletionDetailsComponent,
],
imports: [
@ -58,7 +56,6 @@ import { CoreCourseModuleCompletionDetailsComponent } from './module-completion-
CoreCourseTagAreaComponent,
CoreCourseUnsupportedModuleComponent,
CoreCourseModuleNavigationComponent,
CoreCourseModuleSummaryComponent,
CoreCourseModuleCompletionDetailsComponent,
],
})

View File

@ -51,8 +51,8 @@ import { CoreCourseCourseIndexTourComponent } from '../course-index-tour/course-
import { CoreDom } from '@singletons/dom';
import { CoreUserTourDirectiveOptions } from '@directives/user-tour';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
import { CoreBlockSideBlocksComponent } from '@features/block/components/side-blocks/side-blocks';
import { ContextLevel } from '@/core/constants';
import { CoreModals } from '@services/modals';
/**
* Component to display course contents using a certain format. If the format isn't found, use default one.
@ -316,7 +316,9 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy {
this.sectionChanged(section);
}
} else if (this.initialBlockInstanceId && this.displayBlocks && this.hasBlocks) {
CoreDomUtils.openSideModal({
const { CoreBlockSideBlocksComponent } = await import('@features/block/components/side-blocks/side-blocks');
CoreModals.openSideModal({
component: CoreBlockSideBlocksComponent,
componentProps: {
contextLevel: ContextLevel.COURSE,
@ -431,7 +433,7 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy {
const { CoreCourseCourseIndexComponent } = await import('@features/course/components/course-index/course-index');
const data = await CoreDomUtils.openModal<CoreCourseIndexSectionWithModule>({
const data = await CoreModals.openModal<CoreCourseIndexSectionWithModule>({
component: CoreCourseCourseIndexComponent,
initialBreakpoint: 1,
breakpoints: [0, 1],

View File

@ -28,11 +28,12 @@ import { CoreFilepool } from '@services/filepool';
import { CoreNavigator } from '@services/navigator';
import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreTextUtils } from '@services/utils/text';
import { CoreText } from '@singletons/text';
import { CoreUtils } from '@services/utils/utils';
import { ModalController, NgZone } from '@singletons';
import { CoreEventObserver, CoreEvents } from '@singletons/events';
import { Subscription } from 'rxjs';
import { CoreSharedModule } from '@/core/shared.module';
/**
* Component to display a module summary modal.
@ -40,7 +41,11 @@ import { Subscription } from 'rxjs';
@Component({
selector: 'core-course-module-summary',
templateUrl: 'module-summary.html',
styleUrls: ['module-summary.scss'],
styleUrl: 'module-summary.scss',
standalone: true,
imports: [
CoreSharedModule,
],
})
export class CoreCourseModuleSummaryComponent implements OnInit, OnDestroy {
@ -222,7 +227,7 @@ export class CoreCourseModuleSummaryComponent implements OnInit, OnDestroy {
if (this.canPrefetch) {
if (moduleInfo.downloadTime && moduleInfo.downloadTime > 0) {
this.downloadTimeReadable = CoreTextUtils.ucFirst(moduleInfo.downloadTimeReadable);
this.downloadTimeReadable = CoreText.capitalize(moduleInfo.downloadTimeReadable);
}
this.prefetchLoading = moduleInfo.status === DownloadStatus.DOWNLOADING;
this.prefetchDisabled = moduleInfo.status === DownloadStatus.DOWNLOADED;

View File

@ -13,13 +13,11 @@
// limitations under the License.
import { Component, OnInit } from '@angular/core';
import {
CoreCourseModuleSummaryResult,
CoreCourseModuleSummaryComponent,
} from '@features/course/components/module-summary/module-summary';
import { CoreCourseModuleSummaryResult } from '@features/course/components/module-summary/module-summary';
import { CoreCourse } from '@features/course/services/course';
import { CoreCourseHelper, CoreCourseModuleData, CoreCourseSection } from '@features/course/services/course-helper';
import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate';
import { CoreModals } from '@services/modals';
import { CoreNavigator } from '@services/navigator';
import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
@ -106,7 +104,9 @@ export class CoreCourseModulePreviewPage implements OnInit {
return;
}
const data = await CoreDomUtils.openSideModal<CoreCourseModuleSummaryResult>({
const { CoreCourseModuleSummaryComponent } = await import('@features/course/components/module-summary/module-summary');
const data = await CoreModals.openSideModal<CoreCourseModuleSummaryResult>({
component: CoreCourseModuleSummaryComponent,
componentProps: {
moduleId: this.module.id,

View File

@ -69,12 +69,12 @@ import { CoreNavigationOptions, CoreNavigator } from '@services/navigator';
import { CoreSiteHomeHomeHandlerService } from '@features/sitehome/services/handlers/sitehome-home';
import { CoreStatusWithWarningsWSResponse } from '@services/ws';
import { CoreCourseWithImageAndColor } from '@features/courses/services/courses-helper';
import { CoreCourseSummaryPage } from '../pages/course-summary/course-summary.page';
import { CoreRemindersPushNotificationData } from '@features/reminders/services/reminders';
import { CoreLocalNotifications } from '@services/local-notifications';
import { CoreEnrol } from '@features/enrol/services/enrol';
import { CoreEnrolAction, CoreEnrolDelegate } from '@features/enrol/services/enrol-delegate';
import { LazyRoutesModule } from '@/app/app-routing.module';
import { CoreModals } from '@services/modals';
/**
* Prefetch info of a module.
@ -645,9 +645,8 @@ export class CoreCourseHelperProvider {
// Now determine the status of the whole list.
let status = statuses[0];
const filepool = CoreFilepool.instance;
for (let i = 1; i < statuses.length; i++) {
status = filepool.determinePackagesStatus(status, statuses[i]);
status = CoreFilepool.determinePackagesStatus(status, statuses[i]);
}
return status;
@ -1996,6 +1995,7 @@ export class CoreCourseHelperProvider {
/**
* Retrieves course summary page module.
* This is meant to be here so it can be overriden.
*
* @returns Course summary page module.
*/
@ -2008,8 +2008,10 @@ export class CoreCourseHelperProvider {
*
* @param course Course selected
*/
openCourseSummary(course: CoreCourseWithImageAndColor & CoreCourseAnyCourseData): void {
CoreDomUtils.openSideModal<void>({
async openCourseSummary(course: CoreCourseWithImageAndColor & CoreCourseAnyCourseData): Promise<void> {
const { CoreCourseSummaryPage } = await import('../pages/course-summary/course-summary.page');
CoreModals.openSideModal<void>({
component: CoreCourseSummaryPage,
componentProps: {
courseId: course.id,

View File

@ -18,7 +18,8 @@ import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { CoreDataPrivacy } from '@features/dataprivacy/services/dataprivacy';
import { CoreUser } from '@features/user/services/user';
import { CoreSites } from '@services/sites';
import { CoreDomUtils, ToastDuration } from '@services/utils/dom';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreToasts, ToastDuration } from '@services/toasts';
import { CoreUtils } from '@services/utils/utils';
import { ModalController } from '@singletons';
@ -80,7 +81,11 @@ export class CoreDataPrivacyContactDPOComponent implements OnInit {
// Send the message.
const succeed = await CoreDataPrivacy.contactDPO(this.message);
if (succeed) {
CoreDomUtils.showToast('core.dataprivacy.requestsubmitted', true, ToastDuration.LONG);
CoreToasts.show({
message: 'core.dataprivacy.requestsubmitted',
translateMessage: true,
duration: ToastDuration.LONG,
});
ModalController.dismiss(true);
}
} catch (error) {

View File

@ -20,7 +20,8 @@ import {
CoreDataPrivacyDataRequestType,
CoreDataPrivacyGetAccessInformationWSResponse,
} from '@features/dataprivacy/services/dataprivacy';
import { CoreDomUtils, ToastDuration } from '@services/utils/dom';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreToasts, ToastDuration } from '@services/toasts';
import { ModalController } from '@singletons';
@ -105,7 +106,11 @@ export class CoreDataPrivacyNewRequestComponent implements OnInit {
// Send the message.
const requestId = await CoreDataPrivacy.createDataRequest(this.typeControl.value, this.message);
if (requestId) {
CoreDomUtils.showToast('core.dataprivacy.requestsubmitted', true, ToastDuration.LONG);
CoreToasts.show({
message: 'core.dataprivacy.requestsubmitted',
translateMessage: true,
duration: ToastDuration.LONG,
});
ModalController.dismiss(true);
}
} catch (error) {

View File

@ -19,6 +19,7 @@ import {
CoreDataPrivacyGetAccessInformationWSResponse,
CoreDataPrivacyRequest,
} from '@features/dataprivacy/services/dataprivacy';
import { CoreModals } from '@services/modals';
import { CoreNavigator } from '@services/navigator';
import { CoreScreen } from '@services/screen';
import { CoreDomUtils } from '@services/utils/dom';
@ -117,7 +118,7 @@ export class CoreDataPrivacyMainPage implements OnInit {
await import('@features/dataprivacy/components/contactdpo/contactdpo');
// Create and show the modal.
const succeed = await CoreDomUtils.openModal<boolean>({
const succeed = await CoreModals.openModal<boolean>({
component: CoreDataPrivacyContactDPOComponent,
});
@ -139,7 +140,7 @@ export class CoreDataPrivacyMainPage implements OnInit {
await import('@features/dataprivacy/components/newrequest/newrequest');
// Create and show the modal.
const succeed = await CoreDomUtils.openModal<boolean>({
const succeed = await CoreModals.openModal<boolean>({
component: CoreDataPrivacyNewRequestComponent,
componentProps: {
accessInfo: this.accessInfo,

View File

@ -24,8 +24,6 @@ import { CoreSharedModule } from '@/core/shared.module';
imports: [
CoreSharedModule,
],
providers: [
],
exports: [
CoreEditorRichTextEditorComponent,
],

View File

@ -1045,7 +1045,7 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterViewInit,
* Window resized.
*/
protected async windowResized(): Promise<void> {
await CoreDomUtils.waitForResizeDone();
await CoreWait.waitForResizeDone();
this.isPhone = CoreScreen.isMobile;
this.maximizeEditorSize();

View File

@ -44,6 +44,7 @@ import { CorePath } from '@singletons/path';
import { CorePromisedValue } from '@classes/promised-value';
import { CorePlatform } from '@services/platform';
import { Chooser } from '@features/native/plugins';
import { CoreToasts } from '@services/toasts';
/**
* Helper service to upload files.
@ -457,7 +458,11 @@ export class CoreFileUploaderHelperProvider {
await this.uploadGenericFile(CoreFile.getFileEntryURL(fileEntry), file.name, file.type, deleteAfterUpload, siteId);
CoreDomUtils.showToast('core.fileuploader.fileuploaded', true, undefined, 'core-toast-success');
CoreToasts.show({
message: 'core.fileuploader.fileuploaded',
translateMessage: true,
cssClass: 'core-toast-success',
});
} catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'core.fileuploader.errorreadingfile', true);

View File

@ -26,8 +26,6 @@ import { CoreH5PIframeComponent } from './h5p-iframe/h5p-iframe';
imports: [
CoreSharedModule,
],
providers: [
],
exports: [
CoreH5PPlayerComponent,
CoreH5PIframeComponent,

View File

@ -14,14 +14,12 @@
import { NgModule } from '@angular/core';
import { CoreSharedModule } from '@/core/shared.module';
import { CoreLoginSitesModalComponent } from './sites-modal/sites-modal';
import { CoreLoginMethodsComponent } from './login-methods/login-methods';
import { CoreLoginExceededAttemptsComponent } from '@features/login/components/exceeded-attempts/exceeded-attempts';
@NgModule({
declarations: [
CoreLoginExceededAttemptsComponent,
CoreLoginSitesModalComponent,
CoreLoginMethodsComponent,
],
imports: [
@ -29,7 +27,6 @@ import { CoreLoginExceededAttemptsComponent } from '@features/login/components/e
],
exports: [
CoreLoginExceededAttemptsComponent,
CoreLoginSitesModalComponent,
CoreLoginMethodsComponent,
],
})

View File

@ -21,6 +21,7 @@ import { CoreNavigator } from '@services/navigator';
import { CoreFilter } from '@features/filter/services/filter';
import { CoreAnimations } from '@components/animations';
import { ModalController } from '@singletons';
import { CoreSharedModule } from '@/core/shared.module';
/**
* Modal that displays a list of sites to be able to enter or delete a site.
@ -29,6 +30,10 @@ import { ModalController } from '@singletons';
selector: 'core-login-sites-modal',
templateUrl: 'sites-modal.html',
animations: [CoreAnimations.SLIDE_IN_OUT, CoreAnimations.SHOW_HIDE],
standalone: true,
imports: [
CoreSharedModule,
],
})
export class CoreLoginSitesModalComponent implements OnInit {

View File

@ -46,6 +46,7 @@ import { CoreSitesFactory } from '@services/sites-factory';
import { ONBOARDING_DONE } from '@features/login/constants';
import { CoreUnauthenticatedSite } from '@classes/sites/unauthenticated-site';
import { CoreKeyboard } from '@singletons/keyboard';
import { CoreModals } from '@services/modals';
/**
* Site (url) chooser when adding a new site.
@ -260,7 +261,7 @@ export class CoreLoginSitePage implements OnInit {
const { CoreLoginSiteHelpComponent } =
await import('@features/login/components/site-help/site-help');
await CoreDomUtils.openModal({
await CoreModals.openModal({
component: CoreLoginSiteHelpComponent,
cssClass: 'core-modal-fullscreen',
});
@ -273,7 +274,7 @@ export class CoreLoginSitePage implements OnInit {
const { CoreLoginSiteOnboardingComponent } =
await import('@features/login/components/site-onboarding/site-onboarding');
await CoreDomUtils.openModal({
await CoreModals.openModal({
component: CoreLoginSiteOnboardingComponent,
cssClass: 'core-modal-fullscreen',
});

View File

@ -15,14 +15,12 @@
import { NgModule } from '@angular/core';
import { CoreSharedModule } from '@/core/shared.module';
import { CoreMainMenuUserButtonComponent } from './user-menu-button/user-menu-button';
import { CoreMainMenuUserMenuComponent } from './user-menu/user-menu';
import { CoreLoginComponentsModule } from '@features/login/components/components.module';
import { CoreMainMenuUserMenuTourComponent } from './user-menu-tour/user-menu-tour';
@NgModule({
declarations: [
CoreMainMenuUserButtonComponent,
CoreMainMenuUserMenuComponent,
CoreMainMenuUserMenuTourComponent,
],
imports: [
@ -31,7 +29,6 @@ import { CoreMainMenuUserMenuTourComponent } from './user-menu-tour/user-menu-to
],
exports: [
CoreMainMenuUserButtonComponent,
CoreMainMenuUserMenuComponent,
CoreMainMenuUserMenuTourComponent,
],
})

View File

@ -19,9 +19,8 @@ import { CoreUserToursAlignment, CoreUserToursSide } from '@features/usertours/s
import { IonRouterOutlet } from '@ionic/angular';
import { CoreScreen } from '@services/screen';
import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreModals } from '@services/modals';
import { CoreMainMenuUserMenuTourComponent } from '../user-menu-tour/user-menu-tour';
import { CoreMainMenuUserMenuComponent } from '../user-menu/user-menu';
import { CoreMainMenuPage } from '@features/mainmenu/pages/menu/menu';
/**
@ -62,11 +61,13 @@ export class CoreMainMenuUserButtonComponent implements OnInit {
*
* @param event Click event.
*/
openUserMenu(event: Event): void {
async openUserMenu(event: Event): Promise<void> {
event.preventDefault();
event.stopPropagation();
CoreDomUtils.openSideModal<void>({
const { CoreMainMenuUserMenuComponent } = await import('../user-menu/user-menu');
CoreModals.openSideModal<void>({
component: CoreMainMenuUserMenuComponent,
});
}

View File

@ -13,11 +13,11 @@
// limitations under the License.
import { CoreConstants } from '@/core/constants';
import { CoreSharedModule } from '@/core/shared.module';
import { Component, OnDestroy, OnInit } from '@angular/core';
import { CoreSite } from '@classes/sites/site';
import { CoreSiteInfo } from '@classes/sites/unauthenticated-site';
import { CoreFilter } from '@features/filter/services/filter';
import { CoreLoginSitesModalComponent } from '@features/login/components/sites-modal/sites-modal';
import { CoreLoginHelper } from '@features/login/services/login-helper';
import { CoreUserAuthenticatedSupportConfig } from '@features/user/classes/support/authenticated-support-config';
import { CoreUserSupport } from '@features/user/services/support';
@ -28,6 +28,7 @@ import {
CoreUserProfileHandlerType,
CoreUserDelegateContext,
} from '@features/user/services/user-delegate';
import { CoreModals } from '@services/modals';
import { CoreNavigator } from '@services/navigator';
import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
@ -41,7 +42,11 @@ import { Subscription } from 'rxjs';
@Component({
selector: 'core-main-menu-user-menu',
templateUrl: 'user-menu.html',
styleUrls: ['user-menu.scss'],
styleUrl: 'user-menu.scss',
standalone: true,
imports: [
CoreSharedModule,
],
})
export class CoreMainMenuUserMenuComponent implements OnInit, OnDestroy {
@ -248,7 +253,9 @@ export class CoreMainMenuUserMenuComponent implements OnInit, OnDestroy {
event.preventDefault();
event.stopPropagation();
const closeAll = await CoreDomUtils.openSideModal<boolean>({
const { CoreLoginSitesModalComponent } = await import('@features/login/components/sites-modal/sites-modal');
const closeAll = await CoreModals.openSideModal<boolean>({
component: CoreLoginSitesModalComponent,
cssClass: 'core-modal-lateral core-modal-lateral-sm',
});

View File

@ -26,6 +26,7 @@ import { Subscription } from 'rxjs';
import { CORE_DATAPRIVACY_FEATURE_NAME, CORE_DATAPRIVACY_PAGE_NAME } from '@features/dataprivacy/constants';
import { CoreNavigator } from '@services/navigator';
import { CoreDataPrivacy } from '@features/dataprivacy/services/dataprivacy';
import { CoreModals } from '@services/modals';
/**
* Page to view user acceptances.
@ -194,7 +195,7 @@ export class CorePolicyAcceptancesPage implements OnInit, OnDestroy {
const { CorePolicyViewPolicyModalComponent } =
await import('@features/policy/components/policy-modal/policy-modal');
CoreDomUtils.openModal({
CoreModals.openModal({
component: CorePolicyViewPolicyModalComponent,
componentProps: { policy },
});

View File

@ -31,6 +31,7 @@ import { CoreScreen } from '@services/screen';
import { Subscription } from 'rxjs';
import { CoreDom } from '@singletons/dom';
import { CoreWait } from '@singletons/wait';
import { CoreModals } from '@services/modals';
/**
* Page to accept a site policy.
@ -468,7 +469,7 @@ export class CorePolicySitePolicyPage implements OnInit, OnDestroy {
const { CorePolicyViewPolicyModalComponent } =
await import('@features/policy/components/policy-modal/policy-modal');
CoreDomUtils.openModal({
CoreModals.openModal({
component: CorePolicyViewPolicyModalComponent,
componentProps: { policy },
});

View File

@ -20,8 +20,8 @@ import {
CoreRatingInfoItem,
CoreRatingProvider,
} from '@features/rating/services/rating';
import { CoreModals } from '@services/modals';
import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreEventObserver, CoreEvents } from '@singletons/events';
/**
@ -120,7 +120,7 @@ export class CoreRatingAggregateComponent implements OnChanges, OnDestroy {
const { CoreRatingRatingsComponent } =
await import('@features/rating/components/ratings/ratings');
await CoreDomUtils.openModal({
await CoreModals.openModal({
component: CoreRatingRatingsComponent,
componentProps: {
contextLevel: this.contextLevel,

View File

@ -23,7 +23,8 @@ import {
} from '@features/rating/services/rating';
import { CoreRatingOffline } from '@features/rating/services/rating-offline';
import { CoreSites } from '@services/sites';
import { CoreDomUtils, ToastDuration } from '@services/utils/dom';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreToasts, ToastDuration } from '@services/toasts';
import { Translate } from '@singletons';
import { CoreEventObserver, CoreEvents } from '@singletons/events';
@ -147,7 +148,11 @@ export class CoreRatingRateComponent implements OnChanges, OnDestroy {
);
if (response === undefined) {
CoreDomUtils.showToast('core.datastoredoffline', true, ToastDuration.LONG);
CoreToasts.show({
message: 'core.datastoredoffline',
translateMessage: true,
duration: ToastDuration.LONG,
});
} else {
this.onUpdate.emit();
}

View File

@ -18,6 +18,7 @@ import { CoreDomUtils } from '@services/utils/dom';
import { CoreRemindersSetReminderMenuComponent } from '../set-reminder-menu/set-reminder-menu';
import { Translate } from '@singletons';
import { CoreTimeUtils } from '@services/utils/time';
import { CoreToasts } from '@services/toasts';
/**
* Component that displays a button to set a reminder.
@ -127,7 +128,10 @@ export class CoreRemindersSetButtonComponent implements OnInit {
if (timebefore === undefined || timebefore === CoreRemindersService.DISABLED) {
this.setTimebefore(undefined);
CoreDomUtils.showToast('core.reminders.reminderunset', true);
CoreToasts.show({
message: 'core.reminders.reminderunset',
translateMessage: true,
});
return;
}
@ -148,8 +152,8 @@ export class CoreRemindersSetButtonComponent implements OnInit {
await CoreReminders.addReminder(reminder);
const time = this.time - timebefore;
const text = Translate.instant('core.reminders.reminderset', { $a: CoreTimeUtils.userDate(time * 1000) });
CoreDomUtils.showToast(text);
const message = Translate.instant('core.reminders.reminderset', { $a: CoreTimeUtils.userDate(time * 1000) });
CoreToasts.show({ message });
}
}

View File

@ -16,7 +16,6 @@ import { NgModule } from '@angular/core';
import { CoreSharedModule } from '@/core/shared.module';
import { CoreReportBuilderReportColumnComponent } from './report-column/report-column';
import { CoreReportBuilderReportDetailComponent } from './report-detail/report-detail';
import { CoreReportBuilderReportSummaryComponent } from './report-summary/report-summary';
@NgModule({
imports: [
@ -25,12 +24,10 @@ import { CoreReportBuilderReportSummaryComponent } from './report-summary/report
declarations: [
CoreReportBuilderReportDetailComponent,
CoreReportBuilderReportColumnComponent,
CoreReportBuilderReportSummaryComponent,
],
exports: [
CoreReportBuilderReportDetailComponent,
CoreReportBuilderReportColumnComponent,
CoreReportBuilderReportSummaryComponent,
],
})
export class CoreReportBuilderComponentsModule {}

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { CoreSharedModule } from '@/core/shared.module';
import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
import { CoreReportBuilderReportDetail } from '@features/reportbuilder/services/reportbuilder';
import { CoreFormatDatePipe } from '@pipes/format-date';
@ -21,8 +22,12 @@ import { ModalController } from '@singletons';
@Component({
selector: 'core-report-builder-report-summary',
templateUrl: './report-summary.html',
styleUrls: ['./report-summary.scss'],
styleUrl: './report-summary.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [
CoreSharedModule,
],
})
export class CoreReportBuilderReportSummaryComponent implements OnInit {
@ -30,6 +35,9 @@ export class CoreReportBuilderReportSummaryComponent implements OnInit {
reportUrl!: string;
reportDetailToDisplay!: { title: string; text: string }[];
/**
* @inheritdoc
*/
ngOnInit(): void {
const formatDate = new CoreFormatDatePipe();
const site = CoreSites.getRequiredCurrentSite();
@ -54,6 +62,9 @@ export class CoreReportBuilderReportSummaryComponent implements OnInit {
];
}
/**
* Close the modal.
*/
closeModal(): void {
ModalController.dismiss();
}

View File

@ -13,10 +13,9 @@
// limitations under the License.
import { Component, OnInit } from '@angular/core';
import { CoreReportBuilderReportSummaryComponent } from '@features/reportbuilder/components/report-summary/report-summary';
import { CoreReportBuilderReportDetail } from '@features/reportbuilder/services/reportbuilder';
import { CoreModals } from '@services/modals';
import { CoreNavigator } from '@services/navigator';
import { CoreDomUtils } from '@services/utils/dom';
@Component({
selector: 'core-report-builder-report',
@ -26,6 +25,7 @@ export class CoreReportBuilderReportPage implements OnInit {
reportId!: string;
reportDetail?: CoreReportBuilderReportDetail;
/**
* @inheritdoc
*/
@ -42,8 +42,14 @@ export class CoreReportBuilderReportPage implements OnInit {
this.reportDetail = reportDetail;
}
openInfo(): void {
CoreDomUtils.openSideModal<void>({
/**
* Open the report info modal.
*/
async openInfo(): Promise<void> {
const { CoreReportBuilderReportSummaryComponent } =
await import('@features/reportbuilder/components/report-summary/report-summary');
CoreModals.openSideModal<void>({
component: CoreReportBuilderReportSummaryComponent,
componentProps: { reportDetail: this.reportDetail },
});

View File

@ -23,6 +23,7 @@ import {
import { CoreEvents } from '@singletons/events';
import { ModalController } from '@singletons';
import { CoreUtils } from '@services/utils/utils';
import { CoreSharedModule } from '@/core/shared.module';
type Filter<T=unknown> = T & { checked: boolean };
@ -30,6 +31,10 @@ type Filter<T=unknown> = T & { checked: boolean };
selector: 'core-search-global-search-filters',
templateUrl: 'global-search-filters.html',
styleUrls: ['./global-search-filters.scss'],
standalone: true,
imports: [
CoreSharedModule,
],
})
export class CoreSearchGlobalSearchFiltersComponent implements OnInit {

View File

@ -1,30 +0,0 @@
// (C) Copyright 2015 Moodle Pty Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import { CoreSharedModule } from '@/core/shared.module';
import { NgModule } from '@angular/core';
import { CoreSearchGlobalSearchFiltersComponent } from './global-search-filters.component';
export { CoreSearchGlobalSearchFiltersComponent };
@NgModule({
imports: [
CoreSharedModule,
],
declarations: [
CoreSearchGlobalSearchFiltersComponent,
],
})
export class CoreSearchGlobalSearchFiltersComponentModule {}

View File

@ -29,6 +29,7 @@ import {
} from '@features/search/services/global-search';
import { CoreNavigator } from '@services/navigator';
import { CoreSearchBoxComponent } from '@features/search/components/search-box/search-box';
import { CoreModals } from '@services/modals';
@Component({
selector: 'page-core-search-global-search',
@ -137,9 +138,9 @@ export class CoreSearchGlobalSearchPage implements OnInit, OnDestroy, AfterViewI
*/
async openFilters(): Promise<void> {
const { CoreSearchGlobalSearchFiltersComponent } =
await import('@features/search/components/global-search-filters/global-search-filters.module');
await import('@features/search/components/global-search-filters/global-search-filters.component');
await CoreDomUtils.openSideModal<CoreSearchGlobalSearchFilters>({
await CoreModals.openSideModal<CoreSearchGlobalSearchFilters>({
component: CoreSearchGlobalSearchFiltersComponent,
componentProps: {
hideCourses: !!this.courseId,

View File

@ -24,7 +24,8 @@ import { CoreFile } from '@services/file';
import { CoreNavigator } from '@services/navigator';
import { CorePlatform } from '@services/platform';
import { CoreSites } from '@services/sites';
import { CoreDomUtils, ToastDuration } from '@services/utils/dom';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreToasts, ToastDuration } from '@services/toasts';
import { CoreText } from '@singletons/text';
/**
@ -177,7 +178,7 @@ export class CoreSettingsDevPage implements OnInit {
await CoreConfig.delete(ONBOARDING_DONE);
await CoreConfig.delete(FAQ_QRCODE_INFO_DONE);
CoreDomUtils.showToast('User tours have been reseted');
CoreToasts.show({ message: 'User tours have been reseted' });
}
/**
@ -194,7 +195,10 @@ export class CoreSettingsDevPage implements OnInit {
return;
}
await CoreDomUtils.showToast('Caches invalidated', true, ToastDuration.LONG);
await CoreToasts.show({
message: 'Caches invalidated',
duration: ToastDuration.LONG,
});
}
/**
@ -205,7 +209,7 @@ export class CoreSettingsDevPage implements OnInit {
await CoreFile.clearDeletedSitesFolder(sites);
await CoreFile.clearTmpFolder();
CoreDomUtils.showToast('File storage cleared');
CoreToasts.show({ message: 'File storage cleared' });
}
async setEnabledStagingSites(enabled: boolean): Promise<void> {

View File

@ -23,7 +23,7 @@ import { CoreUtils } from '@services/utils/utils';
import { Subscription } from 'rxjs';
import { CorePushNotifications } from '@features/pushnotifications/services/pushnotifications';
import { CoreConfig } from '@services/config';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreToasts } from '@services/toasts';
import { CoreNavigator } from '@services/navigator';
import { CorePlatform } from '@services/platform';
import { CoreNetwork } from '@services/network';
@ -86,9 +86,6 @@ export class CoreSettingsDeviceInfoPage implements OnDestroy {
protected onlineObserver?: Subscription;
constructor() {
const sitesProvider = CoreSites.instance;
const device = Device.instance;
const translate = Translate.instance;
const navigator = window.navigator;
this.deviceInfo = {
@ -128,7 +125,7 @@ export class CoreSettingsDeviceInfoPage implements OnDestroy {
this.deviceOsTranslated = matches[1];
} else {
this.deviceInfo.deviceOs = 'unknown';
this.deviceOsTranslated = translate.instant('core.unknown');
this.deviceOsTranslated = Translate.instant('core.unknown');
}
}
} else {
@ -139,39 +136,35 @@ export class CoreSettingsDeviceInfoPage implements OnDestroy {
this.deviceOsTranslated = matches[1];
} else {
this.deviceInfo.deviceOs = 'unknown';
this.deviceOsTranslated = translate.instant('core.unknown');
this.deviceOsTranslated = Translate.instant('core.unknown');
}
}
if (navigator) {
if (navigator.userAgent) {
this.deviceInfo.userAgent = navigator.userAgent;
}
if (navigator.language) {
this.deviceInfo.browserLanguage = navigator.language;
}
if (navigator.userAgent) {
this.deviceInfo.userAgent = navigator.userAgent;
}
if (device) {
if (device.cordova) {
this.deviceInfo.cordovaVersion = device.cordova;
}
if (device.platform) {
this.deviceInfo.platform = device.platform;
}
if (device.version) {
this.deviceInfo.osVersion = device.version;
}
if (device.model) {
this.deviceInfo.model = device.model;
}
if (device.uuid) {
this.deviceInfo.uuid = device.uuid;
}
if (navigator.language) {
this.deviceInfo.browserLanguage = navigator.language;
}
const currentSite = sitesProvider.getCurrentSite();
if (Device.cordova) {
this.deviceInfo.cordovaVersion = Device.cordova;
}
if (Device.platform) {
this.deviceInfo.platform = Device.platform;
}
if (Device.version) {
this.deviceInfo.osVersion = Device.version;
}
if (Device.model) {
this.deviceInfo.model = Device.model;
}
if (Device.uuid) {
this.deviceInfo.uuid = Device.uuid;
}
const currentSite = CoreSites.getCurrentSite();
this.deviceInfo.siteId = currentSite?.getId();
this.deviceInfo.siteVersion = currentSite?.getInfo()?.release;
@ -190,14 +183,11 @@ export class CoreSettingsDeviceInfoPage implements OnDestroy {
* Async part of the constructor.
*/
protected async asyncInit(): Promise<void> {
const sitesProvider = CoreSites.instance;
const fileProvider = CoreFile.instance;
const lang = await CoreLang.getCurrentLanguage();
this.deviceInfo.currentLanguage = lang;
this.currentLangName = CoreConstants.CONFIG.languages[lang];
const currentSite = sitesProvider.getCurrentSite();
const currentSite = CoreSites.getCurrentSite();
const isSingleFixedSite = await CoreLoginHelper.isSingleFixedSite();
const sites = await CoreLoginHelper.getAvailableSites();
const firstUrl = isSingleFixedSite && sites[0].url;
@ -207,10 +197,10 @@ export class CoreSettingsDeviceInfoPage implements OnDestroy {
this.displaySiteUrl = !!this.deviceInfo.siteUrl &&
(currentSite ?? CoreSitesFactory.makeUnauthenticatedSite(this.deviceInfo.siteUrl)).shouldDisplayInformativeLinks();
if (fileProvider.isAvailable()) {
const basepath = await fileProvider.getBasePath();
if (CoreFile.isAvailable()) {
const basepath = await CoreFile.getBasePath();
this.deviceInfo.fileSystemRoot = basepath;
this.fsClickable = fileProvider.usesHTMLAPI();
this.fsClickable = CoreFile.usesHTMLAPI();
}
const showDevOptionsOnConfig = await CoreConfig.get('showDevOptions', 0);
@ -265,7 +255,10 @@ export class CoreSettingsDeviceInfoPage implements OnDestroy {
this.showDevOptions = true;
await CoreConfig.set('showDevOptions', 1);
CoreDomUtils.showToast('core.settings.youradev', true);
CoreToasts.show({
message: 'core.settings.youradev',
translateMessage: true,
});
} else {
this.showDevOptions = false;
await CoreConfig.delete('showDevOptions');

View File

@ -29,6 +29,7 @@ import { NgZone } from '@singletons';
import { CoreConstants } from '@/core/constants';
import { CoreConfig } from '@services/config';
import { CoreSettingsHandlersSource } from '@features/settings/classes/settings-handlers-source';
import { CoreToasts } from '@services/toasts';
/**
* Page that displays the list of site settings pages.
@ -117,7 +118,10 @@ export class CoreSitePreferencesPage implements AfterViewInit, OnDestroy {
// Using syncOnlyOnWifi false to force manual sync.
await CoreSettingsHelper.synchronizeSite(false, this.siteId);
CoreDomUtils.showToast('core.settings.sitesynccompleted', true);
CoreToasts.show({
message: 'core.settings.sitesynccompleted',
translateMessage: true,
});
} catch (error) {
if (this.isDestroyed) {
return;

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