REF: change copy to clipboard from complete logs to single line

This commit is contained in:
Gabriel Bazán 2018-01-18 12:01:12 -03:00
parent c3a954841e
commit b2366c4cd7
3 changed files with 5 additions and 22 deletions

View File

@ -17,7 +17,7 @@
<ion-list text-wrap>
<ion-item class="log-entry">
<div *ngIf="filteredLogs && filteredLogs.length > 0">
<div *ngFor="let l of filteredLogs">
<div *ngFor="let l of filteredLogs" copy-to-clipboard="{{ copyLogToClipboard(l) }}">
<span [ngClass]="{'energized': l.level=='warn', 'dark': l.level=='debug', 'positive': l.level=='info', 'assertive': l.level=='error'}">
<span class="log-timestamp">[{{l.timestamp}}]</span>
<span class="log-level">[{{l.level}}]</span> {{l.msg}}

View File

@ -1,9 +1,8 @@
import { Component } from '@angular/core';
import { ActionSheetController, ToastController } from 'ionic-angular';
import { ActionSheetController } from 'ionic-angular';
//native
import { SocialSharing } from '@ionic-native/social-sharing';
import { Clipboard } from '@ionic-native/clipboard';
//providers
import { ConfigProvider } from '../../../../providers/config/config';
@ -30,8 +29,6 @@ export class SessionLogPage {
private logger: Logger,
private socialSharing: SocialSharing,
private actionSheetCtrl: ActionSheetController,
private clipboard: Clipboard,
private toastCtrl: ToastController,
private platformProvider: PlatformProvider
) {
this.config = this.configProvider.get();
@ -75,15 +72,8 @@ export class SessionLogPage {
return log;
}
public copyToClipboard(): void {
let logs = this.prepareLogs();
this.clipboard.copy(logs);
let copyMessage = 'Copied to clipboard' //TODO gettextcatalog
let showSuccess = this.toastCtrl.create({
message: copyMessage,
duration: 1000,
});
showSuccess.present();
public copyLogToClipboard(l): any {
return '[' + l.timestamp + '][' + l.level + ']' + l.msg;
}
public sendLogs(): void {
@ -101,18 +91,11 @@ export class SessionLogPage {
public showOptionsMenu(): void {
let copyText = 'Copy to clipboard' //TODO gettextcatalog
let emailText = 'Send by email' //TODO gettextcatalog
let actionSheet = this.actionSheetCtrl.create({
title: '',
buttons: [
{
text: copyText,
handler: () => {
this.copyToClipboard();
}
},
{
text: emailText,
handler: () => {

View File

@ -707,7 +707,7 @@ export class ProfileProvider {
if (showOpts.extendedPrivateKey) showOpts.extendedPrivateKey = '[hidden]';
if (showOpts.mnemonic) showOpts.mnemonic = '[hidden]';
this.logger.debug('Creating Wallet:', showOpts);
this.logger.debug('Creating Wallet:', JSON.stringify(showOpts));
setTimeout(() => {
this.seedWallet(opts).then((walletClient: any) => {