diff --git a/public/views/glidera.html b/public/views/glidera.html index d39f553a3..732fa4400 100644 --- a/public/views/glidera.html +++ b/public/views/glidera.html @@ -8,7 +8,7 @@
-
+
@@ -17,14 +17,16 @@
- Connecting to Glidera... + Linking to Glidera... + {{index.glideraLoading|translate}}
-
+ +

You can buy and sell Bitcoin with a US bank account directly in Copay.

diff --git a/public/views/includes/menu-item.html b/public/views/includes/menu-item.html index 5f85ce3c5..fbd813303 100644 --- a/public/views/includes/menu-item.html +++ b/public/views/includes/menu-item.html @@ -1,4 +1,4 @@ - +
{{ item.title|translate }} @@ -6,4 +6,4 @@ {{ index.pendingTxProposalsCountForUs }}
-
\ No newline at end of file + diff --git a/public/views/modals/glidera-confirmation.html b/public/views/modals/glidera-confirmation.html new file mode 100644 index 000000000..11f007613 --- /dev/null +++ b/public/views/modals/glidera-confirmation.html @@ -0,0 +1,15 @@ +
+
+

Revoke Glidera Token

+
+ +
+
+ +
+
+
diff --git a/public/views/preferencesGlidera.html b/public/views/preferencesGlidera.html index 31b8467a9..9a8a52458 100644 --- a/public/views/preferencesGlidera.html +++ b/public/views/preferencesGlidera.html @@ -1,81 +1,266 @@
+ ng-init="titleSection='Preferences'; goBackToState = 'glidera'">
-
+
-
-
+
    +

    Permissions

    +
  • + Email + + {{index.glideraPermissions.view_email_address}} + +
  • +
  • + Personal Information + + {{index.glideraPermissions.personal_info}} + +
  • +
  • + Buy/Sell + + {{index.glideraPermissions.transact}} + +
  • +
  • + Transaction History + + {{index.glideraPermissions.transaction_history}} + +
  • +
-
- - Revoke Token - +
    +

    Email

    +
  • + Email + + {{glidera.email.email}} + +
  • +
  • + Active + + {{glidera.email.userEmailIsSetup}} + +
  • +
-

Permissions

-
    -
  • personal_info: {{glidera.permission.personal_info}} -
  • transact: {{glidera.permission.transact}} -
  • transaction_history: {{glidera.permission.transaction_history}} -
  • view_email_address: {{glidera.permission.view_email_address}} -
+
    +

    Personal Information

    -

    Email

    -
      -
    • Email: {{glidera.email.email}} -
    • userEmailIsSetup: {{glidera.email.userEmailIsSetup}} -
    +
  • + First Name + + {{glidera.personalInfo.firstName}} + +
  • +
  • + Middle Name + + {{glidera.personalInfo.middleName}} + +
  • +
  • + Last Name + + {{glidera.personalInfo.lastName}} + +
  • +
  • + Birth Date + + {{glidera.personalInfo.birthDate}} + +
  • +
  • + Address 1 + + {{glidera.personalInfo.address1}} + +
  • +
  • + Address 2 + + {{glidera.personalInfo.address2}} + +
  • +
  • + City + + {{glidera.personalInfo.city}} + +
  • +
  • + State + + {{glidera.personalInfo.state}} + +
  • +
  • + ZIP Code + + {{glidera.personalInfo.zipCode}} + +
  • +
  • + Country + + {{glidera.personalInfo.countryCode}} + +
  • +
  • + Occupation + + {{glidera.personalInfo.occupation}} + +
  • +
  • + Basic Information State + + {{glidera.personalInfo.basicInfoState}} + +
  • +
-

Personal Info

-
    -
  • first name: {{glidera.personalInfo.firstName}} -
  • middleName: {{glidera.personalInfo.middleName}} -
  • last name: {{glidera.personalInfo.lastName}} -
  • birthDate: {{glidera.personalInfo.birthDate}} -
  • address1: {{glidera.personalInfo.address1}} -
  • address2: {{glidera.personalInfo.address2}} -
  • city: {{glidera.personalInfo.city}} -
  • state: {{glidera.personalInfo.state}} -
  • zipCode: {{glidera.personalInfo.zipCode}} -
  • countryCode: {{glidera.personalInfo.countryCode}} -
  • occupation: {{glidera.personalInfo.occupation}} -
  • basicInfoState: {{glidera.personalInfo.basicInfoState}} -
