MOBILE-3401 ws: Add platform ready to override user agent

main
Pau Ferrer Ocaña 2020-06-11 15:07:10 +02:00
parent 0db91392a4
commit b8cc0e4f57
1 changed files with 8 additions and 4 deletions

View File

@ -13,6 +13,7 @@
// limitations under the License.
import { Injectable } from '@angular/core';
import { Platform } from 'ionic-angular';
import { HttpClient, HttpResponse } from '@angular/common/http';
import { TranslateService } from '@ngx-translate/core';
import { FileTransfer, FileUploadOptions } from '@ionic-native/file-transfer';
@ -156,12 +157,15 @@ export class CoreWSProvider {
protected fileProvider: CoreFileProvider,
protected fileTransfer: FileTransfer,
protected mimeUtils: CoreMimetypeUtilsProvider,
logger: CoreLoggerProvider) {
logger: CoreLoggerProvider,
platform: Platform) {
this.logger = logger.getInstance('CoreWSProvider');
platform.ready().then(() => {
if (this.appProvider.isMobile()) {
(<any> cordova).plugin.http.setHeader('User-Agent', navigator.userAgent);
}
});
}
/**