mirror of https://github.com/BTCPrivate/copay.git
Merge pull request #8084 from bitjson/tslint/prefer-conditional-expression
lint: reenable tslint prefer-conditional-expression, fix
This commit is contained in:
commit
f2fa241c0e
|
@ -113,10 +113,10 @@ export class BackupGamePage {
|
||||||
};
|
};
|
||||||
|
|
||||||
private shouldContinue(): void {
|
private shouldContinue(): void {
|
||||||
if (this.customWords.length == this.shuffledMnemonicWords.length)
|
this.selectComplete =
|
||||||
this.selectComplete = true;
|
this.customWords.length === this.shuffledMnemonicWords.length
|
||||||
else
|
? true
|
||||||
this.selectComplete = false;
|
: false;
|
||||||
};
|
};
|
||||||
|
|
||||||
private showBackupResult(): void {
|
private showBackupResult(): void {
|
||||||
|
|
|
@ -421,13 +421,9 @@ export class BitPayCardTopUpPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
private openFinishModal(): void {
|
private openFinishModal(): void {
|
||||||
let finishComment: string;
|
const finishComment = this.wallet.credentials.m === 1
|
||||||
if (this.wallet.credentials.m == 1) {
|
? this.translate.instant('Funds were added to debit card')
|
||||||
finishComment = this.translate.instant('Funds were added to debit card');
|
: this.translate.instant('Transaction initiated');
|
||||||
}
|
|
||||||
else {
|
|
||||||
finishComment = this.translate.instant('Transaction initiated');
|
|
||||||
}
|
|
||||||
let finishText = '';
|
let finishText = '';
|
||||||
let modal = this.modalCtrl.create(FinishModalPage, { finishText, finishComment }, { showBackdrop: true, enableBackdropDismiss: false });
|
let modal = this.modalCtrl.create(FinishModalPage, { finishText, finishComment }, { showBackdrop: true, enableBackdropDismiss: false });
|
||||||
modal.present();
|
modal.present();
|
||||||
|
|
|
@ -45,10 +45,9 @@ export class MercadoLibreCardDetailsPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
public openRedeemLink() {
|
public openRedeemLink() {
|
||||||
let url;
|
const url = this.mercadoLibreProvider.getNetwork() === 'testnet'
|
||||||
let isSandbox = this.mercadoLibreProvider.getNetwork() == 'testnet' ? true : false;
|
? 'https://beta.mercadolivre.com.br/vale-presente/resgate'
|
||||||
if (isSandbox) url = 'https://beta.mercadolivre.com.br/vale-presente/resgate';
|
: 'https://www.mercadolivre.com.br/vale-presente/resgate';
|
||||||
else url = 'https://www.mercadolivre.com.br/vale-presente/resgate';
|
|
||||||
this.openExternalLink(url);
|
this.openExternalLink(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -355,11 +355,7 @@ export class AmountPage {
|
||||||
if (a) {
|
if (a) {
|
||||||
this.alternativeAmount = this.txFormatProvider.formatAmount(a * this.unitToSatoshi, true);
|
this.alternativeAmount = this.txFormatProvider.formatAmount(a * this.unitToSatoshi, true);
|
||||||
} else {
|
} else {
|
||||||
if (result) {
|
this.alternativeAmount = result ? 'N/A' : null;
|
||||||
this.alternativeAmount = 'N/A';
|
|
||||||
} else {
|
|
||||||
this.alternativeAmount = null;
|
|
||||||
}
|
|
||||||
this.allowSend = false;
|
this.allowSend = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -426,13 +422,9 @@ export class AmountPage {
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
let amount = _amount;
|
let amount = _amount;
|
||||||
|
amount = unit.isFiat
|
||||||
if (unit.isFiat) {
|
? (this.fromFiat(amount) * this.unitToSatoshi).toFixed(0)
|
||||||
amount = (this.fromFiat(amount) * this.unitToSatoshi).toFixed(0);
|
: (amount * this.unitToSatoshi).toFixed(0);
|
||||||
} else {
|
|
||||||
amount = (amount * this.unitToSatoshi).toFixed(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
recipientType: this.recipientType,
|
recipientType: this.recipientType,
|
||||||
amount,
|
amount,
|
||||||
|
|
|
@ -131,16 +131,11 @@ export class ChooseFeeLevelPage {
|
||||||
|
|
||||||
public checkFees(feePerSatByte: string): void {
|
public checkFees(feePerSatByte: string): void {
|
||||||
let fee = Number(feePerSatByte);
|
let fee = Number(feePerSatByte);
|
||||||
|
this.showError = fee <= this.minFeeAllowed ? true : false;
|
||||||
|
this.showMinWarning =
|
||||||
if (fee <= this.minFeeAllowed) this.showError = true;
|
fee > this.minFeeAllowed && fee < this.minFeeRecommended ? true : false;
|
||||||
else this.showError = false;
|
this.showMaxWarning =
|
||||||
|
fee < this.maxFeeAllowed && fee > this.maxFeeRecommended ? true : false;
|
||||||
if (fee > this.minFeeAllowed && fee < this.minFeeRecommended) this.showMinWarning = true;
|
|
||||||
else this.showMinWarning = false;
|
|
||||||
|
|
||||||
if (fee < this.maxFeeAllowed && fee > this.maxFeeRecommended) this.showMaxWarning = true;
|
|
||||||
else this.showMaxWarning = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ok(): void {
|
public ok(): void {
|
||||||
|
|
|
@ -40,12 +40,8 @@ export class AddressbookViewPage {
|
||||||
this.name = this.navParams.data.contact.name;
|
this.name = this.navParams.data.contact.name;
|
||||||
this.email = this.navParams.data.contact.email;
|
this.email = this.navParams.data.contact.email;
|
||||||
|
|
||||||
var cashAddress = this.bitcoreCash.Address.isValid(this.address, 'livenet');
|
const cashAddress = this.bitcoreCash.Address.isValid(this.address, 'livenet');
|
||||||
if (cashAddress) {
|
this.coin = cashAddress ? 'bch' : 'btc';
|
||||||
this.coin = 'bch';
|
|
||||||
} else {
|
|
||||||
this.coin = 'btc';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ionViewDidLoad() {
|
ionViewDidLoad() {
|
||||||
|
|
|
@ -65,11 +65,9 @@ export class TxDetailsPage {
|
||||||
this.txsUnsubscribedForNotifications = this.config.confirmedTxsNotifications ? !this.config.confirmedTxsNotifications.enabled : true;
|
this.txsUnsubscribedForNotifications = this.config.confirmedTxsNotifications ? !this.config.confirmedTxsNotifications.enabled : true;
|
||||||
|
|
||||||
let defaults = this.configProvider.getDefaults();
|
let defaults = this.configProvider.getDefaults();
|
||||||
if (this.wallet.coin == 'bch') {
|
this.blockexplorerUrl = this.wallet.coin === 'bch'
|
||||||
this.blockexplorerUrl = defaults.blockExplorerUrl.bch;
|
? defaults.blockExplorerUrl.bch
|
||||||
} else {
|
: defaults.blockExplorerUrl.btc;
|
||||||
this.blockexplorerUrl = defaults.blockExplorerUrl.btc;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.txConfirmNotificationProvider.checkIfEnabled(this.txId).then((res: any) => {
|
this.txConfirmNotificationProvider.checkIfEnabled(this.txId).then((res: any) => {
|
||||||
this.txNotification = {
|
this.txNotification = {
|
||||||
|
|
|
@ -122,11 +122,7 @@ export class WalletDetailsPage {
|
||||||
// };
|
// };
|
||||||
// lodash.times(15, addOutput);
|
// lodash.times(15, addOutput);
|
||||||
// txps.push(txp);
|
// txps.push(txp);
|
||||||
if (!txps) {
|
this.txps = !txps ? [] : _.sortBy(txps, 'createdOn').reverse();
|
||||||
this.txps = [];
|
|
||||||
} else {
|
|
||||||
this.txps = _.sortBy(txps, 'createdOn').reverse();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateTxHistory() {
|
private updateTxHistory() {
|
||||||
|
@ -146,8 +142,7 @@ export class WalletDetailsPage {
|
||||||
this.updatingTxHistory = false;
|
this.updatingTxHistory = false;
|
||||||
|
|
||||||
let hasTx = txHistory[0];
|
let hasTx = txHistory[0];
|
||||||
if (hasTx) this.showNoTransactionsYetMsg = false;
|
this.showNoTransactionsYetMsg = hasTx ? false : true;
|
||||||
else this.showNoTransactionsYetMsg = true;
|
|
||||||
|
|
||||||
this.wallet.completeHistory = txHistory;
|
this.wallet.completeHistory = txHistory;
|
||||||
this.showHistory();
|
this.showHistory();
|
||||||
|
|
|
@ -28,12 +28,9 @@ export class AmazonProvider {
|
||||||
* Production: 'livenet'
|
* Production: 'livenet'
|
||||||
*/
|
*/
|
||||||
this.credentials.NETWORK = 'livenet';
|
this.credentials.NETWORK = 'livenet';
|
||||||
// TODO this.credentials.NETWORK = 'testnet';
|
this.credentials.BITPAY_API_URL = this.credentials.NETWORK === 'testnet'
|
||||||
if (this.credentials.NETWORK == 'testnet') {
|
? "https://test.bitpay.com"
|
||||||
this.credentials.BITPAY_API_URL = "https://test.bitpay.com";
|
: "https://bitpay.com";
|
||||||
} else {
|
|
||||||
this.credentials.BITPAY_API_URL = "https://bitpay.com";
|
|
||||||
};
|
|
||||||
this.limitPerDay = 2000;
|
this.limitPerDay = 2000;
|
||||||
this.homeItem = {
|
this.homeItem = {
|
||||||
name: 'amazon',
|
name: 'amazon',
|
||||||
|
|
|
@ -12,15 +12,9 @@ export class BwcErrorProvider {
|
||||||
if (!err)
|
if (!err)
|
||||||
return 'Unknown error';
|
return 'Unknown error';
|
||||||
|
|
||||||
let name;
|
const name = err.name ?
|
||||||
|
(err.name === 'Error' ? err.message : err.name.replace(/^bwc.Error/g, ''))
|
||||||
if (err.name) {
|
: err;
|
||||||
if (err.name == 'Error')
|
|
||||||
name = err.message
|
|
||||||
else
|
|
||||||
name = err.name.replace(/^bwc.Error/g, '');
|
|
||||||
} else
|
|
||||||
name = err;
|
|
||||||
|
|
||||||
let body = '';
|
let body = '';
|
||||||
prefix = prefix || '';
|
prefix = prefix || '';
|
||||||
|
|
|
@ -100,11 +100,9 @@ export class CoinbaseProvider {
|
||||||
'wallet:payment-methods:read';
|
'wallet:payment-methods:read';
|
||||||
|
|
||||||
// NW has a bug with Window Object
|
// NW has a bug with Window Object
|
||||||
if (this.isCordova) {
|
this.credentials.REDIRECT_URI = this.isCordova
|
||||||
this.credentials.REDIRECT_URI = coinbase.redirect_uri.mobile;
|
? coinbase.redirect_uri.mobile
|
||||||
} else {
|
: coinbase.redirect_uri.desktop;
|
||||||
this.credentials.REDIRECT_URI = coinbase.redirect_uri.desktop;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.credentials.NETWORK == 'testnet') {
|
if (this.credentials.NETWORK == 'testnet') {
|
||||||
this.credentials.HOST = coinbase.sandbox.host;
|
this.credentials.HOST = coinbase.sandbox.host;
|
||||||
|
|
|
@ -61,10 +61,8 @@ export class LanguageProvider {
|
||||||
if (!_.isEmpty(lang)) this.current = lang;
|
if (!_.isEmpty(lang)) this.current = lang;
|
||||||
else {
|
else {
|
||||||
// Get from browser
|
// Get from browser
|
||||||
let browserLang = this.translate.getBrowserLang();
|
const browserLang = this.translate.getBrowserLang();
|
||||||
let validBrowserLang = this.getName(browserLang) ? true : false;
|
this.current = this.getName(browserLang) ? browserLang : this.getDefault();
|
||||||
if (validBrowserLang) this.current = browserLang;
|
|
||||||
else this.current = this.getDefault();
|
|
||||||
}
|
}
|
||||||
this.logger.info('Default language: ' + this.current);
|
this.logger.info('Default language: ' + this.current);
|
||||||
this.translate.setDefaultLang(this.current);
|
this.translate.setDefaultLang(this.current);
|
||||||
|
|
|
@ -92,8 +92,7 @@ export class Logger {
|
||||||
if (typeof v == 'undefined') v = 'undefined';
|
if (typeof v == 'undefined') v = 'undefined';
|
||||||
if (!v) v = 'null';
|
if (!v) v = 'null';
|
||||||
if (typeof v == 'object') {
|
if (typeof v == 'object') {
|
||||||
if (v.message) v = v.message;
|
v = v.message ? v.message : JSON.stringify(v);
|
||||||
else v = JSON.stringify(v);
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// tslint:disable-next-line:no-console
|
// tslint:disable-next-line:no-console
|
||||||
|
|
|
@ -36,12 +36,9 @@ export class MercadoLibreProvider {
|
||||||
*/
|
*/
|
||||||
this.credentials = {};
|
this.credentials = {};
|
||||||
this.credentials.NETWORK = 'livenet';
|
this.credentials.NETWORK = 'livenet';
|
||||||
// TODO this.credentials.NETWORK = 'testnet';
|
this.credentials.BITPAY_API_URL = this.credentials.NETWORK === 'testnet'
|
||||||
if (this.credentials.NETWORK == 'testnet') {
|
? "https://test.bitpay.com"
|
||||||
this.credentials.BITPAY_API_URL = "https://test.bitpay.com";
|
: "https://bitpay.com";
|
||||||
} else {
|
|
||||||
this.credentials.BITPAY_API_URL = "https://bitpay.com";
|
|
||||||
}
|
|
||||||
|
|
||||||
this.homeItem = {
|
this.homeItem = {
|
||||||
name: 'mercadoLibre',
|
name: 'mercadoLibre',
|
||||||
|
|
|
@ -58,11 +58,9 @@ export class PersistenceProvider {
|
||||||
};
|
};
|
||||||
|
|
||||||
public load() {
|
public load() {
|
||||||
if (this.platform.isCordova) {
|
this.storage = this.platform.isCordova
|
||||||
this.storage = new FileStorage(this.file, this.logger);
|
? new FileStorage(this.file, this.logger)
|
||||||
} else {
|
: new LocalStorage();
|
||||||
this.storage = new LocalStorage();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
storeNewProfile(profile): Promise<void> {
|
storeNewProfile(profile): Promise<void> {
|
||||||
|
|
|
@ -34,14 +34,10 @@ export class ShapeshiftProvider {
|
||||||
* Production: 'livenet'
|
* Production: 'livenet'
|
||||||
*/
|
*/
|
||||||
this.credentials.NETWORK = 'livenet';
|
this.credentials.NETWORK = 'livenet';
|
||||||
// TODO this.credentials.NETWORK = 'testnet';
|
this.credentials.API_URL = this.credentials.NETWORK === 'testnet'
|
||||||
|
? ""
|
||||||
if (this.credentials.NETWORK == 'testnet') {
|
|
||||||
this.credentials.API_URL = "";
|
|
||||||
} else {
|
|
||||||
// CORS: cors.shapeshift.io
|
// CORS: cors.shapeshift.io
|
||||||
this.credentials.API_URL = "https://shapeshift.io";
|
: "https://shapeshift.io";
|
||||||
}
|
|
||||||
|
|
||||||
this.homeItem = {
|
this.homeItem = {
|
||||||
name: 'shapeshift',
|
name: 'shapeshift',
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
"no-implicit-dependencies": false,
|
"no-implicit-dependencies": false,
|
||||||
"object-literal-sort-keys": false,
|
"object-literal-sort-keys": false,
|
||||||
"interface-name": false,
|
"interface-name": false,
|
||||||
"prefer-conditional-expression": false,
|
|
||||||
"prefer-for-of": false,
|
"prefer-for-of": false,
|
||||||
"forin": false,
|
"forin": false,
|
||||||
"prefer-const": false,
|
"prefer-const": false,
|
||||||
|
|
Loading…
Reference in New Issue