Merge pull request #7093 from cmgustavo/v4-12

[v4-12] Upgrade packages
This commit is contained in:
Gabriel Edgardo Bazán 2017-11-09 15:51:30 -03:00 committed by GitHub
commit 633366cf1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 148 additions and 159 deletions

View File

@ -35,33 +35,33 @@
<preference name="android-minSdkVersion" value="19" /> <preference name="android-minSdkVersion" value="19" />
<!-- Supported Platforms --> <!-- Supported Platforms -->
<engine name="android" spec="6.2.3" /> <engine name="android" spec="^6.3.0" />
<engine name="ios" spec="4.5.2" /> <engine name="ios" spec="^4.5.3" />
<!-- Plugins --> <!-- Plugins -->
<plugin name="cordova-clipboard" spec="1.1.0" /> <plugin name="cordova-clipboard" spec="^1.1.0" />
<plugin name="cordova-plugin-android-fingerprint-auth" spec="1.4.0" /> <plugin name="cordova-plugin-android-fingerprint-auth" spec="^1.4.0" />
<plugin name="cordova-plugin-device" spec="1.1.6" /> <plugin name="cordova-plugin-device" spec="^1.1.6" />
<plugin name="cordova-plugin-globalization" spec="1.0.7" /> <plugin name="cordova-plugin-globalization" spec="^1.0.7" />
<plugin name="cordova-plugin-qrscanner" spec="2.5.0" /> <plugin name="cordova-plugin-qrscanner" spec="^2.5.0" />
<plugin name="cordova-plugin-splashscreen" spec="4.0.3" /> <plugin name="cordova-plugin-splashscreen" spec="^4.0.3" />
<plugin name="cordova-plugin-statusbar" spec="2.2.3" /> <plugin name="cordova-plugin-statusbar" spec="^2.2.3" />
<plugin name="cordova-plugin-inappbrowser" spec="1.7.1" /> <plugin name="cordova-plugin-inappbrowser" spec="^1.7.1" />
<plugin name="cordova-plugin-touch-id" spec="3.2.0" /> <plugin name="cordova-plugin-touch-id" spec="^3.3.1" />
<plugin name="cordova-plugin-whitelist" spec="1.3.2" /> <plugin name="cordova-plugin-whitelist" spec="^1.3.2" />
<plugin name="cordova-plugin-x-socialsharing" spec="5.2.0" /> <plugin name="cordova-plugin-x-socialsharing" spec="^5.2.1" />
<plugin name="cordova-plugin-x-toast" spec="2.6.0" /> <plugin name="cordova-plugin-x-toast" spec="^2.6.0" />
<plugin name="ionic-plugin-keyboard" spec="2.2.1" /> <plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
<plugin name="cordova-plugin-spinner-dialog" spec="1.3.1" /> <plugin name="cordova-plugin-native-spinner" spec="^1.0.8" />
<plugin name="cordova-plugin-dialogs" spec="1.3.3" /> <plugin name="cordova-plugin-dialogs" spec="^1.3.3" />
<plugin name="cordova-plugin-network-information" spec="1.3.3" /> <plugin name="cordova-plugin-network-information" spec="^1.3.3" />
<plugin name="cordova-plugin-uniquedeviceid" spec="1.3.2" /> <plugin name="cordova-plugin-uniquedeviceid" spec="^1.3.2" />
<plugin name="cordova-plugin-file" spec="4.3.3" /> <plugin name="cordova-plugin-file" spec="^4.3.3" />
<plugin name="cordova-plugin-transport-security" spec="0.1.2" /> <plugin name="cordova-plugin-transport-security" spec="^0.1.2" />
<plugin name="cordova-ios-requires-fullscreen" spec="0.0.2" /> <plugin name="cordova-ios-requires-fullscreen" spec="^0.0.2" />
<plugin name="cordova-plugin-screen-orientation" spec="1.4.3" /> <plugin name="cordova-plugin-screen-orientation" spec="^2.0.1" />
<plugin name="cordova-custom-config" spec="4.0.2" /> <plugin name="cordova-custom-config" spec="^4.0.2" />
<plugin name="cordova-plugin-customurlscheme" spec="https://github.com/cmgustavo/Custom-URL-scheme.git#v4.0"> <plugin name="cordova-plugin-customurlscheme" spec="https://github.com/cmgustavo/Custom-URL-scheme.git#v4.0">
<variable name="URL_SCHEME" value="bitcoin" /> <variable name="URL_SCHEME" value="bitcoin" />
<variable name="SECOND_URL_SCHEME" value="*APPURI*" /> <variable name="SECOND_URL_SCHEME" value="*APPURI*" />
@ -69,7 +69,7 @@
</plugin> </plugin>
<plugin name="cordova-plugin-fcm" spec="https://github.com/cmgustavo/cordova-plugin-fcm.git" /> <plugin name="cordova-plugin-fcm" spec="https://github.com/cmgustavo/cordova-plugin-fcm.git" />
<plugin name="cordova-plugin-ionic-webview" spec="1.1.15" /> <plugin name="cordova-plugin-ionic-webview" spec="^1.1.16" />
<!-- Platform Specific Settings --> <!-- Platform Specific Settings -->
<platform name="ios"> <platform name="ios">

View File

@ -49,41 +49,40 @@
"apply:bitpay": "npm i && cd app-template && node apply.js bitpay" "apply:bitpay": "npm i && cd app-template && node apply.js bitpay"
}, },
"dependencies": { "dependencies": {
"@angular/common": "4.4.3", "@angular/common": "^5.0.1",
"@angular/compiler": "4.4.3", "@angular/compiler": "^5.0.1",
"@angular/compiler-cli": "4.4.3", "@angular/compiler-cli": "^5.0.1",
"@angular/core": "4.4.3", "@angular/core": "^5.0.1",
"@angular/forms": "4.4.3", "@angular/forms": "^5.0.1",
"@angular/http": "4.4.3", "@angular/http": "^5.0.1",
"@angular/platform-browser": "4.4.3", "@angular/platform-browser": "^5.0.1",
"@angular/platform-browser-dynamic": "4.4.3", "@angular/platform-browser-dynamic": "^5.0.1",
"@angular/tsc-wrapped": "4.4.3", "@angular/tsc-wrapped": "^4.4.6",
"@biesbjerg/ngx-translate-po-http-loader": "1.0.1", "@biesbjerg/ngx-translate-po-http-loader": "^2.0.1",
"@ionic-native/android-fingerprint-auth": "^4.2.1", "@ionic-native/android-fingerprint-auth": "^4.2.1",
"@ionic-native/clipboard": "^4.1.0", "@ionic-native/clipboard": "^4.1.0",
"@ionic-native/core": "^3.12.1", "@ionic-native/core": "^4.3.3",
"@ionic-native/file": "^4.1.0", "@ionic-native/file": "^4.1.0",
"@ionic-native/qr-scanner": "^4.1.0", "@ionic-native/qr-scanner": "^4.1.0",
"@ionic-native/social-sharing": "^4.1.0", "@ionic-native/social-sharing": "^4.1.0",
"@ionic-native/splash-screen": "^3.12.1", "@ionic-native/splash-screen": "^4.3.3",
"@ionic-native/status-bar": "^3.12.1", "@ionic-native/status-bar": "^4.3.3",
"@ionic-native/toast": "^4.1.0", "@ionic-native/toast": "^4.1.0",
"@ionic-native/touch-id": "^4.2.1", "@ionic-native/touch-id": "^4.2.1",
"@ionic/storage": "^2.0.1", "@ionic/storage": "^2.1.3",
"@ngx-translate/core": "6.0.1", "@ngx-translate/core": "^8.0.0",
"@nsalaun/ng-logger": "2.0.1", "@nsalaun/ng-logger": "^5.0.0",
"ajv": "5.2.2", "ajv": "^5.3.0",
"angular2-moment": "1.7.0", "angular2-moment": "^1.7.0",
"angular2-qrcode": "2.0.1", "angular2-qrcode": "^2.0.1",
"autoprefixer": "7.1.2", "autoprefixer": "^7.1.6",
"bitcore-wallet-client": "6.4.0", "bitcore-wallet-client": "^6.4.0",
"preconditions": "2.2.0", "buffer-compare": "^1.1.1",
"buffer-compare": "1.1.1", "cordova-android": "^6.3.0",
"cordova-android": "6.2.3",
"cordova-clipboard": "^1.1.0", "cordova-clipboard": "^1.1.0",
"cordova-custom-config": "^4.0.2", "cordova-custom-config": "^4.0.2",
"cordova-ios": "4.5.2", "cordova-ios": "^4.5.3",
"cordova-ios-requires-fullscreen": "0.0.2", "cordova-ios-requires-fullscreen": "^0.0.2",
"cordova-plugin-android-fingerprint-auth": "^1.4.0", "cordova-plugin-android-fingerprint-auth": "^1.4.0",
"cordova-plugin-compat": "^1.2.0", "cordova-plugin-compat": "^1.2.0",
"cordova-plugin-customurlscheme": "https://github.com/cmgustavo/Custom-URL-scheme.git#v4.0", "cordova-plugin-customurlscheme": "https://github.com/cmgustavo/Custom-URL-scheme.git#v4.0",
@ -96,66 +95,65 @@
"cordova-plugin-ionic-webview": "^1.1.16", "cordova-plugin-ionic-webview": "^1.1.16",
"cordova-plugin-network-information": "^1.3.3", "cordova-plugin-network-information": "^1.3.3",
"cordova-plugin-qrscanner": "^2.5.0", "cordova-plugin-qrscanner": "^2.5.0",
"cordova-plugin-screen-orientation": "^1.4.3", "cordova-plugin-screen-orientation": "^2.0.1",
"cordova-plugin-spinner-dialog": "^1.3.1", "cordova-plugin-native-spinner": "^1.0.8",
"cordova-plugin-splashscreen": "^4.0.3", "cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-statusbar": "^2.2.3", "cordova-plugin-statusbar": "^2.2.3",
"cordova-plugin-swift-support": "^3.1.1", "cordova-plugin-swift-support": "^3.1.1",
"cordova-plugin-touch-id": "^3.2.0", "cordova-plugin-touch-id": "^3.3.1",
"cordova-plugin-transport-security": "^0.1.2", "cordova-plugin-transport-security": "^0.1.2",
"cordova-plugin-uniquedeviceid": "^1.3.2", "cordova-plugin-uniquedeviceid": "^1.3.2",
"cordova-plugin-whitelist": "^1.3.2", "cordova-plugin-whitelist": "^1.3.2",
"cordova-plugin-x-socialsharing": "^5.2.1", "cordova-plugin-x-socialsharing": "^5.2.1",
"cordova-plugin-x-toast": "^2.6.0", "cordova-plugin-x-toast": "^2.6.0",
"cordova-sqlite-storage": "^2.0.4",
"es6-promise-plugin": "^4.1.0", "es6-promise-plugin": "^4.1.0",
"ionic-angular": "3.7.1", "ionic-angular": "^3.9.2",
"ionic-plugin-keyboard": "^2.2.1", "ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0", "ionicons": "^3.0.0",
"lodash": "4.17.4", "lodash": "^4.17.4",
"ngx-clipboard": "8.0.3", "ngx-clipboard": "^8.1.1",
"rxjs": "5.4.3", "preconditions": "^2.2.0",
"simple-plist": "0.2.1", "rxjs": "^5.5.2",
"sw-toolbox": "3.6.0", "simple-plist": "^0.2.1",
"zone.js": "0.8.18" "sw-toolbox": "^3.6.0",
"zone.js": "^0.8.18"
}, },
"devDependencies": { "devDependencies": {
"@angular/cli": "1.3.0", "@angular/cli": "^1.5.0",
"@biesbjerg/ngx-translate-extract": "2.3.2", "@biesbjerg/ngx-translate-extract": "^2.3.4",
"@ionic/app-scripts": "3.0.1", "@ionic/app-scripts": "^3.1.0",
"@types/chrome": "0.0.47", "@types/chrome": "^0.0.52",
"@types/cordova-plugin-qrscanner": "1.0.31", "@types/cordova-plugin-qrscanner": "^1.0.31",
"@types/jasmine": "2.5.53", "@types/jasmine": "^2.6.3",
"@types/lodash": "4.14.71", "@types/lodash": "^4.14.83",
"angular2-template-loader": "0.6.2", "angular2-template-loader": "^0.6.2",
"codecov": "2.2.0", "codecov": "^3.0.0",
"fs-extra": "^4.0.2", "fs-extra": "^4.0.2",
"html-loader": "0.4.5", "html-loader": "^0.5.1",
"ionic": "3.17.0", "ionic": "^3.17.0",
"jasmine-core": "2.6.4", "jasmine-core": "^2.8.0",
"jasmine-spec-reporter": "4.1.1", "jasmine-spec-reporter": "^4.2.1",
"karma": "1.7.0", "karma": "^1.7.1",
"karma-chrome-launcher": "2.2.0", "karma-chrome-launcher": "^2.2.0",
"karma-jasmine": "1.1.0", "karma-jasmine": "^1.1.0",
"karma-jasmine-html-reporter": "0.2.2", "karma-jasmine-html-reporter": "^0.2.2",
"karma-mocha-reporter": "2.2.3", "karma-mocha-reporter": "^2.2.5",
"karma-phantomjs-launcher": "1.0.4", "karma-phantomjs-launcher": "^1.0.4",
"karma-remap-istanbul": "0.6.0", "karma-remap-istanbul": "^0.6.0",
"karma-sourcemap-loader": "0.3.7", "karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "2.0.4", "karma-webpack": "^2.0.5",
"null-loader": "0.1.1", "null-loader": "^0.1.1",
"path": "0.12.7", "path": "^0.12.7",
"trash-cli": "1.4.0", "trash-cli": "^1.4.0",
"ts-loader": "2.0.3", "ts-loader": "^3.1.1",
"ts-node": "3.3.0", "ts-node": "^3.3.0",
"tslint": "5.5.0", "tslint": "^5.8.0",
"tslint-eslint-rules": "4.1.1", "tslint-eslint-rules": "^4.1.1",
"typescript": "2.3.4", "typescript": "^2.6.1",
"webpack": "3.8.1" "webpack": "^3.8.1"
}, },
"cordova": { "cordova": {
"plugins": { "plugins": {
"cordova-sqlite-storage": {},
"cordova-plugin-device": {}, "cordova-plugin-device": {},
"cordova-plugin-splashscreen": {}, "cordova-plugin-splashscreen": {},
"cordova-plugin-statusbar": {}, "cordova-plugin-statusbar": {},
@ -167,7 +165,7 @@
"cordova-plugin-qrscanner": {}, "cordova-plugin-qrscanner": {},
"cordova-plugin-touch-id": {}, "cordova-plugin-touch-id": {},
"cordova-plugin-android-fingerprint-auth": {}, "cordova-plugin-android-fingerprint-auth": {},
"cordova-plugin-spinner-dialog": {}, "cordova-plugin-native-spinner": {},
"cordova-plugin-dialogs": {}, "cordova-plugin-dialogs": {},
"cordova-plugin-network-information": {}, "cordova-plugin-network-information": {},
"cordova-plugin-uniquedeviceid": {}, "cordova-plugin-uniquedeviceid": {},

View File

@ -1,6 +1,6 @@
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule, APP_INITIALIZER } from '@angular/core'; import { ErrorHandler, NgModule, APP_INITIALIZER } from '@angular/core';
import { HttpModule, Http } from '@angular/http'; import { HttpClient, HttpClientModule } from '@angular/common/http';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular'; import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
/* Native modules */ /* Native modules */
@ -94,7 +94,7 @@ import { TxConfirmNotificationProvider } from '../providers/tx-confirm-notificat
import { TxFormatProvider } from '../providers/tx-format/tx-format'; import { TxFormatProvider } from '../providers/tx-format/tx-format';
import { WalletProvider } from '../providers/wallet/wallet'; import { WalletProvider } from '../providers/wallet/wallet';
export function createTranslateLoader(http: Http) { export function createTranslateLoader(http: HttpClient) {
return new TranslatePoHttpLoader(http, 'assets/i18n', '.po'); return new TranslatePoHttpLoader(http, 'assets/i18n', '.po');
} }
@ -206,7 +206,7 @@ export function providersComponents() {
tabsPlacement: 'bottom' tabsPlacement: 'bottom'
}), }),
BrowserModule, BrowserModule,
HttpModule, HttpClientModule,
NgLoggerModule.forRoot(Level.LOG), NgLoggerModule.forRoot(Level.LOG),
MomentModule, MomentModule,
QRCodeModule, QRCodeModule,
@ -214,7 +214,7 @@ export function providersComponents() {
loader: { loader: {
provide: TranslateLoader, provide: TranslateLoader,
useFactory: createTranslateLoader, useFactory: createTranslateLoader,
deps: [Http] deps: [HttpClient]
} }
}), }),
], ],

View File

@ -146,8 +146,8 @@ export class AmountPage {
// Always return to BTC... TODO? // Always return to BTC... TODO?
this.altUnitIndex = 0; this.altUnitIndex = 0;
} else { } else {
this.altUnitIndex = _.findIndex(this.availableUnits, { this.altUnitIndex = _.findIndex(this.availableUnits, function(o) {
isFiat: true return o.isFiat == true;
}); });
} }

View File

@ -1,7 +1,6 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http'; import { HttpClient } from '@angular/common/http';
import { Logger } from '@nsalaun/ng-logger'; import { Logger } from '@nsalaun/ng-logger';
import 'rxjs/add/operator/map';
import { LanguageProvider } from '../../providers/language/language'; import { LanguageProvider } from '../../providers/language/language';
import { ConfigProvider } from '../../providers/config/config'; import { ConfigProvider } from '../../providers/config/config';
@ -41,11 +40,11 @@ interface App {
@Injectable() @Injectable()
export class AppProvider { export class AppProvider {
public info: App; public info: any;
private jsonPath: string = 'assets/appConfig.json'; private jsonPath: string = 'assets/appConfig.json';
constructor( constructor(
public http: Http, public http: HttpClient,
private logger: Logger, private logger: Logger,
private language: LanguageProvider, private language: LanguageProvider,
private config: ConfigProvider, private config: ConfigProvider,
@ -71,7 +70,6 @@ export class AppProvider {
} }
private getInfo() { private getInfo() {
return this.http.get(this.jsonPath) return this.http.get(this.jsonPath);
.map((res: Response) => res.json());
} }
} }

View File

@ -44,12 +44,12 @@ export class FeeProvider {
let feeLevelRate: any; let feeLevelRate: any;
if (response.fromCache) { if (response.fromCache) {
feeLevelRate = _.find(response.levels[network], { feeLevelRate = _.find(response.levels[network], function (o) {
level: feeLevel return o.level == feeLevel;
}); });
} else { } else {
feeLevelRate = _.find(response[network], { feeLevelRate = _.find(response[network], function (o) {
level: feeLevel return o.level == feeLevel;
}); });
} }
if (!feeLevelRate || !feeLevelRate.feePerKb) { if (!feeLevelRate || !feeLevelRate.feePerKb) {
@ -104,4 +104,4 @@ export class FeeProvider {
} }
} }

View File

@ -1,6 +1,4 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import 'rxjs/add/operator/map';
import * as _ from "lodash"; import * as _ from "lodash";
@Injectable() @Injectable()
@ -8,7 +6,7 @@ export class Filter {
public formats: any; public formats: any;
constructor(public http: Http) { constructor() {
console.log('Hello Filter Provider'); console.log('Hello Filter Provider');
this.formats = { this.formats = {
CURRENCY_SYM: "$", CURRENCY_SYM: "$",

View File

@ -1,5 +1,5 @@
import { TestBed, inject, async } from '@angular/core/testing'; import { TestBed, inject, async } from '@angular/core/testing';
import { Http } from '@angular/http'; import { HttpClient } from '@angular/common/http';
import { Logger } from '@nsalaun/ng-logger'; import { Logger } from '@nsalaun/ng-logger';
import { WalletProvider } from '../wallet/wallet'; import { WalletProvider } from '../wallet/wallet';
import { ProfileProvider } from './profile'; import { ProfileProvider } from './profile';
@ -36,7 +36,7 @@ describe('Profile Provider', () => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
providers: [ providers: [
ProfileProvider, ProfileProvider,
{ provide: Http }, { provide: HttpClient },
{ provide: Logger }, { provide: Logger },
{ provide: WalletProvider }, { provide: WalletProvider },
{ provide: PersistenceProvider, useClass: PersistenceProviderMock }, { provide: PersistenceProvider, useClass: PersistenceProviderMock },

View File

@ -1,7 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Http } from '@angular/http'; import { HttpClient } from '@angular/common/http';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';
import * as _ from 'lodash'; import * as _ from 'lodash';
@Injectable() @Injectable()
@ -17,7 +15,7 @@ export class RateProvider {
private rateServiceUrl = 'https://bitpay.com/api/rates'; private rateServiceUrl = 'https://bitpay.com/api/rates';
private bchRateServiceUrl = 'https://api.kraken.com/0/public/Ticker?pair=BCHUSD,BCHEUR'; private bchRateServiceUrl = 'https://api.kraken.com/0/public/Ticker?pair=BCHUSD,BCHEUR';
constructor(public http: Http) { constructor(public http: HttpClient) {
console.log('Hello RateProvider Provider'); console.log('Hello RateProvider Provider');
this._rates = {}; this._rates = {};
this._alternatives = []; this._alternatives = [];
@ -65,17 +63,19 @@ export class RateProvider {
} }
getBTC(): Promise<any> { getBTC(): Promise<any> {
return this.http.get(this.rateServiceUrl) return new Promise((resolve, reject) => {
.map((response) => response.json()) this.http.get(this.rateServiceUrl).subscribe((data) => {
.toPromise() resolve(data);
.catch((error) => console.log("Error", error)); });
});
} }
getBCH(): Promise<any> { getBCH(): Promise<any> {
return this.http.get(this.bchRateServiceUrl) return new Promise((resolve, reject) => {
.map((response) => response.json()) this.http.get(this.bchRateServiceUrl).subscribe((data) => {
.toPromise() resolve(data);
.catch((error) => console.log("Error", error)); });
});
} }
getRate(code, chain?) { getRate(code, chain?) {

View File

@ -1,5 +1,5 @@
import { TestBed, inject, async } from '@angular/core/testing'; import { TestBed, inject, async } from '@angular/core/testing';
import { Http } from '@angular/http'; import { HttpClient } from '@angular/common/http';
import { AppProvider } from '../../providers/app/app'; import { AppProvider } from '../../providers/app/app';
import { ReleaseProvider } from './release'; import { ReleaseProvider } from './release';
@ -17,9 +17,9 @@ describe('Release Provider', () => {
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
providers: [ providers: [
ReleaseProvider, ReleaseProvider,
{ provide: Http }, { provide: HttpClient },
{ provide: AppProvider, useClass: AppProviderMock }, { provide: AppProvider, useClass: AppProviderMock },
] ]
}); });
}); });
@ -34,7 +34,7 @@ describe('Release Provider', () => {
it('should get successfully the current app version', () => { it('should get successfully the current app version', () => {
// Should return the AppProviderMock object // Should return the AppProviderMock object
const appVersion = service.getCurrentAppVersion(); const appVersion = service.getCurrentAppVersion();
expect(appVersion).toBeDefined(); expect(appVersion).toBeDefined();
expect(appVersion).toEqual(currentAppVersion); expect(appVersion).toEqual(currentAppVersion);
}); });
@ -49,20 +49,20 @@ describe('Release Provider', () => {
expect(version).toEqual(latestAppVersion); expect(version).toEqual(latestAppVersion);
}); });
})); }));
it('should check unsuccessfully the current app version format', () => { it('should check unsuccessfully the current app version format', () => {
const result = service.checkForUpdates(latestAppVersion, 'V..3.3.3'); const result = service.checkForUpdates(latestAppVersion, 'V..3.3.3');
expect(result.updateAvailable).toBeNull; expect(result.updateAvailable).toBeNull;
expect(result.availabeVersion).toBeNull; expect(result.availabeVersion).toBeNull;
expect(result.error).toBeDefined(); expect(result.error).toBeDefined();
expect(result.error).toMatch('Cannot'); expect(result.error).toMatch('Cannot');
expect(result.error).toMatch('version tag'); expect(result.error).toMatch('version tag');
}); });
it('should check unsuccessfully the latest app version format', () => { it('should check unsuccessfully the latest app version format', () => {
const result = service.checkForUpdates('V..3.3.3', currentAppVersion); const result = service.checkForUpdates('V..3.3.3', currentAppVersion);
expect(result.updateAvailable).toBeNull; expect(result.updateAvailable).toBeNull;
expect(result.availabeVersion).toBeNull; expect(result.availabeVersion).toBeNull;
expect(result.error).toBeDefined(); expect(result.error).toBeDefined();
@ -77,10 +77,10 @@ describe('Release Provider', () => {
expect(result.updateAvailable).toBeNull; expect(result.updateAvailable).toBeNull;
expect(result.availabeVersion).toBeNull; expect(result.availabeVersion).toBeNull;
}); });
it('should be a new version available', () => { it('should be a new version available', () => {
const result = service.checkForUpdates(latestAppVersion, currentAppVersion); const result = service.checkForUpdates(latestAppVersion, currentAppVersion);
expect(result.error).toBeNull; expect(result.error).toBeNull;
expect(result.updateAvailable).toBeTruthy; expect(result.updateAvailable).toBeTruthy;
expect(result.availabeVersion).toEqual(latestAppVersion); expect(result.availabeVersion).toEqual(latestAppVersion);

View File

@ -1,7 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Http } from '@angular/http'; import { HttpClient } from '@angular/common/http';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';
import { AppProvider } from '../../providers/app/app'; import { AppProvider } from '../../providers/app/app';
@Injectable() @Injectable()
@ -9,20 +7,21 @@ export class ReleaseProvider {
private LATEST_RELEASE_URL: string; private LATEST_RELEASE_URL: string;
private appVersion: string; private appVersion: string;
constructor(public http: Http, private app: AppProvider) { constructor(public http: HttpClient, private app: AppProvider) {
this.LATEST_RELEASE_URL = 'https://api.github.com/repos/bitpay/copay/releases/latest'; this.LATEST_RELEASE_URL = 'https://api.github.com/repos/bitpay/copay/releases/latest';
this.appVersion = this.app.info.version; this.appVersion = this.app.info.version;
} }
getCurrentAppVersion() { getCurrentAppVersion() {
return this.appVersion; return this.appVersion;
} }
getLatestAppVersion(): Promise<any> { getLatestAppVersion(): Promise<any> {
return this.http.get(this.LATEST_RELEASE_URL) return new Promise((resolve, reject) => {
.map((response) => response.json().tag_name) this.http.get(this.LATEST_RELEASE_URL).subscribe((data) => {
.toPromise() resolve(data['tag_name']);
.catch((error) => (error)); });
});
} }
checkForUpdates(latestVersion: string, currentVersion?: string) { checkForUpdates(latestVersion: string, currentVersion?: string) {

View File

@ -1,7 +1,6 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { QRScanner, QRScannerStatus } from '@ionic-native/qr-scanner'; import { QRScanner, QRScannerStatus } from '@ionic-native/qr-scanner';
import { PlatformProvider } from '../platform/platform'; import { PlatformProvider } from '../platform/platform';
import 'rxjs/add/operator/map';
@Injectable() @Injectable()
export class ScanProvider { export class ScanProvider {

View File

@ -1,6 +1,4 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import 'rxjs/add/operator/map';
import { BwcProvider } from '../bwc/bwc'; import { BwcProvider } from '../bwc/bwc';
import { RateProvider } from '../rate/rate'; import { RateProvider } from '../rate/rate';
import { ConfigProvider } from '../config/config'; import { ConfigProvider } from '../config/config';
@ -14,7 +12,6 @@ export class TxFormatProvider {
public pendingTxProposalsCountForUs: number public pendingTxProposalsCountForUs: number
constructor( constructor(
public http: Http,
private bwc: BwcProvider, private bwc: BwcProvider,
private rate: RateProvider, private rate: RateProvider,
private config: ConfigProvider, private config: ConfigProvider,

View File

@ -1,5 +1,5 @@
import { TestBed, async } from '@angular/core/testing'; import { TestBed, async } from '@angular/core/testing';
import { HttpModule } from '@angular/http'; import { HttpClientModule } from '@angular/common/http';
import { ConfigProvider } from '../config/config'; import { ConfigProvider } from '../config/config';
import { WalletProvider } from './wallet'; import { WalletProvider } from './wallet';
import { Logger, Level as LoggerLevel } from '@nsalaun/ng-logger'; import { Logger, Level as LoggerLevel } from '@nsalaun/ng-logger';
@ -37,7 +37,7 @@ describe('Provider: Wallet Provider', () => {
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [HttpModule], imports: [HttpClientModule],
providers: [ providers: [
WalletProvider, WalletProvider,
{ provide: ConfigProvider }, { provide: ConfigProvider },
@ -114,4 +114,4 @@ describe('Provider: Wallet Provider', () => {
}) })
}); });
}); });

View File

@ -637,8 +637,8 @@ export class WalletProvider {
// Approx utxo amount, from which the uxto is economically redeemable // Approx utxo amount, from which the uxto is economically redeemable
private getMinFee(wallet: any, feeLevels: any, nbOutputs?: number): number { private getMinFee(wallet: any, feeLevels: any, nbOutputs?: number): number {
let level: any = lodash.find(feeLevels[wallet.network], { let level: any = lodash.find(feeLevels[wallet.network], function (o) {
level: 'normal', return o.level == 'normal';
}); });
let lowLevelRate = parseInt((level.feePerKb / 1000).toFixed(0)); let lowLevelRate = parseInt((level.feePerKb / 1000).toFixed(0));