mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-19 16:43:26 +02:00
Implement pop up add account menu (for Google Account).
This commit is contained in:
@@ -32,4 +32,26 @@ module.exports = syrup.serial()
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
router.on(wire.AccountAddMenuMessage, function(channel) {
|
||||
var reply = wireutil.reply(options.serial)
|
||||
|
||||
log.info('Showing add account menu for Google Account')
|
||||
|
||||
service.addAccountMenu()
|
||||
.timeout(30000)
|
||||
.then(function() {
|
||||
push.send([
|
||||
channel
|
||||
, reply.okay()
|
||||
])
|
||||
})
|
||||
.error(function(err) {
|
||||
log.error('Add account menu failed', err.stack)
|
||||
push.send([
|
||||
channel
|
||||
, reply.fail(err.message)
|
||||
])
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -505,6 +505,21 @@ module.exports = syrup.serial()
|
||||
})
|
||||
}
|
||||
|
||||
plugin.addAccountMenu = function() {
|
||||
return runServiceCommand(
|
||||
apk.wire.MessageType.DO_ADD_ACCOUNT_MENU
|
||||
, new apk.wire.DoAddAccountMenuRequest()
|
||||
)
|
||||
.timeout(15000)
|
||||
.then(function(data) {
|
||||
var response = apk.wire.DoAddAccountMenuResponse.decode(data)
|
||||
if (response.success) {
|
||||
return true
|
||||
}
|
||||
throw new Error('Unable to show add account menu')
|
||||
})
|
||||
}
|
||||
|
||||
plugin.setRingerMode = function(mode) {
|
||||
return runServiceCommand(
|
||||
apk.wire.MessageType.SET_RINGER_MODE
|
||||
|
||||
@@ -15,7 +15,7 @@ module.exports = syrup.serial()
|
||||
var log = logger.createLogger('device:resources:service')
|
||||
|
||||
var resource = {
|
||||
requiredVersion: '0.7.12'
|
||||
requiredVersion: '0.7.13'
|
||||
, pkg: 'jp.co.cyberagent.stf'
|
||||
, main: 'jp.co.cyberagent.stf.Agent'
|
||||
, apk: pathutil.vendor('STFService/STFService.apk')
|
||||
|
||||
Reference in New Issue
Block a user