flutter_downloader
flutter_downloader copied to clipboard
Add option to download only via wifi
- Add
allowCellular
flag to theenqueue
that defaults totrue
- Add separate
NSURLSession
on iOS that setsallowsCellularAccess
false in its configuration - Schedule download requests with one of the two sessions depending on the flag of the download
- Add the flag to the Android plugin and set the
network constraints to either
NetworkType.CONNECTED
orNetworkType.UNMETERED
depending on the value of the flag - Migrate sql database on Android to keep track of the flag
Closes #408
@hnvn Is this something you would consider reviewing if the conflicts are resolved?
Thanks @lyio and @kuhnroyal for this PR. Android implementation is good for me but it seems that iOS implementation is missing configuration for DB scheme. On iOS, we have a pre-defined DB scheme in file download_tasks.sql
in ios/Assets/
folder
@hnvn it works fine on iOS without updating the schema for some reason. I'll see to it that the file is updated, though.
@hnvn I have a couple of questions regarding the scheme. I have updated the binary database file to include a new column allow_cellular
.
I have not seen anything in the Objective-C code suggesting that any form of migration strategy is applied. On Android the database is cleared and recreated when changes are made, but on iOS I don't see anything like that.
Am I missing something here?
Do we need to add this first? Because otherwise my changes will have no effect on existing installations as the file is only copied over if it does not exist yet.
The iOS implementation comes without migration solution. I currently don't find down any solution for it. That's why I am quit hesitate to add new field to DB schema. New field on DB need to release as a major update
The Android solution to the problem seems to be, to simply delete the DB and create it again when the version changes.
@hnvn do you have a migration path for iOS in mind?
Due to all the changes in the meantime (especially the migration to Kotlin), I have a hard time rebasing this and still getting it to work.
I will close this PR and make a new one.