Skip to content

Commit 0309b5a

Browse files
committed
Show finer progress when installing
1 parent 7734420 commit 0309b5a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/ios-deploy/ios-deploy.m

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@
116116
bool _json_output = false;
117117
NSMutableArray *_file_meta_info = nil;
118118
int port = 0; // 0 means "dynamically assigned"
119-
CFStringRef last_path = NULL;
120119
ServiceConnRef dbgServiceConnection = NULL;
121120
pid_t parent = 0;
122121
// PID of child process running lldb
@@ -717,10 +716,13 @@ mach_error_t transfer_callback(CFDictionaryRef dict, int arg) {
717716
CFNumberGetValue(CFDictionaryGetValue(dict, CFSTR("PercentComplete")), kCFNumberSInt32Type, &percent);
718717

719718
if (CFEqual(status, CFSTR("CopyingFile"))) {
719+
static CFStringRef last_path = NULL;
720+
static int last_overall_percent = -1;
721+
720722
CFStringRef path = CFDictionaryGetValue(dict, CFSTR("Path"));
723+
int overall_percent = percent / 2;
721724

722-
if ((last_path == NULL || !CFEqual(path, last_path)) && !CFStringHasSuffix(path, CFSTR(".ipa"))) {
723-
int overall_percent = percent / 2;
725+
if ((last_path == NULL || !CFEqual(path, last_path) || last_overall_percent != overall_percent) && !CFStringHasSuffix(path, CFSTR(".ipa"))) {
724726
NSLogOut(@"[%3d%%] Copying %@ to device", overall_percent, path);
725727
NSLogJSON(@{@"Event": @"BundleCopy",
726728
@"OverallPercent": @(overall_percent),
@@ -729,6 +731,8 @@ mach_error_t transfer_callback(CFDictionaryRef dict, int arg) {
729731
});
730732
}
731733

734+
last_overall_percent = overall_percent;
735+
732736
if (last_path != NULL) {
733737
CFRelease(last_path);
734738
}

0 commit comments

Comments
 (0)