mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 16:13:24 +02:00
A bit of refactoring and new functionality for removeAccount method.
This commit is contained in:
@@ -14,12 +14,12 @@ module.exports = syrup.serial()
|
||||
.define(function(options, service, identity, touch, router, push, adb) {
|
||||
var log = logger.createLogger('device:plugins:account')
|
||||
|
||||
router.on(wire.AccountRemoveMessage, function(channel) {
|
||||
router.on(wire.AccountRemoveMessage, function(channel, message) {
|
||||
var reply = wireutil.reply(options.serial)
|
||||
|
||||
log.info('Removing current Google account(s)')
|
||||
log.info('Removing "%s" account(s)', message.type)
|
||||
|
||||
service.removeAccount()
|
||||
service.removeAccount(message)
|
||||
.timeout(30000)
|
||||
.then(function() {
|
||||
push.send([
|
||||
|
||||
@@ -490,14 +490,17 @@ module.exports = syrup.serial()
|
||||
})
|
||||
}
|
||||
|
||||
plugin.removeAccount = function() {
|
||||
plugin.removeAccount = function(data) {
|
||||
return runServiceCommand(
|
||||
apk.wire.MessageType.REMOVE_ACCOUNT
|
||||
, new apk.wire.RemoveAccountRequest()
|
||||
apk.wire.MessageType.DO_REMOVE_ACCOUNT
|
||||
, new apk.wire.DoRemoveAccountRequest({
|
||||
type: data.type
|
||||
, account: data.account
|
||||
})
|
||||
)
|
||||
.timeout(15000)
|
||||
.then(function(data) {
|
||||
var response = apk.wire.RemoveAccountResponse.decode(data)
|
||||
var response = apk.wire.DoRemoveAccountResponse.decode(data)
|
||||
if (response.success) {
|
||||
return true
|
||||
}
|
||||
@@ -523,9 +526,7 @@ module.exports = syrup.serial()
|
||||
plugin.setRingerMode = function(mode) {
|
||||
return runServiceCommand(
|
||||
apk.wire.MessageType.SET_RINGER_MODE
|
||||
, new apk.wire.SetRingerModeRequest(
|
||||
mode
|
||||
)
|
||||
, new apk.wire.SetRingerModeRequest(mode)
|
||||
)
|
||||
.timeout(10000)
|
||||
.then(function(data) {
|
||||
|
||||
Reference in New Issue
Block a user