+
    +

    Status

    -

    Status

    -
      -
    • userCanTransact: {{glidera.status.userCanTransact}} -
    • userCanBuy: {{glidera.status.userCanBuy}} -
    • userCanSell: {{glidera.status.userCanSell}} -
    • userEmailIsSetup: {{glidera.status.userEmailIsSetup}} -
    • userPhoneIsSetup: {{glidera.status.userPhoneIsSetup}} -
    • userBankAccountIsSetup: {{glidera.status.userBankAccountIsSetup}} -
    • personalInfoState: {{glidera.status.personalInfoState}} -
    • bankAccountState: {{glidera.status.bankAccountState}} -
    • country: {{glidera.status.country}} -
    +
  • + Buy/Sell + + {{glidera.status.userCanTransact}} + +
  • -

    Limits

    -
      -
    • dailyBuy: {{glidera.limits.dailyBuy}} -
    • dailySell: {{glidera.limits.dailySell}} -
    • monthlyBuy: {{glidera.limits.monthlyBuy}} -
    • monthlySell: {{glidera.limits.monthlySell}} -
    • dailyBuyRemaining: {{glidera.limits.dailyBuyRemaining}} -
    • dailySellRemaining: {{glidera.limits.dailySellRemaining}} -
    • monthlyBuyRemaining: {{glidera.limits.monthlyBuyRemaining}} -
    • monthlySellRemaining: {{glidera.limits.monthlySellRemaining}} -
    • currency: {{glidera.limits.currency}} -
    • transactDisabledPendingFirstTransaction: {{glidera.limits.transactDisabledPendingFirstTransaction}} -
    -
