mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-27 19:25:13 +02:00
Support uninstalling applications.
This commit is contained in:
@@ -434,6 +434,16 @@ module.exports = function(options) {
|
||||
)
|
||||
])
|
||||
})
|
||||
.on('device.uninstall', function(channel, responseChannel, data) {
|
||||
joinChannel(responseChannel)
|
||||
push.send([
|
||||
channel
|
||||
, wireutil.transaction(
|
||||
responseChannel
|
||||
, new wire.UninstallMessage(data)
|
||||
)
|
||||
])
|
||||
})
|
||||
})
|
||||
.finally(function() {
|
||||
// Clean up all listeners and subscriptions
|
||||
|
||||
@@ -132,4 +132,35 @@ module.exports = syrup.serial()
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
router.on(wire.UninstallMessage, function(channel, message) {
|
||||
log.info('Uninstalling "%s"', message.package)
|
||||
|
||||
var seq = 0
|
||||
|
||||
adb.uninstall(options.serial, message.package)
|
||||
.then(function() {
|
||||
push.send([
|
||||
channel
|
||||
, wireutil.envelope(new wire.TransactionDoneMessage(
|
||||
options.serial
|
||||
, seq++
|
||||
, true
|
||||
, 'success'
|
||||
))
|
||||
])
|
||||
})
|
||||
.catch(function(err) {
|
||||
log.error('Uninstallation failed', err.stack)
|
||||
push.send([
|
||||
channel
|
||||
, wireutil.envelope(new wire.TransactionDoneMessage(
|
||||
options.serial
|
||||
, seq++
|
||||
, false
|
||||
, 'fail'
|
||||
))
|
||||
])
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user