Skip to content
This repository has been archived by the owner on Sep 2, 2023. It is now read-only.

Commit

Permalink
Merge pull request #2461 from darkdarkdragon/develop-RT-3259
Browse files Browse the repository at this point in the history
[FIX] Save last trade page (RT-3259)
  • Loading branch information
vhpoet committed Apr 29, 2015
2 parents 6af1f93 + 5fd19d1 commit d83f919
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/js/services/id.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ module.factory('rpId', ['$rootScope', '$location', '$route', '$routeParams', '$t
$scope.$on('$blobUpdate', function() {
if (!settings.blobIsValid($scope.userBlob)) return;

$scope.ripple_exchange_selection_trade = settings.getSetting($scope.userBlob, 'rippleExchangeSelectionTrade', false);

var d = $scope.userBlob.data;
Options.advanced_feature_switch = settings.getSetting($scope.userBlob, 'trust.advancedMode', false);
Options.historyApi = settings.getSetting($scope.userBlob, 'historyApi', Options.historyApi).replace(/[\/]*$/, '');
Expand Down
13 changes: 13 additions & 0 deletions src/js/tabs/exchange.controller.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var util = require('util'),
webutil = require('../util/web'),
settings = require('../util/settings'),
Tab = require('../client/tab').Tab,
Amount = ripple.Amount,
Base = ripple.Base,
Expand Down Expand Up @@ -27,6 +28,18 @@ ExchangeTab.prototype.angular = function (module)
var timer;
var pf = null;

if (settings.blobIsValid($scope.userBlob)) {
if (settings.getSetting($scope.userBlob, 'rippleExchangeSelectionTrade', false)) {
$scope.userBlob.set('/clients/rippletradecom/rippleExchangeSelectionTrade', false);
}
} else {
var removeListener = $scope.$on('$blobUpdate', function() {
if (settings.getSetting($scope.userBlob, 'rippleExchangeSelectionTrade', false)) {
$scope.userBlob.set('/clients/rippletradecom/rippleExchangeSelectionTrade', false);
}
removeListener();
});
}
// Remember user preference on Convert vs. Trade
$rootScope.ripple_exchange_selection_trade = false;

Expand Down
20 changes: 18 additions & 2 deletions src/js/tabs/trade.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,24 @@ TradeTab.prototype.angular = function(module)
reverse: false
};

function onBlobIsValid() {
$scope.pairs_query = settings.getSetting($scope.userBlob, 'trade_currency_pairs');
// Remember user preference on Convert vs. Trade
if (!settings.getSetting($scope.userBlob, 'rippleExchangeSelectionTrade', false)) {
$scope.userBlob.set('/clients/rippletradecom/rippleExchangeSelectionTrade', true);
}
}

if (settings.blobIsValid($scope.userBlob)) {
onBlobIsValid();
} else {
var removeListener = $scope.$on('$blobUpdate', function() {
if (!settings.blobIsValid($scope.userBlob)) return;
onBlobIsValid();
removeListener();
});
}

$scope.sortOptions.sortFieldName = $scope.ordersSortFieldChoicesKeyed[$scope.sortOptions.sortField];

$scope.$watch('sortOptions.sortFieldName', function () {
Expand All @@ -70,8 +88,6 @@ TradeTab.prototype.angular = function(module)
// Remember user preference on Convert vs. Trade
$rootScope.ripple_exchange_selection_trade = true;

$scope.pairs_query = settings.getSetting($scope.userBlob, 'trade_currency_pairs');

$scope.currencies_all = require('../data/currencies');
$scope.currencies = [];

Expand Down

0 comments on commit d83f919

Please sign in to comment.