Skip to content

Commit

Permalink
Fix #4495, part of #3088, #4467, #4505, #4266, #4446: Miscellaneous a…
Browse files Browse the repository at this point in the history
…lpha MR5 fixes (#4506)

## Explanation
Fixes #4495
Fixes part of #3088
Fixes #4467
Fixes #4505
Fixes #4266
Fixes #4446

This PR fixes a number of key blockers for the upcoming Alpha MR5 release of the app. In particular:
- It fixes #4266 by reformatting one XML file that Rajat left a comment for during his post-merge reviews of Alpha MR4 PRs.
- It mitigates #4495 by introducing a banner for when correct audio can't be played (I did run into an actual bug where the wrong audio played once, but I couldn't repro it--most of the time the app will stop autoplaying if it can't find the correct language). This also fixes part of #3088 since the mitigation will help make that situation better.
- It addresses #4467 by logging stringified versions of all supported answer types upon answer submission (rather than just whether the answer is correct).
- It addresses #4446 by (1) introducing a new default hint text for text input, and (2) by ensuring hint text is fully readable by wrapping it when it extends to more than one line. However, another issue was discovered which would be really nice to fix (but is not feasible given the amount of time available for this PR). #4509 is tracking this future work.
- It addresses #4505 by disabling profile name verification when the learner study is enabled (as a stop-gap).

Note that there are no new tests being added in this PR since the fixes are mostly trivial and have been manually verified during development. #4510 is tracking adding automated tests for long-term app health.

Furthermore, AudioViewModel was allow-listed to reference Locale directly so that it can it include a localized language name in the fail-to-play audio notice. #3791 will fix this in the long-term.

This PR also includes version code & minor version bumps to prepare for the upcoming release. It also fixes the Kenya-specific alpha build flavor (which was unfortunately checked in as broken in #4507), and adds it to CI since the assumption in #4507 that it doesn't need to be covered is incorrect. The Gradle workaround for the new flavor was removed since it was a legitimate failure that wasn't being picked up by Bazel builds in CI.

## Essential Checklist
- [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
Creating profile names with normally forbidden characters (in this case, numbers):

https://user-images.githubusercontent.com/12983742/185594638-3bd653a4-916a-4471-963a-d00ab987f378.mp4

Demonstrating when English audio is sometimes unavailable & the new notice to make this clearer:

https://user-images.githubusercontent.com/12983742/185594719-896e428c-96b8-42f3-b53f-721352a90f14.mp4

Audio not being available can occur in all languages, not just English:

![audio_unavailable](https://user-images.githubusercontent.com/12983742/185594834-6f6127db-e54b-4a23-a734-7b3a6b849184.png)

Text input hints can now be multi-line to ensure that they're not cut off:

![oppia_multiline_text_input_hint](https://user-images.githubusercontent.com/12983742/185594908-4b4a07f3-cff7-44f7-a2c9-8dfb7a8ca784.png)

Commits:

* Address
#4274 (comment).

This is part of addressing #4266.

* Add audio notice for when language is missing.

* Disable invalid profile name rules for studies.

* Add analytics logging for submitted answers.

* Code health fixes.

* Add hint wrapping, and default text input hint.

* Fix broken tests.

* Test fixes.

* Fix broken Kenya-specific alpha build.

Also, bump version codes & minor versions in preparation for the
release.
  • Loading branch information
BenHenning authored Aug 19, 2022
1 parent 6bab482 commit 091b45a
Show file tree
Hide file tree
Showing 28 changed files with 402 additions and 130 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/build_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,24 @@ jobs:
run: |
bazel build --compilation_mode=opt -- //:oppia_alpha_kitkat
# Note that caching only works on non-forks.
- name: Build Oppia alpha Kenya-specific AAB (with caching, non-fork only)
if: ${{ env.ENABLE_CACHING == 'true' && github.event.pull_request.head.repo.full_name == 'oppia/oppia-android' }}
env:
BAZEL_REMOTE_CACHE_URL: ${{ secrets.BAZEL_REMOTE_CACHE_URL }}
run: |
bazel build --compilation_mode=opt --remote_http_cache=$BAZEL_REMOTE_CACHE_URL --google_credentials=./config/oppia-dev-workflow-remote-cache-credentials.json -- //:oppia_alpha_kenya
- name: Build Oppia alpha Kenya-specific AAB (without caching, or on a fork)
if: ${{ env.ENABLE_CACHING == 'false' || github.event.pull_request.head.repo.full_name != 'oppia/oppia-android' }}
run: |
bazel build --compilation_mode=opt -- //:oppia_alpha_kenya
- name: Copy Oppia alpha AABs for uploading
run: |
cp $GITHUB_WORKSPACE/bazel-bin/oppia_alpha.aab /home/runner/work/oppia-android/oppia-android/
cp $GITHUB_WORKSPACE/bazel-bin/oppia_alpha_kitkat.aab /home/runner/work/oppia-android/oppia-android/
cp $GITHUB_WORKSPACE/bazel-bin/oppia_alpha_kenya.aab /home/runner/work/oppia-android/oppia-android/
- uses: actions/upload-artifact@v2
with:
Expand All @@ -457,3 +471,8 @@ jobs:
with:
name: oppia_alpha_kitkat.aab
path: /home/runner/work/oppia-android/oppia-android/oppia_alpha_kitkat.aab

- uses: actions/upload-artifact@v2
with:
name: oppia_alpha_kenya.aab
path: /home/runner/work/oppia-android/oppia-android/oppia_alpha_kenya.aab
4 changes: 2 additions & 2 deletions app/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,15 @@ VIEW_MODELS_WITH_RESOURCE_IMPORTS = [
"src/main/java/org/oppia/android/app/parser/FractionParsingUiError.kt",
"src/main/java/org/oppia/android/app/parser/StringToNumberParser.kt",
"src/main/java/org/oppia/android/app/parser/StringToRatioParser.kt",
"src/main/java/org/oppia/android/app/player/audio/AudioViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/DragDropInteractionContentViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/FractionInteractionViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/ImageRegionSelectionInteractionViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/MathExpressionInteractionsViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/PreviousResponsesHeaderViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/RatioExpressionInputInteractionViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/SubmittedAnswerViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/TextInputViewModel.kt",
"src/main/java/org/oppia/android/app/profile/AddProfileViewModel.kt",
"src/main/java/org/oppia/android/app/profile/PinPasswordViewModel.kt",
"src/main/java/org/oppia/android/app/profile/ResetPinViewModel.kt",
Expand Down Expand Up @@ -296,7 +298,6 @@ VIEW_MODELS = [
"src/main/java/org/oppia/android/app/options/OptionsItemViewModel.kt",
"src/main/java/org/oppia/android/app/options/OptionsReadingTextSizeViewModel.kt",
"src/main/java/org/oppia/android/app/options/ReadingTextSizeSelectionViewModel.kt",
"src/main/java/org/oppia/android/app/player/audio/AudioViewModel.kt",
"src/main/java/org/oppia/android/app/player/exploration/ExplorationViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/ContentViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/ContinueInteractionViewModel.kt",
Expand All @@ -312,7 +313,6 @@ VIEW_MODELS = [
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/SelectionInteractionViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/StateItemViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/SubmitButtonViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/itemviewmodel/TextInputViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/StateViewModel.kt",
"src/main/java/org/oppia/android/app/player/state/testing/StateFragmentTestViewModel.kt",
"src/main/java/org/oppia/android/app/profile/AdminAuthViewModel.kt",
Expand Down
1 change: 0 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ def filesToExclude = [
'**/*AppLanguageLocaleHandlerTest*.kt',
'**/*AppLanguageResourceHandlerTest*.kt',
'**/*AppLanguageWatcherMixinTest*.kt',
'**/alphakenya/*.kt',
]
_excludeSourceFiles(filesToExclude)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ import javax.inject.Singleton
LoggingIdentifierModule::class, ApplicationLifecycleModule::class,
NetworkConnectionDebugUtilModule::class, LoggingIdentifierModule::class,
SyncStatusModule::class, LogReportingModule::class, NetworkConnectionUtilProdModule::class,
HintsAndSolutionProdModule::class, AlphaKenyaBuildFlavorModule::class
HintsAndSolutionProdModule::class
]
)
interface AlphaKenyaApplicationComponent : ApplicationComponent {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ kt_android_library(
name = "alpha_kenya_application",
srcs = [
"AlphaKenyaApplicationComponent.kt",
"AlphaKenyaBuildFlavorModule.kt",
"AlphaKenyaOppiaApplication.kt",
],
visibility = ["//:oppia_binary_visibility"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,25 @@ class FractionInputInteractionView @JvmOverloads constructor(

init {
onFocusChangeListener = this
// Assume multi-line for the purpose of properly showing long hints.
setSingleLine(hint != null)
hintText = (hint ?: "")
stateKeyboardButtonListener = context as StateKeyboardButtonListener
}

override fun onFocusChange(v: View, hasFocus: Boolean) = if (hasFocus) {
hint = ""
typeface = Typeface.DEFAULT
hideHint()
showSoftKeyboard(v, context)
} else {
hint = hintText
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
restoreHint()
hideSoftKeyboard(v, context)
}

override fun onKeyPreIme(keyCode: Int, event: KeyEvent): Boolean {
if (event.keyCode == KEYCODE_BACK && event.action == ACTION_UP)
this.clearFocus()
if (event.keyCode == KEYCODE_BACK && event.action == ACTION_UP) {
clearFocus()
restoreHint()
}
return super.onKeyPreIme(keyCode, event)
}

Expand All @@ -59,4 +61,16 @@ class FractionInputInteractionView @JvmOverloads constructor(
}
super.onEditorAction(actionCode)
}

private fun hideHint() {
hint = ""
typeface = Typeface.DEFAULT
setSingleLine(true)
}

private fun restoreHint() {
hint = hintText
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
setSingleLine(false)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,24 @@ class MathExpressionInteractionsView @JvmOverloads constructor(

init {
onFocusChangeListener = this
// Assume multi-line for the purpose of properly showing long hints.
setSingleLine(hint != null)
hintText = (hint ?: "")
stateKeyboardButtonListener = context as StateKeyboardButtonListener
}

override fun onFocusChange(v: View, hasFocus: Boolean) = if (hasFocus) {
hint = ""
typeface = Typeface.DEFAULT
hideHint()
showSoftKeyboard(v, context)
} else {
hint = hintText
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
restoreHint()
hideSoftKeyboard(v, context)
}

override fun onKeyPreIme(keyCode: Int, event: KeyEvent): Boolean {
if (event.keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_UP) {
clearFocus()
restoreHint()
}
return super.onKeyPreIme(keyCode, event)
}
Expand All @@ -73,4 +74,16 @@ class MathExpressionInteractionsView @JvmOverloads constructor(
hint = placeholderText
}
}

private fun hideHint() {
hint = ""
typeface = Typeface.DEFAULT
setSingleLine(true)
}

private fun restoreHint() {
hint = hintText
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
setSingleLine(false)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,25 @@ class NumericInputInteractionView @JvmOverloads constructor(

init {
onFocusChangeListener = this
// Assume multi-line for the purpose of properly showing long hints.
setSingleLine(hint != null)
hintText = (hint ?: "")
stateKeyboardButtonListener = context as StateKeyboardButtonListener
}

override fun onFocusChange(v: View, hasFocus: Boolean) = if (hasFocus) {
hint = ""
typeface = Typeface.DEFAULT
hideHint()
showSoftKeyboard(v, context)
} else {
hint = hintText
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
restoreHint()
hideSoftKeyboard(v, context)
}

override fun onKeyPreIme(keyCode: Int, event: KeyEvent): Boolean {
if (event.keyCode == KEYCODE_BACK && event.action == ACTION_UP)
this.clearFocus()
if (event.keyCode == KEYCODE_BACK && event.action == ACTION_UP) {
clearFocus()
restoreHint()
}
return super.onKeyPreIme(keyCode, event)
}

Expand All @@ -57,4 +59,16 @@ class NumericInputInteractionView @JvmOverloads constructor(
}
super.onEditorAction(actionCode)
}

private fun hideHint() {
hint = ""
typeface = Typeface.DEFAULT
setSingleLine(true)
}

private fun restoreHint() {
hint = hintText
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
setSingleLine(false)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,25 @@ class RatioInputInteractionView @JvmOverloads constructor(

init {
onFocusChangeListener = this
// Assume multi-line for the purpose of properly showing long hints.
setSingleLine(hint != null)
hintText = (hint ?: "")
stateKeyboardButtonListener = context as StateKeyboardButtonListener
}

override fun onFocusChange(v: View, hasFocus: Boolean) = if (hasFocus) {
hint = ""
typeface = Typeface.DEFAULT
hideHint()
KeyboardHelper.showSoftKeyboard(v, context)
} else {
hint = hintText
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
restoreHint()
KeyboardHelper.hideSoftKeyboard(v, context)
}

override fun onKeyPreIme(keyCode: Int, event: KeyEvent): Boolean {
if (event.keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_UP)
this.clearFocus()
if (event.keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_UP) {
clearFocus()
restoreHint()
}
return super.onKeyPreIme(keyCode, event)
}

Expand All @@ -47,4 +49,16 @@ class RatioInputInteractionView @JvmOverloads constructor(
}
super.onEditorAction(actionCode)
}

private fun hideHint() {
hint = ""
typeface = Typeface.DEFAULT
setSingleLine(true)
}

private fun restoreHint() {
hint = hintText
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
setSingleLine(false)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,25 @@ class TextInputInteractionView @JvmOverloads constructor(

init {
onFocusChangeListener = this
// Assume multi-line for the purpose of properly showing long hints.
setSingleLine(hint != null)
hintText = (hint ?: "")
stateKeyboardButtonListener = context as StateKeyboardButtonListener
}

override fun onFocusChange(v: View, hasFocus: Boolean) = if (hasFocus) {
hint = ""
typeface = Typeface.DEFAULT
hideHint()
showSoftKeyboard(v, context)
} else {
hint = hintText
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
restoreHint()
hideSoftKeyboard(v, context)
}

override fun onKeyPreIme(keyCode: Int, event: KeyEvent): Boolean {
if (event.keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_UP)
this.clearFocus()
if (event.keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_UP) {
clearFocus()
restoreHint()
}
return super.onKeyPreIme(keyCode, event)
}

Expand All @@ -54,4 +56,16 @@ class TextInputInteractionView @JvmOverloads constructor(
}
super.onEditorAction(actionCode)
}

private fun hideHint() {
hint = ""
typeface = Typeface.DEFAULT
setSingleLine(true)
}

private fun restoreHint() {
hint = hintText
if (text.isEmpty()) setTypeface(typeface, Typeface.ITALIC)
setSingleLine(false)
}
}
Loading

0 comments on commit 091b45a

Please sign in to comment.