Skip to content
Permalink
Browse files

prettier fixes

  • Loading branch information
JohnathanWhite committed Feb 7, 2020
1 parent 0ae9cff commit 5165ad56a4d1c702cf96cd72c211ea1d942c48e4
@@ -286,7 +286,7 @@ export class CopayApp {
'card',
CARD_IAB_CONFIG,
'https://<url>',
`sessionStorage.setItem('isPaired', ${!!token})`,
`sessionStorage.setItem('isPaired', ${!!token})`
)
.then(ref => {
this.cardIAB_Ref = ref;
@@ -1,3 +1,2 @@
export const CARD_IAB_CONFIG =
'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,hidden=yes,clearcache=yes,hidespinner=yes,disallowoverscroll=yes,zoom=no';

@@ -120,6 +120,12 @@ page-cards {
animation: fadeInX 400ms;
}
@keyframes fadeInX {
from { transform: translateX(25px); opacity: 0; }
to { transform: translateX(0); opacity: 1; }
from {
transform: translateX(25px);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
@@ -27,7 +27,7 @@ export class CardsPage {
private giftCardProvider: GiftCardProvider,
private persistenceProvider: PersistenceProvider
) {
this.persistenceProvider.getCardExperimentFlag().then( (status) => {
this.persistenceProvider.getCardExperimentFlag().then(status => {
this.cardExperimentEnabled = status === 'enabled';
});
}
@@ -47,7 +47,6 @@ export class CardsPage {
this.ready = true;
}


public enableCard() {
this.longPressed++;

@@ -2,7 +2,11 @@ import { Component, Input, OnInit } from '@angular/core';
import { NavController } from 'ionic-angular';

// Providers
import { AppProvider, InAppBrowserProvider, PersistenceProvider } from '../../../../providers';
import {
AppProvider,
InAppBrowserProvider,
PersistenceProvider
} from '../../../../providers';

// Pages
import { BitPayCardPage } from '../../../integrations/bitpay-card/bitpay-card';
@@ -21,7 +25,7 @@ export class BitPayCardHome implements OnInit {
private appProvider: AppProvider,
private navCtrl: NavController,
private persistenceProvider: PersistenceProvider,
private iab: InAppBrowserProvider,
private iab: InAppBrowserProvider
) {}

ngOnInit() {
@@ -33,19 +37,21 @@ export class BitPayCardHome implements OnInit {
}

public goToCard(cardId): void {
this.persistenceProvider.getCardExperimentFlag().then( (status: string )=> {
this.persistenceProvider.getCardExperimentFlag().then((status: string) => {
if (status === 'enabled') {
this.iab.refs.card.executeScript({
code: `window.postMessage(${JSON.stringify({
message: 'openDashboard'
})}, '*')`
}, () => {
this.iab.refs.card.show();
});
this.iab.refs.card.executeScript(
{
code: `window.postMessage(${JSON.stringify({
message: 'openDashboard'
})}, '*')`
},
() => {
this.iab.refs.card.show();
}
);
} else {
this.navCtrl.push(BitPayCardPage, { id: cardId });
}
});

}
}
@@ -26,8 +26,14 @@ page-bitpay-card-intro {
}

@keyframes fadein {
from { transform: translateY(20px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
from {
transform: translateY(20px);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}

.bitpayCard {
@@ -113,14 +113,16 @@ export class BitPayCardIntroPage {

public async orderBitPayCard() {
if (this.cardExperimentEnabled) {
this.iab.refs.card.executeScript({
code: `window.postMessage(${JSON.stringify({
message: 'orderCard'
})}, '*')`
}, () => {
this.iab.refs.card.show();
});

this.iab.refs.card.executeScript(
{
code: `window.postMessage(${JSON.stringify({
message: 'orderCard'
})}, '*')`
},
() => {
this.iab.refs.card.show();
}
);
} else {
this.bitPayCardProvider.logEvent('legacycard_order', {});
let url = 'https://bitpay.com/visa/get-started';
@@ -57,15 +57,17 @@ export class BitPayIdPage {
)
}
);
this.iab.refs.card.executeScript({
code: `window.postMessage(${JSON.stringify({
message: 'bitPayIdDisconnected'
})}, '*')`
}, () => {
infoSheet.present();
this.navCtrl.popToRoot();
});

this.iab.refs.card.executeScript(
{
code: `window.postMessage(${JSON.stringify({
message: 'bitPayIdDisconnected'
})}, '*')`
},
() => {
infoSheet.present();
this.navCtrl.popToRoot();
}
);
},
err => {
this.logger.log(err);
@@ -185,17 +185,20 @@ export class SettingsPage {

public openBitPayIdPage(): void {
if (this.bitPayIdUserInfo) {
this.navCtrl.push(BitPayIdPage, this.bitPayIdUserInfo)
this.navCtrl.push(BitPayIdPage, this.bitPayIdUserInfo);
} else {
this.cardIAB_Ref.executeScript({
code: `window.postMessage(${JSON.stringify({
message: 'pairingOnly'
})}, '*')`
}, () => {
setTimeout(() => {
this.cardIAB_Ref.show();
}, 500)
});
this.cardIAB_Ref.executeScript(
{
code: `window.postMessage(${JSON.stringify({
message: 'pairingOnly'
})}, '*')`
},
() => {
setTimeout(() => {
this.cardIAB_Ref.show();
}, 500);
}
);
}
}

@@ -25,16 +25,15 @@ export class BitPayIdProvider {
private device: Device,
private platformProvider: PlatformProvider,
private persistenceProvider: PersistenceProvider,
private iab: InAppBrowserProvider,

private iab: InAppBrowserProvider
) {
this.logger.debug('BitPayProvider initialized');

this.NETWORK = 'livenet';
this.BITPAY_API_URL = 'https://192.168.1.79:8088';
// this.NETWORK == 'livenet'
// ? 'https://bitpay.com'
// : 'https://test.bitpay.com';
// this.NETWORK == 'livenet'
// ? 'https://bitpay.com'
// : 'https://test.bitpay.com';
if (this.platformProvider.isElectron) {
this.deviceName = this.platformProvider.getOS().OSName;
} else if (this.platformProvider.isCordova) {
@@ -116,7 +115,6 @@ export class BitPayIdProvider {
const { data } = user;
const { email, familyName, givenName } = data;


await Promise.all([
this.persistenceProvider.setBitPayIdPairingToken(
network,
@@ -129,13 +127,10 @@ export class BitPayIdProvider {
token: token.data,
familyName: familyName || '',
givenName: givenName || ''
}),
})
]);



successCallback(data);

}
} catch (err) {
errorCallback(err);
@@ -152,23 +147,28 @@ export class BitPayIdProvider {
const network = Network[this.getEnvironment().network];

// @ts-ignore
const user: any = await this.persistenceProvider.getBitPayIdUserInfo(network);
const user: any = await this.persistenceProvider.getBitPayIdUserInfo(
network
);
// TODO add in logic to remove all cards

try {
await Promise.all([
this.persistenceProvider.removeBitPayIdPairingToken(network),
this.persistenceProvider.removeBitPayIdUserInfo(network),
this.persistenceProvider.removeBitPayIdUserInfo(network)
// TODO leave commented for the time being
// this.persistenceProvider.removeBitpayAccount(network, user.email)
]);
this.iab.refs.card.executeScript({
code: `window.postMessage(${JSON.stringify({
message: 'bitpayIdDisconnected'
})}, '*')`
}, () => {
successCallback();
});
this.iab.refs.card.executeScript(
{
code: `window.postMessage(${JSON.stringify({
message: 'bitpayIdDisconnected'
})}, '*')`
},
() => {
successCallback();
}
);
} catch (err) {
errorCallback(err);
}

0 comments on commit 5165ad5

Please sign in to comment.
You can’t perform that action at this time.