Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile 4465 #3850

Merged
merged 2 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/addons/mod/assign/pages/edit/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h1>
<ion-item class="ion-text-wrap" *ngIf="activityInstructions">
<ion-label>
<core-format-text [text]="activityInstructions" [component]="component" [componentId]="moduleId" contextLevel="module"
[contextInstanceId]="moduleId" [courseId]="courseId" [maxHeight]="120">
[contextInstanceId]="moduleId" [courseId]="courseId">
</core-format-text>
</ion-label>
</ion-item>
Expand Down
4 changes: 0 additions & 4 deletions src/core/classes/errors/ajaxerror.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ import { CoreSiteError, CoreSiteErrorOptions } from '@classes/errors/siteerror';
*/
export class CoreAjaxError extends CoreSiteError {

/**
* @deprecated since 4.0. AJAX endpoint should always be available in supported Moodle versions.
*/
available = 1;
status?: number;

constructor(messageOrOptions: string | CoreSiteErrorOptions, available?: number, status?: number) {
Expand Down
59 changes: 0 additions & 59 deletions src/core/classes/site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1634,38 +1634,6 @@ export class CoreSite {
return CoreUrlUtils.addParamsToUrl(CorePath.concatenatePaths(this.siteUrl, path), params, anchor);
}

/**
* Check if the local_mobile plugin is installed in the Moodle site.
*
* @returns Promise resolved when the check is done.
* @deprecated since 4.0.
*/
// eslint-disable-next-line deprecation/deprecation
async checkLocalMobilePlugin(): Promise<LocalMobileResponse> {
// Not used anymore.
return { code: 0, coreSupported: true };
}

/**
* Check if local_mobile has been installed in Moodle.
*
* @returns Whether the App is able to use local_mobile plugin for this site.
* @deprecated since 4.0.
*/
checkIfAppUsesLocalMobile(): boolean {
return false;
}

/**
* Check if local_mobile has been installed in Moodle but the app is not using it.
*
* @returns Promise resolved it local_mobile was added, rejected otherwise.
* @deprecated since 4.0.
*/
async checkIfLocalMobileInstalledAndNotUsed(): Promise<void> {
throw new CoreError('Deprecated.');
}

/**
* Check if a URL belongs to this site.
*
Expand Down Expand Up @@ -2666,33 +2634,6 @@ export type CoreSiteWSPreSets = {
updateInBackground?: boolean;
};

/**
* Response of checking local_mobile status.
*
* @deprecated since 4.0.
*/
export type LocalMobileResponse = {
/**
* Code to identify the authentication method to use.
*/
code: number;

/**
* Name of the service to use.
*/
service?: string;

/**
* Code of the warning message.
*/
warning?: string;

/**
* Whether core SSO is supported.
*/
coreSupported?: boolean;
};

/**
* Info of a request waiting in the queue.
*/
Expand Down
12 changes: 0 additions & 12 deletions src/core/components/context-menu/context-menu-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

import { Component, Input, Output, OnInit, OnDestroy, EventEmitter, OnChanges, SimpleChange } from '@angular/core';
import { CoreLogger } from '@singletons/logger';
import { CoreContextMenuComponent } from '../context-menu/context-menu';

/**
Expand Down Expand Up @@ -58,11 +57,6 @@ export class CoreContextMenuItemComponent implements OnInit, OnDestroy, OnChange
@Output() onClosed?: EventEmitter<() => void>; // Will emit an event when the popover is closed because the item was clicked.
@Output() toggleChange = new EventEmitter<boolean>();// Will emit an event when toggle changes to enable 2-way data binding.

/**
* @deprecated since 4.0. Not used anymore.
*/
@Input() iconDescription?: string;

protected hasAction = false;
protected destroyed = false;

Expand Down Expand Up @@ -92,12 +86,6 @@ export class CoreContextMenuItemComponent implements OnInit, OnDestroy, OnChange
if (!this.destroyed) {
this.ctxtMenu.addItem(this);
}

// eslint-disable-next-line deprecation/deprecation
if (this.iconDescription !== undefined) {
CoreLogger.getInstance('CoreContextMenuItemComponent')
.warn('iconDescription Input is deprecated and should not be used');
}
}

/**
Expand Down
4 changes: 0 additions & 4 deletions src/core/components/download-refresh/download-refresh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ export class CoreDownloadRefreshComponent {
@Input() statusTranslatable?: string; // Download status translatable string.
@Input() enabled = false; // Whether the download is enabled.
@Input() loading = true; // Force loading status when is not downloading.
/**
* @deprecated since 4.0. Not used anymore.
*/
@Input() size = ''; // Size of the buttons.
@Input() canTrustDownload = false; // If false, refresh will be shown if downloaded.
@Output() action: EventEmitter<boolean>; // Will emit an event when the item clicked.

Expand Down
5 changes: 0 additions & 5 deletions src/core/components/empty-box/empty-box.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ export class CoreEmptyBoxComponent {
@Input() image?: string; // Image source. If an icon is provided, image won't be used.
@Input() flipIconRtl = false; // Whether to flip the icon in RTL. Defaults to false.

/**
* @deprecated since 4.0. Not used anymore.
*/
@Input() inline = false;

@HostBinding('class.dimmed')
get isDimmed(): boolean {
return this.dimmed;
Expand Down
8 changes: 0 additions & 8 deletions src/core/components/loading/loading.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import { Component, Input, OnInit, OnChanges, SimpleChange, ElementRef, AfterViewInit, OnDestroy } from '@angular/core';

import { CoreEventLoadingChangedData, CoreEvents } from '@singletons/events';
import { CoreUtils } from '@services/utils/utils';
import { CoreAnimations } from '@components/animations';
import { Translate } from '@singletons';
Expand Down Expand Up @@ -153,13 +152,6 @@ export class CoreLoadingComponent implements OnInit, OnChanges, AfterViewInit, A
this.lastScrollPosition = this.getScrollPosition();
this.mutationObserver.disconnect();
}

// Event has been deprecated since app 4.0.
// eslint-disable-next-line deprecation/deprecation
CoreEvents.trigger(CoreEvents.CORE_LOADING_CHANGED, <CoreEventLoadingChangedData> {
loaded,
uniqueId: this.uniqueId,
});
}

/**
Expand Down
4 changes: 0 additions & 4 deletions src/core/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ export class CoreConstants {
// WS constants.
static readonly WS_TIMEOUT = 30000; // Timeout when not in WiFi.
static readonly WS_TIMEOUT_WIFI = 30000; // Timeout when in WiFi.
/**
* @deprecated since 4.0. Not used anymore.
*/
static readonly WS_PREFIX = 'local_mobile_';

// Login constants.
/**
Expand Down
24 changes: 0 additions & 24 deletions src/core/directives/format-text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,6 @@ export class CoreFormatTextDirective implements OnChanges, OnDestroy, AsyncDirec
@Input() hideIfEmpty = false; // If true, the tag will contain nothing if text is empty.
@Input() disabled?: boolean; // If disabled, autoplay elements will be disabled.

/**
* @deprecated since 4.0. Not used anymore.
*/
@Input() fullOnClick?: boolean | string;
/**
* @deprecated since 4.0. Not used anymore.
*/
@Input() fullTitle?: string;
/**
* Max height in pixels to render the content box. It should be 50 at least to make sense.
*
* @deprecated since 4.0 Use collapsible-item directive instead.
*/
@Input() maxHeight?: number;

@Output() afterRender: EventEmitter<void>; // Called when the data is rendered.
@Output() onClick: EventEmitter<void> = new EventEmitter(); // Called when clicked.

Expand Down Expand Up @@ -380,15 +365,6 @@ export class CoreFormatTextDirective implements OnChanges, OnDestroy, AsyncDirec

await CoreUtils.nextTick();

// Use collapsible-item directive instead.
// eslint-disable-next-line deprecation/deprecation
if (this.maxHeight && !this.collapsible) {
this.collapsible = new CoreCollapsibleItemDirective(new ElementRef(this.element));
// eslint-disable-next-line deprecation/deprecation
this.collapsible.height = this.maxHeight;
this.collapsible.ngOnInit();
}

// Add magnifying glasses to images.
this.addMagnifyingGlasses();

Expand Down
32 changes: 2 additions & 30 deletions src/core/features/contentlinks/classes/module-index-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.

import { CoreContentLinksHandlerBase } from './base-handler';
import { Params } from '@angular/router';
import { CoreContentLinksAction } from '../services/contentlinks-delegate';
import { CoreCourseHelper } from '@features/course/services/course-helper';
import { CoreNavigationOptions } from '@services/navigator';
Expand Down Expand Up @@ -52,20 +51,6 @@ export class CoreContentLinksModuleIndexHandler extends CoreContentLinksHandlerB
this.featureName = 'CoreCourseModuleDelegate_' + addon;
}

