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

[FIX] Save last trade page (RT-3259) #2461

Merged
merged 1 commit into from
Apr 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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