MOBILE-3565 core: Drop desktop support
parent
14decb9c01
commit
7008be6536
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
const nav = <any> 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/';
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -117,17 +117,7 @@ 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';
|
||||
} else {
|
||||
this.deviceInfo.deviceType = 'browser';
|
||||
const matches = navigator.userAgent.match(/\(([^)]*)\)/);
|
||||
if (matches && matches.length > 1) {
|
||||
this.deviceInfo.deviceOs = matches[1];
|
||||
|
@ -137,7 +127,6 @@ export class CoreSettingsDeviceInfoPage implements OnDestroy {
|
|||
this.deviceOsTranslated = translate.instant('core.unknown');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (navigator) {
|
||||
if (navigator.userAgent) {
|
||||
|
|
|
@ -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,41 +309,23 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the main menu is open.
|
||||
*
|
||||
|
@ -435,22 +402,13 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the keyboard.
|
||||
*/
|
||||
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1756,13 +1756,9 @@ 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 {
|
||||
// This URL is usually used to launch files or put them in HTML.
|
||||
return fileEntry.toURL();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the local URL of a file.
|
||||
|
@ -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) {
|
||||
|
|
|
@ -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 = <any> window; // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
|
||||
return CoreApp.instance.isDesktop() || !!win.cordova?.plugins?.notification?.local;
|
||||
return !!win.cordova?.plugins?.notification?.local;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
|
|
|
@ -144,11 +144,6 @@ export class CoreDomUtilsProvider {
|
|||
const readableSize = CoreTextUtils.instance.bytesToSize(size.size, 2);
|
||||
|
||||
const getAvailableBytes = async (): Promise<number | null> => {
|
||||
if (CoreApp.instance.isDesktop()) {
|
||||
// Free space calculation is not supported on desktop.
|
||||
return null;
|
||||
}
|
||||
|
||||
const availableBytes = await CoreFile.instance.calculateFreeSpace();
|
||||
|
||||
if (CoreApp.instance.isAndroid()) {
|
||||
|
|
|
@ -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,12 +1006,8 @@ export class CoreUtilsProvider {
|
|||
* @param url The URL to open.
|
||||
*/
|
||||
openInBrowser(url: string): void {
|
||||
if (CoreApp.instance.isDesktop()) {
|
||||
// @todo
|
||||
} else {
|
||||
window.open(url, '_system');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Open an online file using platform specific method.
|
||||
|
@ -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.
|
||||
|
|
|
@ -27,7 +27,6 @@ declare global {
|
|||
CONFIG: {
|
||||
app_id: string;
|
||||
appname: string;
|
||||
desktopappname: string;
|
||||
versioncode: number;
|
||||
versionname: string;
|
||||
cache_update_frequency_usually: number;
|
||||
|
|
Loading…
Reference in New Issue