mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 16:13:24 +02:00
Guesstimate installation progress.
This commit is contained in:
@@ -58,8 +58,8 @@ module.exports = syrup.serial()
|
||||
// Progress 0% to 70%
|
||||
sendProgress(
|
||||
'pushing_app'
|
||||
, 70 * Math.max(0, Math.min(
|
||||
70
|
||||
, 50 * Math.max(0, Math.min(
|
||||
50
|
||||
, stats.bytesTransferred / contentLength
|
||||
))
|
||||
)
|
||||
@@ -90,9 +90,22 @@ module.exports = syrup.serial()
|
||||
sendProgress('pushing_app', 0)
|
||||
pushApp()
|
||||
.then(function(apk) {
|
||||
// Progress 80%
|
||||
sendProgress('installing_app', 80)
|
||||
return adb.installRemote(options.serial, apk)
|
||||
var start = 50
|
||||
, end = 90
|
||||
, guesstimate = start
|
||||
|
||||
sendProgress('installing_app', guesstimate)
|
||||
return promiseutil.periodicNotify(
|
||||
adb.installRemote(options.serial, apk)
|
||||
, 1000
|
||||
)
|
||||
.progressed(function() {
|
||||
guesstimate = Math.min(
|
||||
end
|
||||
, guesstimate + 5 * (end - guesstimate) / (end - start)
|
||||
)
|
||||
sendProgress('installing_app', guesstimate)
|
||||
})
|
||||
})
|
||||
.timeout(30000)
|
||||
.then(function() {
|
||||
|
||||
Reference in New Issue
Block a user