Skip to content
This repository has been archived by the owner on Nov 21, 2019. It is now read-only.

Commit

Permalink
Merge pull request #2148 from SteveMieskoski/mercury
Browse files Browse the repository at this point in the history
Fix send of null and browser check issues
  • Loading branch information
gamalielhere authored Nov 29, 2018
2 parents 719be58 + 4852dc2 commit 44f1edf
Show file tree
Hide file tree
Showing 9 changed files with 203,983 additions and 205,080 deletions.
28 changes: 11 additions & 17 deletions app/scripts/controllers/decryptWalletCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -627,28 +627,22 @@ var decryptWalletCtrl = function($scope, $sce, walletService) {
globalFuncs.MEWconnectStatus.update(0);
var app = new MewConnectEth();

$scope.mewConnect = MewConnect.init();

Reflect.defineProperty(MewConnect, "instance", {
value: $scope.mewConnect
});
globalFuncs.MEWconnectStatus.MEWconnect = MewConnect.init();

$scope.$on("$destroy", function() {
globalFuncs.MEWconnectStatus.newTabOpenedTrigger(false);
globalFuncs.MEWconnectStatus.update(0);
$scope.mewConnect.disconnectRTC();
if (MewConnect.instance) {
Reflect.deleteProperty(MewConnect, "instance");
}
globalFuncs.MEWconnectStatus.MEWconnect.disconnectRTC();
globalFuncs.MEWconnectStatus.MEWconnect = null;
});

$scope.mewConnect.on("codeDisplay", codeDisplay);
$scope.mewConnect.on("RtcConnectedEvent", rtcConnected);
$scope.mewConnect.on("RtcClosedEvent", rtcClosed);
$scope.mewConnect.on("RtcDisconnectEvent", rtcDisconnected);
$scope.mewConnect.on("address", makeWallet);
globalFuncs.MEWconnectStatus.MEWconnect.on("codeDisplay", codeDisplay);
globalFuncs.MEWconnectStatus.MEWconnect.on("RtcConnectedEvent", rtcConnected);
globalFuncs.MEWconnectStatus.MEWconnect.on("RtcClosedEvent", rtcClosed);
globalFuncs.MEWconnectStatus.MEWconnect.on("RtcDisconnectEvent", rtcDisconnected);
globalFuncs.MEWconnectStatus.MEWconnect.on("address", makeWallet);

app.setMewConnect($scope.mewConnect);
app.setMewConnect(globalFuncs.MEWconnectStatus.MEWconnect);
app.signalerConnect();

$scope.connectionCodeTimeout = null;
Expand All @@ -661,7 +655,7 @@ var decryptWalletCtrl = function($scope, $sce, walletService) {
if ($scope.mewConnectionStatus !== 2) {
$scope.connectionCodeTimeout = null;
uiFuncs.notifier.info("Connected Via MEWconnect");
$scope.mewConnect.sendRtcMessage("address", "");
globalFuncs.MEWconnectStatus.MEWconnect.sendRtcMessage("address", "");
$scope.mewConnectionStatus = 2;
}
}
Expand Down Expand Up @@ -709,7 +703,7 @@ var decryptWalletCtrl = function($scope, $sce, walletService) {
};

$scope.mewConnectDisconnect = function() {
$scope.mewConnect.disconnectRTC();
globalFuncs.MEWconnectStatus.MEWconnect.disconnectRTC();
};
//= ================ Mew Connect (end)==============================
$scope.getLedgerPath = function() {
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/controllers/signMsgCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ var signMsgCtrl = function($scope, $sce, walletService) {
//TODO reset ui when rtc disconnects
// var msg = Buffer.from(thisMessage).toString("hex");
var connectApp = new MewConnectEth();
var mewConnect = MewConnect.instance;
var mewConnect =globalFuncs.MEWconnectStatus.MEWconnect;
connectApp.setMewConnect(mewConnect);
mewConnect.on("signMessage", function(data) {
$scope.signMsg.signedMsg = JSON.stringify(
Expand Down
1 change: 1 addition & 0 deletions app/scripts/globalFuncs.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ globalFuncs.localStorage = {
};

globalFuncs.MEWconnectStatus = {
MEWconnect: null,
decryptOpenTriggers: [],
mewConnectListener: function() {},
register: function(listener) {
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/kyber.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ kyberFuncs.prototype.getTradeData = function (swapOrder, minRate) {
var funcABI = _this.kyberNetworkABI.trade
var srcTokenAddress = _this.getTokenAddress(swapOrder.fromCoin)
var destTokenAddress = _this.getTokenAddress(swapOrder.toCoin)
let walletId = '0xDECAF9CD2367cdbb726E904cD6397eDFcAe6068D'
let walletId = '0x4247951c2eb6d0bA38d233fe7d542c8c80c9d46A'
let minConversionRate = _this.convertToTokenWei(minRate, 'ETH') // Uses slippagePrice with fallback to MarketRate. 1 => Market Rate, but we could also set this as the quoted rate
let srcAmount = _this.convertToTokenWei(swapOrder.fromVal, swapOrder.fromCoin) //etherUnits.toWei(swapOrder.fromVal, "ether");
let maxDestAmount = 2 ** 200 //100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000; // Really big number (like a googol)
Expand Down
8 changes: 4 additions & 4 deletions app/scripts/staticJS/mewConnectEth.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class MewConnectEth {

static checkBrowser() {
const browser = window.browser;
const version = browser.version.split(0, 1)[0]
const version = browser.version.split('.')[0];
/*
* Chrome > 23
* Firefox > 22
Expand All @@ -134,7 +134,7 @@ class MewConnectEth {
// if (+version >= 12) {
// return MewConnectEth.buildBrowserResult(false, '', '');
// } else if (+version === 11) {
return MewConnectEth.buildBrowserResult(true, 'Safari', 'version: ' + browser.version);
return MewConnectEth.buildBrowserResult(true, 'Safari', 'version: ' + browser.version);
// }
} else if (browser.name === 'ie') {
return MewConnectEth.buildBrowserResult(true, 'Internet Explorer', '', true);
Expand Down Expand Up @@ -163,8 +163,8 @@ class MewConnectEth {
} else {
return MewConnectEth.buildBrowserResult(false, '', '');
}
} catch(e) {
console.error(e)
} catch (e) {
console.error(e);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/scripts/uiFuncs.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ uiFuncs.signTxMewConnect = function (eTx, rawTx, txData, callback) {
// uiFuncs.notifier.info("Tap a touch button on your device to confirm signing.");

var app = new MewConnectEth()
var mewConnect = MewConnect.instance

// var mewConnect = MewConnect.instance
var mewConnect = globalFuncs.MEWconnectStatus.MEWconnect;
app.setMewConnect(mewConnect)
mewConnect.once('signTx', function(data) {
uiFuncs.notifier.info("The transaction was signed but not sent. Click the blue 'Send Transaction' button to continue.")
Expand Down
Loading

0 comments on commit 44f1edf

Please sign in to comment.