Skip to content
Permalink
Browse files

Merge pull request kvhnuke#2148 from SteveMieskoski/mercury

Fix send of null and browser check issues
  • Loading branch information...
gamalielhere committed Nov 29, 2018
2 parents 719be58 + 4852dc2 commit 44f1edf71368eb78e113f617ce71103ce98bb7a6
@@ -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;
@@ -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;
}
}
@@ -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() {
@@ -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(
@@ -394,6 +394,7 @@ globalFuncs.localStorage = {
};

globalFuncs.MEWconnectStatus = {
MEWconnect: null,
decryptOpenTriggers: [],
mewConnectListener: function() {},
register: function(listener) {
@@ -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)
@@ -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
@@ -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);
@@ -163,8 +163,8 @@ class MewConnectEth {
} else {
return MewConnectEth.buildBrowserResult(false, '', '');
}
} catch(e) {
console.error(e)
} catch (e) {
console.error(e);
}
}
}
@@ -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.")
Oops, something went wrong.

0 comments on commit 44f1edf

Please sign in to comment.
You can’t perform that action at this time.