Repository navigation
Conversation
|
On my fork there are unsigned builds ready to be tested. |
Other notesI'm using Obtainium also on my PC using WSA and on 1.6.11 the DART implementation is relatively fast. I suspect that the core issue is a CPU or a memory bottleneck of some sorts. Fortunately this implementation should benefit both speed and battery life on mobile devices |
|
Definitely cool that the download speed will be improved! I have some general comments, but someone else will need to check the implementation. I think the On commits, I have opinions.
Feel free to disregard the commit opinions. Everyone has their own ideas. ^_^ |
|
I know this may sound like I'm overcomplicating things, but maybe it would've been better to use a production-ready downloader (like Having a lot of platform-specific code in a Flutter app can be hard to maintain in the future. Also, using a native library for downloads would not only give a substantial performance improvement (native multithreading, synchronous FFI calls, etc.), but also delegate the fetching/downloading logic to the library, helping avoid potential problems in some edge cases. |
I agree that error messages could be translated, I do not object about it. Currently I've pushed an update that refactored a lot of code inside MainActivity to get the same benefits when pulling updates in background, so check that out
I do agree to an extent: the scope of this project (undisclosed, my bad) was to solve my specific issue with Obtainium downloading speed on my phone that was unreasonably slow. I've picked up the easiest and fastest way possible to achieve that goal. Thank you for your replies! |
fe4c9fb to
5a8fea8
Compare
Progress updateSo, I've unlocked more throughput performance on downloads and I've reached nearly 90% of my internet speed compared to only 50% with previous commits. |
|
@ImranR98 Is there a way to faster debug background updates? Using "Run background check now" appears inconsistent when I got some apps that needs to be updated |
Progress updateAfter exploring a couple of alternatives, due to how Flutter works underneath I've decided to refactor the PR to be a Flutter plugin properly. This is intended for background updated as it wouldn't work without tampering generated code or throw out Flutter entirely from this project. Due to the nature of GitHub's PR, I've decided to add a |
|
I recommend considering to change the plugin from using Method Channels to JNI? It could give a considerable performance boost when sending data between native and app code. Also fully synchronous, supports async via Kotlin's suspend functions, etc. |
I didn't find particular regressions doing Method Channels but I'll take a look if there is some performance left on the table |
I tried to see a JNI version what it could look like but I don't think it's worth it as it would modify |
|
@ImranR98 This is ready to be merged |
|
Is there any chance the |
I'll check if I can do quickly |
@Marocco2, I'd recommend backing up the |
Removed unused downloadBuffer and related stream transformation logic to simplify download process.
…nd add timeout handling for improved download reliability
…ncellation support
…load in modo sicuro nel thread principale
…ed structure and maintainability
…formance and maintainability
Done 👌 |
|
Hmmm... this PR may conflict with certificate pinning feature added not so long ago as opt-in feature. Will test later |
|
Problems I see:
I would prefer this implementation to be using |
I've tried the "broken" 1.6.14 and I did encounter the same github.com bug when I've tried to download something from a repo, so the certificate pinning pipeline is present somewhat. I didn't try RuStore, but if you'll see an issue while testing, feel free to add code suggestions to this PR
AFAIK, |
|
Your implementation does not provide certificate pinning nor it inherit implementation currently presented in Obtainium. I obviously cloned your fork, switched branch to |
Alr, I'll see what I can do shortly |
|
@flexxxxer Quick update: currently this PR has not been merged with latest base, so it shouldn't have the github certificate pinning commit. I'll push the rebased branch on github |
bdee197 to
cc426a8
Compare
|
@flexxxxer Now it should work with RuStore |
|
I tested latest changes. Problems:
|
|
|
Not sure im comfortable adding a whole new custom library for faster downloads tbh. Are there no existing solutions (like the ones suggested earlier)? Also if we're going to use native code there should be a way to hook into Android's own cert store, in which case it would make sense to extend the lib to be used for all our http needs. Appreciate the effort on the PR. Just thinking out loud as I'm not sure it's a good idea. |
Unfortunately it's unfeasible due to how Flutter plugins such as
I dunno if it's possible and I think it won't matter too much on both performance and security
In the end, IMHO, developing this PR on Flutter was very painful for me (the tooling aren't so smooth as a Kotlin app on Android Studio) even more so if these app binaries wouldn't see the light of the day beside Android. |
|
Obtainment cancellation does not work as I stated above, see video recording I attached: Obtainment cancellation does not workScreencast_20260910_122615.mp4I pasted link to MirPay app on RuStore: link Also there are issues with certificate pinning implementation. I didnt expect that you would implement it anyway, so thank you! Issues related to this code:
|
|
maybe better to report this issue about bad obtainment speeds to upstream? I didnt dig into that on flutter issue tracker, maybe it already reported... The whole situation is mess. Maybe one day someone will rewrite Obtainium with Kotlin + Compose... |
|
@flexxxxer Thank you for the repro! I noticed you have tested the debug version, meanwhile I've checked only normal version. Could you reproduce it also in that flavor? It may be related on how it handles split-parallel downloads to maximize connection throughput Regarding RuStore, I'll rewrite the logic as you wish. It may come later in the day but I'm not sure |
I would really really really like to drop off this PR if DART implementation can be fixed upstream or it hasn't set correctly and I didn't notice it. Download progress was a culprit for low download performance also in DART but it can't explain why 50% of throughput speed is missing |
Yeah sure I will test release version later. Thanks for note |
|
@flexxxxer So, I've changed how native downloader behaves according to your specification, please review it if I've understood it correctly. I've got rid of duplicate code inside .kt for maintenance purposes: now a Also, I think I found the cancellation bug: a missing |
|
Sorry, I was busy. Will check in the few days |
|
@Marocco2 seems now certificate pinning implemented correctly I suggest to replace: final policyHost = certificatePinning
? (_certificatePinAssetNames.containsKey(host)
? host
: _certificatePinAssetNames.containsKey(rootHost)
? rootHost
: null)
: null;with: String? policyHost;
if (certificatePinning && _certificatePins.containsKey(host)) {
policyHost = host;
} else if (certificatePinning && _certificatePins.containsKey(rootHost)) {
policyHost = rootHost;
}First one harder to read I think |
I cannot reproduce that anymore. Seems fixed in flutter or in your code |
FYI, you can write requested changes on your PR review so I can press "Accept changes" easily. I'll merge them anyway, so don't worry |

Fixes #533
Fixes #580
By using Java libraries, this PR will approx speed up download up to 10x compared to DART implementation.
This was tested on Pixel 8 Pro on a 1Gbps Wi-Fi 6 connection
Before
After
Known issues
It could throw up some error messages when cancelling downloads or checking in background(fixed with 4f5201b )Disclaimer
This PR is made with the assistance of Github Copilot. Commits history of this PR is shown for transparency but I prefer that should be squashed once PR is merged