Skip to content

Commit

Permalink
Merge pull request #964 from zebrunner/develop
Browse files Browse the repository at this point in the history
2.7
  • Loading branch information
vdelendik authored May 27, 2024
2 parents ec4e408 + 9d0c62d commit 7d19c1d
Show file tree
Hide file tree
Showing 21 changed files with 115 additions and 41 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ RUN cp ./icon/x120/iOS.jpg /opt/node_modules/@devicefarmer/stf-device-db/dist/ic
cp ./icon/x24/tvOS.png /opt/node_modules/@devicefarmer/stf-device-db/dist/icon/x24/tvOS && \
cp ./icon/x120/tvOS.png /opt/node_modules/@devicefarmer/stf-device-db/dist/icon/x120/tvOS

#951 bump up Pixel 7 on Andoroid 14
COPY files/STFService.apk /opt/vendor/STFService

# Switch to the app user.
USER stf
##Use root user only for debug
Expand Down
Binary file added files/STFService.apk
Binary file not shown.
11 changes: 9 additions & 2 deletions lib/units/ios-device/plugins/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,15 @@ module.exports = syrup.serial()
json: true
})
.then((deviceInfo) => {
log.info('Storing device type value: ' + deviceInfo.value.model)
let = deviceType = deviceInfo.value.model
let deviceInfoModel = deviceInfo.value.model.toLowerCase()
let deviceInfoName = deviceInfo.value.name.toLowerCase()
let deviceType
if (deviceInfoModel.includes("tv") || deviceInfoName.includes("tv")) {
deviceType = "Apple TV"
} else {
deviceType = "iPhone"
}
log.info('Storing device type value: ' + deviceType)
dbapi.setDeviceType(options.serial, deviceType)
})
.catch((err) => {
Expand Down
20 changes: 18 additions & 2 deletions lib/units/ios-device/plugins/util/iosutil.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const fs = require('fs')
const path = require('path')
const logger = require('../../../../util/logger')
const { Promise } = require('bluebird')

var log = logger.createLogger('iosutil')

Expand Down Expand Up @@ -56,6 +57,16 @@ let iosutil = {
},
pressButton: function(key) {
switch (key) {
case 'settings':
if (this.deviceType === 'Apple TV') {
return this.appActivate('com.apple.TVSettings')
}
return this.appActivate('com.apple.Preferences')
case 'store':
if (this.deviceType === 'Apple TV') {
return this.appActivate('com.apple.TVAppStore')
}
return this.appActivate('com.apple.AppStore')
case 'volume_up':
return this.pressButton('volumeUp')
case 'volume_down':
Expand All @@ -65,15 +76,20 @@ let iosutil = {
case 'camera':
return this.appActivate('com.apple.camera')
case 'search':
if (this.deviceType === 'Apple TV') {
return this.appActivate('com.apple.TVSearch')
}
return this.appActivate('com.apple.mobilesafari')
case 'finder':
return this.appActivate('com.apple.findmy')
case 'home':
return this.homeBtn()
case 'mute': {
let i
for(i = 0; i < 25; i++) {
this.pressButton('volumeDown')
for (i = 0; i < 16; i++) {
Promise.delay(1000).then(() => {
this.pressButton('volumeDown')
})
}
return true }
case 'switch_charset': {
Expand Down
6 changes: 3 additions & 3 deletions lib/units/ios-device/plugins/wda.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ module.exports = syrup.serial()
iosutil.pressButton.call(wdaClient, message.key)
})
.on(wire.StoreOpenMessage, (channel, message) => {
wdaClient.appActivate('com.apple.AppStore')
iosutil.pressButton.call(wdaClient, 'store')
})
.on(wire.DashboardOpenMessage, (channel, message) =>{
wdaClient.appActivate('com.apple.Preferences')
iosutil.pressButton.call(wdaClient, 'settings')
})
.on(wire.PhysicalIdentifyMessage, (channel, message) =>{
wdaClient.appActivate('com.apple.findmy')
iosutil.pressButton.call(wdaClient, 'finder')
})
.on(wire.TouchDownIosMessage, (channel, message) => {
wdaClient.tap(message)
Expand Down
8 changes: 1 addition & 7 deletions res/app/components/stf/basic-mode/basic-mode-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@ module.exports = function basicModeDirective($rootScope, BrowserInfo) {
restrict: 'AE',
link: function(scope, element) {
$rootScope.basicMode = !!BrowserInfo.mobile
if ($rootScope.basicMode) {
element.addClass('basic-mode')
}

if (BrowserInfo.mobile) {
element.addClass('mobile')
}
element.addClass('basic-mode')
}
}
}
10 changes: 10 additions & 0 deletions res/app/components/stf/basic-mode/basic-mode.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,13 @@
.guest-landscape .basic-mode .fill-height {
width: 100%;
}

@media (max-width: 767px) {
.basic-mode .stf-device-list .device-search {
width: 8em;
}
.pull-right > .dropdown-menu {
left: -140px;
right: auto;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ module.exports = function EnhanceDeviceServiceFactory($filter, AppState) {
device.enhancedModel = device.model || 'Unknown'
device.enhancedImage120 = '/static/app/devices/icon/x120/' + (device.platform || device.image || '_default.jpg')
device.enhancedImage24 = '/static/app/devices/icon/x24/' + (device.platform || device.image || '_default.jpg')
if (device.ios && device.state === "available" && !device.using) {
device.enhancedStateAction = $filter('statusNameAction')('available')
device.enhancedStatePassive = $filter('statusNamePassive')('available')
return
}
if (device.ios && device.state === "available" && device.using) {
device.enhancedStateAction = $filter('statusNameAction')('using')
device.enhancedStatePassive = $filter('statusNamePassive')('using')
return
}
if (device.ios && device.status === 6 && device.state !== 'present') {
device.enhancedStateAction = $filter('statusNameAction')('preparing')
device.enhancedStatePassive = $filter('statusNamePassive')('preparing')
Expand Down
17 changes: 17 additions & 0 deletions res/app/control-panes/advanced/input/input-controller.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
module.exports = function InputCtrl($scope) {

let muteButton = document.getElementById('muteButton')

muteButton.onclick = function() {
if (muteButton.getAttribute('disabled')) {
return
}

$scope.control.keyPress('mute')
muteButton.setAttribute('disabled', 'disabled')
muteButton.setAttribute('style', 'cursor: wait;')

setTimeout(function() {
muteButton.removeAttribute('disabled')
muteButton.setAttribute('style', 'cursor: pointer;')
}, 16000)
}

$scope.press = function(key) {
$scope.control.keyPress(key)
}
Expand Down
2 changes: 1 addition & 1 deletion res/app/control-panes/advanced/input/input.pug
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

h6(translate) Volume
.btn-group
button(uib-tooltip='{{ "Mute" | translate }}', ng-click='press("mute")').btn.btn-primary.btn-xs
button(uib-tooltip='{{ "Mute" | translate }}' id='muteButton').btn.btn-primary.btn-xs
i.fa.fa-volume-off
button(uib-tooltip='{{ "Volume Down" | translate }}', ng-click='press("volume_down")').btn.btn-primary.btn-xs
i.fa.fa-volume-down
Expand Down
11 changes: 5 additions & 6 deletions res/app/control-panes/control-panes.pug
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
div(ng-controller='ControlPanesHotKeysCtrl').fill-height
div(ng-if='$root.basicMode || $root.standalone').fill-height
div(ng-if='!$root.basicMode && $root.standalone').fill-height
div.fill-height.basic-remote-control
.remote-control
div(ng-include='"control-panes/device-control/device-control-standalone.pug"').fill-height

div(ng-if='!$root.basicMode && !$root.standalone')
div(fa-pane, pane-id='control-device', pane-anchor='west', pane-size='{{remotePaneSize}}', pane-min='200px', pane-max='100% + 2px', pane-handle='4', pane-no-toggle='false')

div(ng-if='!(!$root.basicMode && $root.standalone)' style='{{!$root.basicMode ? "" : "display: grid; grid-template-columns: 1fr 1fr; height: 100%; width: 100%;" }}')
div(fa-pane, pane-id='control-device', pane-anchor='west', pane-size='{{remotePaneSize}}', pane-min='350px', pane-max='100% + 2px', pane-handle='4', pane-no-toggle='false')
.remote-control
div(ng-include='"control-panes/device-control/device-control.pug"').fill-height

div(fa-pane, pane-id='control-bottom-tabs', pane-anchor='south', pane-size='30% + 2px', pane-handle='4').pane-bottom-p
div(fa-pane, pane-id='control-bottom-tabs', pane-anchor='south', pane-size='30% + 2px', pane-handle='4', style='{{!root.basicMode ? "display: none" : "display: initial"}}').pane-bottom-p
.widget-container.fluid-height
nice-tabs(key='ControlBottomTabs', direction='below', tabs='belowTabs', filter='$root.platform')
div(fa-pane, pane-id='control-top-tabs', pane-anchor='')
div(fa-pane, pane-id='control-top-tabs', pane-anchor='' style='{{!$root.basicMode ? "" : "position: relative; height: auto; width: 350px" }}')
.widget-container.fluid-height
nice-tabs(key='ControlBottomTabs', tabs='topTabs', filter='$root.platform')
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var _ = require('lodash')

module.exports = function DeviceControlCtrl($scope, DeviceService, GroupService,
$location, $timeout, $window, $rootScope, LogcatService) {
$location, $timeout, $window, $rootScope, LogcatService, $route) {

$scope.showScreen = true

Expand Down Expand Up @@ -54,6 +54,9 @@ module.exports = function DeviceControlCtrl($scope, DeviceService, GroupService,
$scope.$digest()
})
$location.path('/devices/')
setTimeout(function() {
$route.reload()
}, 50)
}
} else {
GroupService.kick(device).then(function() {
Expand Down
2 changes: 1 addition & 1 deletion res/app/control-panes/info/info.pug
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
stacked-icon(icon='fa-location-arrow', color='color-pink')
span(translate) Physical Device
.pull-right
button(ng-click='device.ios ? press("finder") : finder()').btn.btn-xs.btn-primary-outline
button(ng-click='device.ios ? press("finder") : finder()', ng-disabled='device.platform === "tvOS"').btn.btn-xs.btn-primary-outline
i.fa.fa-info
span(translate) Find Device

Expand Down
12 changes: 12 additions & 0 deletions res/app/control-panes/screenshots/screenshots-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ module.exports = function ScreenshotsCtrl($scope) {
$scope.screenshots = []
$scope.screenShotSize = 400

let screenshotButtons = document.getElementsByClassName('btn btn-sm btn-primary-outline')

$scope.clear = function() {
$scope.screenshots = []
}
Expand All @@ -24,6 +26,16 @@ module.exports = function ScreenshotsCtrl($scope) {
$scope.screenshots.unshift(result)
})
})
Array.from(screenshotButtons).forEach((button) => {
button.setAttribute('disabled', 'disabled');
button.setAttribute('style', 'cursor: wait;')
});
setTimeout(function() {
Array.from(screenshotButtons).forEach((button) => {
button.removeAttribute('disabled')
button.setAttribute('style', 'cursor: pointer;')
});
}, 3000)
}

$scope.zoom = function(param) {
Expand Down
6 changes: 1 addition & 5 deletions res/app/device-list/details/device-list-details-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,8 @@ module.exports = function DeviceListDetailsDirective(
function updateFilters(filters) {
let deviceFilters = JSON.parse(localStorage.getItem('deviceFilters'))

if (!deviceFilters) {
deviceFilters = []
}

// Use input filters
if (!deviceFilters[0]) {
if (!deviceFilters || !deviceFilters[0]) {
activeFilters = filters
storeFilters(filters)
return filterAll()
Expand Down
8 changes: 4 additions & 4 deletions res/app/device-list/device-list.pug
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
list='searchFields', multiple,
text-focus-select, accesskey='4').form-control.input-sm.device-search.pull-right

span.pull-right(ng-if='activeTabs.details && !$root.basicMode')
span.pull-right(ng-if='activeTabs.details')
.btn-group(uib-dropdown).pull-right
button.btn.btn-sm.btn-primary-outline(type='button', uib-dropdown-toggle)
i.fa.fa-columns
Expand All @@ -44,15 +44,15 @@
uib-tab(active='activeTabs.icons', select='focusSearch()')
uib-tab-heading
i.fa.fa-th-large
span(translate) Devices
span(ng-if='!$root.basicMode', translate) Devices
div.device-list-devices-content(ng-if='activeTabs.icons').selectable

device-list-icons(tracker='tracker', columns='columns', sort='sort', filter='filter')

uib-tab(active='activeTabs.details', select='focusSearch()', ng-if='!$root.basicMode')
uib-tab(active='activeTabs.details', select='focusSearch()')
uib-tab-heading
i.fa.fa-list
span(translate) Details
span(ng-if='!$root.basicMode', translate) Details
div.device-list-details-content(ng-if='activeTabs.details').selectable

device-list-details(tracker='tracker', columns='columns', sort='sort', filter='filter').selectable
2 changes: 1 addition & 1 deletion res/app/menu/menu-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = function MenuCtrl(
, $window
, $route) {

const contactEmail = '[email protected]'
let contactEmail = '[email protected]'

SettingsService.bind($scope, {
target: 'lastUsedDevice'
Expand Down
11 changes: 9 additions & 2 deletions res/app/menu/menu.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}

.stf-menu .stf-top-bar {
height: 44px;
height: fit-content;
padding: 0 10px 0 20px;
width: 100%;
float: left;
Expand Down Expand Up @@ -42,7 +42,7 @@
line-height: 44px;
color: #777777;
font-weight: 400;
height: 44px;
height: fit-content;
position: relative;
}

Expand All @@ -64,4 +64,11 @@
.stf-menu.navbar {
height: 44px !important;
min-height: 44px !important;
background-color: white;
}

@media (min-width: 600px) {
.stf-menu .stf-nav > li {
padding: 0;
}
}
8 changes: 4 additions & 4 deletions res/app/menu/menu.pug
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,27 @@
a(ng-href='/stf#!/settings')
span.fa.fa-gears
span(ng-if='!$root.basicMode', translate) Settings
ul.nav.stf-nav.stf-feedback.pull-right(ng-cloak, nav-menu='current').unselectable
ul.nav.stf-nav.stf-feedback.pull-right(ng-cloak, nav-menu='current', style='padding: 0').unselectable
li.stf-nav-web-native-button(ng-if='!$root.basicMode && isControlRoute')
.btn-group
button(type='button', ng-model='$root.platform', uib-btn-radio="'web'", translate).btn.btn-sm.btn-default-outline Web
button(type='button', ng-model='$root.platform', uib-btn-radio="'native'", translate).btn.btn-sm.btn-default-outline Native

li.stf-nav-web-native-button(ng-if='!$root.basicMode')
li.stf-nav-web-native-button()
button.btn.btn-sm.btn-default-outline(
type='button'
ng-click='mailToSupport()')
i.fa.fa-envelope-o
span(translate) Contact Support

li.stf-nav-web-native-button(ng-if='!$root.basicMode')
li.stf-nav-web-native-button()
button.btn.btn-sm.btn-default-outline(
type='button'
ng-click='logout()')
i.fa.fa-sign-out
span(translate) Logout

li(ng-show='!$root.basicMode')
li()
a(ng-href='/stf#!/help', accesskey='6')
i.fa.fa-question-circle.fa-fw
| {{ "Help" | translate }}
3 changes: 1 addition & 2 deletions res/app/views/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ html(ng-app='app')
div(ng-controller='LayoutCtrl', basic-mode, admin-mode, standalone, landscape).fill-height
.pane-top.fill-height(fa-pane)
.pane-top-bar(fa-pane, pane-id='menu', pane-anchor='north',
pane-size='{{!$root.basicMode && !$root.standalone ? 44 : 0 }}px',

pane-size='{{!$root.basicMode && !$root.standalone ? 44 : 80 }}px',
pane-handle='')
div(ng-include='"menu.pug"')

Expand Down
1 change: 1 addition & 0 deletions res/web_modules/angular-borderlayout/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

/* TODO: CHECK THIS */
.pane-top-bar {
background: white;
box-shadow: 0 1px 10px rgba(0, 0, 0, 0.1);
z-index: 500;
}
Expand Down

0 comments on commit 7d19c1d

Please sign in to comment.