Skip to content

v1.0.0#17

Merged
basemosama merged 23 commits into
mainfrom
qa
Jul 6, 2025
Merged

v1.0.0#17
basemosama merged 23 commits into
mainfrom
qa

Conversation

@basemosama

@basemosama basemosama commented Jul 6, 2025

Copy link
Copy Markdown
Member

1.0.0 - [2025-07-06]

Note: This release is a major release and may break some of the existing implementations. Please read the documentation carefully.

This major release introduces significant refactoring, enhanced error handling, improved customization options, and updated build infrastructure.

✨ Major Features & API Enhancements

  • Unified Update Options:
    • Introduced PlayxUpdateOptions to consolidate parameters for version checking (e.g., store IDs, local/new versions, country, language).
    • Introduced PlayxUpdateUIOptions to consolidate parameters for the visual presentation of update dialogs/pages (e.g., titles, descriptions, button labels, callbacks, show/hide elements).
    • This refactoring simplifies method signatures for checkVersion, showUpdateDialog, and showInAppUpdateDialog, improving organization and extensibility.
  • Comprehensive Error Handling Rework:
    • Enhanced Android In-App Update Errors: Replaced generic PlayxInAppUpdateFailed with a detailed PlayxInstallError sealed class, directly mapping to Android's InstallErrorCode for specific error types (e.g., ApiNotAvailable, AppNotOwned, DownloadNotPresent).
    • Improved Network Error Clarity: Introduced PlayxVersionNetworkError to wrap playx_network's NetworkException, differentiating network issues from other update errors, while providing specific, user-friendly messages for network-related exceptions during app version checks
    • Error Consolidation: Merged PlayxInAppUpdateInfoRequestCanceledError into PlayxInAppUpdateCanceledError for simplified error handling.
    • Updated Dart error classes to mirror native changes and refined messages for clarity.
  • Flexible Version Parsing:
    • Introduced a new internal Version class for robust and flexible parsing/comparison of version strings (supporting SemVer, multi-part numeric versions, and ignoring non-numeric tags) like 2.25.18.80.
    • Improved Google Play Store version parsing reliability using the new Version class.
    • Removed the external version package dependency.
  • Advanced UI Customization for Flutter:
    • Added PlayxUpdateDisplayType enum to control Flutter-based update prompt presentation (Dialog, Page, or Page on Force Update).
    • Introduced extensive styling options for Flutter-based update dialogs and pages, including text styles (titleTextStyle, descriptionTextStyle, releaseNotesTitleTextStyle, releaseNotesTextStyle, button text styles) and button styles.
    • PlayxUpdateUIOptions.displayType now defaults to pageOnForceUpdate.
    • UpdateNameInfoCallback renamed to UpdateTextInfoCallback.

✨ Enhancements & Refinements

  • Improved In-App Update Flow:
    • If a flexible update is already downloaded, showInAppUpdateDialog now prompts to complete it.
    • Enhanced documentation for in-app update methods in PlayxVersionUpdate, providing clearer descriptions of immediate and flexible flows, detailed error types, and best practice recommendations.
  • Result Access: Added updateData and updateError getters to PlayxVersionUpdateResult for easier access to success data or error information.
  • Code Quality: Minor code formatting, logging cleanup, and general documentation improvements across the package.

⚙️ Build System & Example App Updates

  • Android Gradle Plugin & Kotlin Upgrades:
    • Upgraded Android Gradle Plugin to 8.7.3 and Kotlin to 2.1.0.
    • Updated compile SDK to 36.
    • Set Java and Kotlin JVM target to 17.
    • Updated Gradle wrapper to 8.12.
  • Android Example Migration: Migrated the Android example project to use Gradle Kotlin DSL (.gradle.kts).
  • Significantly Improved Example App:
    • Enhanced UI with updated button labels and more visual elements to demonstrate customization.
    • Showcases extensive UI customization using PlayxUpdateUIOptions (custom leading widget, text styles, button styles, action callbacks).
    • Clarified behavior for both Android (native) and iOS (custom UI) for flexible and immediate updates, including detailed iosUiOptions examples.
    • Demonstrates using PlayxUpdateOptions for checkVersion and conditional display of PlayxUpdatePage (forced) and PlayxUpdateDialog (optional) with custom UI.
    • Added a button/option in the example app to start flexible updates specifically on Android.

⬆️ Dependency Updates

  • Updated SDK constraints to >=3.6.0 <4.0.0 and Flutter to >=3.27.0.
  • Upgraded playx_network to ^0.5.1.

basemosama added 23 commits July 2, 2025 17:40
- Updated SDK constraints to `'>=3.6.0 <4.0.0'` and Flutter to `'>=3.27.0'`
- Upgraded `playx_network` to `^0.5.0`
… 86c49fq26

This commit refactors the public API by introducing two new option classes:
- `PlayxUpdateOptions`: Consolidates parameters related to version checking (e.g., store IDs, local/new versions, country, language).
- `PlayxUpdateUIOptions`: Consolidates parameters related to the visual presentation of update dialogs/pages (e.g., titles, descriptions, button labels, callbacks, show/hide elements).

This change aims to:
- Simplify method signatures for `checkVersion`, `showUpdateDialog`, and `showInAppUpdateDialog`.
- Improve code organization and readability by grouping related configurations.
- Enhance extensibility for future options.

The core functionality remains the same, but the way options are passed to the library's methods has been updated. Internal logic for displaying UI elements has also been refactored to use these new option classes.
This commit introduces a new `PlayxUpdateDisplayType` enum to control the presentation of Flutter-based update prompts (dialog, page, or page on force update).

It also adds extensive UI customization options for Flutter-based update dialogs and pages:
- `titleTextStyle`, `descriptionTextStyle`, `releaseNotesTitleTextStyle`, `releaseNotesTextStyle`, `updateButtonTextStyle`, `dismissButtonTextStyle` for text styling.
- `updateButtonStyle`, `dismissButtonStyle` for button styling.

The default behavior for `PlayxUpdateUIOptions.displayType` is now `pageOnForceUpdate`.
The `showPageOnForceUpdate` option in `PlayxUpdateUIOptions` has been removed in favor of the new `displayType` enum.
`UpdateNameInfoCallback` has been renamed to `UpdateTextInfoCallback` for clarity.

`PlayxUpdatePage` and `PlayxUpdateDialog` have been updated to utilize the new text and button style options and to align dismissibility logic with the `isDismissible` property and `forceUpdate` status.
- Upgraded Android Gradle Plugin to version 8.7.3.
- Upgraded Kotlin to version 2.1.0.
- Updated compile SDK to 36.
- Set Java and Kotlin JVM target to 17.
- Updated Gradle wrapper to version 8.12.
- Removed plugin management and plugins block from `settings.gradle` as they are now handled by the top-level `build.gradle` file.
…r explanations

This commit significantly improves the example app by:

- **Enhancing UI:** Updated button labels for clarity and added more visual elements to demonstrate UI customization options.
- **Detailed `showUpdateDialog`:** Showcases extensive UI customization using `PlayxUpdateUIOptions`, including custom leading widget, text styles, button styles, and action callbacks.
- **Improved In-App Update Demonstrations:**
    - Clarified behavior for both Android (native) and iOS (custom UI) for flexible and immediate updates.
    - Provided detailed examples of using `iosUiOptions` for customizing the fallback UI on iOS.
- **Refined `checkVersion`:**
    - Demonstrates using `PlayxUpdateOptions` for `checkVersion`.
    - Shows how to conditionally display `PlayxUpdatePage` for forced updates and `PlayxUpdateDialog` for optional updates, both with custom UI configurations.
- **Better User Feedback:** Implemented a `_showMessage` helper to display success and error messages via SnackBars.
- **Code Clarity:**
    - Added more comprehensive comments explaining the purpose of different methods and parameters.
    - Improved formatting and variable naming for better readability.
    - Added `debugShowCheckedModeBanner: false` for a cleaner example UI.
- **Robust Error Handling:** Ensured error messages from async operations are displayed to the user.
- **Flexible Update Flow:** Added logging for flexible update download failures.
This commit migrates the Android example project to use Gradle Kotlin DSL (`.gradle.kts`) instead of Groovy (`.gradle`).

Key changes include:
- Renamed `build.gradle` and `settings.gradle` files to `build.gradle.kts` and `settings.gradle.kts` respectively.
- Updated Gradle wrapper to version 8.12.
- Updated Android Gradle Plugin to 8.7.3 and Kotlin Android plugin to 2.1.0 in `settings.gradle.kts`.
- Updated `compileOptions` and `kotlinOptions` to Java 17.
- Adjusted package name for `MainActivity.kt` and `AndroidManifest.xml` from `io.sourcya.playx_version_update_example` to `com.example.playx_version_update_example`.
- Removed `INTERNET` permission from `AndroidManifest.xml` as it's typically added by Flutter itself if needed.
- Increased Gradle JVM arguments in `gradle.properties`.
- Added `.cxx/` to `.gitignore`.
- Deleted old Groovy-based `build.gradle`, `settings.gradle` and `MainActivity.kt` files.
This commit introduces a new `Version` class for more robust and flexible parsing and comparison of version strings. The new class supports:
- Standard SemVer (e.g., "1.2.3-alpha.1+build.456")
- Multi-part numeric versions (e.g., "2.25.18.80")
- Flexible parsing with defaults for missing components
- Ignoring non-numeric tags in the core version string

The Google Play Store version parsing logic has been updated to use this new `Version` class and to improve the reliability of extracting the store version by trying multiple regex patterns.

The `version` package dependency has been removed as its functionality is now covered by the new internal `Version` class.
This commit introduces several improvements to the in-app update functionality:

- **Enhanced Android Error Handling:**
    - Replaced the generic `PlayxInAppUpdateFailed` with a more detailed `PlayxInstallError` sealed class. This class maps directly to Android's `InstallErrorCode` and provides specific error types like `ApiNotAvailable`, `AppNotOwned`, `DownloadNotPresent`, etc.
    - Improved how exceptions are caught and processed in `UpdateManger.kt` to convert `InstallException` into the new `PlayxInstallError` types.
    - Removed the reliance on `onActivityResult` for update flow results, using the `Task`'s success/failure/cancel listeners directly for more robust error reporting.
- **Improved Dart Error Classes:**
    - Updated `PlayxVersionUpdateError.dart` to include the new `PlayxInstallError` hierarchy, mirroring the Kotlin changes.
    - Renamed `PLAYX_REQUEST_CANCELLED` to `PLAYX_INFO_REQUEST_CANCELLED` for better clarity.
    - Refined error messages across various `PlayxVersionUpdateError` subclasses to be more user-friendly and informative.
This commit refactors the error handling in `playx_version_update` to provide more specific and actionable error information.

**Key changes:**

*   **Introduced `PlayxVersionNetworkError`:** This new error class wraps `playx_network`'s `NetworkException` to differentiate network-related issues (like timeouts or no internet) from other update errors. This allows for more targeted error handling and user feedback.
*   **Removed generic network error factory:** The `PlayxVersionUpdateError.fromNetworkException` factory was removed as network errors are now handled by `PlayxVersionNetworkError`.
*   **Exported `playx_network` exceptions:** Common `playx_network` exceptions are now exported from `playx_version_update.dart` for easier access by developers.
*   Minor code formatting and documentation improvements.
Introduces `NetworkExceptionsMessages` class to provide specific error messages for network-related exceptions encountered during app version checks.

This allows for more user-friendly and context-aware error handling. The `NetworkClient` is updated to utilize these custom messages.
- For showInAppUpdateDialog if If a flexible update is already downloaded, prompt to complete it
- Merged `PlayxInAppUpdateInfoRequestCanceledError` into `PlayxInAppUpdateCanceledError` to simplify error handling.
- Improved documentation for in-app update methods in `PlayxVersionUpdate` with:
    - Clearer descriptions of immediate and flexible update flows.
    - Detailed explanations of possible error types for each method.
    - Best practice recommendations for using flexible updates and handling app resume scenarios.
- Added `updateData` and `updateError` getters to `PlayxVersionUpdateResult` for easier access to success data or error information.
@basemosama basemosama merged commit 4a78b14 into main Jul 6, 2025
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