Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions packages/screen_state/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 5.0.2

* Relax Dart SDK lower bound from `^3.12.2` to `>=3.12.0` — the patch-level pin was accidental and blocked apps on Flutter 3.44.0/3.44.1.
* Fix Android build in apps using AGP < 9: apply the Kotlin Gradle plugin conditionally instead of pinning AGP 9.0.1/Kotlin 2.3.20 on the buildscript classpath (see the [built-in Kotlin migration guide](https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-plugin-authors)).
* Fix `NoClassDefFoundError: ScreenReceiver` at runtime: `ScreenReceiver.java` lived in the `src/main/kotlin` folder and relied on a `sourceSets` override to be compiled; it is now converted to Kotlin (`ScreenReceiver.kt`).
* Note: 5.0.1 also raised Android `minSdk` 21 → 24 and `compileSdk` 33 → 36 (undocumented in its changelog).

## 5.0.1

* Fix app not running on Flutter 3.44.X
Expand Down
34 changes: 10 additions & 24 deletions packages/screen_state/android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
group = "dk.cachet.screen_state"
version = "5.0.1"

buildscript {
val kotlinVersion = "2.3.20"
repositories {
google()
mavenCentral()
}

dependencies {
classpath("com.android.tools.build:gradle:9.0.1")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
}
}
version = "5.0.2"

allprojects {
repositories {
Expand All @@ -25,6 +12,14 @@ plugins {
id("com.android.library")
}

// AGP 9+ has built-in Kotlin support; on older AGP the Kotlin Gradle plugin
// must be applied explicitly. Version is supplied by the consuming app.
// See https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-plugin-authors
val agpMajor = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.substringBefore('.').toInt()
if (agpMajor < 9) {
apply(plugin = "org.jetbrains.kotlin.android")
}

android {
namespace = "dk.cachet.screen_state"

Expand All @@ -35,15 +30,6 @@ android {
targetCompatibility = JavaVersion.VERSION_17
}

sourceSets {
getByName("main") {
java.srcDirs("src/main/kotlin")
}
getByName("test") {
java.srcDirs("src/test/kotlin")
}
}

defaultConfig {
minSdk = 24
}
Expand All @@ -65,7 +51,7 @@ android {
}
}

kotlin {
project.extensions.configure(org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension::class.java) {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package dk.cachet.screen_state

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import io.flutter.plugin.common.EventChannel.EventSink

class ScreenReceiver(private val eventSink: EventSink?) : BroadcastReceiver() {

override fun onReceive(context: Context, intent: Intent) {
eventSink?.success(intent.action)
}
}
2 changes: 1 addition & 1 deletion packages/screen_state/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
version: 5.0.0+1

environment:
sdk: ^3.12.2
sdk: ^3.10.0
flutter: ">=3.6.0"

dependencies:
Expand Down
4 changes: 2 additions & 2 deletions packages/screen_state/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: screen_state
description: A plugin for reporting screen events while the flutter application is running in background. Works for Android and iOS only.
version: 5.0.1
version: 5.0.2
homepage: https://github.com/carp-dk/flutter-plugins/tree/master/packages/screen_state

environment:
sdk: ^3.12.2
sdk: ^3.10.0
flutter: ">=3.3.0"

dependencies:
Expand Down
Loading