Skip to content

Commit

Permalink
Bump native Android deps (#873)
Browse files Browse the repository at this point in the history
* bump Gradle to 8.2.1, bump Kotlin to 1.9.0

* bump deps, set min Flutter to 3.10

* fix analyzer being angry

* remove unnecessasry gradle files

* fix ktlint warnings

* flutter format -> dart format
  • Loading branch information
bartekpacia authored Jul 30, 2023
1 parent 40950b3 commit 15bfecd
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 35 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/prepare.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
flutter-version: ['3.0.x', '3.3.x', '3.7.x', '3.10.x']
flutter-version: ['3.10.x']

steps:
- name: Clone repository
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:

- name: flutter format (example app)
working-directory: ./example
run: flutter format --set-exit-if-changed .
run: dart format --set-exit-if-changed .

- name: flutter analyze (example app)
working-directory: ./example
Expand Down
10 changes: 5 additions & 5 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
buildscript {
ext.kotlin_version = "1.7.22"
ext.kotlin_version = "1.9.0"
repositories {
google()
mavenCentral()
gradlePluginPortal()
}

dependencies {
classpath "com.android.tools.build:gradle:7.2.2"
classpath "com.android.tools.build:gradle:7.4.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jlleitschuh.gradle:ktlint-gradle:11.0.0"
classpath "org.jlleitschuh.gradle:ktlint-gradle:11.5.0"
}
}

Expand All @@ -29,7 +29,7 @@ rootProject.allprojects {

android {
namespace "vn.hunghd.flutterdownloader"
compileSdk 32
compileSdk 33

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -46,7 +46,7 @@ android {

defaultConfig {
minSdk 19
targetSdk 32
targetSdk 33
}
}

Expand Down
3 changes: 0 additions & 3 deletions android/gradle.properties

This file was deleted.

5 changes: 0 additions & 5 deletions android/gradle/wrapper/gradle-wrapper.properties

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = "1.7.22"
ext.kotlin_version = "1.9.0"
repositories {
google()
mavenCentral()
}

dependencies {
classpath "com.android.tools.build:gradle:7.2.2"
classpath "com.android.tools.build:gradle:7.4.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ 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
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
6 changes: 3 additions & 3 deletions example/lib/download_list_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ class DownloadListItem extends StatelessWidget {
});

final ItemHolder? data;
final Function(TaskInfo?)? onTap;
final Function(TaskInfo)? onActionTap;
final Function(TaskInfo)? onCancel;
final void Function(TaskInfo?)? onTap;
final void Function(TaskInfo)? onActionTap;
final void Function(TaskInfo)? onCancel;

Widget? _buildTrailing(TaskInfo task) {
if (task.status == DownloadTaskStatus.undefined) {
Expand Down
6 changes: 3 additions & 3 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ version: 1.0.0+1
publish_to: none

environment:
sdk: '>=2.17.0 <4.0.0'
flutter: '>=3.0.0'
sdk: '>=3.0.0 <4.0.0'
flutter: '>=3.10.0'

dependencies:
android_path_provider: ^0.3.0
Expand All @@ -20,7 +20,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
leancode_lint: ^2.0.0+1
leancode_lint: ^4.0.0+2

flutter:
uses-material-design: true
3 changes: 2 additions & 1 deletion lib/src/callback_dispatcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ void callbackDispatcher() {
..setMethodCallHandler((call) async {
final args = call.arguments as List<dynamic>;
final handle = CallbackHandle.fromRawHandle(args[0] as int);
final callback = PluginUtilities.getCallbackFromHandle(handle);
final callback = PluginUtilities.getCallbackFromHandle(handle) as void
Function(String id, int status, int progress)?;

if (callback == null) {
// ignore: avoid_print
Expand Down
6 changes: 2 additions & 4 deletions lib/src/downloader.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ignore_for_file: avoid_dynamic_calls

import 'dart:async';
import 'dart:convert';
import 'dart:io';
Expand Down Expand Up @@ -149,8 +151,6 @@ class FlutterDownloader {

return result.map(
(dynamic item) {
// item as Map<String, dynamic>; // throws

return DownloadTask(
taskId: item['task_id'] as String,
status: DownloadTaskStatus(item['status'] as int),
Expand Down Expand Up @@ -209,8 +209,6 @@ class FlutterDownloader {

return result.map(
(dynamic item) {
// item as Map<String, dynamic>; // throws

return DownloadTask(
taskId: item['task_id'] as String,
status: DownloadTaskStatus(item['status'] as int),
Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ flutter:
pluginClass: FlutterDownloaderPlugin

environment:
sdk: '>=2.17.0 <4.0.0'
flutter: '>=3.0.0'
sdk: '>=3.0.0 <4.0.0'
flutter: '>=3.10.0'

dependencies:
flutter:
Expand All @@ -25,4 +25,4 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
leancode_lint: ^2.0.0+1
leancode_lint: ^4.0.0+2

0 comments on commit 15bfecd

Please sign in to comment.