Conversation
This commit introduces an in-app review prompting system that requests reviews from users at opportune "happy moments."
Key Changes:
- Add `HappyMomentCriteria` interface and concrete implementations:
- `ReturningUserCriteria`: Triggers if the user has opened the app at least 3 times in the past 30 days.
- `ReturningUserWithFavoritesCriteria`: Triggers if the user is logged in, has favorites, and meets the app open criteria.
- `AlwaysTrueCriteria`: (Likely for testing/debugging) Always triggers.
- Implement `AppStartTrackingDataSource` to track app open frequency using DataStore.
- Create `InAppReviewHappyMomentService` to manage and select active happy moment criteria.
- Introduce `HappyMomentTracker`, a new `Tracker` implementation, to dispatch analytics events to the `InAppReviewHappyMomentService`.
- Add `InAppReviewViewModel` to observe happy moments and launch the review flow using `InAppReviewManager`.
- Provide `GoogleInAppReviewManager` for production and `FakeInAppReviewManager` for debug builds.
- Integrate the review flow into the main `App` composable, listening for review triggers.
- Pass event properties to Amplitude tracker.
- Add new analytics events: `ReviewDialogDismissed` (with duration) and `ReviewDialogFailed` (with reason).
- Update DI module to provide all new components.
This commit updates the InAppReviewHappyMomentService to specifically use the `ReturningUserWithFavoritesCriteria` for determining when to prompt users for an in-app review. Previously, the service would use the first criteria found in the `criteriaList`, or specifically the `ReturningUserCriteria` if present. This change makes the selection more specific, targeting users who are returning and have favorited items, which is a stronger signal for a "happy moment".
This commit introduces a new debug module that allows developers to enable or disable in-app review prompts.
Key Changes:
- Added `InAppReviewDebugModule.kt` to provide a Composable UI for the debug toggle.
- Created `InAppReviewDebugModuleDataSource.kt` for both debug and release builds to manage the state of the toggle.
- In debug builds, this uses `DebugModuleDataSource` to persist the setting.
- In release builds, it defaults to in-app reviews being enabled.
- Implemented `InAppReviewDebugModuleState.kt` to define the state (enabled/disabled).
- Added `InAppReviewDebugModuleViewModel.kt` to handle the logic for the debug module.
- Updated `InAppReviewHappyMomentService.kt` to respect the debug toggle, preventing review prompts if disabled via the debug menu.
- Integrated the new debug module into the existing debug DI setup (`DebugDI.kt`) and the main debug menu UI (`SevDebugMenu.kt`).
- Ensured the `InAppReviewHappyMomentService` correctly combines the happy moment criteria with the debug setting.
This feature provides more control during development and testing by allowing easy suppression of in-app review prompts.
This commit enhances the in-app review debug module by displaying the name of the currently active happy moment criteria. Key Changes: - Add `activeCriteriaName` field to `InAppReviewDebugModuleState`. - `InAppReviewHappyMomentService` now exposes an `observeActiveCriteriaName()` StateFlow. - `InAppReviewDebugModuleViewModel` combines the base state with the active criteria name. - The `InAppReviewDebugModule` composable now displays the active criteria name if available. - Updated DI for `InAppReviewDebugModuleViewModel` to include `InAppReviewHappyMomentService`.
This commit introduces a new criterion for triggering in-app review prompts: when a user adds a new favorite stop, and it's not their first favorite (i.e., they already have at least one favorite). Key Changes: - Create `AddingFavoriteCriteria` class implementing `HappyMomentCriteria`. - This new criteria checks if the user has existing favorites when an `AddFavoriteClicked` event is dispatched. - If the user already has favorites, it sets the happy moment flag to true. - Update `InAppReviewHappyMomentService` to prioritize `AddingFavoriteCriteria` over `ReturningUserWithFavoritesCriteria` when selecting the active criteria. - Register `AddingFavoriteCriteria` in the Koin dependency injection module. This change aims to prompt users for a review at a moment they are actively engaging with a positive feature of the app, potentially increasing the likelihood of positive reviews.
This commit enhances the In-App Review debug module by adding a dropdown menu to select and activate different "happy moment" criteria.
Key Changes:
- `InAppReviewDebugModuleState`: Added `availableCriteria` list.
- `InAppReviewHappyMomentService`:
- Added `getAllCriteria()` to retrieve all defined criteria.
- Added `setActiveCriteria(criteriaName: String)` to allow changing the active criteria for testing purposes.
- `InAppReviewDebugModuleViewModel`:
- Updated to populate `availableCriteria` in the state.
- Added `onCriteriaSelected(criteriaName: String)` to handle user selection from the debug menu.
- `InAppReviewDebugModule.kt` (UI):
- Implemented an `ExposedDropdownMenuBox` to display available criteria.
- Users can now select a criteria from the dropdown, which updates the active criteria in `InAppReviewHappyMomentService`.
- The dropdown shows the currently active criteria or "None".
This allows for easier testing of different conditions that trigger the in-app review prompt.
This commit significantly improves the In-App Review debug module by allowing developers to override the active review criteria for testing purposes.
Key Changes:
- **Criteria Override:** Developers can now select a specific review criteria from the debug module, which will then be used by the `InAppReviewHappyMomentService` instead of the live/production criteria selection logic.
- **State Management:**
- `InAppReviewDebugModuleState` and its release counterpart now include `selectedDebugCriteriaName` to store the overridden criteria.
- `InAppReviewDebugModuleViewModel` handles the selection and persistence of the debug criteria via `InAppReviewDebugModuleDataSource`.
- **UI Enhancements:**
- The debug module UI now indicates whether the active criteria is "live" or a "debug" override.
- A "Revert to live criteria" button (refresh icon) is added, appearing only when a debug override is active. This allows easy switching back to the default criteria selection logic.
- **Service Logic Update:**
- `InAppReviewHappyMomentService` now checks for a debug criteria override during initialization.
- New methods `setActiveCriteria(criteriaName: String)` and `revertToLiveCriteria()` are added to manage the debug override.
- Logging is improved to clearly indicate when a debug override is active.
- **Code Structure:**
- `selectLiveCriteria()` private method introduced in `InAppReviewHappyMomentService` to encapsulate the production criteria selection logic.
This enhancement provides better control and visibility for testing different In-App Review scenarios without affecting production behavior.
This commit adds a "Current Conditions" section to the In-App Review debug module, displaying real-time data for: - Number of favorites - App open count (last 30 days) - User login status This provides developers with better insight into the conditions that trigger in-app review prompts. Key Changes: - Updated `InAppReviewDebugModuleState` to include `favoritesCount`, `appOpensCount`, and `isUserLoggedIn`. - Modified `InAppReviewDebugModuleViewModel` to collect and expose these new state values by observing `FavoriteRepository`, `AppStartTrackingDataSource`, and `SessionService`. - Updated the `InAppReviewDebugModule` UI to display the new "Current Conditions" section. - Adjusted DI in `DebugDI.kt` to provide necessary dependencies to `InAppReviewDebugModuleViewModel`. - Updated the release variant of `InAppReviewDebugModuleDataSource.kt` to include default values for the new state fields.
This commit renames the class `InAppReviewHappyMomentService` to the more concise `InAppReviewService`. This change is applied across the codebase where this service is used, including: - `InAppReviewDebugModuleViewModel` - `HappyMomentTracker` - Dependency injection configurations in `DI.kt` - `InAppReviewViewModel`
This commit adds analytics tracking for when the in-app review dialog is requested. Key Changes: - Add `ReviewDialogRequested` event to `Events.kt` - Track `ReviewDialogRequested` event in `InAppReviewViewModel.launch()`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements a comprehensive in-app review system that prompts users for reviews at optimal moments, with full debug controls for testing different criteria and monitoring conditions.
Key Features
Review Criteria
Debug Module Features
Review Control
Real-time Monitoring
Persistence
Technical Implementation
Usage
Developers can now: