diff --git a/app-template/config-template.xml b/app-template/config-template.xml
index 68cad7645..2e38c872c 100644
--- a/app-template/config-template.xml
+++ b/app-template/config-template.xml
@@ -35,33 +35,33 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -69,7 +69,7 @@
-
+
diff --git a/package.json b/package.json
index 9c33cab9d..e99b7dd21 100644
--- a/package.json
+++ b/package.json
@@ -49,41 +49,40 @@
"apply:bitpay": "npm i && cd app-template && node apply.js bitpay"
},
"dependencies": {
- "@angular/common": "4.4.3",
- "@angular/compiler": "4.4.3",
- "@angular/compiler-cli": "4.4.3",
- "@angular/core": "4.4.3",
- "@angular/forms": "4.4.3",
- "@angular/http": "4.4.3",
- "@angular/platform-browser": "4.4.3",
- "@angular/platform-browser-dynamic": "4.4.3",
- "@angular/tsc-wrapped": "4.4.3",
- "@biesbjerg/ngx-translate-po-http-loader": "1.0.1",
+ "@angular/common": "^5.0.1",
+ "@angular/compiler": "^5.0.1",
+ "@angular/compiler-cli": "^5.0.1",
+ "@angular/core": "^5.0.1",
+ "@angular/forms": "^5.0.1",
+ "@angular/http": "^5.0.1",
+ "@angular/platform-browser": "^5.0.1",
+ "@angular/platform-browser-dynamic": "^5.0.1",
+ "@angular/tsc-wrapped": "^4.4.6",
+ "@biesbjerg/ngx-translate-po-http-loader": "^2.0.1",
"@ionic-native/android-fingerprint-auth": "^4.2.1",
"@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/qr-scanner": "^4.1.0",
"@ionic-native/social-sharing": "^4.1.0",
- "@ionic-native/splash-screen": "^3.12.1",
- "@ionic-native/status-bar": "^3.12.1",
+ "@ionic-native/splash-screen": "^4.3.3",
+ "@ionic-native/status-bar": "^4.3.3",
"@ionic-native/toast": "^4.1.0",
"@ionic-native/touch-id": "^4.2.1",
- "@ionic/storage": "^2.0.1",
- "@ngx-translate/core": "6.0.1",
- "@nsalaun/ng-logger": "2.0.1",
- "ajv": "5.2.2",
- "angular2-moment": "1.7.0",
- "angular2-qrcode": "2.0.1",
- "autoprefixer": "7.1.2",
- "bitcore-wallet-client": "6.4.0",
- "preconditions": "2.2.0",
- "buffer-compare": "1.1.1",
- "cordova-android": "6.2.3",
+ "@ionic/storage": "^2.1.3",
+ "@ngx-translate/core": "^8.0.0",
+ "@nsalaun/ng-logger": "^5.0.0",
+ "ajv": "^5.3.0",
+ "angular2-moment": "^1.7.0",
+ "angular2-qrcode": "^2.0.1",
+ "autoprefixer": "^7.1.6",
+ "bitcore-wallet-client": "^6.4.0",
+ "buffer-compare": "^1.1.1",
+ "cordova-android": "^6.3.0",
"cordova-clipboard": "^1.1.0",
"cordova-custom-config": "^4.0.2",
- "cordova-ios": "4.5.2",
- "cordova-ios-requires-fullscreen": "0.0.2",
+ "cordova-ios": "^4.5.3",
+ "cordova-ios-requires-fullscreen": "^0.0.2",
"cordova-plugin-android-fingerprint-auth": "^1.4.0",
"cordova-plugin-compat": "^1.2.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-network-information": "^1.3.3",
"cordova-plugin-qrscanner": "^2.5.0",
- "cordova-plugin-screen-orientation": "^1.4.3",
- "cordova-plugin-spinner-dialog": "^1.3.1",
+ "cordova-plugin-screen-orientation": "^2.0.1",
+ "cordova-plugin-native-spinner": "^1.0.8",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-statusbar": "^2.2.3",
"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-uniquedeviceid": "^1.3.2",
"cordova-plugin-whitelist": "^1.3.2",
"cordova-plugin-x-socialsharing": "^5.2.1",
"cordova-plugin-x-toast": "^2.6.0",
- "cordova-sqlite-storage": "^2.0.4",
"es6-promise-plugin": "^4.1.0",
- "ionic-angular": "3.7.1",
+ "ionic-angular": "^3.9.2",
"ionic-plugin-keyboard": "^2.2.1",
- "ionicons": "3.0.0",
- "lodash": "4.17.4",
- "ngx-clipboard": "8.0.3",
- "rxjs": "5.4.3",
- "simple-plist": "0.2.1",
- "sw-toolbox": "3.6.0",
- "zone.js": "0.8.18"
+ "ionicons": "^3.0.0",
+ "lodash": "^4.17.4",
+ "ngx-clipboard": "^8.1.1",
+ "preconditions": "^2.2.0",
+ "rxjs": "^5.5.2",
+ "simple-plist": "^0.2.1",
+ "sw-toolbox": "^3.6.0",
+ "zone.js": "^0.8.18"
},
"devDependencies": {
- "@angular/cli": "1.3.0",
- "@biesbjerg/ngx-translate-extract": "2.3.2",
- "@ionic/app-scripts": "3.0.1",
- "@types/chrome": "0.0.47",
- "@types/cordova-plugin-qrscanner": "1.0.31",
- "@types/jasmine": "2.5.53",
- "@types/lodash": "4.14.71",
- "angular2-template-loader": "0.6.2",
- "codecov": "2.2.0",
+ "@angular/cli": "^1.5.0",
+ "@biesbjerg/ngx-translate-extract": "^2.3.4",
+ "@ionic/app-scripts": "^3.1.0",
+ "@types/chrome": "^0.0.52",
+ "@types/cordova-plugin-qrscanner": "^1.0.31",
+ "@types/jasmine": "^2.6.3",
+ "@types/lodash": "^4.14.83",
+ "angular2-template-loader": "^0.6.2",
+ "codecov": "^3.0.0",
"fs-extra": "^4.0.2",
- "html-loader": "0.4.5",
- "ionic": "3.17.0",
- "jasmine-core": "2.6.4",
- "jasmine-spec-reporter": "4.1.1",
- "karma": "1.7.0",
- "karma-chrome-launcher": "2.2.0",
- "karma-jasmine": "1.1.0",
- "karma-jasmine-html-reporter": "0.2.2",
- "karma-mocha-reporter": "2.2.3",
- "karma-phantomjs-launcher": "1.0.4",
- "karma-remap-istanbul": "0.6.0",
- "karma-sourcemap-loader": "0.3.7",
- "karma-webpack": "2.0.4",
- "null-loader": "0.1.1",
- "path": "0.12.7",
- "trash-cli": "1.4.0",
- "ts-loader": "2.0.3",
- "ts-node": "3.3.0",
- "tslint": "5.5.0",
- "tslint-eslint-rules": "4.1.1",
- "typescript": "2.3.4",
- "webpack": "3.8.1"
+ "html-loader": "^0.5.1",
+ "ionic": "^3.17.0",
+ "jasmine-core": "^2.8.0",
+ "jasmine-spec-reporter": "^4.2.1",
+ "karma": "^1.7.1",
+ "karma-chrome-launcher": "^2.2.0",
+ "karma-jasmine": "^1.1.0",
+ "karma-jasmine-html-reporter": "^0.2.2",
+ "karma-mocha-reporter": "^2.2.5",
+ "karma-phantomjs-launcher": "^1.0.4",
+ "karma-remap-istanbul": "^0.6.0",
+ "karma-sourcemap-loader": "^0.3.7",
+ "karma-webpack": "^2.0.5",
+ "null-loader": "^0.1.1",
+ "path": "^0.12.7",
+ "trash-cli": "^1.4.0",
+ "ts-loader": "^3.1.1",
+ "ts-node": "^3.3.0",
+ "tslint": "^5.8.0",
+ "tslint-eslint-rules": "^4.1.1",
+ "typescript": "^2.6.1",
+ "webpack": "^3.8.1"
},
"cordova": {
"plugins": {
- "cordova-sqlite-storage": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-statusbar": {},
@@ -167,7 +165,7 @@
"cordova-plugin-qrscanner": {},
"cordova-plugin-touch-id": {},
"cordova-plugin-android-fingerprint-auth": {},
- "cordova-plugin-spinner-dialog": {},
+ "cordova-plugin-native-spinner": {},
"cordova-plugin-dialogs": {},
"cordova-plugin-network-information": {},
"cordova-plugin-uniquedeviceid": {},
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 798b90a19..3c1d87647 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -1,6 +1,6 @@
import { BrowserModule } from '@angular/platform-browser';
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';
/* Native modules */
@@ -94,7 +94,7 @@ import { TxConfirmNotificationProvider } from '../providers/tx-confirm-notificat
import { TxFormatProvider } from '../providers/tx-format/tx-format';
import { WalletProvider } from '../providers/wallet/wallet';
-export function createTranslateLoader(http: Http) {
+export function createTranslateLoader(http: HttpClient) {
return new TranslatePoHttpLoader(http, 'assets/i18n', '.po');
}
@@ -206,7 +206,7 @@ export function providersComponents() {
tabsPlacement: 'bottom'
}),
BrowserModule,
- HttpModule,
+ HttpClientModule,
NgLoggerModule.forRoot(Level.LOG),
MomentModule,
QRCodeModule,
@@ -214,7 +214,7 @@ export function providersComponents() {
loader: {
provide: TranslateLoader,
useFactory: createTranslateLoader,
- deps: [Http]
+ deps: [HttpClient]
}
}),
],
diff --git a/src/pages/send/amount/amount.ts b/src/pages/send/amount/amount.ts
index 9cd6186c9..d0bb0b34a 100644
--- a/src/pages/send/amount/amount.ts
+++ b/src/pages/send/amount/amount.ts
@@ -146,8 +146,8 @@ export class AmountPage {
// Always return to BTC... TODO?
this.altUnitIndex = 0;
} else {
- this.altUnitIndex = _.findIndex(this.availableUnits, {
- isFiat: true
+ this.altUnitIndex = _.findIndex(this.availableUnits, function(o) {
+ return o.isFiat == true;
});
}
diff --git a/src/providers/app/app.ts b/src/providers/app/app.ts
index ce45df2b6..6030fd1c8 100644
--- a/src/providers/app/app.ts
+++ b/src/providers/app/app.ts
@@ -1,7 +1,6 @@
import { Injectable } from '@angular/core';
-import { Http, Response } from '@angular/http';
+import { HttpClient } from '@angular/common/http';
import { Logger } from '@nsalaun/ng-logger';
-import 'rxjs/add/operator/map';
import { LanguageProvider } from '../../providers/language/language';
import { ConfigProvider } from '../../providers/config/config';
@@ -41,11 +40,11 @@ interface App {
@Injectable()
export class AppProvider {
- public info: App;
+ public info: any;
private jsonPath: string = 'assets/appConfig.json';
constructor(
- public http: Http,
+ public http: HttpClient,
private logger: Logger,
private language: LanguageProvider,
private config: ConfigProvider,
@@ -71,7 +70,6 @@ export class AppProvider {
}
private getInfo() {
- return this.http.get(this.jsonPath)
- .map((res: Response) => res.json());
+ return this.http.get(this.jsonPath);
}
}
diff --git a/src/providers/fee/fee.ts b/src/providers/fee/fee.ts
index 36ef5d622..d5a36790f 100644
--- a/src/providers/fee/fee.ts
+++ b/src/providers/fee/fee.ts
@@ -44,12 +44,12 @@ export class FeeProvider {
let feeLevelRate: any;
if (response.fromCache) {
- feeLevelRate = _.find(response.levels[network], {
- level: feeLevel
+ feeLevelRate = _.find(response.levels[network], function (o) {
+ return o.level == feeLevel;
});
} else {
- feeLevelRate = _.find(response[network], {
- level: feeLevel
+ feeLevelRate = _.find(response[network], function (o) {
+ return o.level == feeLevel;
});
}
if (!feeLevelRate || !feeLevelRate.feePerKb) {
@@ -104,4 +104,4 @@ export class FeeProvider {
}
-}
\ No newline at end of file
+}
diff --git a/src/providers/filter/filter.ts b/src/providers/filter/filter.ts
index 481097b74..ade751871 100644
--- a/src/providers/filter/filter.ts
+++ b/src/providers/filter/filter.ts
@@ -1,6 +1,4 @@
import { Injectable } from '@angular/core';
-import { Http } from '@angular/http';
-import 'rxjs/add/operator/map';
import * as _ from "lodash";
@Injectable()
@@ -8,7 +6,7 @@ export class Filter {
public formats: any;
- constructor(public http: Http) {
+ constructor() {
console.log('Hello Filter Provider');
this.formats = {
CURRENCY_SYM: "$",
diff --git a/src/providers/profile/profile.spec.ts b/src/providers/profile/profile.spec.ts
index d7dc683d4..50691dcae 100644
--- a/src/providers/profile/profile.spec.ts
+++ b/src/providers/profile/profile.spec.ts
@@ -1,5 +1,5 @@
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 { WalletProvider } from '../wallet/wallet';
import { ProfileProvider } from './profile';
@@ -36,7 +36,7 @@ describe('Profile Provider', () => {
TestBed.configureTestingModule({
providers: [
ProfileProvider,
- { provide: Http },
+ { provide: HttpClient },
{ provide: Logger },
{ provide: WalletProvider },
{ provide: PersistenceProvider, useClass: PersistenceProviderMock },
diff --git a/src/providers/rate/rate.ts b/src/providers/rate/rate.ts
index 1aa2c69b3..52eca3387 100644
--- a/src/providers/rate/rate.ts
+++ b/src/providers/rate/rate.ts
@@ -1,7 +1,5 @@
import { Injectable } from '@angular/core';
-import { Http } from '@angular/http';
-import 'rxjs/add/operator/map';
-import 'rxjs/add/operator/toPromise';
+import { HttpClient } from '@angular/common/http';
import * as _ from 'lodash';
@Injectable()
@@ -17,7 +15,7 @@ export class RateProvider {
private rateServiceUrl = 'https://bitpay.com/api/rates';
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');
this._rates = {};
this._alternatives = [];
@@ -65,17 +63,19 @@ export class RateProvider {
}
getBTC(): Promise {
- return this.http.get(this.rateServiceUrl)
- .map((response) => response.json())
- .toPromise()
- .catch((error) => console.log("Error", error));
+ return new Promise((resolve, reject) => {
+ this.http.get(this.rateServiceUrl).subscribe((data) => {
+ resolve(data);
+ });
+ });
}
getBCH(): Promise {
- return this.http.get(this.bchRateServiceUrl)
- .map((response) => response.json())
- .toPromise()
- .catch((error) => console.log("Error", error));
+ return new Promise((resolve, reject) => {
+ this.http.get(this.bchRateServiceUrl).subscribe((data) => {
+ resolve(data);
+ });
+ });
}
getRate(code, chain?) {
diff --git a/src/providers/release/release.spec.ts b/src/providers/release/release.spec.ts
index f75800276..0ee783bbc 100644
--- a/src/providers/release/release.spec.ts
+++ b/src/providers/release/release.spec.ts
@@ -1,5 +1,5 @@
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 { ReleaseProvider } from './release';
@@ -17,9 +17,9 @@ describe('Release Provider', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [
- ReleaseProvider,
- { provide: Http },
- { provide: AppProvider, useClass: AppProviderMock },
+ ReleaseProvider,
+ { provide: HttpClient },
+ { provide: AppProvider, useClass: AppProviderMock },
]
});
});
@@ -34,7 +34,7 @@ describe('Release Provider', () => {
it('should get successfully the current app version', () => {
// Should return the AppProviderMock object
const appVersion = service.getCurrentAppVersion();
-
+
expect(appVersion).toBeDefined();
expect(appVersion).toEqual(currentAppVersion);
});
@@ -49,20 +49,20 @@ describe('Release Provider', () => {
expect(version).toEqual(latestAppVersion);
});
}));
-
+
it('should check unsuccessfully the current app version format', () => {
const result = service.checkForUpdates(latestAppVersion, 'V..3.3.3');
-
+
expect(result.updateAvailable).toBeNull;
expect(result.availabeVersion).toBeNull;
expect(result.error).toBeDefined();
expect(result.error).toMatch('Cannot');
expect(result.error).toMatch('version tag');
});
-
+
it('should check unsuccessfully the latest app version format', () => {
const result = service.checkForUpdates('V..3.3.3', currentAppVersion);
-
+
expect(result.updateAvailable).toBeNull;
expect(result.availabeVersion).toBeNull;
expect(result.error).toBeDefined();
@@ -77,10 +77,10 @@ describe('Release Provider', () => {
expect(result.updateAvailable).toBeNull;
expect(result.availabeVersion).toBeNull;
});
-
+
it('should be a new version available', () => {
const result = service.checkForUpdates(latestAppVersion, currentAppVersion);
-
+
expect(result.error).toBeNull;
expect(result.updateAvailable).toBeTruthy;
expect(result.availabeVersion).toEqual(latestAppVersion);
diff --git a/src/providers/release/release.ts b/src/providers/release/release.ts
index 911cf5acd..78ed434fd 100644
--- a/src/providers/release/release.ts
+++ b/src/providers/release/release.ts
@@ -1,7 +1,5 @@
import { Injectable } from '@angular/core';
-import { Http } from '@angular/http';
-import 'rxjs/add/operator/map';
-import 'rxjs/add/operator/toPromise';
+import { HttpClient } from '@angular/common/http';
import { AppProvider } from '../../providers/app/app';
@Injectable()
@@ -9,20 +7,21 @@ export class ReleaseProvider {
private LATEST_RELEASE_URL: 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.appVersion = this.app.info.version;
}
-
+
getCurrentAppVersion() {
return this.appVersion;
}
getLatestAppVersion(): Promise {
- return this.http.get(this.LATEST_RELEASE_URL)
- .map((response) => response.json().tag_name)
- .toPromise()
- .catch((error) => (error));
+ return new Promise((resolve, reject) => {
+ this.http.get(this.LATEST_RELEASE_URL).subscribe((data) => {
+ resolve(data['tag_name']);
+ });
+ });
}
checkForUpdates(latestVersion: string, currentVersion?: string) {
diff --git a/src/providers/scan/scan.ts b/src/providers/scan/scan.ts
index 7bb06e676..9ba630645 100644
--- a/src/providers/scan/scan.ts
+++ b/src/providers/scan/scan.ts
@@ -1,7 +1,6 @@
import { Injectable } from '@angular/core';
import { QRScanner, QRScannerStatus } from '@ionic-native/qr-scanner';
import { PlatformProvider } from '../platform/platform';
-import 'rxjs/add/operator/map';
@Injectable()
export class ScanProvider {
diff --git a/src/providers/tx-format/tx-format.ts b/src/providers/tx-format/tx-format.ts
index aa3e69d5d..5a1a9023b 100644
--- a/src/providers/tx-format/tx-format.ts
+++ b/src/providers/tx-format/tx-format.ts
@@ -1,6 +1,4 @@
import { Injectable } from '@angular/core';
-import { Http } from '@angular/http';
-import 'rxjs/add/operator/map';
import { BwcProvider } from '../bwc/bwc';
import { RateProvider } from '../rate/rate';
import { ConfigProvider } from '../config/config';
@@ -14,7 +12,6 @@ export class TxFormatProvider {
public pendingTxProposalsCountForUs: number
constructor(
- public http: Http,
private bwc: BwcProvider,
private rate: RateProvider,
private config: ConfigProvider,
diff --git a/src/providers/wallet/wallet.spec.ts b/src/providers/wallet/wallet.spec.ts
index d8685f766..5abb009fd 100644
--- a/src/providers/wallet/wallet.spec.ts
+++ b/src/providers/wallet/wallet.spec.ts
@@ -1,5 +1,5 @@
import { TestBed, async } from '@angular/core/testing';
-import { HttpModule } from '@angular/http';
+import { HttpClientModule } from '@angular/common/http';
import { ConfigProvider } from '../config/config';
import { WalletProvider } from './wallet';
import { Logger, Level as LoggerLevel } from '@nsalaun/ng-logger';
@@ -37,7 +37,7 @@ describe('Provider: Wallet Provider', () => {
beforeEach(() => {
TestBed.configureTestingModule({
- imports: [HttpModule],
+ imports: [HttpClientModule],
providers: [
WalletProvider,
{ provide: ConfigProvider },
@@ -114,4 +114,4 @@ describe('Provider: Wallet Provider', () => {
})
});
-});
\ No newline at end of file
+});
diff --git a/src/providers/wallet/wallet.ts b/src/providers/wallet/wallet.ts
index e3f3d328a..5e1abb19a 100644
--- a/src/providers/wallet/wallet.ts
+++ b/src/providers/wallet/wallet.ts
@@ -637,8 +637,8 @@ export class WalletProvider {
// Approx utxo amount, from which the uxto is economically redeemable
private getMinFee(wallet: any, feeLevels: any, nbOutputs?: number): number {
- let level: any = lodash.find(feeLevels[wallet.network], {
- level: 'normal',
+ let level: any = lodash.find(feeLevels[wallet.network], function (o) {
+ return o.level == 'normal';
});
let lowLevelRate = parseInt((level.feePerKb / 1000).toFixed(0));