diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index a7b8502e6c59c6de3ae0519df7e74f87b9b64127..0000000000000000000000000000000000000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1,2 +0,0 @@ -* @bartekpacia -* @salmaahhmed diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index c3c083bb55b72bcda5f137589aa176458597fc3d..0000000000000000000000000000000000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: "" -labels: "bug" -assignees: "" ---- - - - -**Describe the bug** - - - -**To Reproduce** - - - -Steps to reproduce the behavior: - -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** - - - -**Screenshots** - - - -**Desktop (please complete the following information):** - -- OS: [e.g. iOS] -- Browser [e.g. chrome, safari] -- Version [e.g. 22] - -**Device information:** - - - -- Device: [e.g. iPhone 13] -- OS: [e.g. iOS 15.4] -- plugin version [e.g. v1.8.0] - -**Additional context** - - diff --git a/.github/workflows/prepare.yaml b/.github/workflows/prepare.yaml deleted file mode 100644 index b477d38126019b18166e1b27c926fa29282587cc..0000000000000000000000000000000000000000 --- a/.github/workflows/prepare.yaml +++ /dev/null @@ -1,72 +0,0 @@ -name: prepare - -on: - workflow_dispatch: - pull_request: - branches: [master] - -jobs: - main: - name: Flutter ${{ matrix.flutter-version }} - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - flutter-version: ["3.19.x"] - - steps: - - name: Clone repository - uses: actions/checkout@v4 - - - name: Set up Flutter - uses: subosito/flutter-action@v2 - with: - channel: stable - flutter-version: ${{ matrix.flutter-version }} - - - name: Set up Java - uses: actions/setup-java@v4 - with: - distribution: temurin - java-version: 21 - - - name: flutter pub get - run: flutter pub get - - - name: Build example app - working-directory: example - run: flutter build apk --debug - - - name: dart format - run: dart format --set-exit-if-changed . - - - name: flutter analyze - run: flutter analyze --no-fatal-infos - - - name: flutter test - run: flutter test - - - name: ktlint check - working-directory: example/android - run: ./gradlew flutter_downloader:ktlintCheck - - - name: flutter pub get (example app) - working-directory: ./example - run: flutter pub get - - - name: flutter format (example app) - working-directory: ./example - run: dart format --set-exit-if-changed . - - - name: flutter analyze (example app) - working-directory: ./example - run: flutter analyze --no-fatal-infos - - - name: flutter test (example app) - working-directory: ./example - run: flutter test - - - name: Dry run pub publish - # We don't want it to fail the CI, it's just to see how would `pub publish` behave. - run: dart pub publish --dry-run || true diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml deleted file mode 100644 index 83682d51c9bfaa269841785cb485343e9c7e1d32..0000000000000000000000000000000000000000 --- a/.github/workflows/publish.yaml +++ /dev/null @@ -1,33 +0,0 @@ -name: publish - -on: - push: - tags: ["v*"] - -jobs: - publish: - name: Publish on pub.dev - runs-on: ubuntu-latest - - permissions: - id-token: write - contents: write - - steps: - - name: Clone repository - uses: actions/checkout@v4 - - # This step adds the auth token for pub.dev - - name: Set up Dart - uses: dart-lang/setup-dart@v1 - with: - sdk: stable - - - name: Set up Flutter - uses: subosito/flutter-action@v2 - with: - channel: stable - - - name: Publish to pub.dev - id: pub_release - uses: leancodepl/mobile-tools/.github/actions/pub-release@pub-release-v1 diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 64dde02e5b3e9f2fda0bf4825d12a71b9b92cdc6..0000000000000000000000000000000000000000 --- a/.gitignore +++ /dev/null @@ -1,95 +0,0 @@ -# Miscellaneous -*.class -*.lock -*.log -*.pyc -*.swp -.DS_Store -.atom/ -.buildlog/ -.history -.svn/ - -# IntelliJ related -*.iml -*.ipr -*.iws -.idea/ - -# 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/ -build/ -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 diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 36eb658d41ddda1548872ec08293ec279e538db7..0000000000000000000000000000000000000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - "name": "example", - "cwd": "example", - "request": "launch", - "type": "dart" - }, - { - "name": "example (profile)", - "cwd": "example", - "request": "launch", - "type": "dart", - "flutterMode": "profile" - }, - { - "name": "example (release)", - "cwd": "example", - "request": "launch", - "type": "dart", - "flutterMode": "release" - } - ] -} diff --git a/CHANGELOG.md b/CHANGELOG.md index 2151c4cc509cee88532f4865fabcec90f48eea6b..f064cf983c77bb5c50b0073e212a82cf8970c627 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,57 +1,3 @@ -## 1.11.8 - -- Dependencies update (#952) - - Gradle buildscripts on Android - - Bump minimum Android SDK to 21 - - Bump minimum Flutter to 3.19 - -## 1.11.7 - -- Update dependencies (#946) -- Update CI workflows (#945) -- Bump `compileSdk` to 34 (#944) - -## 1.11.6 - -- No release notes were provided - -## 1.11.5 - -- Republish fixes for previous verison - -## 1.11.4 - -- Fix for not working after upgrade to IOS 17 and Xcode 15 (#899) -- fix for Issue with Spaces and Parentheses in File Names (#904) - -## 1.11.3 - -- Fix for file name not being saved (#894) - -## 1.11.2 - -- Security update for iOS (#887) -- Support file store in any iOS directory (#829) - -## 1.11.1 - -- Don't crash when `FlutterDownloader.registerCallback()` wasn't called (#879) - -## 1.11.0 - -- Convert `DownloadTaskStatus` into an `enum` (#835) - -## 1.10.7 - -- Override `operator ==` and `hashCode` for `DownloadTask` (#875) - -## 1.10.6 - -- Fix `delete()` not working when file isn't saved to public storage (#871) -- Update CI workflows on GitHub Actions (#872) -- Bump native Android dependencies and Gradle (#873) -- Bump minimum Flutter version to 3.10 (#873) - ## 1.10.5 - Make the project compile when the app not doesn't have dependency on Kotlin diff --git a/OAT.xml b/OAT.xml new file mode 100644 index 0000000000000000000000000000000000000000..73e89e016ad10a69a0e5224960aab8240010f695 --- /dev/null +++ b/OAT.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/README.md b/README.md index fd0097a24f0d954e192bea27c1c5c9d2eabc0e15..c1362e1f0dc340980122954385c8caf650487981 100644 --- a/README.md +++ b/README.md @@ -19,12 +19,6 @@ manage download file location. It is still in triage and discussion in this very appreciated to have contribution and feedback from Flutter developer to get better design for the plugin._ -# Past Versions and SQL Injection Vulnerabilities - -In previous versions of this package, there were known vulnerabilities related to SQL injection. SQL injection is a type of security vulnerability that can allow malicious users to manipulate SQL queries executed by an application, potentially leading to unauthorized access or manipulation of the database. - -It is strongly recommended to upgrade to the latest version of this package to ensure that your application is not exposed to SQL injection vulnerabilities. The latest version contains the necessary security improvements and patches to mitigate such risks. - ## iOS integration ### Required configuration: diff --git a/android/.gitignore b/android/.gitignore deleted file mode 100644 index 16feccee7979bb61ea60d44289f606b82b86595f..0000000000000000000000000000000000000000 --- a/android/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -*.iml -.gradle -/local.properties -/.idea/workspace.xml -/.idea/misc.xml -/.idea/markdown-navigator -/.idea/encodings.xml -/.idea/libraries -/.idea/gradle.xml -.DS_Store -/build -/captures diff --git a/android/build.gradle b/android/build.gradle index 78f9b70ba896f6fa831c7a72286bcbd4f4266054..dbcbc14b726bffbbcd4e342de64610a8c91389f4 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,7 +1,5 @@ -group = "vn.hunghd.flutterdownloader" -version = "1.0-SNAPSHOT" - buildscript { + ext.kotlin_version = "1.7.22" repositories { google() mavenCentral() @@ -9,24 +7,29 @@ buildscript { } dependencies { - classpath "com.android.tools.build:gradle:7.4.2" - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0" - classpath "org.jlleitschuh.gradle:ktlint-gradle:11.5.0" + classpath "com.android.tools.build:gradle:7.2.2" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "org.jlleitschuh.gradle:ktlint-gradle:11.0.0" } } -repositories { - google() - mavenCentral() -} - apply plugin: "com.android.library" apply plugin: "kotlin-android" apply plugin: "org.jlleitschuh.gradle.ktlint" +group "vn.hunghd.flutterdownloader" +version "1.0-SNAPSHOT" + +rootProject.allprojects { + repositories { + google() + mavenCentral() + } +} + android { - namespace = "vn.hunghd.flutterdownloader" - compileSdk = 34 + namespace "vn.hunghd.flutterdownloader" + compileSdk 32 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 @@ -34,23 +37,21 @@ android { } kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8 - // allWarningsAsErrors = true // TODO(bartekpacia): Re-enable + jvmTarget = "1.8" } sourceSets { main.java.srcDirs += "src/main/kotlin" - test.java.srcDirs += "src/test/kotlin" } defaultConfig { - minSdk = 21 - targetSdk = 34 + minSdk 19 + targetSdk 32 } } dependencies { - compileOnly "androidx.annotation:annotation:1.6.0" - implementation "androidx.core:core-ktx:1.13.1" - implementation "androidx.work:work-runtime:2.9.0" + implementation "androidx.work:work-runtime:2.7.1" + implementation "androidx.annotation:annotation:1.5.0" + implementation "androidx.core:core-ktx:1.9.0" } diff --git a/android/gradle.properties b/android/gradle.properties new file mode 100644 index 0000000000000000000000000000000000000000..08f2b5f91bff656eaca532e9bc1510d5d3d2f912 --- /dev/null +++ b/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx1536M +android.enableJetifier=true +android.useAndroidX=true diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..dcf0f19c5220b13c4eecfc34a6e786df5280a81c --- /dev/null +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip diff --git a/android/src/main/kotlin/vn/hunghd/flutterdownloader/DownloadWorker.kt b/android/src/main/kotlin/vn/hunghd/flutterdownloader/DownloadWorker.kt index 2d9bf628c93d74390c231cf9ad1c9ae1e291d526..94bd5c47419bb6f52fc1d262c3298074c45d3f3d 100644 --- a/android/src/main/kotlin/vn/hunghd/flutterdownloader/DownloadWorker.kt +++ b/android/src/main/kotlin/vn/hunghd/flutterdownloader/DownloadWorker.kt @@ -257,7 +257,7 @@ class DownloadWorker(context: Context, params: WorkerParameters) : filename: String?, headers: String, isResume: Boolean, - timeout: Int + timeout: Int, ) { var actualFilename = filename var url = fileURL diff --git a/android/src/main/kotlin/vn/hunghd/flutterdownloader/FlutterDownloaderPlugin.kt b/android/src/main/kotlin/vn/hunghd/flutterdownloader/FlutterDownloaderPlugin.kt index 6867bf6585006cf7c95d03340db9b12d676d7537..b6f527b2d053d7df9250c46e7e88cc5fc5759e20 100644 --- a/android/src/main/kotlin/vn/hunghd/flutterdownloader/FlutterDownloaderPlugin.kt +++ b/android/src/main/kotlin/vn/hunghd/flutterdownloader/FlutterDownloaderPlugin.kt @@ -6,7 +6,6 @@ import android.content.Context import android.content.Intent import android.net.Uri import android.provider.MediaStore -import android.util.Log import androidx.core.app.NotificationManagerCompat import androidx.work.BackoffPolicy import androidx.work.Constraints @@ -92,7 +91,7 @@ class FlutterDownloaderPlugin : MethodChannel.MethodCallHandler, FlutterPlugin { requiresStorageNotLow: Boolean, saveInPublicStorage: Boolean, timeout: Int, - allowCellular: Boolean + allowCellular: Boolean, ): WorkRequest { return OneTimeWorkRequest.Builder(DownloadWorker::class.java) .setConstraints( @@ -391,14 +390,7 @@ class FlutterDownloaderPlugin : MethodChannel.MethodCallHandler, FlutterPlugin { val saveFilePath = task.savedDir + File.separator + filename val tempFile = File(saveFilePath) if (tempFile.exists()) { - try { - deleteFileInMediaStore(tempFile) - } catch (e: SecurityException) { - Log.d( - "FlutterDownloader", - "Failed to delete file in media store, will fall back to normal delete()" - ) - } + deleteFileInMediaStore(tempFile) tempFile.delete() } } diff --git a/android/src/main/kotlin/vn/hunghd/flutterdownloader/TaskDao.kt b/android/src/main/kotlin/vn/hunghd/flutterdownloader/TaskDao.kt index 1fffd964e4232d56851767545b043a77bcf9e453..6bb7a8a90cc89eb40aac66bfe50ae8072aece1c4 100644 --- a/android/src/main/kotlin/vn/hunghd/flutterdownloader/TaskDao.kt +++ b/android/src/main/kotlin/vn/hunghd/flutterdownloader/TaskDao.kt @@ -21,7 +21,7 @@ class TaskDao(private val dbHelper: TaskDbHelper) { TaskEntry.COLUMN_NAME_SHOW_NOTIFICATION, TaskEntry.COLUMN_NAME_TIME_CREATED, TaskEntry.COLUMN_SAVE_IN_PUBLIC_STORAGE, - TaskEntry.COLUMN_ALLOW_CELLULAR + TaskEntry.COLUMN_ALLOW_CELLULAR, ) fun insertOrUpdateNewTask( diff --git a/example/.gitignore b/example/.gitignore deleted file mode 100644 index dee655cc42ea7c763579e3b22730f1c1b8ac38d4..0000000000000000000000000000000000000000 --- a/example/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -.DS_Store -.dart_tool/ - -.packages -.pub/ - -build/ - -.flutter-plugins diff --git a/example/.idea/libraries/Dart_SDK.xml b/example/.idea/libraries/Dart_SDK.xml deleted file mode 100644 index 170212acf7a46c97492ee82b633f8abeafb424a3..0000000000000000000000000000000000000000 --- a/example/.idea/libraries/Dart_SDK.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/example/.idea/libraries/Flutter_for_Android.xml b/example/.idea/libraries/Flutter_for_Android.xml deleted file mode 100644 index 27c77368754aa0c2dd3fbd1491be33c67c3aca0d..0000000000000000000000000000000000000000 --- a/example/.idea/libraries/Flutter_for_Android.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/example/.idea/modules.xml b/example/.idea/modules.xml deleted file mode 100644 index eca6ca725b3f54753ea8f35d0b8cb910da662fbc..0000000000000000000000000000000000000000 --- a/example/.idea/modules.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/example/.idea/runConfigurations/main_dart.xml b/example/.idea/runConfigurations/main_dart.xml deleted file mode 100644 index aab7b5cd8325696835286f195527e16ffb1f675a..0000000000000000000000000000000000000000 --- a/example/.idea/runConfigurations/main_dart.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/example/.idea/workspace.xml b/example/.idea/workspace.xml deleted file mode 100644 index 003039871593c6076d67371bf161492f6123715f..0000000000000000000000000000000000000000 --- a/example/.idea/workspace.xml +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -