-
Notifications
You must be signed in to change notification settings - Fork 532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle configuration change using onSavedInstance #4470
Handle configuration change using onSavedInstance #4470
Comments
The ui/presenter is subscribed to get EphemeraState updates here. The subscription is not removed after first data comes, so theoretically new data can come at any time that recreates the ui. In this case, the user input is also lost. Should I handle this case as well or in practice it won't happen? If it can happen and I need to handle the case, what changes can I expect? could the interaction id have changed? Even if the interaction id is the same, can it belong to a different question, in which case the saved data must be discarded? Potential scenario I'm imagining:
Another potential case:
|
@masclot the app is currently local only, so fortunately none of the network scenarios you've outlined can occur. Regarding stability, the actual source of truth is whatever is provided via Anything that's transient UI state and not part of the ephemeral data structures will be lost on configuration change. User input/interaction selections are the most obvious that are affected by this. FWIW if there's an easy way represent partial interaction answers in the ephemeral structures, that might actually be an easier way to go than trying to make saved instance state work. It also potentially leads to a cleaner long-term solution of saving these protos on disk for low-memory death scenarios, as well (but that's not part of the scope of this issue so it doesn't specifically need to be considered here). |
Unassigning @masclot because I feel this is blocked on technical direction. See #5008 (comment) |
…sing onSavedInstance. (#5458) <!-- READ ME FIRST: Please fill in the explanation section below and check off every point from the Essential Checklist! --> ## Explanation Fix part of #4470. Fixes #4471. Fixes #4474 This PR enables the retention of input when the device configuration changes using onSavedInstance. List of interactions covered in this PR: 1. FractionInputInteraction 2. NumericInputInteraction 3. TextInputInteraction 4. MathExpressionInteraction 5. RatioExpressionInteraction List of interactions not covered in this PR: 1. Image Region selection interaction. 2. Drag and Drop interaction. <!-- - Explain what your PR does. If this PR fixes an existing bug, please include - "Fixes #bugnum:" in the explanation so that GitHub can auto-close the issue - when this PR is merged. --> ## Essential Checklist <!-- Please tick the relevant boxes by putting an "x" in them. --> - [x] The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".) - [x] Any changes to [scripts/assets](https://github.com/oppia/oppia-android/tree/develop/scripts/assets) files have their rationale included in the PR explanation. - [x] The PR follows the [style guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide). - [x] The PR does not contain any unnecessary code changes from Android Studio ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#undo-unnecessary-changes)). - [x] The PR is made from a branch that's **not** called "develop" and is up-to-date with "develop". - [x] The PR is **assigned** to the appropriate reviewers ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#clarification-regarding-assignees-and-reviewers-section)). ## For UI-specific PRs only <!-- Delete these section if this PR does not include UI-related changes. --> If your PR includes UI-related changes, then: - Add screenshots for portrait/landscape for both a tablet & phone of the before & after UI changes - For the screenshots above, include both English and pseudo-localized (RTL) screenshots (see [RTL guide](https://github.com/oppia/oppia-android/wiki/RTL-Guidelines)) - Add a video showing the full UX flow with a screen reader enabled (see [accessibility guide](https://github.com/oppia/oppia-android/wiki/Accessibility-A11y-Guide)) - For PRs introducing new UI elements or color changes, both light and dark mode screenshots must be included - Add a screenshot demonstrating that you ran affected Espresso tests locally & that they're passing
…iguration change u…" This reverts commit 7568bd3.
Problem
For all interactions in exploration player and question player when we rotate our device, selected or entered answer doesn't persist.
Solution
To solve this problem of configuration change we use onSavedInstance method to store the last entered user answer.
Alternatives
Note: Closing issue #1737 as the approach for configuration change is changed to onSavedInstance from Singleton class approach.
The text was updated successfully, but these errors were encountered: