diff --git a/android/build.gradle b/android/build.gradle index 8ef67d3..63beb74 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -2,14 +2,17 @@ group 'nl.dutchcodingcompany.pin_lock' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.3.50' + ext.kotlin_version = '2.2.20' + ext { + agp_version = '8.12.1' + } repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.0' + classpath "com.android.tools.build:gradle:$agp_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -25,8 +28,15 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' android { - compileSdkVersion 30 - + namespace "nl.dutchcodingcompany.pin_lock" + compileSdkVersion 36 + compileOptions { + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 + } + kotlinOptions { + jvmTarget = "17" + } sourceSets { main.java.srcDirs += 'src/main/kotlin' } diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 3c9d085..2295f2a 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,8 @@ +#Thu Jun 05 19:43:25 CEST 2025 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip diff --git a/lib/src/entities/authenticator.dart b/lib/src/entities/authenticator.dart index 89ab5f3..87bc38d 100644 --- a/lib/src/entities/authenticator.dart +++ b/lib/src/entities/authenticator.dart @@ -12,8 +12,8 @@ abstract class Authenticator with WidgetsBindingObserver { /// Interval after which the app will become pin locked after entering the background Duration get lockAfterDuration; - /// Emits a [LockState] event every time the state is changed - Stream get lockState; + /// Emits a [PinLockState] event every time the state is changed + Stream get lockState; /// The number of times that a pin can be entered incorrectly, before the app /// stops accepting unlock attempts for [lockedOutDuration] diff --git a/lib/src/entities/authenticator_impl.dart b/lib/src/entities/authenticator_impl.dart index f78f566..fc41a5d 100644 --- a/lib/src/entities/authenticator_impl.dart +++ b/lib/src/entities/authenticator_impl.dart @@ -38,7 +38,7 @@ class AuthenticatorImpl with WidgetsBindingObserver implements Authenticator { ); @override - Stream get lockState { + Stream get lockState { _checkInitialLockStatus(); return _lockController.state; } diff --git a/lib/src/entities/lock_controller.dart b/lib/src/entities/lock_controller.dart index 578d232..7b0515f 100644 --- a/lib/src/entities/lock_controller.dart +++ b/lib/src/entities/lock_controller.dart @@ -8,9 +8,9 @@ import 'package:pin_lock/src/entities/lock_state.dart'; /// It allows registering callbacks that will get triggered when the /// app is locked/unlocked (e.g., for analytics purposes) class LockController { - /// The stream of [LockState] where the last entry is always the current + /// The stream of [PinLockState] where the last entry is always the current /// state of the app - late final Stream state; + late final Stream state; /// Optionally register a callback that gets triggered every time the app is locked /// (e.g., for analytics purposes) @@ -20,7 +20,7 @@ class LockController { /// (e.g., for analytics purposes) final VoidCallback? onUnlockCallback; - final StreamController _streamController; + final StreamController _streamController; LockController({this.onUnlockCallback, this.onLockCallback}) : _streamController = StreamController.broadcast() { diff --git a/lib/src/entities/lock_state.dart b/lib/src/entities/lock_state.dart index 2fbf535..9fb6b35 100644 --- a/lib/src/entities/lock_state.dart +++ b/lib/src/entities/lock_state.dart @@ -1,13 +1,13 @@ import 'package:equatable/equatable.dart'; import 'package:pin_lock/src/entities/biometric_method.dart'; -abstract class LockState extends Equatable { - const LockState(); +abstract class PinLockState extends Equatable { + const PinLockState(); @override List get props => []; } -class Locked extends LockState { +class Locked extends PinLockState { final List availableBiometricMethods; const Locked({required this.availableBiometricMethods}); @@ -16,6 +16,6 @@ class Locked extends LockState { List get props => [availableBiometricMethods]; } -class Unlocked extends LockState { +class Unlocked extends PinLockState { const Unlocked() : super(); } diff --git a/lib/src/presentation/authenticator_widget.dart b/lib/src/presentation/authenticator_widget.dart index 8b3a769..f2f188b 100644 --- a/lib/src/presentation/authenticator_widget.dart +++ b/lib/src/presentation/authenticator_widget.dart @@ -70,7 +70,7 @@ class _AuthenticatorWidgetState extends State { late final StreamSubscription lockSubscription; OverlayEntry? overlayEntry; bool _isShowingSplashScreen = true; - late final Stream lockState ; + late final Stream lockState; @override void initState() { @@ -123,7 +123,7 @@ class _AuthenticatorWidgetState extends State { @override Widget build(BuildContext context) { - return StreamBuilder( + return StreamBuilder( stream: lockState, builder: (context, snapshot) { if (snapshot.hasData && !_isShowingSplashScreen) { diff --git a/pubspec.yaml b/pubspec.yaml index a8e0ef6..d91ee28 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -7,7 +7,7 @@ description: "A full solution to local authentication: it contains authenticatio repository: https://github.com/DutchCodingCompany/pin_lock environment: - sdk: ">=2.12.0 <3.0.0" + sdk: ">=2.17.0 <4.0.0" flutter: ">=3.0.0" dependencies: