Closed firen777 closed 6 months ago
Oh thanks for the report, i never saw this since my update are super slim. Yes the unzip happen twice since in IOS the update have to be saved in 2 place, one for hot reload (when the app is running) one for cold, when the app reboot ... I did compare with copying 2 times the folder and it was worst for what i remember. i will check why the UI hang
Yes the unzip happen twice since in IOS the update have to be saved in 2 place, one for hot reload (when the app is running) one for cold, when the app reboot ...
Thanks for the clarification. That's what I suspected when I inspected the code.
I did compare with copying 2 times the folder and it was worst for what i remember.
I modified the code on my end and made it unzip once then copy. The result is ~17s unzipping + ~2s copying vs ~17s unzipping + ~17s unzipping. In my experience of interacting old hardware (not just i-devices), unzipping many files always causes slow down.
I feel like this is a case of YMMV tho so I'm not sure.
i will check why the UI hang
I opened a pull request ( #223 ) that seems to fixed that issue by changing request.responseURL
callback to perform it's operation in background thread, as it seems like by default it would do stuffs in the main thread. (At least I think that's what I did? I have very little experience in multithreading & swift so I'm not sure).
Also, regarding the pull request, kinda regret the way I did it since I copied the entire download()
function instead of modifying it as I wanted to only change the behavior of manual download()
call. It might be a bad idea to merge it and it's better to serve as a reference instead.
Anyway, thanks for the awesome project!
i took your change and added it to the main function since it was working for both. i let you try and tell me
Bug Report
Capacitor Version
Plugin Version
context(s)
Platform(s)
iOS
Current Behavior
The UI hang when performing
CapacitorUpdater.download()
. Further digging suggestSSZipArchive.unzipFile()
insideCapacitorUpdater.swift
'ssaveDownloaded()
is what blocks the main UI thread.The issue is particularly serious on old iOS devices (e.g. iPad mini 4) and can hang the UI for about 10 seconds. For new-ish device (e.g. iPhone XR), it will hiccup for about 3 seconds.
Android does not exhibit this issue, and I have only tested manual mode. Trying to test auto mode is currently not allowed (or at least very painful) due to project requirement.
Expected Behavior
CapacitorUpdater.download() should not hang the UI.
Code Reproduction
The issue occurs whenever
CapacitorUpdater.download()
is called so not much code reproduction to speak of.Below is the "digging" I do in order to identify the issue:
console output show:
The UI become unresponsive during the unzipping. Outright removing the unzipping code and the UI is no longer unresponsive.
(Also, did the unzip happened twice?)