From 0309b5af0de73cdc0b872cdd3fcb3cae3f9653d1 Mon Sep 17 00:00:00 2001 From: Nisarg Jhaveri Date: Tue, 1 Jun 2021 11:09:46 +0530 Subject: [PATCH] Show finer progress when installing --- src/ios-deploy/ios-deploy.m | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/ios-deploy/ios-deploy.m b/src/ios-deploy/ios-deploy.m index dacd8509..aa53463a 100644 --- a/src/ios-deploy/ios-deploy.m +++ b/src/ios-deploy/ios-deploy.m @@ -116,7 +116,6 @@ bool _json_output = false; NSMutableArray *_file_meta_info = nil; int port = 0; // 0 means "dynamically assigned" -CFStringRef last_path = NULL; ServiceConnRef dbgServiceConnection = NULL; pid_t parent = 0; // PID of child process running lldb @@ -717,10 +716,13 @@ mach_error_t transfer_callback(CFDictionaryRef dict, int arg) { CFNumberGetValue(CFDictionaryGetValue(dict, CFSTR("PercentComplete")), kCFNumberSInt32Type, &percent); if (CFEqual(status, CFSTR("CopyingFile"))) { + static CFStringRef last_path = NULL; + static int last_overall_percent = -1; + CFStringRef path = CFDictionaryGetValue(dict, CFSTR("Path")); + int overall_percent = percent / 2; - if ((last_path == NULL || !CFEqual(path, last_path)) && !CFStringHasSuffix(path, CFSTR(".ipa"))) { - int overall_percent = percent / 2; + if ((last_path == NULL || !CFEqual(path, last_path) || last_overall_percent != overall_percent) && !CFStringHasSuffix(path, CFSTR(".ipa"))) { NSLogOut(@"[%3d%%] Copying %@ to device", overall_percent, path); NSLogJSON(@{@"Event": @"BundleCopy", @"OverallPercent": @(overall_percent), @@ -729,6 +731,8 @@ mach_error_t transfer_callback(CFDictionaryRef dict, int arg) { }); } + last_overall_percent = overall_percent; + if (last_path != NULL) { CFRelease(last_path); }