Merge pull request #3801 from crazyserver/MOBILE-4362

Mobile 4362
main
Dani Palou 2023-10-02 16:46:16 +02:00 committed by GitHub
commit 7667774a2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 4 additions and 465 deletions

View File

@ -2136,7 +2136,7 @@
"core.login.signupplugindisabled": "local_moodlemobileapp",
"core.login.signuprequiredfieldnotsupported": "local_moodlemobileapp",
"core.login.siteaddress": "local_moodlemobileapp",
"core.login.siteaddressplaceholder": "donottranslate",
"core.login.siteaddressplaceholder": "local_moodlemobileapp",
"core.login.sitebadgedescription": "local_moodlemobileapp",
"core.login.sitehasredirect": "local_moodlemobileapp",
"core.login.siteinmaintenance": "local_moodlemobileapp",

View File

@ -612,7 +612,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide
let lastOnlineWasFinished = false;
// Sync offline logs.
await CoreUtils.ignoreErrors(CoreCourseLogHelper.syncIfNeeded(AddonModScormProvider.COMPONENT, scorm.id, siteId));
await CoreUtils.ignoreErrors(CoreCourseLogHelper.syncActivity(AddonModScormProvider.COMPONENT, scorm.id, siteId));
// Get attempts data. We ignore cache for online attempts, so this call will fail if offline or server down.
const attemptsData = await AddonModScorm.getAttemptCount(scorm.id, {

View File

@ -129,18 +129,6 @@ export class CoreInfiniteLoadingComponent implements OnChanges {
this.checkScrollDistance();
}
/**
* Get the height of the element.
*
* @returns Height.
* @todo erase if not needed: I'm depreacating it because if not needed or getBoundingClientRect has the same result, it should
* be erased, also with getElementHeight
* @deprecated since 3.9.5
*/
getHeight(): number {
return this.hostElement.getBoundingClientRect().height;
}
/**
* Get the infinite scroll element.
*

View File

@ -62,7 +62,6 @@ export class CoreConstants {
static readonly DOWNLOAD_THRESHOLD = 10485760; // 10MB.
static readonly MINIMUM_FREE_SPACE = 10485760; // 10MB.
static readonly IOS_FREE_SPACE_THRESHOLD = 524288000; // 500MB.
static readonly DONT_SHOW_ERROR = 'CoreDontShowError'; // @deprecated since 3.9.5. Use CoreSilentError instead.
static readonly NO_SITE_ID = 'NoSite';
// Settings constants.

View File

@ -19,7 +19,6 @@ import { CoreContentLinksDelegate, CoreContentLinksAction } from './contentlinks
import { CoreSite } from '@classes/site';
import { makeSingleton, Translate } from '@singletons';
import { CoreNavigator } from '@services/navigator';
import { Params } from '@angular/router';
import { CoreContentLinksChooseSiteModalComponent } from '../components/choose-site-modal/choose-site-modal';
import { CoreCustomURLSchemes } from '@services/urlschemes';
@ -90,21 +89,6 @@ export class CoreContentLinksHelperProvider {
return actions.find((action) => action && action.sites && action.sites.length);
}
/**
* Goes to a certain page in a certain site. If the site is current site it will perform a regular navigation,
* otherwise it will 'redirect' to the other site.
*
* @param navCtrlUnused Deprecated param.
* @param pageName Name of the page to go.
* @param pageParams Params to send to the page.
* @param siteId Site ID. If not defined, current site.
* @returns Promise resolved when done.
* @deprecated since 3.9.5. Use CoreNavigator.navigateToSitePath instead.
*/
async goInSite(navCtrlUnused: unknown, pageName: string, pageParams: Params, siteId?: string): Promise<void> {
await CoreNavigator.navigateToSitePath(pageName, { params: pageParams, siteId });
}
/**
* Go to the page to choose a site.
*

View File

@ -179,21 +179,4 @@ export class CoreCourseActivityPrefetchHandlerBase extends CoreCourseModulePrefe
await CoreFilepool.setPackagePreviousStatus(siteId, this.component, id);
}
/**
* Set previous status and return a rejected promise.
*
* @param id Unique identifier per component.
* @param error Error to throw.
* @param siteId Site ID. If not defined, current site.
* @returns Rejected promise.
* @deprecated since 3.9.5. Use setPreviousStatus instead.
*/
async setPreviousStatusAndReject(id: number, error?: Error, siteId?: string): Promise<never> {
siteId = siteId || CoreSites.getCurrentSiteId();
await CoreFilepool.setPackagePreviousStatus(siteId, this.component, id);
throw error;
}
}

View File

@ -299,19 +299,6 @@ export class CoreCourseLogHelperProvider {
return this.syncLogs(unique, siteId);
}
/**
* Sync the offline saved activity logs.
*
* @param component Component name.
* @param componentId Component ID.
* @param siteId Site ID. If not defined, current site.
* @returns Promise resolved when done.
* @deprecated since 3.9.5. Please use syncActivity instead.
*/
syncIfNeeded(component: string, componentId: number, siteId?: string): Promise<void> {
return this.syncActivity(component, componentId, siteId);
}
/**
* Sync the offline saved activity logs.
*

View File

@ -238,20 +238,6 @@ export interface CoreCourseModuleHandlerButton {
*/
hidden?: boolean;
/**
* The name of the button icon to use in iOS instead of "icon".
*
* @deprecated since 3.9.5. Now the icon must be the same for all platforms.
*/
iosIcon?: string;
/**
* The name of the button icon to use in MaterialDesign instead of "icon".
*
* @deprecated since 3.9.5. Now the icon must be the same for all platforms.
*/
mdIcon?: string;
/**
* Action to perform when the button is clicked.
*

View File

@ -445,17 +445,6 @@ export class CoreFileUploaderProvider {
}
}
/**
* Mark files as offline.
*
* @param files Files to mark as offline.
* @returns Files marked as offline.
* @deprecated since 3.9.5. Now stored files no longer have an offline property.
*/
markOfflineFiles(files: FileEntry[]): FileEntry[] {
return files;
}
/**
* Parse filetypeList to get the list of allowed mimetypes and the data to render information.
*

View File

@ -208,31 +208,6 @@ export class CoreSettingsHelperProvider {
return totalEntries;
}
/**
* Get a certain processor from a list of processors.
*
* @param processors List of processors.
* @param name Name of the processor to get.
* @param fallback True to return first processor if not found, false to not return any. Defaults to true.
* @deprecated since 3.9.5. This function has been moved to AddonNotificationsHelperProvider.
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
getProcessor(processors: unknown[], name: string, fallback: boolean = true): void {
return;
}
/**
* Return the components and notifications that have a certain processor.
*
* @param processorName Name of the processor to filter.
* @param components Array of components.
* @returns Filtered components.
* @deprecated since 3.9.5. This function has been moved to AddonNotificationsHelperProvider.
*/
getProcessorComponents(processorName: string, components: unknown[]): unknown[] {
return components;
}
/**
* Get the synchronization promise of a site.
*

View File

@ -20,7 +20,7 @@ import { AddonModAssignSubmissionDelegate } from '@addons/mod/assign/services/su
import { AddonModQuizAccessRuleDelegate } from '@addons/mod/quiz/services/access-rules-delegate';
import { CoreDelegate, CoreDelegateHandler } from '@classes/delegate';
import { CoreError } from '@classes/errors/error';
import { CoreSite, CoreSiteWSPreSets } from '@classes/site';
import { CoreSiteWSPreSets } from '@classes/site';
import { CoreBlockDelegate } from '@features/block/services/block-delegate';
import { CoreCompile } from '@features/compile/services/compile';
import { CoreCourseOptionsDelegate } from '@features/course/services/course-options-delegate';
@ -293,17 +293,6 @@ export class CoreSitePluginsHelperProvider {
return result;
}
/**
* Fetch site plugins.
*
* @param siteId Site ID. If not defined, current site.
* @returns Promise resolved when done. Returns the list of plugins to load.
* @deprecated since 3.9.5. The function was moved to CoreSitePlugins.getPlugins.
*/
async fetchSitePlugins(siteId?: string): Promise<CoreSitePluginsPlugin[]> {
return CoreSitePlugins.getPlugins(siteId);
}
/**
* Given an addon name, return the prefix to add to its string keys.
*
@ -329,18 +318,6 @@ export class CoreSitePluginsHelperProvider {
return this.getPrefixForStrings(addon) + key;
}
/**
* Check if a certain plugin is a site plugin and it's enabled in a certain site.
*
* @param plugin Data of the plugin.
* @param site Site affected.
* @returns Whether it's a site plugin and it's enabled.
* @deprecated since 3.9.5. The function was moved to CoreSitePlugins.isSitePluginEnabled.
*/
isSitePluginEnabled(plugin: CoreSitePluginsPlugin, site: CoreSite): boolean {
return CoreSitePlugins.isSitePluginEnabled(plugin, site);
}
/**
* Load the lang strings for a plugin.
*

View File

@ -189,16 +189,6 @@ export class CoreAppProvider {
return this.db;
}
/**
* Get an ID for a main menu.
*
* @returns Main menu ID.
* @deprecated since 3.9.5. No longer supported.
*/
getMainMenuId(): number {
return 0;
}
/**
* Get app store URL.
*
@ -231,16 +221,6 @@ export class CoreAppProvider {
return CorePlatform.getPlatformMajorVersion();
}
/**
* Checks if the app is running in a 64 bits desktop environment (not browser).
*
* @returns false.
* @deprecated since 3.9.5 Desktop support has been removed.
*/
is64Bits(): boolean {
return false;
}
/**
* Checks if the app is running in an Android mobile or tablet device.
*
@ -251,16 +231,6 @@ export class CoreAppProvider {
return CorePlatform.isAndroid();
}
/**
* Checks if the app is running in a desktop environment (not browser).
*
* @returns false.
* @deprecated since 3.9.5 Desktop support has been removed.
*/
isDesktop(): boolean {
return false;
}
/**
* Checks if the app is running in an iOS mobile or tablet device.
*
@ -298,36 +268,6 @@ export class CoreAppProvider {
return this.isKeyboardShown;
}
/**
* Check if the app is running in a Linux environment.
*
* @returns false.
* @deprecated since 3.9.5 Desktop support has been removed.
*/
isLinux(): boolean {
return false;
}
/**
* Check if the app is running in a Mac OS environment.
*
* @returns false.
* @deprecated since 3.9.5 Desktop support has been removed.
*/
isMac(): boolean {
return false;
}
/**
* Check if the main menu is open.
*
* @returns Whether the main menu is open.
* @deprecated since 3.9.5. No longer supported.
*/
isMainMenuOpen(): boolean {
return false;
}
/**
* Checks if the app is running in a mobile or tablet device (Cordova).
*
@ -377,16 +317,6 @@ export class CoreAppProvider {
return CoreNetwork.isWifi();
}
/**
* Check if the app is running in a Windows environment.
*
* @returns false.
* @deprecated since 3.9.5 Desktop support has been removed.
*/
isWindows(): boolean {
return false;
}
/**
* Open the keyboard.
*/
@ -609,21 +539,6 @@ export class CoreAppProvider {
}
}
/**
* Register a back button action.
* This function is deprecated and no longer works. You should now use Ionic events directly, please see:
* https://ionicframework.com/docs/developing/hardware-back-button
*
* @param callback Called when the back button is pressed.
* @param priority Priority.
* @returns A function that, when called, will unregister the back button action.
* @deprecated since 3.9.5
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
registerBackButtonAction(callback: () => boolean, priority = 0): () => boolean {
return () => false;
}
/**
* Set System UI Colors.
*/
@ -652,15 +567,6 @@ export class CoreAppProvider {
StatusBar.backgroundColorByHexString(color);
}
/**
* Reset StatusBar color if any was set.
*
* @deprecated since 3.9.5. Use setStatusBarColor passing the color of the new statusbar color, or no color to reset.
*/
resetStatusBarColor(): void {
this.setStatusBarColor();
}
/**
* Set value of forceOffline flag. If true, the app will think the device is offline.
*

View File

@ -71,28 +71,6 @@ export const enum CoreFileFormat {
@Injectable({ providedIn: 'root' })
export class CoreFileProvider {
// Formats to read a file.
/**
* @deprecated since 3.9.5, use CoreFileFormat directly.
*/
static readonly FORMATTEXT = CoreFileFormat.FORMATTEXT;
/**
* @deprecated since 3.9.5, use CoreFileFormat directly.
*/
static readonly FORMATDATAURL = CoreFileFormat.FORMATDATAURL;
/**
* @deprecated since 3.9.5, use CoreFileFormat directly.
*/
static readonly FORMATBINARYSTRING = CoreFileFormat.FORMATBINARYSTRING;
/**
* @deprecated since 3.9.5, use CoreFileFormat directly.
*/
static readonly FORMATARRAYBUFFER = CoreFileFormat.FORMATARRAYBUFFER;
/**
* @deprecated since 3.9.5, use CoreFileFormat directly.
*/
static readonly FORMATJSON = CoreFileFormat.FORMATJSON;
// Folders.
static readonly SITESFOLDER = 'sites';
static readonly TMPFOLDER = 'tmp';

