From 543e88f238e1eb73512f3a34d876b464b2ac6a02 Mon Sep 17 00:00:00 2001 From: Bram Bout Date: Sat, 22 Feb 2020 15:46:07 -0800 Subject: [PATCH 01/71] Added timeCreated field to DownloadTask --- lib/src/downloader.dart | 3 ++- lib/src/models.dart | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/src/downloader.dart b/lib/src/downloader.dart index 8fef7add..3d05e48d 100644 --- a/lib/src/downloader.dart +++ b/lib/src/downloader.dart @@ -119,7 +119,8 @@ class FlutterDownloader { progress: item['progress'], url: item['url'], filename: item['file_name'], - savedDir: item['saved_dir'])) + savedDir: item['saved_dir'], + timeCreated: item('time_created'))) .toList(); } on PlatformException catch (e) { print(e.message); diff --git a/lib/src/models.dart b/lib/src/models.dart index 11474758..a489a2ae 100644 --- a/lib/src/models.dart +++ b/lib/src/models.dart @@ -43,6 +43,7 @@ class DownloadTask { final String url; final String filename; final String savedDir; + final int timeCreated; DownloadTask( {this.taskId, @@ -50,7 +51,8 @@ class DownloadTask { this.progress, this.url, this.filename, - this.savedDir}); + this.savedDir, + this.timeCreated}); @override String toString() => From 417574a51635219ef61793bea002d65883f20224 Mon Sep 17 00:00:00 2001 From: Bram Bout Date: Sat, 22 Feb 2020 15:59:34 -0800 Subject: [PATCH 02/71] Added timeCreated in loadTasksWithRawQuery --- lib/src/downloader.dart | 5 +++-- lib/src/models.dart | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/src/downloader.dart b/lib/src/downloader.dart index 3d05e48d..41390e4a 100644 --- a/lib/src/downloader.dart +++ b/lib/src/downloader.dart @@ -1,6 +1,6 @@ +import 'dart:async'; import 'dart:io'; import 'dart:ui'; -import 'dart:async'; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; @@ -163,7 +163,8 @@ class FlutterDownloader { progress: item['progress'], url: item['url'], filename: item['file_name'], - savedDir: item['saved_dir'])) + savedDir: item['saved_dir'], + timeCreated: item('time_created'))) .toList(); } on PlatformException catch (e) { print(e.message); diff --git a/lib/src/models.dart b/lib/src/models.dart index a489a2ae..4d08532c 100644 --- a/lib/src/models.dart +++ b/lib/src/models.dart @@ -56,5 +56,5 @@ class DownloadTask { @override String toString() => - "DownloadTask(taskId: $taskId, status: $status, progress: $progress, url: $url, filename: $filename, savedDir: $savedDir)"; + "DownloadTask(taskId: $taskId, status: $status, progress: $progress, url: $url, filename: $filename, savedDir: $savedDir, timeCreated: $timeCreated)"; } From 0b3a6dbcdd7a4c05ac8b940747a77f1eaa52d7f4 Mon Sep 17 00:00:00 2001 From: Bram Bout Date: Sat, 22 Feb 2020 16:04:29 -0800 Subject: [PATCH 03/71] Updated .gitignore --- .gitignore | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 93 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 8470f198..aec5bdaf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,98 @@ +# Miscellaneous +*.class +*.lock +*.log +*.pyc +*.swp .DS_Store -.dart_tool/ +.atom/ +.buildlog/ +.history +.svn/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# Visual Studio Code related +.vscode/ +# Flutter repo-specific +/bin/cache/ +/bin/mingit/ +/dev/benchmarks/mega_gallery/ +/dev/bots/.recipe_deps +/dev/bots/android_tools/ +/dev/docs/doc/ +/dev/docs/flutter.docs.zip +/dev/docs/lib/ +/dev/docs/pubspec.yaml +/packages/flutter/coverage/ +version +.flutter-plugins-dependencies + +# packages file containing multi-root paths +.packages.generated + +# Flutter/Dart/Pub related +**/doc/api/ +.dart_tool/ +.flutter-plugins .packages +.pub-cache/ .pub/ -pubspec.lock - build/ -.idea/ +flutter_*.png +linked_*.ds +unlinked.ds +unlinked_spec.ds + +# Android related +**/android/**/gradle-wrapper.jar +**/android/.gradle +**/android/captures/ +**/android/gradlew +**/android/gradlew.bat +**/android/local.properties +**/android/**/GeneratedPluginRegistrant.java +**/android/key.properties +*.jks + +# iOS/XCode related +**/ios/**/*.mode1v3 +**/ios/**/*.mode2v3 +**/ios/**/*.moved-aside +**/ios/**/*.pbxuser +**/ios/**/*.perspectivev3 +**/ios/**/*sync/ +**/ios/**/.sconsign.dblite +**/ios/**/.tags* +**/ios/**/.vagrant/ +**/ios/**/DerivedData/ +**/ios/**/Icon? +**/ios/**/Pods/ +**/ios/**/.symlinks/ +**/ios/**/profile +**/ios/**/xcuserdata +**/ios/.generated/ +**/ios/Flutter/App.framework +**/ios/Flutter/Flutter.framework +**/ios/Flutter/Generated.xcconfig +**/ios/Flutter/app.flx +**/ios/Flutter/app.zip +**/ios/Flutter/flutter_assets/ +**/ios/Flutter/flutter_export_environment.sh +**/ios/ServiceDefinitions.json +**/ios/Runner/GeneratedPluginRegistrant.* + +# Coverage +coverage/ + +# Exceptions to above rules. +!**/ios/**/default.mode1v3 +!**/ios/**/default.mode2v3 +!**/ios/**/default.pbxuser +!**/ios/**/default.perspectivev3 +!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages \ No newline at end of file From da4029fc43d17150c4cd21095ca282e2dac3f45d Mon Sep 17 00:00:00 2001 From: Bram Bout Date: Sat, 22 Feb 2020 16:05:34 -0800 Subject: [PATCH 04/71] Updated another .gitignore --- example/ios/.gitignore | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/example/ios/.gitignore b/example/ios/.gitignore index 79cc4da8..b48ca837 100644 --- a/example/ios/.gitignore +++ b/example/ios/.gitignore @@ -43,3 +43,30 @@ Icon? Pods/ .symlinks/ + +# iOS/XCode related +**/ios/**/*.mode1v3 +**/ios/**/*.mode2v3 +**/ios/**/*.moved-aside +**/ios/**/*.pbxuser +**/ios/**/*.perspectivev3 +**/ios/**/*sync/ +**/ios/**/.sconsign.dblite +**/ios/**/.tags* +**/ios/**/.vagrant/ +**/ios/**/DerivedData/ +**/ios/**/Icon? +**/ios/**/Pods/ +**/ios/**/.symlinks/ +**/ios/**/profile +**/ios/**/xcuserdata +**/ios/.generated/ +**/ios/Flutter/App.framework +**/ios/Flutter/Flutter.framework +**/ios/Flutter/Generated.xcconfig +**/ios/Flutter/app.flx +**/ios/Flutter/app.zip +**/ios/Flutter/flutter_assets/ +**/ios/Flutter/flutter_export_environment.sh +**/ios/ServiceDefinitions.json +**/ios/Runner/GeneratedPluginRegistrant.* From 7b030543a2aa3eea28d12cfa2043d1a61b1c7072 Mon Sep 17 00:00:00 2001 From: Bram Bout Date: Sat, 22 Feb 2020 16:08:08 -0800 Subject: [PATCH 05/71] Removed two generated files from git cache that should not be checked into source control --- example/.flutter-plugins-dependencies | 1 - example/ios/Flutter/flutter_export_environment.sh | 11 ----------- 2 files changed, 12 deletions(-) delete mode 100644 example/.flutter-plugins-dependencies delete mode 100755 example/ios/Flutter/flutter_export_environment.sh diff --git a/example/.flutter-plugins-dependencies b/example/.flutter-plugins-dependencies deleted file mode 100644 index 3d7e3dec..00000000 --- a/example/.flutter-plugins-dependencies +++ /dev/null @@ -1 +0,0 @@ -{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"flutter_downloader","dependencies":[]},{"name":"path_provider","dependencies":[]},{"name":"permission_handler","dependencies":[]}]} \ No newline at end of file diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh deleted file mode 100755 index 27eb5932..00000000 --- a/example/ios/Flutter/flutter_export_environment.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -# This is a generated file; do not edit or check into version control. -export "FLUTTER_ROOT=/Users/hunghd/Documents/Workspace/flutter" -export "FLUTTER_APPLICATION_PATH=/Users/hunghd/Documents/Workspace/flutter_packages/flutter_downloader/example" -export "FLUTTER_TARGET=/Users/hunghd/Documents/Workspace/flutter_packages/flutter_downloader/example/lib/main.dart" -export "FLUTTER_BUILD_DIR=build" -export "SYMROOT=${SOURCE_ROOT}/../build/ios" -export "FLUTTER_FRAMEWORK_DIR=/Users/hunghd/Documents/Workspace/flutter/bin/cache/artifacts/engine/ios" -export "FLUTTER_BUILD_NAME=1.0.0" -export "FLUTTER_BUILD_NUMBER=1" -export "TRACK_WIDGET_CREATION=true" From 70499e19ab412c67e9df210821a5b925c9987757 Mon Sep 17 00:00:00 2001 From: Bram Bout Date: Sat, 22 Feb 2020 16:16:32 -0800 Subject: [PATCH 06/71] Corrected error Used () where I should have used [] to get time_created from the [item] map --- lib/src/downloader.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/downloader.dart b/lib/src/downloader.dart index 41390e4a..ad2d84e5 100644 --- a/lib/src/downloader.dart +++ b/lib/src/downloader.dart @@ -120,7 +120,7 @@ class FlutterDownloader { url: item['url'], filename: item['file_name'], savedDir: item['saved_dir'], - timeCreated: item('time_created'))) + timeCreated: item['time_created'])) .toList(); } on PlatformException catch (e) { print(e.message); @@ -164,7 +164,7 @@ class FlutterDownloader { url: item['url'], filename: item['file_name'], savedDir: item['saved_dir'], - timeCreated: item('time_created'))) + timeCreated: item['time_created'])) .toList(); } on PlatformException catch (e) { print(e.message); From e8bcfc5703dbd0a6dd2269835e98adbc8c36c1db Mon Sep 17 00:00:00 2001 From: Eiichiro Adachi Date: Thu, 26 Mar 2020 17:44:17 +0900 Subject: [PATCH 07/71] To support use from isolation, do not use singleton. --- ios/Classes/FlutterDownloaderPlugin.m | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/ios/Classes/FlutterDownloaderPlugin.m b/ios/Classes/FlutterDownloaderPlugin.m index 31cdbc60..0e7dcb2b 100644 --- a/ios/Classes/FlutterDownloaderPlugin.m +++ b/ios/Classes/FlutterDownloaderPlugin.m @@ -51,7 +51,6 @@ @interface FlutterDownloaderPlugin()*)registrar { - @synchronized(self) { - if (instance == nil) { - instance = [[FlutterDownloaderPlugin alloc] init:registrar]; - [registrar addApplicationDelegate: instance]; - } - } + [registrar addApplicationDelegate: [[FlutterDownloaderPlugin alloc] init:registrar]]; } + (void)setPluginRegistrantCallback:(FlutterPluginRegistrantCallback)callback { From 112b940516588d15c71047ce89af351d7aef3e90 Mon Sep 17 00:00:00 2001 From: Bram Bout Date: Sun, 29 Mar 2020 10:29:47 -0700 Subject: [PATCH 08/71] Addressing compiler warnings --- ios/Classes/FlutterDownloaderPlugin.m | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ios/Classes/FlutterDownloaderPlugin.m b/ios/Classes/FlutterDownloaderPlugin.m index 31cdbc60..ac831d0f 100644 --- a/ios/Classes/FlutterDownloaderPlugin.m +++ b/ios/Classes/FlutterDownloaderPlugin.m @@ -152,12 +152,12 @@ - (NSURLSessionDownloadTask*)downloadTaskWithURL: (NSURL*) url fileName: (NSStri return task; } -- (NSString*)identifierForTask:(NSURLSessionDownloadTask*) task +- (NSString*)identifierForTask:(NSURLSessionTask*) task { return [NSString stringWithFormat: @"%@.%lu", [[[self currentSession] configuration] identifier], [task taskIdentifier]]; } -- (NSString*)identifierForTask:(NSURLSessionDownloadTask*) task ofSession:(NSURLSession *)session +- (NSString*)identifierForTask:(NSURLSessionTask*) task ofSession:(NSURLSession *)session { return [NSString stringWithFormat: @"%@.%lu", [[session configuration] identifier], [task taskIdentifier]]; } @@ -270,7 +270,6 @@ - (BOOL)openDocumentWithURL:(NSURL*)url { - (NSURL*)fileUrlFromDict:(NSDictionary*)dict { - NSString *url = dict[KEY_URL]; NSString *savedDir = dict[KEY_SAVED_DIR]; NSString *filename = dict[KEY_FILE_NAME]; NSLog(@"savedDir: %@", savedDir); @@ -901,7 +900,7 @@ -(void)URLSessionDidFinishEventsForBackgroundURLSession:(NSURLSession *)session // Show a local notification when all downloads are over. UILocalNotification *localNotification = [[UILocalNotification alloc] init]; - localNotification.alertBody = _allFilesDownloadedMsg; + localNotification.alertBody = self->_allFilesDownloadedMsg; [[UIApplication sharedApplication] presentLocalNotificationNow:localNotification]; }]; } From 49e9d8847c19d132831331f45b838e7c6563af5e Mon Sep 17 00:00:00 2001 From: Bram Bout Date: Sun, 29 Mar 2020 10:30:59 -0700 Subject: [PATCH 09/71] Making currentTimeInMilliseconds a long long instead of a long --- ios/Classes/FlutterDownloaderPlugin.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ios/Classes/FlutterDownloaderPlugin.m b/ios/Classes/FlutterDownloaderPlugin.m index ac831d0f..2ba9eb52 100644 --- a/ios/Classes/FlutterDownloaderPlugin.m +++ b/ios/Classes/FlutterDownloaderPlugin.m @@ -328,9 +328,9 @@ - (NSString*)shortenSavedDirPath:(NSString*)absolutePath { return absolutePath; } -- (long)currentTimeInMilliseconds +- (long long)currentTimeInMilliseconds { - return [[NSDate date] timeIntervalSince1970]*1000; + return (long long)([[NSDate date] timeIntervalSince1970]*1000); } # pragma mark - Database Accessing @@ -349,7 +349,7 @@ - (NSString*) escape:(NSString*) origin revert:(BOOL)revert - (void) addNewTask: (NSString*) taskId url: (NSString*) url status: (int) status progress: (int) progress filename: (NSString*) filename savedDir: (NSString*) savedDir headers: (NSString*) headers resumable: (BOOL) resumable showNotification: (BOOL) showNotification openFileFromNotification: (BOOL) openFileFromNotification { headers = [self escape:headers revert:false]; - NSString *query = [NSString stringWithFormat:@"INSERT INTO task (task_id,url,status,progress,file_name,saved_dir,headers,resumable,show_notification,open_file_from_notification,time_created) VALUES (\"%@\",\"%@\",%d,%d,\"%@\",\"%@\",\"%@\",%d,%d,%d,%ld)", taskId, url, status, progress, filename, savedDir, headers, resumable ? 1 : 0, showNotification ? 1 : 0, openFileFromNotification ? 1 : 0, [self currentTimeInMilliseconds]]; + NSString *query = [NSString stringWithFormat:@"INSERT INTO task (task_id,url,status,progress,file_name,saved_dir,headers,resumable,show_notification,open_file_from_notification,time_created) VALUES (\"%@\",\"%@\",%d,%d,\"%@\",\"%@\",\"%@\",%d,%d,%d,%lld)", taskId, url, status, progress, filename, savedDir, headers, resumable ? 1 : 0, showNotification ? 1 : 0, openFileFromNotification ? 1 : 0, [self currentTimeInMilliseconds]]; [_dbManager executeQuery:query]; if (_dbManager.affectedRows != 0) { NSLog(@"Query was executed successfully. Affected rows = %d", _dbManager.affectedRows); @@ -390,7 +390,7 @@ - (void) updateTask: (NSString*) taskId status: (int) status progress: (int) pro } - (void) updateTask: (NSString*) currentTaskId newTaskId: (NSString*) newTaskId status: (int) status resumable: (BOOL) resumable { - NSString *query = [NSString stringWithFormat:@"UPDATE task SET task_id=\"%@\", status=%d, resumable=%d, time_created=%ld WHERE task_id=\"%@\"", newTaskId, status, resumable ? 1 : 0, [self currentTimeInMilliseconds], currentTaskId]; + NSString *query = [NSString stringWithFormat:@"UPDATE task SET task_id=\"%@\", status=%d, resumable=%d, time_created=%lld WHERE task_id=\"%@\"", newTaskId, status, resumable ? 1 : 0, [self currentTimeInMilliseconds], currentTaskId]; [_dbManager executeQuery:query]; if (_dbManager.affectedRows != 0) { NSLog(@"Query was executed successfully. Affected rows = %d", _dbManager.affectedRows); From b511a159ab69503595c0516fc29b6f419fa945ad Mon Sep 17 00:00:00 2001 From: Bram Bout Date: Sun, 29 Mar 2020 10:37:34 -0700 Subject: [PATCH 10/71] Fixing critical issue in removeMethodCall Issue: if loadTaskWithId pulls the task from the database (not the cache) and if that task is enqueued or running, then getTaskWithCompletionHandler may not have that task as part of its list of downloadTasks (because it may have been started a long time ago and gotten lost as the app was killed). In that case, the taskId will not be found in the list, and therefore the task will not be removed from the database. As a result, the\ sqlite database can get polluted with tasks that cannot be removed ever. Fix: call [self deleteTask:taskId] unconditionally after the if-statement (that checks for enqueue or running) instead of only in the 'else' clause of that if-statement --- ios/Classes/FlutterDownloaderPlugin.m | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ios/Classes/FlutterDownloaderPlugin.m b/ios/Classes/FlutterDownloaderPlugin.m index 2ba9eb52..a47ae615 100644 --- a/ios/Classes/FlutterDownloaderPlugin.m +++ b/ios/Classes/FlutterDownloaderPlugin.m @@ -705,9 +705,8 @@ - (void)removeMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { } }; }]; - } else { - [self deleteTask:taskId]; } + [self deleteTask:taskId]; if (shouldDeleteContent) { NSURL *destinationURL = [self fileUrlFromDict:taskDict]; From 541cbc652fcf3ff1a02fc3a75b7a5a2b765bb028 Mon Sep 17 00:00:00 2001 From: hunghd Date: Thu, 2 Apr 2020 17:27:41 +0700 Subject: [PATCH 11/71] release v1.4.2 --- example/ios/Runner.xcodeproj/project.pbxproj | 75 ++++++++++---------- example/ios/Runner/Info.plist | 18 ++--- 2 files changed, 46 insertions(+), 47 deletions(-) diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 74f7e076..d8568720 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -20,7 +20,7 @@ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; - 989C7EEA014CD6A313BCAFA8 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 83C6EA63EE4223BCCE3829F9 /* libPods-Runner.a */; }; + BEA474CDA210863B72A4E57C /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F9D50FAFD94739500E54D196 /* libPods-Runner.a */; }; C4211353214285FA00A246B2 /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = C4D3DF9B2139330700C8D767 /* libsqlite3.tbd */; }; /* End PBXBuildFile section */ @@ -42,13 +42,12 @@ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 18B196A2A649484DE70781AB /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 83C6EA63EE4223BCCE3829F9 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 94A702CFECD1FAD8124DEEB6 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; @@ -59,7 +58,8 @@ 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; C4D3DF9B2139330700C8D767 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; }; - D3EBD634F98C3FB29BEEFB52 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + F83ADD754129FA46A923951A /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + F9D50FAFD94739500E54D196 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -70,20 +70,19 @@ C4211353214285FA00A246B2 /* libsqlite3.tbd in Frameworks */, 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, - 989C7EEA014CD6A313BCAFA8 /* libPods-Runner.a in Frameworks */, + BEA474CDA210863B72A4E57C /* libPods-Runner.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 5C19A92533E86D90EBEB6E95 /* Pods */ = { + 92774B30AAE54C0133AAE21E /* Pods */ = { isa = PBXGroup; children = ( - 94A702CFECD1FAD8124DEEB6 /* Pods-Runner.debug.xcconfig */, - D3EBD634F98C3FB29BEEFB52 /* Pods-Runner.release.xcconfig */, + 18B196A2A649484DE70781AB /* Pods-Runner.debug.xcconfig */, + F83ADD754129FA46A923951A /* Pods-Runner.release.xcconfig */, ); - name = Pods; path = Pods; sourceTree = ""; }; @@ -107,7 +106,7 @@ 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, D569ED47379644821DCD4EF0 /* Frameworks */, - 5C19A92533E86D90EBEB6E95 /* Pods */, + 92774B30AAE54C0133AAE21E /* Pods */, ); sourceTree = ""; }; @@ -147,7 +146,7 @@ isa = PBXGroup; children = ( C4D3DF9B2139330700C8D767 /* libsqlite3.tbd */, - 83C6EA63EE4223BCCE3829F9 /* libPods-Runner.a */, + F9D50FAFD94739500E54D196 /* libPods-Runner.a */, ); name = Frameworks; sourceTree = ""; @@ -159,15 +158,15 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 54E96DA60358A5B89BC1A725 /* [CP] Check Pods Manifest.lock */, + 196FFA8076E95CA55DC8203D /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - 94402EFAEEB0E9E03F02E4EF /* [CP] Embed Pods Frameworks */, - 8E3A620D619B5213945F7444 /* [CP] Copy Pods Resources */, + DFABDC4BD757854160F4FCA7 /* [CP] Embed Pods Frameworks */, + 92D9EC5599612D0BF23B6E18 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -234,21 +233,7 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Thin Binary"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; - }; - 54E96DA60358A5B89BC1A725 /* [CP] Check Pods Manifest.lock */ = { + 196FFA8076E95CA55DC8203D /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -270,34 +255,33 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 8E3A620D619B5213945F7444 /* [CP] Copy Pods Resources */ = { + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "[CP] Copy Pods Resources"; + name = "Thin Binary"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; - showEnvVarsInLog = 0; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; }; - 94402EFAEEB0E9E03F02E4EF /* [CP] Embed Pods Frameworks */ = { + 92D9EC5599612D0BF23B6E18 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); - name = "[CP] Embed Pods Frameworks"; + name = "[CP] Copy Pods Resources"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; showEnvVarsInLog = 0; }; 9740EEB61CF901F6004384FC /* Run Script */ = { @@ -314,6 +298,21 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + DFABDC4BD757854160F4FCA7 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -469,7 +468,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = vn.hunghd.flutterDownloaderExample; + PRODUCT_BUNDLE_IDENTIFIER = vn.hunghd.downloader.example; PRODUCT_NAME = "$(TARGET_NAME)"; VERSIONING_SYSTEM = "apple-generic"; }; @@ -493,7 +492,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = vn.hunghd.flutterDownloaderExample; + PRODUCT_BUNDLE_IDENTIFIER = vn.hunghd.downloader.example; PRODUCT_NAME = "$(TARGET_NAME)"; VERSIONING_SYSTEM = "apple-generic"; }; diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist index 1b0c0009..344d0568 100644 --- a/example/ios/Runner/Info.plist +++ b/example/ios/Runner/Info.plist @@ -20,8 +20,17 @@ ???? CFBundleVersion $(FLUTTER_BUILD_NUMBER) + FDAllFilesDownloadedMessage + All files have been downloaded + FDMaximumConcurrentTasks + 5 LSRequiresIPhoneOS + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + UIBackgroundModes fetch @@ -44,15 +53,6 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - - FDMaximumConcurrentTasks - 5 - FDAllFilesDownloadedMessage - All files have been downloaded UIViewControllerBasedStatusBarAppearance From 01f837cd29e78052406ab2b62c3c056e5efdc656 Mon Sep 17 00:00:00 2001 From: hunghd Date: Thu, 2 Apr 2020 17:27:41 +0700 Subject: [PATCH 12/71] release v1.4.2 --- CHANGELOG.md | 5 +++++ pubspec.yaml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index acc7c778..1deace46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.4.2 - 02.04.2020 + +* add `timeCreated` in `DownloadTask` model +* iOS: fix bug MissingPluginException + ## 1.4.1 - 30.01.2020 * Android: fix bug `ensureInitializationComplete must be called after startInitialization` diff --git a/pubspec.yaml b/pubspec.yaml index cbcbcdc9..d01f1e5d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_downloader description: A plugin for creating and managing download tasks. Supports iOS and Android. -version: 1.4.1 +version: 1.4.2 authors: - Flutter Community - Hung Duy Ha From d74efef577b8d8f1e1200ceff33fe102466517aa Mon Sep 17 00:00:00 2001 From: hunghd Date: Thu, 9 Apr 2020 18:09:50 +0700 Subject: [PATCH 13/71] release v1.4.3 --- CHANGELOG.md | 4 ++++ pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1deace46..7cd92198 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.4.3 - 09.04.2020 + +* iOS: fix bug on `remove` method + ## 1.4.2 - 02.04.2020 * add `timeCreated` in `DownloadTask` model diff --git a/pubspec.yaml b/pubspec.yaml index d01f1e5d..1c8f1087 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_downloader description: A plugin for creating and managing download tasks. Supports iOS and Android. -version: 1.4.2 +version: 1.4.3 authors: - Flutter Community - Hung Duy Ha From 87ae257ed4c786d6a59d208c7722fe14b78e2625 Mon Sep 17 00:00:00 2001 From: hunghd Date: Sat, 18 Apr 2020 15:52:15 +0700 Subject: [PATCH 14/71] upgrade Android dependencies --- android/build.gradle | 8 +-- example/android/app/app.iml | 43 +++++-------- example/android/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 4 +- example/ios/Runner.xcodeproj/project.pbxproj | 62 +++++++++---------- lib/src/downloader.dart | 6 +- 6 files changed, 58 insertions(+), 67 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 4f2b1d85..d1e1ab65 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -8,7 +8,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' + classpath 'com.android.tools.build:gradle:3.6.3' } } @@ -34,8 +34,8 @@ android { } dependencies { - implementation 'androidx.work:work-runtime:2.2.0' + implementation 'androidx.work:work-runtime:2.3.4' implementation 'androidx.annotation:annotation:1.1.0' - implementation 'androidx.core:core:1.1.0' - implementation 'androidx.fragment:fragment:1.1.0' + implementation 'androidx.core:core:1.2.0' + implementation 'androidx.fragment:fragment:1.2.4' } diff --git a/example/android/app/app.iml b/example/android/app/app.iml index 7504328b..fb16bd6e 100644 --- a/example/android/app/app.iml +++ b/example/android/app/app.iml @@ -4,8 +4,8 @@ @@ -19,7 +19,7 @@