Skip to content

Commit

Permalink
Merge pull request #4121 from crazyserver/MOBILE-4616
Browse files Browse the repository at this point in the history
Mobile 4616 Solve lots of circular dependencies
  • Loading branch information
dpalou authored Jul 15, 2024
2 parents 3400d18 + a9f4a48 commit 41879a3
Show file tree
Hide file tree
Showing 292 changed files with 2,154 additions and 1,481 deletions.
2 changes: 1 addition & 1 deletion src/addons/block/learningplans/services/block-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { CoreBlockHandlerData } from '@features/block/services/block-delegate';
import { CoreBlockOnlyTitleComponent } from '@features/block/components/only-title-block/only-title-block';
import { CoreBlockBaseHandler } from '@features/block/classes/base-block-handler';
import { makeSingleton } from '@singletons';
import { ADDON_COMPETENCY_LEARNING_PLANS_PAGE } from '@addons/competency/competency.module';
import { ADDON_COMPETENCY_LEARNING_PLANS_PAGE } from '@addons/competency/constants';

/**
* Block handler.
Expand Down
2 changes: 1 addition & 1 deletion src/addons/competency/classes/competency-plans-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import { Params } from '@angular/router';
import { CoreRoutedItemsManagerSource } from '@classes/items-management/routed-items-manager-source';
import { ADDON_COMPETENCY_COMPETENCIES_PAGE } from '../competency.module';
import { ADDON_COMPETENCY_COMPETENCIES_PAGE } from '../constants';
import { AddonCompetency, AddonCompetencyPlan, AddonCompetencyProvider } from '../services/competency';
import { AddonCompetencyHelper } from '../services/competency-helper';
import { CoreIonicColorNames } from '@singletons/colors';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { RouterModule, Routes } from '@angular/router';

import { AddonCompetencyCompetencyPage } from './pages/competency/competency.page';
import { AddonCompetencyCompetencySummaryPage } from './pages/competencysummary/competencysummary.page';
import { ADDON_COMPETENCY_SUMMARY_PAGE } from './competency.module';
import { ADDON_COMPETENCY_SUMMARY_PAGE } from './constants';
import { AddonCompetencyCompetencyPageModule } from './pages/competency/competency.module';
import { AddonCompetencyCompetencySummaryPageModule } from './pages/competencysummary/competencysummary.module';
import { AddonCompetencyCourseCompetenciesPage } from './pages/coursecompetencies/coursecompetencies.page';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { AddonCompetencyPlanPage } from './pages/plan/plan';
import { AddonCompetencyPlanListPage } from './pages/planlist/planlist';
import { AddonCompetencyCompetencyPage } from './pages/competency/competency.page';
import { AddonCompetencyCompetencySummaryPage } from './pages/competencysummary/competencysummary.page';
import { ADDON_COMPETENCY_COMPETENCIES_PAGE, ADDON_COMPETENCY_SUMMARY_PAGE } from './competency.module';
import { ADDON_COMPETENCY_COMPETENCIES_PAGE, ADDON_COMPETENCY_SUMMARY_PAGE } from './constants';
import { AddonCompetencyCompetencyPageModule } from './pages/competency/competency.module';
import { AddonCompetencyCompetencySummaryPageModule } from './pages/competencysummary/competencysummary.module';
import { AddonCompetencyCompetenciesPage } from './pages/competencies/competencies.page';
Expand Down
9 changes: 3 additions & 6 deletions src/addons/competency/competency.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ import { AddonCompetencyUserHandler } from './services/handlers/user';
import { Routes } from '@angular/router';
import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module';
import { CoreCourseIndexRoutingModule } from '@features/course/course-routing.module';
import { COURSE_PAGE_NAME } from '@features/course/course.module';
import { PARTICIPANTS_PAGE_NAME } from '@features/user/user.module';
import { PARTICIPANTS_PAGE_NAME } from '@features/user/constants';
import { COURSE_PAGE_NAME } from '@features/course/constants';
import { ADDON_COMPETENCY_LEARNING_PLANS_PAGE, ADDON_COMPETENCY_COMPETENCIES_PAGE } from './constants';

/**
* Get competency services.
Expand All @@ -45,10 +46,6 @@ export async function getCompetencyServices(): Promise<Type<unknown>[]> {
];
}

export const ADDON_COMPETENCY_LEARNING_PLANS_PAGE = 'learning-plans';
export const ADDON_COMPETENCY_COMPETENCIES_PAGE = 'competencies';
export const ADDON_COMPETENCY_SUMMARY_PAGE = 'summary';

const mainMenuChildrenRoutes: Routes = [
{
path: ADDON_COMPETENCY_LEARNING_PLANS_PAGE,
Expand Down
17 changes: 17 additions & 0 deletions src/addons/competency/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// (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.

export const ADDON_COMPETENCY_LEARNING_PLANS_PAGE = 'learning-plans';
export const ADDON_COMPETENCY_COMPETENCIES_PAGE = 'competencies';
export const ADDON_COMPETENCY_SUMMARY_PAGE = 'summary';
2 changes: 1 addition & 1 deletion src/addons/competency/pages/competency/competency.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
import { CoreNavigator } from '@services/navigator';
import { ContextLevel } from '@/core/constants';
import { CoreUtils } from '@services/utils/utils';
import { ADDON_COMPETENCY_SUMMARY_PAGE } from '@addons/competency/competency.module';
import { ADDON_COMPETENCY_SUMMARY_PAGE } from '@addons/competency/constants';
import { CoreSwipeNavigationItemsManager } from '@classes/items-management/swipe-navigation-items-manager';
import { CoreRoutedItemsManagerSourcesTracker } from '@classes/items-management/routed-items-manager-sources-tracker';
import { AddonCompetencyPlanCompetenciesSource } from '@addons/competency/classes/competency-plan-competencies-source';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { AddonCompetencySummary, AddonCompetency } from '@addons/competency/serv
import { CoreNavigator } from '@services/navigator';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreUtils } from '@services/utils/utils';
import { ADDON_COMPETENCY_SUMMARY_PAGE } from '@addons/competency/competency.module';
import { ADDON_COMPETENCY_SUMMARY_PAGE } from '@addons/competency/constants';
import { CoreTime } from '@singletons/time';
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { CoreUserProfile } from '@features/user/services/user';
import { CoreNavigator } from '@services/navigator';
import { CoreDomUtils } from '@services/utils/dom';
import { ContextLevel } from '@/core/constants';
import { ADDON_COMPETENCY_SUMMARY_PAGE } from '@addons/competency/competency.module';
import { ADDON_COMPETENCY_SUMMARY_PAGE } from '@addons/competency/constants';
import { CoreListItemsManager } from '@classes/items-management/list-items-manager';
import { CoreRoutedItemsManagerSourcesTracker } from '@classes/items-management/routed-items-manager-sources-tracker';
import { AddonCompetencyCourseCompetenciesSource } from '@addons/competency/classes/competency-course-competencies-source';
Expand Down
4 changes: 2 additions & 2 deletions src/addons/competency/services/handlers/competency-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import { ADDON_COMPETENCY_COMPETENCIES_PAGE, ADDON_COMPETENCY_LEARNING_PLANS_PAGE } from '@addons/competency/competency.module';
import { ADDON_COMPETENCY_COMPETENCIES_PAGE, ADDON_COMPETENCY_LEARNING_PLANS_PAGE } from '@addons/competency/constants';
import { Injectable } from '@angular/core';
import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base-handler';
import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate';
import { COURSE_PAGE_NAME } from '@features/course/course.module';
import { COURSE_PAGE_NAME } from '@features/course/constants';
import { CoreNavigator } from '@services/navigator';
import { makeSingleton } from '@singletons';
import { AddonCompetency } from '../competency';
Expand Down
2 changes: 1 addition & 1 deletion src/addons/competency/services/handlers/course-option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { AddonCompetency } from '../competency';
import { CoreCourseAnyCourseData, CoreCourseUserAdminOrNavOptionIndexed } from '@features/courses/services/courses';
import { CoreFilterHelper } from '@features/filter/services/filter-helper';
import { ContextLevel } from '@/core/constants';
import { ADDON_COMPETENCY_COMPETENCIES_PAGE } from '@addons/competency/competency.module';
import { ADDON_COMPETENCY_COMPETENCIES_PAGE } from '@addons/competency/constants';

/**
* Course nav handler.
Expand Down
2 changes: 1 addition & 1 deletion src/addons/competency/services/handlers/plan-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import { ADDON_COMPETENCY_LEARNING_PLANS_PAGE } from '@addons/competency/competency.module';
import { ADDON_COMPETENCY_LEARNING_PLANS_PAGE } from '@addons/competency/constants';
import { Injectable } from '@angular/core';
import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base-handler';
import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate';
Expand Down
2 changes: 1 addition & 1 deletion src/addons/competency/services/handlers/plans-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import { ADDON_COMPETENCY_LEARNING_PLANS_PAGE } from '@addons/competency/competency.module';
import { ADDON_COMPETENCY_LEARNING_PLANS_PAGE } from '@addons/competency/constants';
import { Injectable } from '@angular/core';
import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base-handler';
import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate';
Expand Down
4 changes: 2 additions & 2 deletions src/addons/competency/services/handlers/push-click.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import { ADDON_COMPETENCY_COMPETENCIES_PAGE, ADDON_COMPETENCY_LEARNING_PLANS_PAGE } from '@addons/competency/competency.module';
import { ADDON_COMPETENCY_COMPETENCIES_PAGE, ADDON_COMPETENCY_LEARNING_PLANS_PAGE } from '@addons/competency/constants';
import { Injectable } from '@angular/core';
import { COURSE_PAGE_NAME } from '@features/course/course.module';
import { COURSE_PAGE_NAME } from '@features/course/constants';
import { CorePushNotificationsClickHandler } from '@features/pushnotifications/services/push-delegate';
import { CorePushNotificationsNotificationBasicData } from '@features/pushnotifications/services/pushnotifications';
import { CoreNavigator } from '@services/navigator';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import { ADDON_COMPETENCY_COMPETENCIES_PAGE, ADDON_COMPETENCY_SUMMARY_PAGE } from '@addons/competency/competency.module';
import { ADDON_COMPETENCY_COMPETENCIES_PAGE, ADDON_COMPETENCY_SUMMARY_PAGE } from '@addons/competency/constants';
import { Injectable } from '@angular/core';
import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base-handler';
import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate';
Expand Down
6 changes: 3 additions & 3 deletions src/addons/competency/services/handlers/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import { ADDON_COMPETENCY_COMPETENCIES_PAGE, ADDON_COMPETENCY_LEARNING_PLANS_PAGE } from '@addons/competency/competency.module';
import { ADDON_COMPETENCY_COMPETENCIES_PAGE, ADDON_COMPETENCY_LEARNING_PLANS_PAGE } from '@addons/competency/constants';
import { Injectable } from '@angular/core';
import { COURSE_PAGE_NAME } from '@features/course/course.module';
import { COURSE_PAGE_NAME } from '@features/course/constants';
import { CoreUserProfile } from '@features/user/services/user';
import {
CoreUserProfileHandler,
CoreUserProfileHandlerType,
CoreUserProfileHandlerData,
CoreUserDelegateContext,
} from '@features/user/services/user-delegate';
import { PARTICIPANTS_PAGE_NAME } from '@features/user/user.module';
import { PARTICIPANTS_PAGE_NAME } from '@features/user/constants';
import { CoreNavigator } from '@services/navigator';
import { CoreSites } from '@services/sites';
import { makeSingleton } from '@singletons';
Expand Down
12 changes: 7 additions & 5 deletions src/addons/messages/pages/contacts-35/contacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ import {
AddonMessages,
} from '../../services/messages';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreApp } from '@services/app';
import { CoreEventObserver, CoreEvents } from '@singletons/events';
import { ActivatedRoute } from '@angular/router';
import { Translate } from '@singletons';
import { CoreScreen } from '@services/screen';
import { CoreNavigator } from '@services/navigator';
import { CoreSplitViewComponent } from '@components/split-view/split-view';
import { CoreKeyboard } from '@singletons/keyboard';

/**
* Page that displays the list of contacts.
Expand Down Expand Up @@ -205,15 +205,17 @@ export class AddonMessagesContacts35Page implements OnInit, OnDestroy {
* @param query Text to search for.
* @returns Resolved when done.
*/
search(query: string): Promise<void> {
CoreApp.closeKeyboard();
async search(query: string): Promise<void> {
CoreKeyboard.close();

this.loaded = false;
this.loadingMessage = this.searchingMessages;

return this.performSearch(query).finally(() => {
try {
await this.performSearch(query);
} finally {
this.loaded = true;
});
}
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/addons/messages/pages/discussion/discussion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import { CoreDomUtils } from '@services/utils/dom';
import { CoreUtils } from '@services/utils/utils';
import { CoreTextUtils } from '@services/utils/text';
import { CoreLogger } from '@singletons/logger';
import { CoreApp } from '@services/app';
import { CoreInfiniteLoadingComponent } from '@components/infinite-loading/infinite-loading';
import { Md5 } from 'ts-md5/dist/md5';
import moment from 'moment-timezone';
Expand All @@ -45,6 +44,7 @@ import { CoreIonLoadingElement } from '@classes/ion-loading';
import { ActivatedRoute } from '@angular/router';
import { CoreConstants } from '@/core/constants';
import { CoreDom } from '@singletons/dom';
import { CoreKeyboard } from '@singletons/keyboard';

/**
* Page that displays a message discussion page.
Expand Down Expand Up @@ -1177,7 +1177,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView

// Only close the keyboard if an error happens.
// We want the user to be able to send multiple messages without the keyboard being closed.
CoreApp.closeKeyboard();
CoreKeyboard.close();

CoreDomUtils.showErrorModalDefault(error, 'addon.messages.messagenotsent', true);
this.removeMessage(message.hash!);
Expand Down
4 changes: 2 additions & 2 deletions src/addons/messages/pages/discussions-35/discussions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
} from '../../services/messages';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreUtils } from '@services/utils/utils';
import { CoreApp } from '@services/app';
import { ActivatedRoute, Params } from '@angular/router';
import { CorePushNotificationsNotificationBasicData } from '@features/pushnotifications/services/pushnotifications';
import { CorePushNotificationsDelegate } from '@features/pushnotifications/services/push-delegate';
Expand All @@ -34,6 +33,7 @@ import { CoreScreen } from '@services/screen';
import { CoreMainMenuDeepLinkManager } from '@features/mainmenu/classes/deep-link-manager';
import { CorePlatform } from '@services/platform';
import { CoreSplitViewComponent } from '@components/split-view/split-view';
import { CoreKeyboard } from '@singletons/keyboard';

/**
* Page that displays the list of discussions.
Expand Down Expand Up @@ -234,7 +234,7 @@ export class AddonMessagesDiscussions35Page implements OnInit, OnDestroy {
* @returns Resolved when done.
*/
async searchMessage(query: string): Promise<void> {
CoreApp.closeKeyboard();
CoreKeyboard.close();
this.loaded = false;
this.loadingMessage = this.search.loading;

Expand Down
4 changes: 2 additions & 2 deletions src/addons/messages/pages/search/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import {
AddonMessages,
} from '../../services/messages';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreApp } from '@services/app';
import { CoreNavigator } from '@services/navigator';
import { CoreScreen } from '@services/screen';
import { CoreSplitViewComponent } from '@components/split-view/split-view';
import { CoreKeyboard } from '@singletons/keyboard';

/**
* Page for searching users.
Expand Down Expand Up @@ -124,7 +124,7 @@ export class AddonMessagesSearchPage implements OnDestroy {
* @returns Resolved when done.
*/
async search(query: string, loadMore?: 'contacts' | 'noncontacts' | 'messages', infiniteComplete?: () => void): Promise<void> {
CoreApp.closeKeyboard();
CoreKeyboard.close();

this.query = query;
this.disableSearch = true;
Expand Down
2 changes: 1 addition & 1 deletion src/addons/mod/assign/assign-lazy.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ const routes: Routes = [
AddonModAssignEditPage,
],
})
export class AddonModAssignLazyModule {}
export default class AddonModAssignLazyModule {}
10 changes: 5 additions & 5 deletions src/addons/mod/assign/assign.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ import { CorePushNotificationsDelegate } from '@features/pushnotifications/servi
import { CoreCronDelegate } from '@services/cron';
import { CORE_SITE_SCHEMAS } from '@services/sites';
import { AddonModAssignFeedbackModule } from './feedback/feedback.module';
import { AddonModAssignProvider } from './services/assign';
import { OFFLINE_SITE_SCHEMA } from './services/database/assign';
import { AddonModAssignIndexLinkHandler } from './services/handlers/index-link';
import { AddonModAssignListLinkHandler } from './services/handlers/list-link';
import { AddonModAssignModuleHandler, AddonModAssignModuleHandlerService } from './services/handlers/module';
import { AddonModAssignModuleHandler } from './services/handlers/module';
import { AddonModAssignPrefetchHandler } from './services/handlers/prefetch';
import { AddonModAssignPushClickHandler } from './services/handlers/push-click';
import { AddonModAssignSyncCronHandler } from './services/handlers/sync-cron';
import { AddonModAssignSubmissionModule } from './submission/submission.module';
import { ADDON_MOD_ASSIGN_COMPONENT, ADDON_MOD_ASSIGN_PAGE_NAME } from './constants';

/**
* Get mod assign services.
Expand Down Expand Up @@ -69,8 +69,8 @@ export async function getModAssignComponentModules(): Promise<unknown[]> {

const routes: Routes = [
{
path: AddonModAssignModuleHandlerService.PAGE_NAME,
loadChildren: () => import('./assign-lazy.module').then(m => m.AddonModAssignLazyModule),
path: ADDON_MOD_ASSIGN_PAGE_NAME,
loadChildren: () => import('./assign-lazy.module'),
},
];

Expand All @@ -97,7 +97,7 @@ const routes: Routes = [
CoreCronDelegate.register(AddonModAssignSyncCronHandler.instance);
CorePushNotificationsDelegate.registerClickHandler(AddonModAssignPushClickHandler.instance);

CoreCourseHelper.registerModuleReminderClick(AddonModAssignProvider.COMPONENT);
CoreCourseHelper.registerModuleReminderClick(ADDON_MOD_ASSIGN_COMPONENT);
},
},
],
Expand Down
5 changes: 3 additions & 2 deletions src/addons/mod/assign/classes/submissions-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ import {
} from '../services/assign';
import { AddonModAssignHelper, AddonModAssignSubmissionFormatted } from '../services/assign-helper';
import { AddonModAssignOffline } from '../services/assign-offline';
import { AddonModAssignSync, AddonModAssignSyncProvider } from '../services/assign-sync';
import { AddonModAssignSync } from '../services/assign-sync';
import { ADDON_MOD_ASSIGN_MANUAL_SYNCED } from '../constants';

/**
* Provides a collection of assignment submissions.
Expand Down Expand Up @@ -116,7 +117,7 @@ export class AddonModAssignSubmissionsSource extends CoreRoutedItemsManagerSourc

if (result && result.updated) {
CoreEvents.trigger(
AddonModAssignSyncProvider.MANUAL_SYNCED,
ADDON_MOD_ASSIGN_MANUAL_SYNCED,
{
assignId: this.assign.id,
warnings: result.warnings,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import {
AddonModAssignAssign,
AddonModAssignSubmission,
AddonModAssignPlugin,
AddonModAssignProvider,
AddonModAssign,
} from '../../services/assign';
import { AddonModAssignHelper, AddonModAssignPluginConfig } from '../../services/assign-helper';
import { AddonModAssignFeedbackDelegate } from '../../services/feedback-delegate';
import { ADDON_MOD_ASSIGN_COMPONENT } from '../../constants';

/**
* Component that displays an assignment feedback plugin.
Expand All @@ -48,7 +48,7 @@ export class AddonModAssignFeedbackPluginComponent implements OnInit {
data?: AddonModAssignFeedbackPluginData; // Data to pass to the component.

// Data to render the plugin if it isn't supported.
component = AddonModAssignProvider.COMPONENT;
component = ADDON_MOD_ASSIGN_COMPONENT;
text = '';
files: CoreWSFile[] = [];
notSupported = false;
Expand Down
Loading

0 comments on commit 41879a3

Please sign in to comment.