Skip to content

Commit

Permalink
Revert "#9392 Added possibility to print qr code"
Browse files Browse the repository at this point in the history
  • Loading branch information
cmgustavo authored Dec 24, 2018
1 parent 3867074 commit b796f21
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 71 deletions.
2 changes: 0 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ npm run test:link # Check if the code matches style rules
npm run fix:prettier # Modify files to match style rules
```

Your git commit must be gpg-signed. You'll find further readings on how to sign commits here: https://help.github.com/articles/signing-commits/

**IMPORTANT**: By submitting a patch, you agree to allow the project owner to
license your work under the same license as that used by the project.

Expand Down
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@
"@ionic-native/fcm": "4.14.0",
"@ionic-native/file": "4.14.0",
"@ionic-native/launch-review": "4.14.0",
"@ionic-native/printer": "4.14.0",
"@ionic-native/qr-scanner": "4.14.0",
"@ionic-native/screen-orientation": "4.14.0",
"@ionic-native/social-sharing": "4.14.0",
Expand Down Expand Up @@ -205,7 +204,6 @@
"cordova-plugin-inappbrowser": "2.0.2",
"cordova-plugin-ionic-keyboard": "2.1.3",
"cordova-plugin-network-information": "2.0.1",
"cordova-plugin-printer": "0.7.3",
"cordova-plugin-qrscanner": "2.6.0",
"cordova-plugin-screen-orientation": "3.0.1",
"cordova-plugin-spinner-dialog": "1.3.1",
Expand Down Expand Up @@ -329,8 +327,7 @@
"im.ltdev.cordova.UserAgent": {},
"cordova-launch-review": {},
"cordova-plugin-wkwebview-engine": {},
"cordova-plugin-wkwebview-inputfocusfix": {},
"cordova-plugin-printer": {}
"cordova-plugin-wkwebview-inputfocusfix": {}
},
"platforms": [
"android",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<ion-header class="on-print-hide">
<ion-header>
<ion-navbar [navbar-bg]="wallet?.color">
<ion-title>{{'Export wallet' | translate}}</ion-title>
</ion-navbar>
Expand Down Expand Up @@ -84,21 +84,9 @@
</ion-list>
<ion-list *ngSwitchCase="'qr-code'">
<div class="qrCode" *ngIf="supported && showQrCode">
<div id="cordovaPrintWrapper">
<div class="on-print-show">
<p translate>QR code to recover wallet {{walletName}}</p>
</div>
<ngx-qrcode qrc-value="{{exportWalletInfo}}" qrc-class="aclass" qrc-errorCorrectionLevel="M"></ngx-qrcode>
<ion-item-divider>
<span translate>From the destination device, go to Add wallet &gt; Import wallet and scan this QR code</span>
</ion-item-divider>
</div>
<ion-item-divider class="on-print-hide" *ngIf="isPrintingAvailableOnMobile || !isCordova">
<form>
<button class="button-standard" ion-button type="submit" (click)="printQr()">
<span translate>Print</span>
</button>
</form>
<ngx-qrcode qrc-value="{{exportWalletInfo}}" qrc-class="aclass" qrc-errorCorrectionLevel="M"></ngx-qrcode>
<ion-item-divider>
<span translate>From the destination device, go to Add wallet &gt; Import wallet and scan this QR code</span>
</ion-item-divider>
</div>
<div class="not-supported-message" *ngIf="!supported && showQrCode">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,9 @@ page-wallet-export {
border: 1px solid #e9e9e9;
border-radius: 4px;
}
.on-print-show {
display: none;
}
}
.not-supported-message {
margin-top: 5rem;
text-align: center;
}
@media print {
.scroll-content {
margin: 0 !important; // start printing at the top of the page
}
.on-print-hide {
display: none;
}
.on-print-show {
display: block !important;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { Logger } from '../../../../../providers/logger/logger';

// native
import { Clipboard } from '@ionic-native/clipboard';
import { Printer, PrintOptions } from '@ionic-native/printer';
import { SocialSharing } from '@ionic-native/social-sharing';

// providers
Expand Down Expand Up @@ -43,8 +42,6 @@ export class WalletExportPage extends WalletTabsChild {
public exportWalletInfo;
public supported: boolean;
public showQrCode: boolean;
public isPrintingAvailableOnMobile: boolean = false;
public walletName: string = '';

constructor(
public profileProvider: ProfileProvider,
Expand All @@ -57,7 +54,6 @@ export class WalletExportPage extends WalletTabsChild {
private backupProvider: BackupProvider,
private platformProvider: PlatformProvider,
private socialSharing: SocialSharing,
private printer: Printer,
private appProvider: AppProvider,
private clipboard: Clipboard,
public toastCtrl: ToastController,
Expand Down Expand Up @@ -89,14 +85,6 @@ export class WalletExportPage extends WalletTabsChild {
this.isCordova = this.platformProvider.isCordova;
this.isSafari = this.platformProvider.isSafari;
this.isIOS = this.platformProvider.isIOS;
this.printer.isAvailable().then(
() => {
this.isPrintingAvailableOnMobile = true;
},
() => {}
);
this.walletName =
this.wallet.credentials.walletName || this.wallet.credentials.walletId;
}

private matchingPasswords(passwordKey: string, confirmPasswordKey: string) {
Expand Down Expand Up @@ -375,26 +363,6 @@ export class WalletExportPage extends WalletTabsChild {
});
}

public printQr(): boolean {
if (this.isCordova) {
const elementToPrint = document.getElementById('cordovaPrintWrapper');
const options: PrintOptions = {
name: 'Exported wallet from ' + this.appProvider.info.userVisibleName
};
this.printer.print(elementToPrint, options).then(
() => {
this.logger.debug('Printing dialog finished');
},
() => {
this.logger.error('Unable to print');
}
);
} else {
window.print();
}
return false;
}

private showErrorInfoSheet(err?: Error | string): void {
const title = this.translate.instant('Error');
const msg = err ? err : this.translate.instant('Failed to export');
Expand Down
1 change: 0 additions & 1 deletion src/providers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export { Device } from '@ionic-native/device';
export { FCM } from '@ionic-native/fcm';
export { File } from '@ionic-native/file';
export { LaunchReview } from '@ionic-native/launch-review';
export { Printer } from '@ionic-native/printer';
export { QRScanner } from '@ionic-native/qr-scanner';
export { ScreenOrientation } from '@ionic-native/screen-orientation';
export { SocialSharing } from '@ionic-native/social-sharing';
Expand Down
2 changes: 0 additions & 2 deletions src/providers/providers.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import {
PersistenceProvider,
PlatformProvider,
PopupProvider,
Printer,
ProfileProvider,
PushNotificationsProvider,
QRScanner,
Expand Down Expand Up @@ -104,7 +103,6 @@ import {
OnGoingProcessProvider,
PayproProvider,
PlatformProvider,
Printer,
ProfileProvider,
PopupProvider,
QRScanner,
Expand Down

0 comments on commit b796f21

Please sign in to comment.