diff --git a/res/app/control-panes/dashboard/remote-debug/remote-debug-controller.js b/res/app/control-panes/dashboard/remote-debug/remote-debug-controller.js index 2c1aa81c..dc3798e8 100644 --- a/res/app/control-panes/dashboard/remote-debug/remote-debug-controller.js +++ b/res/app/control-panes/dashboard/remote-debug/remote-debug-controller.js @@ -1,17 +1,24 @@ module.exports = function RemoteDebugCtrl($scope, $timeout) { function startRemoteConnect() { - $scope.control.startRemoteConnect().then(function (result) { - var url = result.lastData - $scope.$apply(function () { - $scope.debugCommand = 'adb connect ' + url + if ($scope.control) { + $scope.control.startRemoteConnect().then(function (result) { + var url = result.lastData + $scope.$apply(function () { + $scope.debugCommand = 'adb connect ' + url + }) }) - }) + + return true + } + return false } // TODO: Remove timeout and fix control initialization - if ($scope.control) { - startRemoteConnect() - } else { - $timeout(startRemoteConnect, 200) + if (!startRemoteConnect()) { + $timeout(function () { + if (!startRemoteConnect()) { + $timeout(startRemoteConnect, 1000) + } + }, 200) } }