Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/android r #21

Open
wants to merge 145 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
613c49e
update gitignore
alanmlira Nov 7, 2019
bfd2b84
include enqueueItems to download a bunch of items
alanmlira Nov 7, 2019
25878a7
fix for i
alanmlira Nov 7, 2019
5bce00c
fix list parameter
alanmlira Nov 7, 2019
c49d03a
fix result as List<dynamic>
alanmlira Nov 7, 2019
9cad506
set toList() on exception
alanmlira Nov 7, 2019
c565bab
fix doc
alanmlira Nov 7, 2019
cdaa8d4
fix enqueueItems
alanmlira Nov 11, 2019
3398080
update gitignore
alanmlira Dec 30, 2019
ef21506
Merge branch 'master' into feature/multiple_downloads
alanmlira Dec 30, 2019
3a24793
update .gitignore
alanmlira Dec 30, 2019
bb54009
include try catch
alanmlira Dec 30, 2019
7f1a723
remove trycatch
alanmlira Dec 30, 2019
768be82
fix null to nil
alanmlira Dec 30, 2019
540cb27
include checks to avoid exceptions
alanmlira Dec 30, 2019
2758b83
fix hot reload
alanmlira Jan 15, 2020
bd6d6e1
fix restart
alanmlira Jan 15, 2020
ae41f40
fix duplicate initialization
alanmlira Feb 17, 2020
cffb85e
update master
alanmlira Feb 17, 2020
05f8df7
Merge branch 'master' into feature/multiple_downloads
atrope Apr 25, 2020
53db362
Adding file to Media Center when downloaded/remove
atrope May 13, 2020
fbb3362
forgot plugin import
atrope May 13, 2020
68691c9
Also removes for iOS
atrope May 13, 2020
649c9c9
Update enqueue Item/Items to async
atrope Jun 23, 2020
e4f4826
Android 10+ Save on another apps
atrope Jul 12, 2020
f8613f9
fixing scan for older Androids
atrope Jul 14, 2020
a793ed9
checking if file exists in first place..
atrope Jul 24, 2020
b85d03e
Merge branch 'master' into feature/multiple_downloads
atrope Aug 19, 2020
ef38a03
adding new field for reporting
atrope Aug 20, 2020
edd20e5
user agent
atrope Aug 25, 2020
77eaa3f
adding headers to resume and retry
atrope Aug 26, 2020
4de922a
fixing invalid array position
atrope Sep 24, 2020
3b28fd5
Add fields music artist and music album as download intent extras
lalbuquerque Sep 29, 2020
8118117
Add fields album and artist to TaskContract
lalbuquerque Sep 30, 2020
1e1358d
Add new columns (album and artist) to DB and increase DATABASE_VERSION
lalbuquerque Sep 30, 2020
e3001e5
Update methods signatures to use album and artist fields
lalbuquerque Sep 30, 2020
673b8c6
Search for album and artist fields when receiving an enqueue or enque…
lalbuquerque Sep 30, 2020
bda7f97
Add albumName and artistName to DownloadTask
lalbuquerque Sep 30, 2020
bca0dfd
Update with new fields (albumName and artistName)
lalbuquerque Sep 30, 2020
46fd419
Update enqueue method signature with new music fields (albumName and …
lalbuquerque Sep 30, 2020
06844ee
Add new field sm_extras to android module DB and Media Store (on Book…
lalbuquerque Oct 2, 2020
f389d04
Add field sm_extras to API layer
lalbuquerque Oct 2, 2020
57f8200
Remove space to fix DB creation
lalbuquerque Oct 5, 2020
350bcea
Fix DownloadItem.toMap() method
lalbuquerque Oct 5, 2020
06875a2
Fix smExtras data type and encoding
lalbuquerque Oct 5, 2020
4556324
Improve parameters log
lalbuquerque Oct 8, 2020
c27b06d
Add DB migration version 3
lalbuquerque Oct 8, 2020
fa0b1f5
Merge pull request #4 from SuaMusica/feature/save_music_info_on_media…
lalbuquerque Oct 9, 2020
c62f23b
Merge branch 'master' into feature/multiple_downloads
atrope Oct 12, 2020
c4e60a5
Insert artist name on column MediaStore.Audio.Media.ALBUM_ARTIST too
lalbuquerque Oct 17, 2020
caf833b
Merge pull request #6 from SuaMusica/fill_album_artist_column_on_medi…
atrope Oct 19, 2020
3842c18
Extend MediaStore support for all APIs above 22 and remove BOOKMARK i…
lalbuquerque Oct 28, 2020
df07217
Merge pull request #7 from SuaMusica/feature/extend_mediastore_api_su…
atrope Oct 28, 2020
1cff303
Save SM extras on id3 through custom tags and comments
lalbuquerque Nov 2, 2020
6a48aac
Merge branch 'master' into feature/multiple_downloads
atrope Nov 3, 2020
f24dfcc
auto cancel Complete Notification
atrope Nov 3, 2020
d785221
[WIP] Fixing MP3 file ID3 tags
Nov 4, 2020
b7bb1a9
Fixing sm-related arguments
Nov 4, 2020
a0b4bcd
Fixing bug
Nov 4, 2020
c140105
Merge branch 'feature/multiple_downloads' into save_extras_on_id3
lalbuquerque Nov 5, 2020
cd04ee2
Removing line
Nov 8, 2020
194b1d1
Merge branch 'save_extras_on_id3' of github.com:SuaMusica/flutter_dow…
Nov 8, 2020
13c53c8
Merge pull request #9 from SuaMusica/save_extras_on_id3
atrope Nov 16, 2020
d567824
try Alter Table
atrope Nov 20, 2020
5c718c9
fix if alter table
atrope Nov 20, 2020
66665aa
fixing if contenttype was wrong.
atrope Jan 14, 2021
4859b46
Fixing issue #1217
Mar 4, 2021
5b8765a
Fixing issue #1217
Mar 4, 2021
265b0dd
Merge branch 'hotfix/#1217' of github.com:SuaMusica/flutter_downloade…
Mar 4, 2021
00235be
Merge pull request #10 from SuaMusica/hotfix/#1217
nferreira Mar 4, 2021
1806d7e
keep id3v2 if exists
atrope Mar 12, 2021
df3320b
Merge branch 'feature/multiple_downloads' of github.com:SuaMusica/flu…
atrope Mar 12, 2021
c4fe640
Merge branch 'master' into feature/multiple_downlo
atrope Mar 30, 2021
d464360
adding nullable possibility to Map
atrope Mar 30, 2021
728ff1c
Merge branch 'feature/multiple_downloads' into uodate
atrope Apr 13, 2021
f9d7c5e
Merge pull request #13 from SuaMusica/uodate
atrope Apr 13, 2021
6fe23dd
remove duplicate code
atrope Apr 13, 2021
05c04b0
fix pubspec example
atrope Apr 13, 2021
b8b6c36
fix Android < 7 content length
atrope Apr 27, 2021
c49c37d
fix android <7 content length
atrope Apr 27, 2021
e08e5c6
disable automatic resume
atrope Apr 28, 2021
b5ea1a9
disabling resume for our app
atrope Apr 28, 2021
01d03f3
try catch
atrope Apr 29, 2021
a604ff9
Merge branch 'feature/multiple_downloads' into xxx
atrope Jun 4, 2021
5748d34
Merge pull request #15 from SuaMusica/xxx
atrope Jun 4, 2021
52b9407
wip: remove deprecated methods
atrope Jun 9, 2021
47a7dda
wip: better id3v2
atrope Jun 9, 2021
292d8fb
wip: add queue
atrope Jun 9, 2021
59cd29f
wip: queue as a singleton
atrope Jun 10, 2021
fa5b65b
wip: remove changes
atrope Jun 10, 2021
770e2ee
Merge pull request #1 from fluttercommunity/master
atrope Jun 10, 2021
3e9361b
Update DownloadWorker.java
atrope Jun 10, 2021
2ef1318
Update FlutterDownloaderInitializer.java
atrope Jun 10, 2021
3efdc1d
Update FlutterDownloaderPlugin.java
atrope Jun 10, 2021
670d64c
Merge branch 'feature/multiple_downloads' into feature/upgradeV1
atrope Jun 10, 2021
3b9b99e
Merge pull request #17 from atrope/feature/upgradeV1
atrope Jun 10, 2021
fe8bd73
Merge branch 'feature/multiple_downloads' into feature/slowdown
atrope Jun 10, 2021
a672fca
fix: id3
atrope Jun 10, 2021
a835970
Merge branch 'feature/multiple_downloads' into feature/slowdown
atrope Jun 10, 2021
bcaee0d
wip: toggle queue on Flutter
atrope Jun 11, 2021
dcc1979
Merge pull request #16 from SuaMusica/feature/slowdown
atrope Jun 14, 2021
9fcb5d2
fix queue
atrope Jun 16, 2021
7deb95e
remove Log
atrope Jun 16, 2021
dbf1df1
fix: retry + enqueue init engine before callback
atrope Jun 16, 2021
e9a89aa
Update DownloadWorker.java
atrope Jun 16, 2021
ff2b1ae
try to synchronize download
atrope Aug 27, 2021
b71acc4
Merge branch 'master' into feature/androidR
atrope Nov 6, 2021
aa32bec
chore: change name
atrope Nov 6, 2021
dac4e97
fix: arguments error on updateNotification
atrope Nov 6, 2021
ccd04d6
wip: fix downloading to dir
atrope Nov 8, 2021
14507fb
fix: adding saveinpublic
atrope Nov 8, 2021
3580b6c
change ifs location
atrope Nov 9, 2021
f35340a
wip: test removeOutside within plugin
atrope Nov 9, 2021
29025f6
wip: activity result
atrope Nov 10, 2021
7c80469
wip: remove removal from here
atrope Nov 10, 2021
2ea8c5a
Android 30
atrope Nov 10, 2021
acce2cb
fix: overwrite if exists for now
atrope Nov 18, 2021
39980eb
Remove on Stopped method override
koga187 Dec 1, 2021
1c78a95
Fix lookupCallback crash
Dec 29, 2021
b6a7b20
remove unnecessary semicolon
ybin0823 Jan 6, 2022
302f155
formatting if statement
ybin0823 Jan 6, 2022
62a05c0
chore(DownloadWorker): Saving on SDcard
koga187 Jan 14, 2022
e7fe4ea
chore(DownloadWorker): Saving androdi 11 but not the old ones
koga187 Jan 14, 2022
725a301
chore(DownloadWorker): Removing debug log
koga187 Jan 17, 2022
02a4d0d
Merge pull request #22 from SuaMusica/feature/androidRSavingOnSD
koga187 Jan 19, 2022
5b9024c
add null check to prevent crashes on android if task not found
mehayhe Jan 20, 2022
c38bb57
Merge pull request #583 from Taym95/Taym95/fix-failed-lookupCallback-…
hnvn Jan 24, 2022
baa0c3e
upgrade android_path_provider
hnvn Jan 25, 2022
bc5917b
upgrade gradle
hnvn Jan 25, 2022
2a99bfd
upgrade gradle
hnvn Jan 25, 2022
e1477ec
fix bug android example in android 12
hnvn Jan 25, 2022
a17d6c5
bump version
hnvn Jan 25, 2022
d8484c6
Merge pull request #586 from ybin0823/remove_semicolon
hnvn Jan 25, 2022
d5e6e8b
Merge branch 'fluttercommunity:master' into master
atrope Jan 25, 2022
a6f5426
Merge branch 'master' into feature/upgradeV1
atrope Jan 25, 2022
23b2617
fix: channel outside synchronized
atrope Jan 25, 2022
8e618b9
fix: cause BLE scan not callback
Jan 26, 2022
98036cb
Merge pull request #477 from atrope/feature/upgradeV1
hnvn Jan 28, 2022
6414d09
Merge branch 'master' into feature/androidR
koga187 Feb 7, 2022
f761e9d
Merge branch 'master' of https://github.com/fluttercommunity/flutter_…
Feb 18, 2022
f5a7b0a
Merge pull request #597 from Yongle-Fu/fix_scan_ble_not_callback
hnvn Feb 18, 2022
dbccee8
Merge branch 'fluttercommunity:master' into master
mehayhe Feb 20, 2022
c4e5539
Merge pull request #607 from mehayhe/master
hnvn Feb 28, 2022
3e87f49
Merge branch 'master' of git://github.com/fluttercommunity/flutter_do…
atrope Mar 3, 2022
b473a02
Merge branch 'feature/androidR' of github.com:SuaMusica/flutter_downl…
atrope Mar 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ version
.pub-cache/
.pub/
build/
.idea/

android/.classpath
android/.project
android/.settings
android/.settings/
android/example/.classpath
android/example/.project
android/example/.settings
android/example/.settings/
example/ios/Flutter/flutter_export_environment.sh
.vscode/
flutter_*.png
linked_*.ds
unlinked.ds
Expand Down Expand Up @@ -95,4 +107,4 @@ coverage/
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

## 1.7.2 - 24-01-2022

* fix bug on Android
* upgrade Android dependencies (WorkerManager 2.7.1)

## 1.7.1 - 08-10-2021

* fix bug resume download on Android
Expand Down
3 changes: 3 additions & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
.DS_Store
/build
/captures
/.classpath
/.project
/.settings
1 change: 1 addition & 0 deletions android/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions android/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion android/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions android/.idea/modules.xml

This file was deleted.

12 changes: 0 additions & 12 deletions android/.idea/runConfigurations.xml

This file was deleted.

8 changes: 6 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.6.4'
classpath 'com.android.tools.build:gradle:4.1.0'
}
}