View File

@ -2839,27 +2839,6 @@ export class CoreFilepoolProvider {
(CoreNetwork.isWifi() && size <= CoreFilepoolProvider.WIFI_DOWNLOAD_THRESHOLD);
}
/**
* Convenience function to check if a file should be downloaded before opening it.
*
* @param url File online URL.
* @param size File size.
* @returns Promise resolved if should download before open, rejected otherwise.
* @deprecated since 3.9.5. Please use shouldDownloadFileBeforeOpen instead.
*/
async shouldDownloadBeforeOpen(url: string, size: number): Promise<void> {
if (size >= 0 && size <= CoreFilepoolProvider.DOWNLOAD_THRESHOLD) {
// The file is small, download it.
return;
}
const mimetype = await CoreUtils.getMimeTypeFromUrl(url);
// If the file is streaming (audio or video) we reject.
if (CoreMimetypeUtils.isStreamedMimetype(mimetype)) {
throw new CoreError('File is audio or video.');
}
}
/**
* Convenience function to check if a file should be downloaded before opening it.
*

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { Injectable, SimpleChange, ElementRef, KeyValueChanges } from '@angular/core';
import { Injectable, SimpleChange, KeyValueChanges } from '@angular/core';
import { IonContent } from '@ionic/angular';
import { ModalOptions, PopoverOptions, AlertOptions, AlertButton, TextFieldTypes, getMode, ToastOptions } from '@ionic/core';
import { Md5 } from 'ts-md5';
@ -43,7 +43,6 @@ import { CoreFileSizeSum } from '@services/plugin-file-delegate';
import { CoreNetworkError } from '@classes/errors/network-error';
import { CoreBSTooltipComponent } from '@components/bs-tooltip/bs-tooltip';
import { CoreViewerImageComponent } from '@features/viewer/components/image/image';
import { CoreFormFields, CoreForms } from '../../singletons/form';
import { CoreModalLateralTransitionEnter, CoreModalLateralTransitionLeave } from '@classes/modal-lateral-transition';
import { CoreZoomLevel } from '@features/settings/services/settings-helper';
import { CoreSites } from '@services/sites';
@ -226,16 +225,6 @@ export class CoreDomUtilsProvider {
return <HTMLElement> this.template.content.children[0];
}
/**
* Create a "cancelled" error. These errors won't display an error message in showErrorModal functions.
*
* @returns The error object.
* @deprecated since 3.9.5. Just create the error directly.
*/
createCanceledError(): CoreCanceledError {
return new CoreCanceledError('');
}
/**
* Given a list of changes for a component input detected by a KeyValueDiffers, create an object similar to the one
* passed to the ngOnChanges functions.
@ -395,17 +384,6 @@ export class CoreDomUtilsProvider {
}
}
/**
* Get the data from a form. It will only collect elements that have a name.
*
* @param form The form to get the data from.
* @returns Object with the data. The keys are the names of the inputs.
* @deprecated since 3.9.5. Function has been moved to CoreForms.
*/
getDataFromForm(form: HTMLFormElement): CoreFormFields {
return CoreForms.getDataFromForm(form);
}
/**
* Returns the attribute value of a string element. Only the first element will be selected.
*
@ -648,11 +626,6 @@ export class CoreDomUtilsProvider {
errorMessage = error;
}
if (errorMessage == CoreConstants.DONT_SHOW_ERROR) {
// The error shouldn't be shown, stop.
return null;
}
let message = CoreTextUtils.decodeHTML(needsTranslate ? Translate.instant(errorMessage) : errorMessage);
if (extraInfo) {
@ -814,16 +787,6 @@ export class CoreDomUtilsProvider {
return !!enabled;
}
/**
* Check if rich text editor is supported in the platform.
*
* @returns Whether it's supported.
* @deprecated since 3.9.5
*/
isRichTextEditorSupported(): boolean {
return true;
}
/**
* Move children from one HTMLElement to another.
*
@ -982,44 +945,6 @@ export class CoreDomUtilsProvider {
return element.innerHTML;
}
/**
* Scroll to somehere in the content.
*
* @param content Content to scroll.
* @param x The x-value to scroll to.
* @param y The y-value to scroll to.
* @param duration Duration of the scroll animation in milliseconds.
* @returns Returns a promise which is resolved when the scroll has completed.
* @deprecated since 3.9.5. Use directly the IonContent class.
*/
scrollTo(content: IonContent, x: number, y: number, duration = 0): Promise<void> {
return content.scrollToPoint(x, y, duration);
}
/**
* Scroll to Bottom of the content.
*
* @param content Content to scroll.
* @param duration Duration of the scroll animation in milliseconds.
* @returns Returns a promise which is resolved when the scroll has completed.
* @deprecated since 3.9.5. Use directly the IonContent class.
*/
scrollToBottom(content: IonContent, duration = 0): Promise<void> {
return content.scrollToBottom(duration);
}
/**
* Scroll to Top of the content.
*
* @param content Content to scroll.
* @param duration Duration of the scroll animation in milliseconds.
* @returns Returns a promise which is resolved when the scroll has completed.
* @deprecated since 3.9.5. Use directly the IonContent class.
*/
scrollToTop(content: IonContent, duration = 0): Promise<void> {
return content.scrollToTop(duration);
}
/**
* Returns height of the content.
*
@ -2041,29 +1966,6 @@ export class CoreDomUtilsProvider {
wrapper.appendChild(el);
}
/**
* Trigger form cancelled event.
*
* @param formRef Form element.
* @param siteId The site affected. If not provided, no site affected.
* @deprecated since 3.9.5. Function has been moved to CoreForms.
*/
triggerFormCancelledEvent(formRef: ElementRef | HTMLFormElement | undefined, siteId?: string): void {
CoreForms.triggerFormCancelledEvent(formRef, siteId);
}
/**
* Trigger form submitted event.
*
* @param formRef Form element.
* @param online Whether the action was done in offline or not.
* @param siteId The site affected. If not provided, no site affected.
* @deprecated since 3.9.5. Function has been moved to CoreForms.
*/
triggerFormSubmittedEvent(formRef: ElementRef | HTMLFormElement | undefined, online?: boolean, siteId?: string): void {
CoreForms.triggerFormSubmittedEvent(formRef, online, siteId);
}
/**
* In iOS the resize event is triggered before the window size changes. Wait for the size to change.
* Use of this function is discouraged. Please use CoreDom.onWindowResize to check window resize event.

View File

@ -23,7 +23,6 @@ import { Locutus } from '@singletons/locutus';
import { CoreViewerTextComponent } from '@features/viewer/components/text/text';
import { CoreFileHelper } from '@services/file-helper';
import { CoreDomUtils } from './dom';
import { CoreText } from '@singletons/text';
import { CoreUrl } from '@singletons/url';
import { AlertButton } from '@ionic/angular';
import { CorePath } from '@singletons/path';
@ -473,43 +472,6 @@ export class CoreTextUtilsProvider {
.replace(/'/g, '&#039;');
}
/**
* Shows a text on a new page.
*
* @param title Title of the new state.
* @param text Content of the text to be expanded.
* @param component Component to link the embedded files to.
* @param componentId An ID to use in conjunction with the component.
* @param files List of files to display along with the text.
* @param filter Whether the text should be filtered.
* @param contextLevel The context level.
* @param instanceId The instance ID related to the context.
* @param courseId Course ID the text belongs to. It can be used to improve performance with filters.
* @returns Promise resolved when done.
* @deprecated since 3.8.3. Please use viewText instead.
*/
expandText(
title: string,
text: string,
component?: string,
componentId?: string | number,
files?: CoreWSFile[],
filter?: boolean,
contextLevel?: string,
instanceId?: number,
courseId?: number,
): Promise<void> {
return this.viewText(title, text, {
component,
componentId,
files,
filter,
contextLevel,
instanceId,
courseId,
});
}
/**
* Formats a text, in HTML replacing new lines by correct html new lines.
*
@ -720,17 +682,6 @@ export class CoreTextUtilsProvider {
throw new CoreError('JSON cannot be parsed and not default value has been provided') ;
}
/**
* Remove ending slash from a path or URL.
*
* @param text Text to treat.
* @returns Treated text.
* @deprecated since 3.9.5. Use CoreText instead.
*/
removeEndingSlash(text?: string): string {
return CoreText.removeEndingSlash(text);
}
/**
* Replace all characters that cause problems with files in Android and iOS.
*

View File

@ -24,7 +24,6 @@ import { CoreWS } from '@services/ws';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreMimetypeUtils } from '@services/utils/mimetype';
import { CoreTextUtils } from '@services/utils/text';
import { CoreWSError } from '@classes/errors/wserror';
import { makeSingleton, Clipboard, InAppBrowser, FileOpener, WebIntent, QRScanner, Translate, NgZone } from '@singletons';
import { CoreLogger } from '@singletons/logger';
import { CoreViewerQRScannerComponent } from '@features/viewer/components/qr-scanner/qr-scanner';
@ -384,18 +383,6 @@ export class CoreUtilsProvider {
CoreDomUtils.showToast('core.copiedtoclipboard', true);
}
/**
* Create a "fake" WS error for local errors.
*
* @param message The message to include in the error.
* @param needsTranslate If the message needs to be translated.
* @returns Fake WS error.
* @deprecated since 3.9.5. Just create the error directly.
*/
createFakeWSError(message: string, needsTranslate?: boolean): CoreWSError {
return CoreWS.createFakeWSError(message, needsTranslate);
}
/**
* Empties an array without losing its reference.
*

View File

@ -208,23 +208,6 @@ export class CoreWSProvider {
return result;
}
/**
* Create a "fake" WS error for local errors.
*
* @param message The message to include in the error.
* @param needsTranslate If the message needs to be translated.
* @param translateParams Translation params, if needed.
* @returns Fake WS error.
* @deprecated since 3.9.5. Just create the error directly.
*/
createFakeWSError(message: string, needsTranslate?: boolean, translateParams?: {[name: string]: string}): CoreError {
if (needsTranslate) {
message = Translate.instant(message, translateParams);
}
return new CoreError(message);
}
/**
* It will check if response has failed and throw the propper error.
*

View File

@ -13,7 +13,6 @@
// limitations under the License.
import { CoreContentLinksHelper } from '@features/contentlinks/services/contentlinks-helper';
import { NavController } from '@ionic/angular';
import { CoreConfig } from '@services/config';
import { CoreFileHelper } from '@services/file-helper';
@ -24,20 +23,6 @@ import { CoreUtils } from '@services/utils/utils';
import { Translate } from '@singletons';
import { CoreConstants } from '../constants';
/**
* Options for the open function.
*
* @deprecated since 3.9.5
*/
export type CoreWindowOpenOptions = {
/**
* NavController to use when opening the link in the app.
*
* @deprecated since 3.9.5
*/
navCtrl?: NavController;
};
/**
* Singleton with helper functions for windows.
*/