diff --git a/scss/ionic.app.scss b/scss/ionic.app.scss index 5088ded9deef579122baf1fe3f3de01d5aaedbf8..05cbeb2b127efcff8ed9099e76a2f1aa761f08d3 100644 --- a/scss/ionic.app.scss +++ b/scss/ionic.app.scss @@ -29,6 +29,7 @@ $ionicons-font-path: "../lib/ionic/fonts" !default; // Include all of Ionic @import "www/lib/ionic/scss/ionic"; +<<<<<<< HEAD // Add robotodraft fonts (need for ionic material) $RobotoDraftFontPath: "../lib/robotodraft/fonts"; $RobotoDraftFontName: "RobotoDraft"; @@ -38,6 +39,44 @@ $RobotoDraftFontVersion: "1.1.0"; // Include all of Ionic-Material @import "www/lib/ionic-material/src/scss/index"; +======= +.background-positive { + background-color: $positive; + color: $light; + text-color: $light; +} + +#wallet .button-float{ + background: $assertive !important; + color:white !important; + z-index: 12 !important; + position: absolute !important; + //top: 150px !important; + //left: 10px; + bottom: 10px !important; + right: 10px !important; + min-width: 47px !important; + border-radius: 50% !important; + box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26) !important; + -webkit-transform: translate3d(0, 0, 0) !important; + transform: translate3d(0, 0, 0) !important; + -webkit-transition: 0.2s linear !important; + transition: 0.2s linear !important; + -webkit-transition-property: -webkit-transform, all !important; + transition-property: transform, all !important; +} + +#wallet .button-float:hover{ + -webkit-transform: translate3d(0, -1px, 0) !important; + transform: translate3d(0, -1px, 0) !important; + box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.4) !important; + background: darken($assertive, 10%) !important; +} + +#wallet .button-float-second{ + left: 70px !important; +} +>>>>>>> origin/with-ES-store // -------------------------------------------------- // Responsive: Utility classes diff --git a/www/i18n/locale-en.json b/www/i18n/locale-en.json index 2d344672afae3caa8974b9b79d46a5e032725a5d..2d473b4f6c0c33b161f8fd47e3d2575b9e686257 100644 --- a/www/i18n/locale-en.json +++ b/www/i18n/locale-en.json @@ -78,7 +78,7 @@ }, "ACCOUNT": { "TITLE": "My Account", - "MENU_TITLE": "Wallet's options", + "MENU_TITLE": "Wallet actions", "BALANCE": "Balance", "LAST_TX": "Last transactions", "NO_TX": "No transaction", @@ -194,10 +194,15 @@ "REFRESH_WALLET_DATA": "Could not refresh wallet", "GET_CURRENCY_PARAMETER": "Could not get currency parameters", "GET_CURRENCIES_FAILED": "Could not load currencies", - "GET_CURRENCY_FAILED": "Could not load currency" + "GET_CURRENCY_FAILED": "Could not load currency", + "SEND_TX_FAILED": "Could not send transaction", + "ALL_SOURCES_USED": "Please wait the next block computation (All transaction sources has been used).", + "NOT_ENOUGH_SOURCES": "Please wait the next block computation (Not enough transaction sources).", + "ACCOUNT_CREATION_FAILED": "Error while creating your member account" }, "INFO": { "POPUP_TITLE": "Information", - "CERTIFICATION_DONE": "Identity successfully signed" + "CERTIFICATION_DONE": "Identity successfully signed", + "NOT_ENOUGH_CREDIT": "Not enough credit." } } diff --git a/www/i18n/locale-fr-FR.json b/www/i18n/locale-fr-FR.json index 281ce926f3f749f72a67f8566ac3cee37a6b7dc8..e47e87a46b08ce5162629cc7ba5c24be326fc0d5 100644 --- a/www/i18n/locale-fr-FR.json +++ b/www/i18n/locale-fr-FR.json @@ -194,10 +194,15 @@ "REFRESH_WALLET_DATA": "Echec du rafraichissement du portefeuille", "GET_CURRENCY_PARAMETER": "Echec de la récupération des règles de la monnaie", "GET_CURRENCIES_FAILED": "Impossible de chargement la liste des monnaies", - "GET_CURRENCY_FAILED": "Chargement de la monnaie impossible" + "GET_CURRENCY_FAILED": "Chargement de la monnaie impossible", + "SEND_TX_FAILED": "Echec de l'envoir du transfer", + "ALL_SOURCES_USED": "Veuillez attendre le cacul du prochain bloc (Toutes vos sources de monnaie ont été utilisées).", + "NOT_ENOUGH_SOURCES": "Veuillez attendre le cacul du prochain bloc (Pas assez de sources de monnaie).", + "ACCOUNT_CREATION_FAILED": "Echec de la création du compte membre" }, "INFO": { "POPUP_TITLE": "Information", - "CERTIFICATION_DONE": "Certification envoyée" + "CERTIFICATION_DONE": "Certification envoyée", + "NOT_ENOUGH_CREDIT": "Credit insuffisant." } } diff --git a/www/js/controllers/home-controllers.js b/www/js/controllers/home-controllers.js index fda18b6952e5d5f76b97859465aba567aeeb8fba..d2cd9809fc12f5cef3f539c10cdeb34dff92d148 100644 --- a/www/js/controllers/home-controllers.js +++ b/www/js/controllers/home-controllers.js @@ -134,9 +134,23 @@ function NewAccountWizardController($scope, $ionicModal, $state, $ionicSideMenuD .then(function(){ Wallet.login($scope.accountData.username, $scope.accountData.password) .then(function() { - // Reset account data - $scope.cancel(); - $state.go('app.view_wallet'); + if (!$scope.accountData.isMember) { + return; + } + + // Send self + Wallet.self($scope.accountData.pseudo, false/*do NOT load membership here*/) + .then(function() { + // Send membership IN + Wallet.membership(true) + .then(function() { + // Reset account data, and open wallet view + $scope.cancel(); + $state.go('app.view_wallet'); + }) + .catch(UIUtils.onError('ERROR.SEND_MEMBERSHIP_IN_FAILED')); + }) + .catch(UIUtils.onError('ERROR.SEND_IDENTITY_FAILED')); }) .catch(function(err) { UIUtils.loading.hide(); diff --git a/www/js/controllers/wallet-controllers.js b/www/js/controllers/wallet-controllers.js index 8d9cadf2b53ff9fcba641f15213705ec6184be49..ff55b1624f46e1c0919fea2d1fdfdfe32a3173f0 100644 --- a/www/js/controllers/wallet-controllers.js +++ b/www/js/controllers/wallet-controllers.js @@ -111,7 +111,6 @@ function WalletController($scope, $state, $q, $ionicPopup, $ionicActionSheet, $t // Set Ink //ionicMaterialInk.displayEffect(); - }, 10); }; @@ -131,66 +130,66 @@ function WalletController($scope, $state, $q, $ionicPopup, $ionicActionSheet, $t // Ask uid $scope.showUidPopup = function() { return $q(function(resolve, reject) { - $translate(['ACCOUNT.NEW.TITLE', 'ACCOUNT.POPUP_REGISTER.TITLE', 'ACCOUNT.POPUP_REGISTER.HELP', 'COMMON.BTN_ADD_ACCOUNT', 'COMMON.BTN_CANCEL']) - .then(function (translations) { - - // Choose UID popup - $ionicPopup.show({ - templateUrl: 'templates/account/popup_register.html', - title: translations['ACCOUNT.POPUP_REGISTER.TITLE'], - subTitle: translations['ACCOUNT.POPUP_REGISTER.HELP'], - scope: $scope, - buttons: [ - { text: translations['COMMON.BTN_CANCEL'] }, - { - text: translations['COMMON.BTN_ADD_ACCOUNT'] /*'<b>Send</b>'*/, - type: 'button-positive', - onTap: function(e) { - $scope.registerForm.$submitted=true; - if(!$scope.registerForm.$valid || !$scope.walletData.uid) { - //don't allow the user to close unless he enters a uid - e.preventDefault(); - } else { - return $scope.walletData.uid; + $translate(['ACCOUNT.NEW.TITLE', 'ACCOUNT.POPUP_REGISTER.TITLE', 'ACCOUNT.POPUP_REGISTER.HELP', 'COMMON.BTN_ADD_ACCOUNT', 'COMMON.BTN_CANCEL']) + .then(function (translations) { + + // Choose UID popup + $ionicPopup.show({ + templateUrl: 'templates/wallet/popup_register.html', + title: translations['ACCOUNT.POPUP_REGISTER.TITLE'], + subTitle: translations['ACCOUNT.POPUP_REGISTER.HELP'], + scope: $scope, + buttons: [ + { text: translations['COMMON.BTN_CANCEL'] }, + { + text: translations['COMMON.BTN_ADD_ACCOUNT'] /*'<b>Send</b>'*/, + type: 'button-positive', + onTap: function(e) { + $scope.registerForm.$submitted=true; + if(!$scope.registerForm.$valid || !$scope.walletData.uid) { + //don't allow the user to close unless he enters a uid + e.preventDefault(); + } else { + return $scope.walletData.uid; + } } } + ] + }) + .then(function(uid) { + if (!uid) { // user cancel + $scope.walletData.uid = null; + UIUtils.loading.hide(); + return; } - ] - }) - .then(function(uid) { - if (!uid) { // user cancel - $scope.walletData.uid = null; - UIUtils.loading.hide(); - return; - } - UIUtils.loading.show(); - BMA.wot.lookup({ search: uid }) - .then(function(res) { - var found = typeof res.results != "undefined" && res.results != null && res.results.length > 0 - && res.results.some(function(pub){ + UIUtils.loading.show(); + BMA.wot.lookup({ search: uid }) + .then(function(res) { + var found = typeof res.results != "undefined" && res.results != null && res.results.length > 0 + && res.results.some(function(pub){ return pub.pubkey != $scope.walletData.pubkey && typeof pub.uids != "undefined" && pub.uids != null && pub.uids.length > 0 - && pub.uids.some(function(idty){ - return (idty.uid == uid); - }); - }); - if (found) { // uid is already used : display a message and reopen the popup - UIUtils.loading.hide(); - UIUtils.alert.info('ACCOUNT.NEW.MSG_UID_ALREADY_USED') - .then(function(){ + && pub.uids.some(function(idty){ + return (idty.uid == uid); + }); + }); + if (found) { // uid is already used : display a message and reopen the popup + UIUtils.loading.hide(); + UIUtils.alert.info('ACCOUNT.NEW.MSG_UID_ALREADY_USED') + .then(function(){ $scope.showUidPopup(); // loop - }); - } - else { + }); + } + else { resolve(uid); - } - }) - .catch(function() { + } + }) + .catch(function() { resolve(uid); + }); }); }); }); - }); }; // Send self identity @@ -259,6 +258,7 @@ function WalletController($scope, $state, $q, $ionicPopup, $ionicActionSheet, $t $translate(['ACCOUNT.MENU_TITLE', 'ACCOUNT.BTN_MEMBERSHIP_OUT', 'ACCOUNT.POPUP_REGISTER.HELP', 'COMMON.BTN_ADD_ACCOUNT', 'COMMON.BTN_CANCEL']) .then(function (translations) { + // Show the action sheet var hideMenu = $ionicActionSheet.show({ buttons: [ diff --git a/www/js/services/utils-services.js b/www/js/services/utils-services.js index 7fadefb5e6fb409d4f4c18e90338014d9463388e..46187900dadd7b21e6ae5a45436b9d0c161f6a9d 100644 --- a/www/js/services/utils-services.js +++ b/www/js/services/utils-services.js @@ -4,13 +4,13 @@ angular.module('cesium.utils.services', ['ngResource']) .factory('UIUtils', function($ionicLoading, $ionicPopup, $translate, $q) { function alertError(err, subtitle) { - $translate([err, 'ERROR.POPUP_TITLE', 'ERROR.UNKNOWN_ERROR', 'COMMON.BTN_OK']) + $translate([err, subtitle, 'ERROR.POPUP_TITLE', 'ERROR.UNKNOWN_ERROR', 'COMMON.BTN_OK']) .then(function (translations) { var message = err.message || translations[err]; return $ionicPopup.show({ template: '<p>' + (message || translations['ERROR.UNKNOWN_ERROR']) + '</p>', title: translations['ERROR.POPUP_TITLE'], - subTitle: subtitle, + subTitle: translations[subtitle], buttons: [ { text: '<b>'+translations['COMMON.BTN_OK']+'</b>', @@ -23,12 +23,12 @@ angular.module('cesium.utils.services', ['ngResource']) function alertInfo(message, subtitle) { return $q(function(resolve, reject) { - $translate([message, 'INFO.POPUP_TITLE', 'COMMON.BTN_OK']) + $translate([message, subtitle, 'INFO.POPUP_TITLE', 'COMMON.BTN_OK']) .then(function (translations) { return $ionicPopup.show({ template: '<p>' + translations[message] + '</p>', title: translations['INFO.POPUP_TITLE'], - subTitle: subtitle, + subTitle: translations[subtitle], buttons: [ { text: '<b>'+translations['COMMON.BTN_OK']+'</b>', diff --git a/www/js/services/wallet-services.js b/www/js/services/wallet-services.js index b2b99418baf43c023cae473c50034b5f253a3f8b..ddbbbc71bb2dad480db4bce1f8042835eee1eeb9 100644 --- a/www/js/services/wallet-services.js +++ b/www/js/services/wallet-services.js @@ -471,7 +471,6 @@ angular.module('cesium.wallet.services', ['ngResource', 'cesium.bma.services', ' */ membership = function(sideIn) { return $q(function(resolve, reject) { - BMA.blockchain.current() .then(function(block) { // Create membership to sign diff --git a/www/templates/account/view_wallet.html b/www/templates/account/view_wallet.html new file mode 100644 index 0000000000000000000000000000000000000000..64f7ec10824456f5f8be7e0a6c718fd6e2cd48af --- /dev/null +++ b/www/templates/account/view_wallet.html @@ -0,0 +1,107 @@ +<ion-view left-buttons="leftButtons" view-title="" id="wallet"> + <ion-nav-buttons side="secondary"> + <button class="button button-icon" ng-click="doUpdate()"> + <i class="icon ion-android-refresh"></i> + </button> + <button class="button button-icon visible-xs visible-sm" ng-click="showActionsheet()"> + <i class="icon ion-android-more-vertical"></i> + </button> + + </ion-nav-buttons> + + <ion-content> + <div class="scroll"> + + <div class="item item-royal item-icon-left center item-text-wrap"> + <i class="icon " ng-class="{'ion-card': !isMember, 'ion-person': isMember}"></i> + <h2 class="light" ng-if="isMember">{{walletData.uid}}</h2> + <h4 class="light" ng-if="isMember">{{walletData.pubkey | formatPubkey}}</h4> + <h2 class="light" ng-if="!isMember">{{walletData.pubkey | formatPubkey}}</h2> + <h1 class="light"> + <span ng-if="!walletData.useRelative">{{convertedBalance | formatInteger}} {{unit | abbreviate}}</span> + <span ng-if="walletData.useRelative">{{convertedBalance | formatDecimal}} {{unit | abbreviate}}<sub>{{udUnit | abbreviate}}</sub></span> + </h1> + </div> + + <div class="item item-content item-toggle dark"> + <h4 class="gray"> + {{'COMMON.BTN_RELATIVE_UNIT' | translate}} + </h4> + <label class="toggle toggle-royal"> + <input type="checkbox" ng-model="walletData.useRelative"> + <div class="track"> + <div class="handle"></div> + </div> + </label> + </div> + + <div class="hidden-xs hidden-sm padding" style="text-align:center"> + <button class="button button-assertive" + ng-click="transfer()"> + {{'ACCOUNT.BTN_SEND_MONEY' | translate}} + </button> + + <button class="button icon-left ion-person" + ng-if="needMembership" + ng-click="membershipIn()"> + {{'ACCOUNT.BTN_MEMBERSHIP_IN' | translate}} + </button> + + <button class="button icon-left ion-loop" + ng-if="needRenew" + ng-click="membershipRenew()"> + {{'ACCOUNT.BTN_MEMBERSHIP_RENEW' | translate}} + </button> + + <button class="button icon-left ion-log-out" + ng-if="needMembershipOut" + ng-click="membershipOut()"> + {{'ACCOUNT.BTN_MEMBERSHIP_OUT' | translate}} + </button> + + <button class="button icon-left ion-flag" + ng-if="needSelf" + ng-click="self()"> + {{'ACCOUNT.BTN_SEND_IDENTITY' | translate}} + </button> + </div> + + <div class="list"> + + <!--div class="item-divider"> + + </div> + + + + <!--TODO : charger les TX en arrière plan + label class="item center" ng-if="search.looking"> + <ion-spinner icon="android"></ion-spinner> + </label--> + + <!-- Last Transactions --> + <div ng-if="walletData.history && walletData.history.length > 0"> + + <div class="item item-divider"> + {{'ACCOUNT.LAST_TX' | translate}} + </div> + + <a href="#" class="item" ng-repeat="tx in walletData.history"> + <h3>{{tx.time | formatDate}}</h3> + <p ng-if="tx.issuer">{{'COMMON.PUBKEY' | translate}}: {{tx.issuer | formatPubkey}}</p> + <p ng-if="tx.receiver">{{'COMMON.PUBKEY' | translate}}: {{tx.receiver | formatPubkey}}</p> + <span class="badge item-note" ng-if="!walletData.useRelative">{{tx.amount | formatInteger}}</span> + <span class="badge item-note" ng-if="walletData.useRelative">{{tx.amount/walletData.currentUD | formatDecimal}}</span> + </a> + </div> + + </div> + <div class="scroll-bar scroll-bar-v"></div> + </div> + </ion-content> + + <button class="button button-float visible-xs visible-sm" ng-click="transfer()"> + <i class="icon ion-android-send"></i> + </button> +</ion-view> + \ No newline at end of file