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.
|
// Load fixed sites if they're set.
|
||||||
if (CoreLoginHelper.instance.hasSeveralFixedSites()) {
|
if (CoreLoginHelper.instance.hasSeveralFixedSites()) {
|
||||||
url = this.initSiteSelector();
|
url = this.initSiteSelector();
|
||||||
} else if (CoreConstants.CONFIG.enableonboarding && !CoreApp.instance.isIOS() && !CoreApp.instance.isMac()) {
|
} else if (CoreConstants.CONFIG.enableonboarding && !CoreApp.instance.isIOS()) {
|
||||||
this.initOnboarding();
|
this.initOnboarding();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -601,11 +601,6 @@ export class CoreLoginHelperProvider {
|
||||||
* @return True if embedded browser, false othwerise.
|
* @return True if embedded browser, false othwerise.
|
||||||
*/
|
*/
|
||||||
isSSOEmbeddedBrowser(code: number): boolean {
|
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;
|
return code == CoreConstants.LOGIN_SSO_INAPP_CODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -722,16 +717,11 @@ export class CoreLoginHelperProvider {
|
||||||
oauthsso: params.id,
|
oauthsso: params.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (CoreApp.instance.isLinux()) {
|
// Always open it in browser because the user might have the session stored in there.
|
||||||
// In Linux desktop app, always use embedded browser.
|
CoreUtils.instance.openInBrowser(loginUrl);
|
||||||
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
|
const nav = <any> window.navigator; // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||||
nav.app?.exitApp();
|
nav.app?.exitApp();
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1071,7 +1061,6 @@ export class CoreLoginHelperProvider {
|
||||||
*/
|
*/
|
||||||
protected showMoodleAppNoticeModal(message: string): void {
|
protected showMoodleAppNoticeModal(message: string): void {
|
||||||
const storesConfig: CoreStoreConfig = CoreConstants.CONFIG.appstores;
|
const storesConfig: CoreStoreConfig = CoreConstants.CONFIG.appstores;
|
||||||
storesConfig.desktop = 'https://download.moodle.org/desktop/';
|
|
||||||
storesConfig.mobile = 'https://download.moodle.org/mobile/';
|
storesConfig.mobile = 'https://download.moodle.org/mobile/';
|
||||||
storesConfig.default = 'https://download.moodle.org/mobile/';
|
storesConfig.default = 'https://download.moodle.org/mobile/';
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ export class CoreSettingsAboutPage {
|
||||||
) {
|
) {
|
||||||
const currentSite = CoreSites.instance.getCurrentSite();
|
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;
|
this.versionName = CoreConstants.CONFIG.versionname;
|
||||||
|
|
||||||
// Calculate the privacy policy to use.
|
// Calculate the privacy policy to use.
|
||||||
|
|
|
@ -117,25 +117,14 @@ export class CoreSettingsDeviceInfoPage implements OnDestroy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.deviceInfo.deviceType = appProvider.isDesktop() ? 'desktop' : 'browser';
|
this.deviceInfo.deviceType = 'browser';
|
||||||
if (appProvider.isLinux()) {
|
const matches = navigator.userAgent.match(/\(([^)]*)\)/);
|
||||||
this.deviceInfo.deviceOs = 'linux';
|
if (matches && matches.length > 1) {
|
||||||
this.deviceOsTranslated = 'Linux';
|
this.deviceInfo.deviceOs = matches[1];
|
||||||
} else if (appProvider.isMac()) {
|
this.deviceOsTranslated = matches[1];
|
||||||
this.deviceInfo.deviceOs = 'mac';
|
|
||||||
this.deviceOsTranslated = 'MacOS';
|
|
||||||
} else if (appProvider.isWindows()) {
|
|
||||||
this.deviceInfo.deviceOs = 'windows';
|
|
||||||
this.deviceOsTranslated = 'Windows';
|
|
||||||
} else {
|
} else {
|
||||||
const matches = navigator.userAgent.match(/\(([^)]*)\)/);
|
this.deviceInfo.deviceOs = 'unknown';
|
||||||
if (matches && matches.length > 1) {
|
this.deviceOsTranslated = translate.instant('core.unknown');
|
||||||
this.deviceInfo.deviceOs = matches[1];
|
|
||||||
this.deviceOsTranslated = matches[1];
|
|
||||||
} else {
|
|
||||||
this.deviceInfo.deviceOs = 'unknown';
|
|
||||||
this.deviceOsTranslated = translate.instant('core.unknown');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -226,22 +226,6 @@ export class CoreAppProvider {
|
||||||
* @return Store URL.
|
* @return Store URL.
|
||||||
*/
|
*/
|
||||||
getAppStoreUrl(storesConfig: CoreStoreConfig): string | undefined {
|
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) {
|
if (this.isIOS() && storesConfig.ios) {
|
||||||
return 'itms-apps://itunes.apple.com/app/' + 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).
|
* 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 {
|
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).
|
* 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 {
|
isDesktop(): boolean {
|
||||||
// @todo
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,39 +309,21 @@ export class CoreAppProvider {
|
||||||
/**
|
/**
|
||||||
* Check if the app is running in a Linux environment.
|
* 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 {
|
isLinux(): boolean {
|
||||||
if (!this.isDesktop()) {
|
return false;
|
||||||
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.
|
* 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 {
|
isMac(): boolean {
|
||||||
if (!this.isDesktop()) {
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
// @todo return require('os').platform().indexOf('darwin') === 0;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
} catch (ex) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -435,20 +402,11 @@ export class CoreAppProvider {
|
||||||
/**
|
/**
|
||||||
* Check if the app is running in a Windows environment.
|
* 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 {
|
isWindows(): boolean {
|
||||||
if (!this.isDesktop()) {
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
// @todo return require('os').platform().indexOf('win') === 0;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
} catch (ex) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -724,26 +682,6 @@ export type CoreRedirectData = {
|
||||||
* Store config data.
|
* Store config data.
|
||||||
*/
|
*/
|
||||||
export type CoreStoreConfig = {
|
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.
|
* ID of the Apple store where the mobile iOS app is uploaded.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -35,7 +35,6 @@ export class CoreCronDelegate {
|
||||||
// Constants.
|
// Constants.
|
||||||
static readonly DEFAULT_INTERVAL = 3600000; // Default interval is 1 hour.
|
static readonly DEFAULT_INTERVAL = 3600000; // Default interval is 1 hour.
|
||||||
static readonly MIN_INTERVAL = 300000; // Minimum interval is 5 minutes.
|
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.
|
static readonly MAX_TIME_PROCESS = 120000; // Max time a process can block the queue. Defaults to 2 minutes.
|
||||||
|
|
||||||
// Variables for database.
|
// Variables for database.
|
||||||
|
@ -237,7 +236,7 @@ export class CoreCronDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't allow intervals lower than the minimum.
|
// 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!();
|
const handlerInterval = this.handlers[name].getInterval!();
|
||||||
|
|
||||||
if (!handlerInterval) {
|
if (!handlerInterval) {
|
||||||
|
|
|
@ -568,7 +568,7 @@ export class CoreFileProvider {
|
||||||
// Create file (and parent folders) to prevent errors.
|
// Create file (and parent folders) to prevent errors.
|
||||||
const fileEntry = await this.createFile(path);
|
const fileEntry = await this.createFile(path);
|
||||||
|
|
||||||
if (this.isHTMLAPI && !CoreApp.instance.isDesktop() &&
|
if (this.isHTMLAPI &&
|
||||||
(typeof data == 'string' || data.toString() == '[object ArrayBuffer]')) {
|
(typeof data == 'string' || data.toString() == '[object ArrayBuffer]')) {
|
||||||
// We need to write Blobs.
|
// We need to write Blobs.
|
||||||
const extension = CoreMimetypeUtils.instance.getFileExtension(path);
|
const extension = CoreMimetypeUtils.instance.getFileExtension(path);
|
||||||
|
|
|
@ -1756,12 +1756,8 @@ export class CoreFilepoolProvider {
|
||||||
const path = await this.getFilePath(siteId, fileId);
|
const path = await this.getFilePath(siteId, fileId);
|
||||||
const fileEntry = await CoreFile.instance.getFile(path);
|
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.
|
// This URL is usually used to launch files or put them in HTML.
|
||||||
if (CoreApp.instance.isDesktop()) {
|
return fileEntry.toURL();
|
||||||
return fileEntry.toInternalURL();
|
|
||||||
} else {
|
|
||||||
return fileEntry.toURL();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2937,11 +2933,6 @@ export class CoreFilepoolProvider {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CoreApp.instance.isDesktop()) {
|
|
||||||
// In desktop always download first.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const mimetype = await CoreUtils.instance.getMimeTypeFromUrl(url);
|
const mimetype = await CoreUtils.instance.getMimeTypeFromUrl(url);
|
||||||
// If the file is streaming (audio or video) we reject.
|
// If the file is streaming (audio or video) we reject.
|
||||||
if (mimetype.indexOf('video') != -1 || mimetype.indexOf('audio') != -1) {
|
if (mimetype.indexOf('video') != -1 || mimetype.indexOf('audio') != -1) {
|
||||||
|
|
|
@ -222,8 +222,7 @@ export class CoreLocalNotificationsProvider {
|
||||||
*/
|
*/
|
||||||
canDisableSound(): boolean {
|
canDisableSound(): boolean {
|
||||||
// Only allow disabling sound in Android 7 or lower. In iOS and Android 8+ it can easily be done with system settings.
|
// 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() &&
|
return this.isAvailable() && CoreApp.instance.isAndroid() && Number(Device.instance.version?.split('.')[0]) < 8;
|
||||||
Number(Device.instance.version?.split('.')[0]) < 8;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -363,7 +362,7 @@ export class CoreLocalNotificationsProvider {
|
||||||
isAvailable(): boolean {
|
isAvailable(): boolean {
|
||||||
const win = <any> window; // eslint-disable-line @typescript-eslint/no-explicit-any
|
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 = {
|
const storesConfig: CoreStoreConfig = {
|
||||||
android: config.tool_mobile_androidappid,
|
android: config.tool_mobile_androidappid,
|
||||||
ios: config.tool_mobile_iosappid,
|
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/',
|
mobile: config.tool_mobile_setuplink || 'https://download.moodle.org/mobile/',
|
||||||
default: config.tool_mobile_setuplink,
|
default: config.tool_mobile_setuplink,
|
||||||
};
|
};
|
||||||
|
|
|
@ -144,11 +144,6 @@ export class CoreDomUtilsProvider {
|
||||||
const readableSize = CoreTextUtils.instance.bytesToSize(size.size, 2);
|
const readableSize = CoreTextUtils.instance.bytesToSize(size.size, 2);
|
||||||
|
|
||||||
const getAvailableBytes = async (): Promise<number | null> => {
|
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();
|
const availableBytes = await CoreFile.instance.calculateFreeSpace();
|
||||||
|
|
||||||
if (CoreApp.instance.isAndroid()) {
|
if (CoreApp.instance.isAndroid()) {
|
||||||
|
|
|
@ -227,15 +227,10 @@ export class CoreUtilsProvider {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close the InAppBrowser window.
|
* 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) {
|
if (this.iabInstance) {
|
||||||
this.iabInstance.close();
|
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);
|
this.iabInstance = InAppBrowser.instance.create(url, '_blank', options);
|
||||||
|
|
||||||
if (CoreApp.instance.isDesktop() || CoreApp.instance.isMobile()) {
|
if (CoreApp.instance.isMobile()) {
|
||||||
let loadStopSubscription;
|
let loadStopSubscription;
|
||||||
const loadStartUrls: string[] = [];
|
const loadStartUrls: string[] = [];
|
||||||
|
|
||||||
|
@ -1011,11 +1006,7 @@ export class CoreUtilsProvider {
|
||||||
* @param url The URL to open.
|
* @param url The URL to open.
|
||||||
*/
|
*/
|
||||||
openInBrowser(url: string): void {
|
openInBrowser(url: string): void {
|
||||||
if (CoreApp.instance.isDesktop()) {
|
window.open(url, '_system');
|
||||||
// @todo
|
|
||||||
} else {
|
|
||||||
window.open(url, '_system');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1513,7 +1504,7 @@ export class CoreUtilsProvider {
|
||||||
|
|
||||||
|
|
||||||
if (!CoreApp.instance.isMobile()) {
|
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.
|
// Ask the user for permission to use the camera.
|
||||||
|
|
|
@ -27,7 +27,6 @@ declare global {
|
||||||
CONFIG: {
|
CONFIG: {
|
||||||
app_id: string;
|
app_id: string;
|
||||||
appname: string;
|
appname: string;
|
||||||
desktopappname: string;
|
|
||||||
versioncode: number;
|
versioncode: number;
|
||||||
versionname: string;
|
versionname: string;
|
||||||
cache_update_frequency_usually: number;
|
cache_update_frequency_usually: number;
|
||||||
|
|
Loading…
Reference in New Issue