diff --git a/src/app/core/login/pages/site/site.page.ts b/src/app/core/login/pages/site/site.page.ts index 158594e0d..67aef30cb 100644 --- a/src/app/core/login/pages/site/site.page.ts +++ b/src/app/core/login/pages/site/site.page.ts @@ -79,7 +79,7 @@ export class CoreLoginSitePage implements OnInit { // Load fixed sites if they're set. if (CoreLoginHelper.instance.hasSeveralFixedSites()) { url = this.initSiteSelector(); - } else if (CoreConstants.CONFIG.enableonboarding && !CoreApp.instance.isIOS() && !CoreApp.instance.isMac()) { + } else if (CoreConstants.CONFIG.enableonboarding && !CoreApp.instance.isIOS()) { this.initOnboarding(); } diff --git a/src/app/core/login/services/helper.ts b/src/app/core/login/services/helper.ts index 5c7d9609b..1d48d43fd 100644 --- a/src/app/core/login/services/helper.ts +++ b/src/app/core/login/services/helper.ts @@ -601,11 +601,6 @@ export class CoreLoginHelperProvider { * @return True if embedded browser, false othwerise. */ isSSOEmbeddedBrowser(code: number): boolean { - if (CoreApp.instance.isLinux()) { - // In Linux desktop app, always use embedded browser. - return true; - } - return code == CoreConstants.LOGIN_SSO_INAPP_CODE; } @@ -722,16 +717,11 @@ export class CoreLoginHelperProvider { oauthsso: params.id, }); - if (CoreApp.instance.isLinux()) { - // In Linux desktop app, always use embedded browser. - CoreUtils.instance.openInApp(loginUrl); - } else { - // Always open it in browser because the user might have the session stored in there. - CoreUtils.instance.openInBrowser(loginUrl); + // Always open it in browser because the user might have the session stored in there. + CoreUtils.instance.openInBrowser(loginUrl); - const nav = window.navigator; // eslint-disable-line @typescript-eslint/no-explicit-any - nav.app?.exitApp(); - } + const nav = window.navigator; // eslint-disable-line @typescript-eslint/no-explicit-any + nav.app?.exitApp(); return true; } @@ -1071,7 +1061,6 @@ export class CoreLoginHelperProvider { */ protected showMoodleAppNoticeModal(message: string): void { const storesConfig: CoreStoreConfig = CoreConstants.CONFIG.appstores; - storesConfig.desktop = 'https://download.moodle.org/desktop/'; storesConfig.mobile = 'https://download.moodle.org/mobile/'; storesConfig.default = 'https://download.moodle.org/mobile/'; diff --git a/src/app/core/settings/pages/about/about.page.ts b/src/app/core/settings/pages/about/about.page.ts index cf00be122..bc35c3244 100644 --- a/src/app/core/settings/pages/about/about.page.ts +++ b/src/app/core/settings/pages/about/about.page.ts @@ -33,7 +33,7 @@ export class CoreSettingsAboutPage { ) { const currentSite = CoreSites.instance.getCurrentSite(); - this.appName = CoreApp.instance.isDesktop() ? CoreConstants.CONFIG.desktopappname : CoreConstants.CONFIG.appname; + this.appName = CoreConstants.CONFIG.appname; this.versionName = CoreConstants.CONFIG.versionname; // Calculate the privacy policy to use. diff --git a/src/app/core/settings/pages/deviceinfo/deviceinfo.page.ts b/src/app/core/settings/pages/deviceinfo/deviceinfo.page.ts index 322fb6585..6149b260b 100644 --- a/src/app/core/settings/pages/deviceinfo/deviceinfo.page.ts +++ b/src/app/core/settings/pages/deviceinfo/deviceinfo.page.ts @@ -117,25 +117,14 @@ export class CoreSettingsDeviceInfoPage implements OnDestroy { } } } else { - this.deviceInfo.deviceType = appProvider.isDesktop() ? 'desktop' : 'browser'; - if (appProvider.isLinux()) { - this.deviceInfo.deviceOs = 'linux'; - this.deviceOsTranslated = 'Linux'; - } else if (appProvider.isMac()) { - this.deviceInfo.deviceOs = 'mac'; - this.deviceOsTranslated = 'MacOS'; - } else if (appProvider.isWindows()) { - this.deviceInfo.deviceOs = 'windows'; - this.deviceOsTranslated = 'Windows'; + this.deviceInfo.deviceType = 'browser'; + const matches = navigator.userAgent.match(/\(([^)]*)\)/); + if (matches && matches.length > 1) { + this.deviceInfo.deviceOs = matches[1]; + this.deviceOsTranslated = matches[1]; } else { - const matches = navigator.userAgent.match(/\(([^)]*)\)/); - if (matches && matches.length > 1) { - this.deviceInfo.deviceOs = matches[1]; - this.deviceOsTranslated = matches[1]; - } else { - this.deviceInfo.deviceOs = 'unknown'; - this.deviceOsTranslated = translate.instant('core.unknown'); - } + this.deviceInfo.deviceOs = 'unknown'; + this.deviceOsTranslated = translate.instant('core.unknown'); } } diff --git a/src/app/services/app.ts b/src/app/services/app.ts index 2862dc336..a22293047 100644 --- a/src/app/services/app.ts +++ b/src/app/services/app.ts @@ -226,22 +226,6 @@ export class CoreAppProvider { * @return Store URL. */ getAppStoreUrl(storesConfig: CoreStoreConfig): string | undefined { - if (this.isMac() && storesConfig.mac) { - return 'itms-apps://itunes.apple.com/app/' + storesConfig.mac; - } - - if (this.isWindows() && storesConfig.windows) { - return 'https://www.microsoft.com/p/' + storesConfig.windows; - } - - if (this.isLinux() && storesConfig.linux) { - return storesConfig.linux; - } - - if (this.isDesktop() && storesConfig.desktop) { - return storesConfig.desktop; - } - if (this.isIOS() && storesConfig.ios) { return 'itms-apps://itunes.apple.com/app/' + storesConfig.ios; } @@ -260,10 +244,11 @@ export class CoreAppProvider { /** * Checks if the app is running in a 64 bits desktop environment (not browser). * - * @return Whether the app is running in a 64 bits desktop environment (not browser). + * @return false. + * @deprecated Desktop support has been removed. */ is64Bits(): boolean { - return this.isDesktop() && window.process.arch == 'x64'; + return false; } /** @@ -278,10 +263,10 @@ export class CoreAppProvider { /** * Checks if the app is running in a desktop environment (not browser). * - * @return Whether the app is running in a desktop environment (not browser). + * @return false. + * @deprecated Desktop support has been removed. */ isDesktop(): boolean { - // @todo return false; } @@ -324,39 +309,21 @@ export class CoreAppProvider { /** * Check if the app is running in a Linux environment. * - * @return Whether it's running in a Linux environment. + * @return false. + * @deprecated Desktop support has been removed. */ isLinux(): boolean { - if (!this.isDesktop()) { - return false; - } - - try { - // @todo return require('os').platform().indexOf('linux') === 0; - - return false; - } catch (ex) { - return false; - } + return false; } /** * Check if the app is running in a Mac OS environment. * - * @return Whether it's running in a Mac OS environment. + * @return false. + * @deprecated Desktop support has been removed. */ isMac(): boolean { - if (!this.isDesktop()) { - return false; - } - - try { - // @todo return require('os').platform().indexOf('darwin') === 0; - - return false; - } catch (ex) { - return false; - } + return false; } /** @@ -435,20 +402,11 @@ export class CoreAppProvider { /** * Check if the app is running in a Windows environment. * - * @return Whether it's running in a Windows environment. + * @return false. + * @deprecated Desktop support has been removed. */ isWindows(): boolean { - if (!this.isDesktop()) { - return false; - } - - try { - // @todo return require('os').platform().indexOf('win') === 0; - - return false; - } catch (ex) { - return false; - } + return false; } /** @@ -724,26 +682,6 @@ export type CoreRedirectData = { * Store config data. */ export type CoreStoreConfig = { - /** - * ID of the Apple store where the desktop Mac app is uploaded. - */ - mac?: string; - - /** - * ID of the Windows store where the desktop Windows app is uploaded. - */ - windows?: string; - - /** - * Url with the desktop linux download link. - */ - linux?: string; - - /** - * Fallback URL when the desktop options is not set. - */ - desktop?: string; - /** * ID of the Apple store where the mobile iOS app is uploaded. */ diff --git a/src/app/services/cron.ts b/src/app/services/cron.ts index a4e6cdf38..fd13576ab 100644 --- a/src/app/services/cron.ts +++ b/src/app/services/cron.ts @@ -35,7 +35,6 @@ export class CoreCronDelegate { // Constants. static readonly DEFAULT_INTERVAL = 3600000; // Default interval is 1 hour. static readonly MIN_INTERVAL = 300000; // Minimum interval is 5 minutes. - static readonly DESKTOP_MIN_INTERVAL = 60000; // Minimum interval in desktop is 1 minute. static readonly MAX_TIME_PROCESS = 120000; // Max time a process can block the queue. Defaults to 2 minutes. // Variables for database. @@ -237,7 +236,7 @@ export class CoreCronDelegate { } // Don't allow intervals lower than the minimum. - const minInterval = CoreApp.instance.isDesktop() ? CoreCronDelegate.DESKTOP_MIN_INTERVAL : CoreCronDelegate.MIN_INTERVAL; + const minInterval = CoreCronDelegate.MIN_INTERVAL; const handlerInterval = this.handlers[name].getInterval!(); if (!handlerInterval) { diff --git a/src/app/services/file.ts b/src/app/services/file.ts index 6d9702625..980bc83d0 100644 --- a/src/app/services/file.ts +++ b/src/app/services/file.ts @@ -568,7 +568,7 @@ export class CoreFileProvider { // Create file (and parent folders) to prevent errors. const fileEntry = await this.createFile(path); - if (this.isHTMLAPI && !CoreApp.instance.isDesktop() && + if (this.isHTMLAPI && (typeof data == 'string' || data.toString() == '[object ArrayBuffer]')) { // We need to write Blobs. const extension = CoreMimetypeUtils.instance.getFileExtension(path); diff --git a/src/app/services/filepool.ts b/src/app/services/filepool.ts index f1b2ec9f2..6baddc81c 100644 --- a/src/app/services/filepool.ts +++ b/src/app/services/filepool.ts @@ -1756,12 +1756,8 @@ export class CoreFilepoolProvider { const path = await this.getFilePath(siteId, fileId); const fileEntry = await CoreFile.instance.getFile(path); - // This URL is usually used to launch files or put them in HTML. In desktop we need the internal URL. - if (CoreApp.instance.isDesktop()) { - return fileEntry.toInternalURL(); - } else { - return fileEntry.toURL(); - } + // This URL is usually used to launch files or put them in HTML. + return fileEntry.toURL(); } /** @@ -2937,11 +2933,6 @@ export class CoreFilepoolProvider { return; } - if (CoreApp.instance.isDesktop()) { - // In desktop always download first. - return; - } - const mimetype = await CoreUtils.instance.getMimeTypeFromUrl(url); // If the file is streaming (audio or video) we reject. if (mimetype.indexOf('video') != -1 || mimetype.indexOf('audio') != -1) { diff --git a/src/app/services/local-notifications.ts b/src/app/services/local-notifications.ts index 2c38641f7..5f1c7e3d7 100644 --- a/src/app/services/local-notifications.ts +++ b/src/app/services/local-notifications.ts @@ -222,8 +222,7 @@ export class CoreLocalNotificationsProvider { */ canDisableSound(): boolean { // Only allow disabling sound in Android 7 or lower. In iOS and Android 8+ it can easily be done with system settings. - return this.isAvailable() &&!CoreApp.instance.isDesktop() && CoreApp.instance.isAndroid() && - Number(Device.instance.version?.split('.')[0]) < 8; + return this.isAvailable() && CoreApp.instance.isAndroid() && Number(Device.instance.version?.split('.')[0]) < 8; } /** @@ -363,7 +362,7 @@ export class CoreLocalNotificationsProvider { isAvailable(): boolean { const win = window; // eslint-disable-line @typescript-eslint/no-explicit-any - return CoreApp.instance.isDesktop() || !!win.cordova?.plugins?.notification?.local; + return !!win.cordova?.plugins?.notification?.local; } /** diff --git a/src/app/services/sites.ts b/src/app/services/sites.ts index 9292eacf4..71604d276 100644 --- a/src/app/services/sites.ts +++ b/src/app/services/sites.ts @@ -888,7 +888,6 @@ export class CoreSitesProvider { const storesConfig: CoreStoreConfig = { android: config.tool_mobile_androidappid, ios: config.tool_mobile_iosappid, - desktop: config.tool_mobile_setuplink || 'https://download.moodle.org/desktop/', mobile: config.tool_mobile_setuplink || 'https://download.moodle.org/mobile/', default: config.tool_mobile_setuplink, }; diff --git a/src/app/services/utils/dom.ts b/src/app/services/utils/dom.ts index 5dfa487d2..7a07f95a4 100644 --- a/src/app/services/utils/dom.ts +++ b/src/app/services/utils/dom.ts @@ -144,11 +144,6 @@ export class CoreDomUtilsProvider { const readableSize = CoreTextUtils.instance.bytesToSize(size.size, 2); const getAvailableBytes = async (): Promise => { - if (CoreApp.instance.isDesktop()) { - // Free space calculation is not supported on desktop. - return null; - } - const availableBytes = await CoreFile.instance.calculateFreeSpace(); if (CoreApp.instance.isAndroid()) { diff --git a/src/app/services/utils/utils.ts b/src/app/services/utils/utils.ts index 84f793f3e..e8eedbb87 100644 --- a/src/app/services/utils/utils.ts +++ b/src/app/services/utils/utils.ts @@ -227,15 +227,10 @@ export class CoreUtilsProvider { /** * Close the InAppBrowser window. - * - * @param closeAll Desktop only. True to close all secondary windows, false to close only the "current" one. */ - closeInAppBrowser(closeAll?: boolean): void { + closeInAppBrowser(): void { if (this.iabInstance) { this.iabInstance.close(); - if (closeAll && CoreApp.instance.isDesktop()) { - // @todo require('electron').ipcRenderer.send('closeSecondaryWindows'); - } } } @@ -959,7 +954,7 @@ export class CoreUtilsProvider { this.iabInstance = InAppBrowser.instance.create(url, '_blank', options); - if (CoreApp.instance.isDesktop() || CoreApp.instance.isMobile()) { + if (CoreApp.instance.isMobile()) { let loadStopSubscription; const loadStartUrls: string[] = []; @@ -1011,11 +1006,7 @@ export class CoreUtilsProvider { * @param url The URL to open. */ openInBrowser(url: string): void { - if (CoreApp.instance.isDesktop()) { - // @todo - } else { - window.open(url, '_system'); - } + window.open(url, '_system'); } /** @@ -1513,7 +1504,7 @@ export class CoreUtilsProvider { if (!CoreApp.instance.isMobile()) { - return Promise.reject('QRScanner isn\'t available in desktop apps.'); + return Promise.reject('QRScanner isn\'t available in browser.'); } // Ask the user for permission to use the camera. diff --git a/src/types/global.d.ts b/src/types/global.d.ts index 1e05ea6d4..19e8234c4 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -27,7 +27,6 @@ declare global { CONFIG: { app_id: string; appname: string; - desktopappname: string; versioncode: number; versionname: string; cache_update_frequency_usually: number;