Expand Down Expand Up @@ -38,8 +38,12 @@ android {
}

dependencies {
implementation 'androidx.work:work-runtime:2.7.0-rc01'
implementation 'androidx.work:work-runtime:2.7.1'
implementation 'androidx.annotation:annotation:1.2.0'
implementation 'androidx.core:core:1.6.0'
implementation 'androidx.fragment:fragment:1.3.6'
implementation 'com.mpatric:mp3agic:0.9.0'
// implementation files('/Users/trope/flutter/bin/cache/artifacts/engine/android-x64/flutter.jar')


}
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package vn.hunghd.flutterdownloader;

import android.content.Context;
import android.util.Log;

import androidx.work.WorkManager;
import androidx.work.WorkRequest;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.Queue;
import java.util.UUID;

public final class DownloadQueue {
private static DownloadQueue instance;
private final Queue<UUID> queue = new LinkedList<>();
private final Map<UUID, WorkRequest> queueMap = new HashMap<>();

private Context context;
private boolean nothingOnWorker = true;

private DownloadQueue(Context context) {
this.context = context;
}

public static DownloadQueue getInstance(Context context) {
if (instance == null) {
instance = new DownloadQueue(context);
}
return instance;
}

public void doQueue() {
final UUID id = queue.poll();
if (id == null) {
reset();
} else {
if (queueMap.containsKey(id)){
final WorkRequest request = queueMap.get(id);
startWork(request);
} else {
doQueue();
}
}
}
private void startWork(WorkRequest e){
nothingOnWorker = false;
WorkManager.getInstance(context).enqueue(e);
}
public void reset() {
queue.clear();
queueMap.clear();
nothingOnWorker = true;
}

public void removeTask(UUID e) {
if(queue.remove(e)){
queueMap.remove(e);
if(queue.isEmpty()){
nothingOnWorker = true;
}
}
}
public void add(WorkRequest e) {
if (queue.isEmpty() && nothingOnWorker) {
startWork(e);
} else {
queue.add(e.getId());
queueMap.put(e.getId(),e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,16 @@ public class DownloadTask {
boolean openFileFromNotification;
long timeCreated;
boolean saveInPublicStorage;
String albumName;
String artistName;
String artistId;
String playlistId;
String albumId;
String musicId;

DownloadTask(int primaryId, String taskId, int status, int progress, String url, String filename, String savedDir,
String headers, String mimeType, boolean resumable, boolean showNotification, boolean openFileFromNotification, long timeCreated, boolean saveInPublicStorage) {
String headers, String mimeType, boolean resumable, boolean showNotification, boolean openFileFromNotification,
long timeCreated, boolean saveInPublicStorage, String albumName, String artistName, String artistId, String playlistId, String albumId, String musicId) {
this.primaryId = primaryId;
this.taskId = taskId;
this.status = status;
Expand All @@ -31,11 +38,23 @@ public class DownloadTask {
this.showNotification = showNotification;
this.openFileFromNotification = openFileFromNotification;
this.timeCreated = timeCreated;
this.albumName = albumName;
this.artistName = artistName;
this.artistId = artistId;
this.playlistId = playlistId;
this.albumId = albumId;
this.musicId = musicId;
this.saveInPublicStorage = saveInPublicStorage;
}

@Override
public String toString() {
return "DownloadTask{taskId=" + taskId + ",status=" + status + ",progress=" + progress + ",url=" + url + ",filename=" + filename + ",savedDir=" + savedDir + ",headers=" + headers + ", saveInPublicStorage= " + saveInPublicStorage + "}";
return "DownloadTask{taskId=" + taskId + ",status=" + status + ",progress=" + progress +
",url=" + url + ",filename=" + filename + ",savedDir=" + savedDir + ",headers=" +
headers + "saveInPublicStorage= " + saveInPublicStorage + ",albumName=" + albumName + ",artistName=" + artistName +
",artistId=" + artistId +
",playlistId=" + playlistId +
",albumId=" + albumId +
",musicId=" + musicId + "}";
}
}
Loading