MOBILE-3523 ios: Fix error calculating platform version

main
Dani Palou 2020-10-15 09:27:09 +02:00
parent d986401aef
commit 514ccda794
2 changed files with 5 additions and 4 deletions

View File

@ -15,6 +15,7 @@
import { Component, Input, Output, EventEmitter, ViewChild, ElementRef, AfterContentInit, OnDestroy, Optional } import { Component, Input, Output, EventEmitter, ViewChild, ElementRef, AfterContentInit, OnDestroy, Optional }
from '@angular/core'; from '@angular/core';
import { TextInput, Content, Platform, Slides } from 'ionic-angular'; import { TextInput, Content, Platform, Slides } from 'ionic-angular';
import { Device } from '@ionic-native/device';
import { CoreApp } from '@providers/app'; import { CoreApp } from '@providers/app';
import { CoreSitesProvider } from '@providers/sites'; import { CoreSitesProvider } from '@providers/sites';
import { CoreFilepoolProvider } from '@providers/filepool'; import { CoreFilepoolProvider } from '@providers/filepool';
@ -118,7 +119,8 @@ export class CoreEditorRichTextEditorComponent implements AfterContentInit, OnDe
protected events: CoreEventsProvider, protected events: CoreEventsProvider,
protected utils: CoreUtilsProvider, protected utils: CoreUtilsProvider,
protected platform: Platform, protected platform: Platform,
protected editorOffline: CoreEditorOfflineProvider) { protected editorOffline: CoreEditorOfflineProvider,
protected device: Device) {
this.contentChanged = new EventEmitter<string>(); this.contentChanged = new EventEmitter<string>();
this.element = elementRef.nativeElement as HTMLDivElement; this.element = elementRef.nativeElement as HTMLDivElement;
this.pageInstance = 'app_' + Date.now(); // Generate a "unique" ID based on timestamp. this.pageInstance = 'app_' + Date.now(); // Generate a "unique" ID based on timestamp.
@ -236,7 +238,7 @@ export class CoreEditorRichTextEditorComponent implements AfterContentInit, OnDe
if (CoreApp.instance.isAndroid()) { if (CoreApp.instance.isAndroid()) {
// In Android we ignore the keyboard height because it is not part of the web view. // In Android we ignore the keyboard height because it is not part of the web view.
height = this.domUtils.getContentHeight(this.content) - this.getSurroundingHeight(this.element); height = this.domUtils.getContentHeight(this.content) - this.getSurroundingHeight(this.element);
} else if (CoreApp.instance.isIOS() && this.kbHeight > 0 && this.platform.version().major < 12) { } else if (CoreApp.instance.isIOS() && this.kbHeight > 0 && Number(this.device.version.split('.')[0]) < 12) {
// Keyboard open in iOS 11 or previous. The window height changes when the keyboard is open. // Keyboard open in iOS 11 or previous. The window height changes when the keyboard is open.
height = window.innerHeight - this.getSurroundingHeight(this.element); height = window.innerHeight - this.getSurroundingHeight(this.element);

View File

@ -44,8 +44,7 @@ export class CoreFileUploaderFileHandler implements CoreFileUploaderHandler {
* @return True or promise resolved with true if enabled. * @return True or promise resolved with true if enabled.
*/ */
isEnabled(): boolean | Promise<boolean> { isEnabled(): boolean | Promise<boolean> {
return CoreApp.instance.isAndroid() || !CoreApp.instance.isMobile() || return true;
(CoreApp.instance.isIOS() && this.platform.version().major >= 9);
} }
/** /**