Skip to content

Commit

Permalink
Add "secure view" error back.
Browse files Browse the repository at this point in the history
  • Loading branch information
sorccu committed Dec 11, 2014
1 parent 49bc669 commit 19f3845
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 33 deletions.
75 changes: 43 additions & 32 deletions res/app/components/stf/screen/screen-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,44 +253,55 @@ module.exports = function DeviceScreenDirective(
if (shouldUpdateScreen()) {
screen.rotation = device.display.rotation

var blob = new Blob([message.data], {
type: 'image/jpeg'
})

var img = new Image()

img.onload = function() {
updateImageArea(this)

g.drawImage(img, 0, 0)

// Try to forcefully clean everything to get rid of memory leaks.
img.onload = img.onerror = null
img.src = BLANK_IMG
img = null
url = null
blob = null
if (message.data instanceof Blob) {
if (scope.displayError) {
scope.$apply(function () {
scope.displayError = false
})
}

var blob = new Blob([message.data], {
type: 'image/jpeg'
})

var img = new Image()

img.onload = function() {
updateImageArea(this)

g.drawImage(img, 0, 0)

// Try to forcefully clean everything to get rid of memory
// leaks.
img.onload = img.onerror = null
img.src = BLANK_IMG
img = null
url = null
blob = null
}

img.onerror = function() {
// Happily ignore. I suppose this shouldn't happen, but
// sometimes it does, presumably when we're loading images
// too quickly.
}

var url = URL.createObjectURL(blob)
img.src = url
}

img.onerror = function() {
// Happily ignore. I suppose this shouldn't happen, but
// sometimes it does, presumably when we're loading images
// too quickly.
else {
switch (message.data) {
case 'secure_on':
scope.$apply(function () {
scope.displayError = 'secure'
})
break
}
}

var url = URL.createObjectURL(blob)
img.src = url

// Next please
maybeLoadScreen()
}

// Reset error, if any
if (scope.displayError) {
scope.$apply(function () {
scope.displayError = false
})
}
}

// NOTE: instead of fa-pane-resize, a fa-child-pane-resize could be better
Expand Down
2 changes: 1 addition & 1 deletion res/app/components/stf/screen/screen.jade
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ div(ng-if='displayError').screen-error

// TODO: PING here to check for connectivity http://172.19.9.107:7401/api/v1/displays/0
.well
.screen-error-alert(ng-show='displayError === "secure"', translate) This might be caused by a network error, or you might be trying to access a secure view.
.screen-error-alert(ng-show='displayError === "secure"', translate) The current view is marked secure and cannot be viewed remotely.
.screen-error-alert(ng-show='displayError === "timeout"', translate) Retrieving the device screen has timed out.

.well
Expand Down
Binary file modified vendor/minicap/bin/arm64-v8a/minicap
Binary file not shown.
Binary file modified vendor/minicap/bin/arm64-v8a/minicap-nopie
Binary file not shown.
Binary file modified vendor/minicap/bin/armeabi-v7a/minicap
Binary file not shown.
Binary file modified vendor/minicap/bin/armeabi-v7a/minicap-nopie
Binary file not shown.
Binary file modified vendor/minicap/bin/x86/minicap
Binary file not shown.
Binary file modified vendor/minicap/bin/x86/minicap-nopie
Binary file not shown.

0 comments on commit 19f3845

Please sign in to comment.