Skip to content

Feat/improvment#3

Merged
aleemElmozogi merged 6 commits into
mainfrom
feat/improvment
May 12, 2026
Merged

Feat/improvment#3
aleemElmozogi merged 6 commits into
mainfrom
feat/improvment

Conversation

@aleemElmozogi
Copy link
Copy Markdown
Owner

No description provided.

- **Configuration**:
  - Bump version from `0.2.0` to `0.2.1` in `pubspec.yaml`.
  - Update `environment.sdk` constraint to include an upper bound (`>=3.10.1 <4.0.0`).
…tion (v0.2.2)

- **Initialization & Lifecycle**:
  - Refactored `FlutterDefender.init()` to be deterministic and thread-safe using a request queue; the latest call now "wins" under concurrency.
  - Ensured initialization is exception-safe by resetting `initInFlight` in a `finally` block.
  - Made `WidgetsBindingObserver` registration idempotent to prevent duplicate observers.
  - Enhanced `dispose()` to properly clear the internal state and pending initialization requests.

- **Security & Performance**:
  - Optimized advanced security detections (root, proxy/VPN, RASP) on both Android and iOS to run asynchronously on background threads, returning cached snapshots to Dart for improved responsiveness.
  - Refactored authenticated-timeout logic to ensure consistent secure-storage clearing across both cold-start and app-resume paths.
  - Standardized logout requests into a single internal method `_requestLogout`.

- **Platform-Level Implementation**:
  - **Android**: Improved plugin lifecycle by removing unused mutable context state and tightening detector/cache lifecycles.
  - **iOS**: Updated `IosSecureStorageHelper` to explicitly throw `FlutterError` on keychain operation failures (delete, write, clear).
  - **Secure Storage**: Implemented fail-fast semantics across both platforms. Direct storage API calls and timeout-driven clears now propagate platform exceptions instead of failing silently.

- **Testing & Documentation**:
  - Added comprehensive test coverage for concurrent `init()` behavior, fail-fast storage error propagation, and cold-start timeout parity.
  - Updated `README.md` to document the new failure policy for secure storage.
  - Bumped version to `0.2.2` in `pubspec.yaml` and updated `CHANGELOG.md`.
…vent race conditions

- **Initialization Logic**:
  - Replace `_initDrainFuture` with a boolean `_isDrainingInit` flag to track the queue draining state.
  - Introduce `Completer` in `_PendingInitRequest` to ensure specific initialization calls resolve correctly.
  - Ensure any existing pending initialization is completed (canceled) when a new `init` request arrives.
  - Wrap `_performInit` in a try-catch block to correctly propagate errors to the caller via the completer.
  - Use `unawaited` for background queue scheduling to prevent unnecessary future chaining.
- **State Management**:
  - Update `dispose()` to reset the new `_isDrainingInit` state.
- **Testing**:
  - Adjust `flutter_defender_guard_test.dart` to use manual pumping for asynchronous initialization verification.
…on to 0.2.3

- **Lifecycle & Timeouts**:
  - Adjust timeout logic to trigger exactly at the configured boundary (`>=` instead of `>`) for OTP and authenticated sessions.
  - Refactor `AppLifecycleState` transitions to prevent overwriting the initial background timestamp during complex state sequences (e.g., Inactive -> Hidden -> Paused).
  - Ensure `_handleForegroundStateChanged` correctly manages background timing and persistence when the app loses focus.
- **Android Implementation**:
  - Add a fallback mechanism to `isVpnEnabled` in `AdvancedSecurityDetector.kt` using network-interface inspection if the system `ConnectivityManager` fails.
- **Project Infrastructure**:
  - Bump version to `0.2.3` in `pubspec.yaml`.
  - Update dependencies: `plugin_platform_interface` to `^2.1.8` and `pigeon` to `^26.3.4`.
- **Testing**:
  - Add comprehensive widget tests to verify authenticated and OTP timeout boundaries.
  - Add tests for Android-specific resume sequences and native foreground state callbacks.
…ility

- **Timeout Logic**:
  - Adjusted `authenticatedBackgroundTimeoutSeconds` and `otpBackgroundTimeoutSeconds` to trigger exactly at the configured boundary.
  - Fixed native foreground callback timeout handling to ensure Android focus transitions correctly apply background-timeout policies.
- **Android Platform**:
  - Fixed resume handling to prevent `hidden -> inactive -> resumed` transitions from overwriting background timestamps, ensuring consistent logout and OTP dismissal behavior.
  - Hardened VPN detection to prevent host app crashes when network-state access is unavailable.
- **Testing**:
  - Added regression tests for authenticated/OTP timeouts, Android lifecycle ordering, native foreground callbacks, and cold-start timeout scenarios.
- **Configuration**:
  - Bumped version to `0.2.3` in `CHANGELOG.md`.
@aleemElmozogi aleemElmozogi self-assigned this May 12, 2026
@aleemElmozogi aleemElmozogi merged commit fca05d2 into main May 12, 2026
1 check passed
@aleemElmozogi aleemElmozogi deleted the feat/improvment branch May 12, 2026 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant