From b5daa7121e2e57874d472a2f4ac76c7dffff481c Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Thu, 15 Oct 2015 18:18:11 -0300 Subject: [PATCH] Fix send addresses by email (pref -> advanced -> information) --- public/views/preferencesAdvanced.html | 8 +-- public/views/preferencesInformation.html | 57 +++++++++---------- src/js/controllers/preferencesInformation.js | 59 +++++++++++++------- 3 files changed, 71 insertions(+), 53 deletions(-) diff --git a/public/views/preferencesAdvanced.html b/public/views/preferencesAdvanced.html index 45d903d36..5a191d9f6 100644 --- a/public/views/preferencesAdvanced.html +++ b/public/views/preferencesAdvanced.html @@ -12,17 +12,17 @@
  • - Wallet Information +
    Wallet Information
  • - Sweep paper wallet +
    Sweep paper wallet
  • - Export Wallet +
    Export Wallet
  • @@ -32,7 +32,7 @@
  • - Delete Wallet +
    Delete Wallet
  • diff --git a/public/views/preferencesInformation.html b/public/views/preferencesInformation.html index a7501887a..a992ec7a0 100644 --- a/public/views/preferencesInformation.html +++ b/public/views/preferencesInformation.html @@ -4,32 +4,32 @@ ng-init="titleSection='Wallet Information'; goBackToState = 'preferencesAdvanced'"> -
    +

    Wallet Information

      -
    • +
    • Wallet Name (at creation) {{walletName}}
    • -
    • +
    • Wallet Id - + {{walletId}}
    • -
    • +
    • Wallet Configuration (m-n) {{M}}-{{N}}
    • -
    • +
    • Wallet Network {{network}} @@ -37,7 +37,7 @@
    • -
    • +
    • Address Type {{addressType}} @@ -45,7 +45,7 @@
    • -
    • +
    • Derivation Strategy {{derivationStrategy}} @@ -54,13 +54,13 @@

      Extended Public Keys

    • -
      -
      Copayer {{$index}}
      -
      - {{pk}} - +
      +
      Copayer {{$index}}
      +
      +
      {{pk}}
      +
      ({{basePath}}) - +
    • @@ -69,13 +69,11 @@

        Last Wallet Addresses

      • -
        +
        {{a.address}}
        -
        - - {{a.path}} · {{a.createdOn *1000 | amDateFormat:'MMMM Do YYYY, h:mm a' }} - +
        + {{a.path}} · {{a.createdOn *1000 | amDateFormat:'MMMM Do YYYY, h:mm a' }}
      • @@ -87,13 +85,13 @@ Scan addresses for funds -
      • - - -
      • -
      @@ -102,8 +100,10 @@

        Balance By Address

        -
      • - {{a.address}} +
      • +
        + {{a.address}} +
        {{(a.amount/1e8).toFixed(8)}} BTC
        @@ -111,6 +111,7 @@
      +

    diff --git a/src/js/controllers/preferencesInformation.js b/src/js/controllers/preferencesInformation.js index 91c9f21eb..487852a2c 100644 --- a/src/js/controllers/preferencesInformation.js +++ b/src/js/controllers/preferencesInformation.js @@ -1,11 +1,12 @@ 'use strict'; angular.module('copayApp.controllers').controller('preferencesInformation', - function($scope, $log, $timeout, lodash, profileService) { + function($scope, $log, $timeout, isMobile, gettextCatalog, lodash, profileService) { + var base = 'xpub'; + this.init = function() { var fc = profileService.focusedClient; var c = fc.credentials; - var base = 'xpub'; var basePath = profileService.getUtils().PATHS.BASE_ADDRESS_DERIVATION[c.derivationStrategy][c.network]; $scope.walletName = c.walletName; @@ -40,8 +41,17 @@ angular.module('copayApp.controllers').controller('preferencesInformation', }); }); + }; this.sendAddrs = function() { + var self = this; + var fc = profileService.focusedClient; + + if (isMobile.Android() || isMobile.Windows()) { + window.ignoreMobilePause = true; + } + + self.loading = true; function formatDate(ts) { var dateObj = new Date(ts * 1000); @@ -55,26 +65,33 @@ angular.module('copayApp.controllers').controller('preferencesInformation', return dateObj.toJSON(); }; - fc.getMainAddresses({ - doNotVerify: true - }, function(err, addrs) { - if (err) { - $log.warn(err); - return; - }; + $timeout(function() { + fc.getMainAddresses({ + doNotVerify: true + }, function(err, addrs) { + self.loading = false; + if (err) { + $log.warn(err); + return; + }; - var body = 'Copay Wallet' + fc.walletName + ' Addresses\n Only Main Addresses are shown.\n\n'; - body += '\n\n'; - body += addrs.map(function(v) { - return addrs.address, base + addrs.path.substring(1), formatDate(addrs.createdOn); - }).join('\n'); + var body = 'Copay Wallet "' + $scope.walletName + '" Addresses\n Only Main Addresses are shown.\n\n'; + body += "\n"; + body += addrs.map(function(v) { + return ('* ' + v.address + ' ' + base + v.path.substring(1) + ' ' + formatDate(v.createdOn)); + }).join("\n"); - var properties = { - subject: 'Copay Addresses', - body: body, - isHtml: false - }; - window.plugin.email.open(properties); - }); + var properties = { + subject: 'Copay Addresses', + body: body, + isHtml: false + }; + window.plugin.email.open(properties); + + $timeout(function() { + $scope.$apply(); + }, 1000); + }); + }, 100); }; });