Skip to content

Commit

Permalink
Merge pull request #826 from zebrunner/develop
Browse files Browse the repository at this point in the history
2.6.1 final changes
  • Loading branch information
vdelendik authored Nov 30, 2023
2 parents 8f3bea1 + cd68589 commit d404b9f
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 15 deletions.
3 changes: 3 additions & 0 deletions lib/units/api/controllers/devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,9 @@ function putDeviceInfoBySerial(req, res) {
case "Disconnected":
updates.push(dbapi.setDeviceAbsent(serial));
break;
case "Unhealthy":
updates.push(dbapi.saveDeviceStatus(serial, 7));
break;
default:
apiutil.respond(res, 400, "Unknown status requested");
break;
Expand Down
31 changes: 19 additions & 12 deletions lib/units/ios-device/plugins/wda/WdaClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ module.exports = syrup.serial()
deviceSize: null,
orientation: null,
touchDownParams: {},
isMove: false,
tapStartAt: 0,
typeKeyActions: [],
typeKeyTimerId: null,
typeKeyDelay: 250,
upperCase: false,
isSwiping: false,

startSession: function() {
log.info('verifying wda session status...')
Expand Down Expand Up @@ -249,7 +249,6 @@ module.exports = syrup.serial()
tap: function(params) {
this.tapStartAt = (new Date()).getTime()
this.touchDownParams = params
this.isMove = false
},
homeBtn: function() {
if (options.deviceType !== 'tvOS') {
Expand Down Expand Up @@ -289,21 +288,29 @@ module.exports = syrup.serial()
],
}

this.isMove = true

if (options.deviceType === 'tvOS') {
return log.error('Swipe is not supported')
}

return this.handleRequest({
method: 'POST',
uri: `${this.baseUrl}/session/${this.sessionId}/actions`,
body,
json: true,
})
let swipeOperation = () => {
if (!this.isSwiping) {
this.isSwiping = true
this.handleRequest({
method: 'POST',
uri: `${this.baseUrl}/session/${this.sessionId}/actions`,
body,
json: true,
}).then((response) => {
log.info('swipe response: ', response)
this.isSwiping = false
})
}
}

return swipeOperation()
},
touchUp: function() {
if (!this.isMove) {
if (!this.isSwiping && this.deviceSize) {
let {x, y} = this.touchDownParams

x *= this.deviceSize.width
Expand Down Expand Up @@ -428,7 +435,7 @@ module.exports = syrup.serial()
})
},
doubleClick: function() {
if(!this.isMove) {
if(!this.isSwiping && this.deviceSize) {
const {x, y} = this.touchDownParams
const params = {
x: x * this.deviceSize.width,
Expand Down
11 changes: 10 additions & 1 deletion lib/units/provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ module.exports = function(options) {
})

// Track and manage devices
client.trackDevices().then(function(tracker) {
client.trackDevices()
.then(function(tracker) {
// This can happen when ADB doesn't have a good connection to
// the device
function isWeirdUnusableDevice(device) {
Expand Down Expand Up @@ -177,6 +178,10 @@ module.exports = function(options) {
privateTracker.once('register', resolve)
})

register.catch(function(err) {
log.fatal('Register promise error', err)
lifecycle.fatal()
})

// Spawn a device worker
function spawn() {
Expand Down Expand Up @@ -428,6 +433,10 @@ module.exports = function(options) {

lifecycle.share('Tracker', tracker)
})
.catch(function(err) {
log.fatal('Adb client error', err)
lifecycle.fatal()
})

lifecycle.observe(function() {
[push, sub].forEach(function(sock) {
Expand Down
4 changes: 2 additions & 2 deletions res/app/control-panes/dashboard/navigation/navigation.pug
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
//i.fa.fa-step-forward.pull-right(ng-click='forward()', title='{{"Go Forward"|translate}}')
//i.fa.fa-step-backward.pull-right(ng-click='back()', title='{{"Go Back"|translate}}')
.widget-content.padded
form(enable-autofill, ng-submit='openUrl()', ng-disabled='device.ios && device.version >= 17')
form(enable-autofill, ng-submit='openUrl()', ng-disabled='device.ios && device.version < 17')
.input-group.url-input-container
input.form-control(type='text', name='textURL', placeholder='http://...', ng-disabled='device.ios && device.version >= 17',
input.form-control(type='text', name='textURL', placeholder='http://...', ng-disabled='device.ios && device.version < 17',
autocomplete='url', ng-model='textURL', text-focus-select,
autocapitalize='off', spellcheck='false', blur-element='blurUrl'
accesskey='N', tabindex='10', ng-change='textUrlChanged()',
Expand Down

0 comments on commit d404b9f

Please sign in to comment.