From 07b34a8185a328760a2f3fc22b01d7109b9d01f1 Mon Sep 17 00:00:00 2001 From: Norwin Roosen Date: Mon, 18 Feb 2019 15:47:27 +0100 Subject: [PATCH] remove cordova-plugin-app-version as it only creates issues --- package-lock.json | 36 ++++++++++---------------------- package.json | 5 +---- src/app/app.module.ts | 2 -- src/constants.ts | 1 + src/providers/logging/logging.ts | 20 +++++++----------- 5 files changed, 20 insertions(+), 44 deletions(-) diff --git a/package-lock.json b/package-lock.json index f54d8e6..d8a78ff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { - "name": "blockly-sensebox", - "version": "1.0.1", + "name": "openSenseApp", + "version": "0.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -91,14 +91,6 @@ "tslib": "^1.7.1" } }, - "@ionic-native/app-version": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@ionic-native/app-version/-/app-version-5.1.0.tgz", - "integrity": "sha512-u+j319sZBBGjf0MjeMhxKpT+iwL8R6bq4MBAbQOV+x/pyGuqed0RvoEZ5TO/XEpBLYrizkiKGffaNqlxHm1W+A==", - "requires": { - "@types/cordova": "^0.0.34" - } - }, "@ionic-native/core": { "version": "4.15.0", "resolved": "https://registry.npmjs.org/@ionic-native/core/-/core-4.15.0.tgz", @@ -1068,11 +1060,6 @@ "resolved": "https://registry.npmjs.org/@ngx-translate/http-loader/-/http-loader-2.0.1.tgz", "integrity": "sha1-qmd4jmS/qGUmkad7Ais7QDEgkRM=" }, - "@types/cordova": { - "version": "0.0.34", - "resolved": "https://registry.npmjs.org/@types/cordova/-/cordova-0.0.34.tgz", - "integrity": "sha1-6nrd907Ow9dimCegw54smt3HPQQ=" - }, "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -2843,11 +2830,6 @@ } } }, - "cordova-plugin-app-version": { - "version": "0.1.9", - "resolved": "https://registry.npmjs.org/cordova-plugin-app-version/-/cordova-plugin-app-version-0.1.9.tgz", - "integrity": "sha1-nbBgeGMzenEEiTAuX1CpBPFEm9s=" - }, "cordova-plugin-device": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/cordova-plugin-device/-/cordova-plugin-device-2.0.2.tgz", @@ -3681,7 +3663,8 @@ }, "ansi-regex": { "version": "2.1.1", - "bundled": true + "bundled": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -4046,7 +4029,8 @@ }, "safe-buffer": { "version": "5.1.1", - "bundled": true + "bundled": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -4094,6 +4078,7 @@ "strip-ansi": { "version": "3.0.1", "bundled": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -4132,11 +4117,13 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true + "bundled": true, + "optional": true }, "yallist": { "version": "3.0.2", - "bundled": true + "bundled": true, + "optional": true } } }, @@ -8016,7 +8003,6 @@ "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" diff --git a/package.json b/package.json index f940d6c..6b5651e 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,6 @@ "@angular/http": "5.2.11", "@angular/platform-browser": "5.2.11", "@angular/platform-browser-dynamic": "5.2.11", - "@ionic-native/app-version": "^5.1.0", "@ionic-native/core": "~4.15.0", "@ionic-native/network": "^4.17.0", "@ionic-native/splash-screen": "~4.15.0", @@ -35,7 +34,6 @@ "@ngx-translate/http-loader": "^2.0.1", "cordova-android": "7.1.1", "cordova-browser": "5.0.4", - "cordova-plugin-app-version": "0.1.9", "cordova-plugin-device": "^2.0.2", "cordova-plugin-ionic-keyboard": "^2.1.3", "cordova-plugin-ionic-webview": "^2.3.3", @@ -68,8 +66,7 @@ }, "cordova-plugin-ionic-keyboard": {}, "wifiwizard2": {}, - "cordova-plugin-network-information": {}, - "cordova-plugin-app-version": {} + "cordova-plugin-network-information": {} }, "platforms": [ "android", diff --git a/src/app/app.module.ts b/src/app/app.module.ts index bd1b7b0..459c979 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -11,7 +11,6 @@ import { openSenseApp } from './app.component'; import { OtaWizardPageModule } from '../pages/ota-wizard/ota-wizard.module'; import { BlocklyPageModule } from '../pages/blockly/blockly.module'; import { LoggingProvider } from '../providers/logging/logging'; -import { AppVersion } from '@ionic-native/app-version/ngx'; import { StorageProvider } from '../providers/storage/storage'; // For AoT compilation (production builds) we need to have a factory for the loader of translation files. @@ -47,7 +46,6 @@ export function createTranslateLoader(http: HttpClient) { StatusBar, SplashScreen, {provide: ErrorHandler, useClass: IonicErrorHandler}, - AppVersion, LoggingProvider, StorageProvider, ] diff --git a/src/constants.ts b/src/constants.ts index 330d72c..bed5a5d 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,5 +1,6 @@ import { LogLevel, LogOptions } from "./providers/logging/logging"; +export const APP_VERSION = '1.1.0' export const COLORS = { PRIMARY: '#4EAF47', // sensebox green } diff --git a/src/providers/logging/logging.ts b/src/providers/logging/logging.ts index 6bc3046..60b828e 100644 --- a/src/providers/logging/logging.ts +++ b/src/providers/logging/logging.ts @@ -1,9 +1,8 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { AppVersion } from '@ionic-native/app-version/ngx'; import { Platform } from 'ionic-angular'; -import { LOG_OPTIONS } from '../../constants'; +import { LOG_OPTIONS, APP_VERSION } from '../../constants'; import { StorageProvider, SETTINGS } from '../storage/storage'; import { TranslateService } from '@ngx-translate/core'; @@ -28,23 +27,18 @@ export class LoggingProvider { constructor( private http: HttpClient, private plt: Platform, - private version: AppVersion, private storage: StorageProvider, private translate: TranslateService, ) { - if ((window).cordova) { - this.version.getPackageName() - .then(name => this.defaultFields.app = name) - this.version.getVersionNumber() - .then(version => this.defaultFields.appVersion = version) - } - this.defaultFields.platform = this.plt.platforms().join(' ') - this.defaultFields.platformVersion = this.plt.version().str - this.defaultFields.lang = translate.currentLang + const { defaultFields } = this + defaultFields.appVersion = APP_VERSION + defaultFields.platform = this.plt.platforms().join(' ') + defaultFields.platformVersion = this.plt.version().str + defaultFields.lang = translate.currentLang } createChild (component: string, defaultFields: object = {}) { - const child = new LoggingProvider(this.http, this.plt, this.version, this.storage, this.translate) + const child = new LoggingProvider(this.http, this.plt, this.storage, this.translate) Object.assign(child.defaultFields, defaultFields, { component }) return child }