/**
* Get the mod params necessary to open an activity.
*
* @param url The URL to treat.
* @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1}
* @param courseId Course ID related to the URL. Optional but recommended.
* @returns List of params to pass to navigateToModule / navigateToModuleByInstance.
* @deprecated since 4.0. Not used anymore.
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
getPageParams(url: string, params: Record<string, string>, courseId?: number): Params {
return {};
}

/**
* Get the navigation options to open the module.
*
Expand Down Expand Up @@ -97,19 +82,6 @@ export class CoreContentLinksModuleIndexHandler extends CoreContentLinksHandlerB
): CoreContentLinksAction[] | Promise<CoreContentLinksAction[]> {

courseId = Number(courseId || params.courseid || params.cid);
const getModNavOptions = (siteId: string): CoreNavigationOptions => {
let modNavOptions = this.getModNavOptions(url, params, siteId, courseId);
if (!modNavOptions) {
// Use the old function, currently deprecated.
// eslint-disable-next-line deprecation/deprecation
const pageParams = this.getPageParams(url, params, courseId);
if (pageParams && Object.keys(pageParams).length > 0) {
modNavOptions = { params: pageParams };
}
}

return modNavOptions;
};

if (this.instanceIdParam && params[this.instanceIdParam] !== undefined) {
const instanceId = parseInt(params[this.instanceIdParam], 10);
Expand All @@ -122,7 +94,7 @@ export class CoreContentLinksModuleIndexHandler extends CoreContentLinksHandlerB
{
courseId,
useModNameToGetModule: this.useModNameToGetModule,
modNavOptions: getModNavOptions(siteId),
modNavOptions: this.getModNavOptions(url, params, siteId, courseId),
siteId,
},
);
Expand All @@ -137,7 +109,7 @@ export class CoreContentLinksModuleIndexHandler extends CoreContentLinksHandlerB
{
courseId,
modName: this.useModNameToGetModule ? this.modName : undefined,
modNavOptions: getModNavOptions(siteId),
modNavOptions: this.getModNavOptions(url, params, siteId, courseId),
siteId,
},
);
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 { Component, Input } from '@angular/core';
import { Component, HostBinding, Input } from '@angular/core';

/**
* Component to display the description of a module.
Expand Down Expand Up @@ -47,4 +47,8 @@ export class CoreCourseModuleDescriptionComponent {
@Input() contextInstanceId?: number; // The instance ID related to the context.
@Input() courseId?: number; // Course ID the text belongs to. It can be used to improve performance with filters.

@HostBinding('class.deprecated') get isDeprecated(): boolean {
return true;
};

}
8 changes: 0 additions & 8 deletions src/core/features/course/pages/index/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,6 @@ export class CoreCourseIndexPage implements OnInit, OnDestroy {

this.modNavOptions = CoreNavigator.getRouteParam<CoreNavigationOptions>('modNavOptions');
this.openModule = CoreNavigator.getRouteBooleanParam('openModule') ?? true; // If false, just scroll to module.
if (!this.modNavOptions) {
// Fallback to old way of passing params. @deprecated since 4.0.
const modParams = CoreNavigator.getRouteParam<Params>('modParams');
if (modParams) {
this.modNavOptions = { params: modParams };
}
}

this.currentPagePath = CoreNavigator.getCurrentPath();
this.contentsTab.page = CorePath.concatenatePaths(this.currentPagePath, this.contentsTab.page);
this.contentsTab.pageParams = {
Expand Down
Loading
Loading