+
  • + Buy + + {{glidera.status.userCanBuy}} + +
  • +
  • + Sell + + {{glidera.status.userCanSell}} + +
  • +
  • + Email Is Setup + + {{glidera.status.userEmailIsSetup}} + +
  • +
  • + Phone Is Setup + + {{glidera.status.userPhoneIsSetup}} + +
  • +
  • + Bank Account Is Setup + + {{glidera.status.userBankAccountIsSetup}} + +
  • +
  • + Personal Information State + + {{glidera.status.personalInfoState}} + +
  • +
  • + Bank Account State + + {{glidera.status.bankAccountState}} + +
  • +
  • + Country + + {{glidera.status.country}} + +
  • + -
    -
    +
      +

      Limits

      + +
    • + Daily Buy + + {{glidera.limits.dailyBuy}} {{glidera.limits.currency}} + +
    • +
    • + Daily Sell + + {{glidera.limits.dailySell}} {{glidera.limits.currency}} + +
    • +
    • + Monthly Buy + + {{glidera.limits.monthlyBuy}} {{glidera.limits.currency}} + +
    • +
    • + Monthly Sell + + {{glidera.limits.monthlySell}} {{glidera.limits.currency}} + +
    • +
    • + Daily Buy Remaining + + {{glidera.limits.dailyBuyRemaining}} {{glidera.limits.currency}} + +
    • +
    • + Daily Sell Remaining + + {{glidera.limits.dailySellRemaining}} {{glidera.limits.currency}} + +
    • +
    • + Monthly Buy Remaining + + {{glidera.limits.monthlyBuyRemaining}} {{glidera.limits.currency}} + +
    • +
    • + Monthly Sell Remaining + + {{glidera.limits.monthlySellRemaining}} {{glidera.limits.currency}} + +
    • +
    • + Buy/Sell Disabled (pending first transaction) + + {{glidera.limits.transactDisabledPendingFirstTransaction}} + +
    • +
    + +
      +

      Account

      + +
    • + + Revoke Token +
    • +
    diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index de09c9026..c33650f43 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -114,6 +114,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r self.setSpendUnconfirmed(); self.glideraToken = null; + self.glideraError = null; self.glideraPermissions = null; self.glideraEmail = null; self.glideraPersonalInfo = null; @@ -152,18 +153,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r self.setTab = function(tab, reset, tries) { tries = tries || 0; - // check if the whole menu item passed - if (typeof tab == 'object') { - if (tab.open) { - if (tab.link) { - self.tab = tab.link; - } - tab.open(); - return; - } else { - return self.setTab(tab.link); - } - } if (self.tab === tab && !reset) return; @@ -173,30 +162,27 @@ angular.module('copayApp.controllers').controller('indexController', function($r }, 300); } - if (!self.tab || !$state.is('walletHome')) + if (!self.tab) self.tab = 'walletHome'; - go.path('walletHome', function() { - - if (document.getElementById(self.tab)) { - document.getElementById(self.tab).className = 'tab-out tab-view ' + self.tab; - var old = document.getElementById('menu-' + self.tab); - if (old) { - old.className = ''; - } + if (document.getElementById(self.tab)) { + document.getElementById(self.tab).className = 'tab-out tab-view ' + self.tab; + var old = document.getElementById('menu-' + self.tab); + if (old) { + old.className = ''; } + } - if (document.getElementById(tab)) { - document.getElementById(tab).className = 'tab-in tab-view ' + tab; - var newe = document.getElementById('menu-' + tab); - if (newe) { - newe.className = 'active'; - } + if (document.getElementById(tab)) { + document.getElementById(tab).className = 'tab-in tab-view ' + tab; + var newe = document.getElementById('menu-' + tab); + if (newe) { + newe.className = 'active'; } + } - self.tab = tab; - $rootScope.$emit('Local/TabChanged', tab); - }); + self.tab = tab; + $rootScope.$emit('Local/TabChanged', tab); }; @@ -864,13 +850,15 @@ angular.module('copayApp.controllers').controller('indexController', function($r getToken(function(err, accessToken) { if (err || !accessToken) return; else { - self.glideraToken = accessToken; - glideraService.getAccessTokenPermissions(self.glideraToken, function(err, p) { + self.glideraLoading = gettext('Connecting to Glidera...'); + glideraService.getAccessTokenPermissions(accessToken, function(err, p) { + self.glideraLoading = null; if (err) { self.glideraError = err; $log.error(err); } else { + self.glideraToken = accessToken; self.glideraPermissions = p; self.updateGlidera(accessToken, p); } @@ -883,17 +871,23 @@ angular.module('copayApp.controllers').controller('indexController', function($r if (!accessToken || !permissions) return; if (permissions.view_email_address) { + self.glideraLoadingEmail = gettext('Getting Glidera Email...'); glideraService.getEmail(accessToken, function(err, data) { + self.glideraLoadingEmail = null; self.glideraEmail = data.email; }); } if (permissions.personal_info) { + self.glideraLoadingPersonalInfo = gettext('Getting Glidera Personal Information...'); glideraService.getPersonalInfo(accessToken, function(err, data) { + self.glideraLoadingPersonalInfo = null; self.glideraPersonalInfo = data; }); } if (permissions.transaction_history) { + self.glideraLoadingHistory = gettext('Getting Glidera transactions...'); glideraService.getTransactions(accessToken, function(err, data) { + self.glideraLoadingHistory = null; self.glideraTxs = data; }); } diff --git a/src/js/controllers/preferencesGlidera.js b/src/js/controllers/preferencesGlidera.js index 9d4d4bd7f..43d270f31 100644 --- a/src/js/controllers/preferencesGlidera.js +++ b/src/js/controllers/preferencesGlidera.js @@ -1,37 +1,60 @@ 'use strict'; angular.module('copayApp.controllers').controller('preferencesGlideraController', - function($scope, $timeout, profileService, applicationService, glideraService, storageService) { + function($scope, $modal, $timeout, profileService, applicationService, glideraService, storageService) { - this.init = function(token) { + this.getEmail = function(token) { var self = this; - glideraService.getAccessTokenPermissions(token, function(error, permission) { - self.permission = permission; - }); - - glideraService.getEmail(token, function(error, email) { - self.email = email; + glideraService.getEmail(token, function(error, data) { + self.email = data; }); + }; + this.getPersonalInfo = function(token) { + var self = this; glideraService.getPersonalInfo(token, function(error, info) { self.personalInfo = info; }); + }; - glideraService.getStatus(token, function(error, status) { - self.status = status; + this.getStatus = function(token) { + var self = this; + glideraService.getStatus(token, function(error, data) { + self.status = data; }); + }; + this.getLimits = function(token) { + var self = this; glideraService.getLimits(token, function(error, limits) { self.limits = limits; }); - }; + }; this.revokeToken = function() { var fc = profileService.focusedClient; - storageService.removeGlideraToken(fc.credentials.network, function() { - $timeout(function() { - applicationService.restart(); - }, 100); + var ModalInstanceCtrl = function($scope, $modalInstance) { + $scope.ok = function() { + $modalInstance.close(true); + }; + $scope.cancel = function() { + $modalInstance.dismiss(); + }; + }; + + var modalInstance = $modal.open({ + templateUrl: 'views/modals/glidera-confirmation.html', + windowClass: 'full', + controller: ModalInstanceCtrl + }); + modalInstance.result.then(function(ok) { + if (ok) { + storageService.removeGlideraToken(fc.credentials.network, function() { + $timeout(function() { + applicationService.restart(); + }, 100); + }); + } }); }; diff --git a/src/js/routes.js b/src/js/routes.js index 0b13d4e8f..adfab01a5 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -321,7 +321,6 @@ angular .state('preferencesGlidera', { url: '/preferencesGlidera', - templateUrl: 'views/preferencesGlidera.html', walletShouldBeComplete: true, needProfile: true, views: {