diff --git a/CHANGELOG.md b/CHANGELOG.md index fe1f287..6af81c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,22 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [4.2.2] - 2025-08-21 + +- iOS SDK version: 6.12.1 +- Android SDK version: 16.0.1 + +### React Native + +#### Changed + +- Replaced deprecated `getCurrentActivity()` call on Android (compatibility with RN 0.81+) + ## [4.2.1] - 2025-08-05 +- iOS SDK version: 6.12.1 +- Android SDK version: 16.0.1 + ### React Native #### Fixed diff --git a/android/src/main/java/com/freeraspreactnative/FreeraspReactNativeModule.kt b/android/src/main/java/com/freeraspreactnative/FreeraspReactNativeModule.kt index 895f6e5..4752375 100644 --- a/android/src/main/java/com/freeraspreactnative/FreeraspReactNativeModule.kt +++ b/android/src/main/java/com/freeraspreactnative/FreeraspReactNativeModule.kt @@ -33,13 +33,13 @@ class FreeraspReactNativeModule(private val reactContext: ReactApplicationContex private val lifecycleListener = object : LifecycleEventListener { override fun onHostResume() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { - currentActivity?.let { ScreenProtector.register(it) } + reactContext.currentActivity?.let { ScreenProtector.register(it) } } } override fun onHostPause() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { - currentActivity?.let { ScreenProtector.unregister(it) } + reactContext.currentActivity?.let { ScreenProtector.unregister(it) } } } @@ -71,7 +71,7 @@ class FreeraspReactNativeModule(private val reactContext: ReactApplicationContex mainHandler.post { talsecStarted = true // This code must be called only AFTER Talsec.start - currentActivity?.let { activity -> + reactContext.currentActivity?.let { activity -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { ScreenProtector.register(activity) } @@ -154,7 +154,7 @@ class FreeraspReactNativeModule(private val reactContext: ReactApplicationContex */ @ReactMethod fun blockScreenCapture(enable: Boolean, promise: Promise) { - val activity = currentActivity ?: run { + val activity = reactContext.currentActivity ?: run { promise.reject( "NativePluginError", "Cannot block screen capture, activity is null." ) diff --git a/package.json b/package.json index c9a8cd0..ff91900 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "freerasp-react-native", - "version": "4.2.1", + "version": "4.2.2", "description": "React Native plugin for improving app security and threat monitoring on Android and iOS mobile devices.", "main": "lib/commonjs/index", "module": "lib/module/index",