Skip to content

Commit

Permalink
Fix #52: Finalize release 0.11 (#5010)
Browse files Browse the repository at this point in the history
## Explanation
Fixes #52

This PR finishes up a bunch of separate tasks relating to the 0.11
release of the Oppia Android app.

### Release plans
Note that a lot of the tasks addressed were completed out-of-band (hence
the lack of tracking issues). These are needed to prepare for the
following release changes:
- A new version of the alpha app will be launched to provide a basis of
testing spotlights
- A new version of the Kenya alpha app will be launched (since those
users are still in transitionary state to the beta version of the app
until later this year)
- A new version of the beta version of the app to include dark mode, the
new language selector, and more

### Overview

#### Language support changes
- Arabic and Nigerian Pidgin (Naija) languages were added to production
builds (Naija was added generally as it wasn't supported previously).
Both languages were also added as possible audio languages.
- Some basic tests were added to cover Arabic and Naija now being
available, though some tests ended up being omitted due to the inherent
complexity of testing these particular languages in certain cases
(Arabic because it's RTL and Naija because Android doesn't actually
support it natively--see below explanation).
- Also added Nigeria as a language region. We don't yet have a strong
grasp on the regions in which Arabic will be used, so that's being kept
as a broad language for now. We may refine this in the future.
- The translations for Nigerian Pidgin are added here as a replacement
to #5009 since the original translations had some formatting issues that
were identified by @adhiamboperes and subsequently fixed by our
translation volunteers. Since we can't wait for another push to #5009,
this PR is just introducing the strings directly.
- ``AndroidLocaleFactory`` was largely rebuilt to make better use of
code sharing, but its actual functionality needed to change due to the
Naija support problems mentioned below.

#### New feature: spotlights (alpha-only)
- A new alpha module was added to allow the team to stage features
specific to alpha builds, and spotlights were added as an initial use
case for this new capability.
- As part of testing spotlights I noticed that the background overlay
was too dark (it was fully occluding the background), so I changed it to
something that's dark but still semi-translucent. See the UI part of the
description below for a before-and-after.

#### New feature: in-app language selector (all users)
- This PR enables the new language selector introduced by #4762 by
default as part of addressing #52.
- Some small fast-follow nits from #4762 were addressed (see
#4762 (comment)
and
#4762 (comment)).

#### Event system changes
- Introduced a new script for decoding the compressed base 64 event
strings that can be generated during user studies (see explanation below
for details). This has some basic fault tolerance built into it so that
truncated event strings can still be partially decoded.
- A debug event property was added which essentially amounts to an event
count since app startup that's attached to each event. While this won't
help us identify events outright missing, it will help us identify
events missing between received events. This is aimed to help an ongoing
investigation that has found the high probability that events are being
lost between user action and Firebase's storage layer.

#### Infrastructure changes
- The minor version of the app is being bumped (since this is a major
beta release of the app).
- Version codes were bumped for 2 releases (since one re-release of the
beta version of the app was needed a few weeks back due to it expiring).
- This PR also quiets the output when creating AABs since currently ~5k
lines are outputted during the final bundle assembly steps and this
output is never useful to the user unless there's a build pipeline
failure.
- This PR fixes an error in the resource filtering output that is
provided at the very end of the AAB creation process (previously it was
outputting the number of configurations being filtered not the number of
actual resources being removed).

#### Improved support for future user studies
- The EnableLearnerStudyAnalytics has been split into 3 flags (2 new
ones): one that controls just whether to attach the sensitive profile
IDs to events, one that controls the fast in-lesson language switcher
(and corresponding admin-controlled profile setting for it), and one
that controls access to the analytics screen + admins being able to mark
lessons as completed for profiles (this is gated on the existing flag).
- The analytics screen flag has been default enabled for regular alpha
builds of the app so that this channel can be better utilized for user
studies. The user ID and in-lesson language switcher aspects of the old
learner study analytics feature are being kept off in alpha builds, only
the analytics screen & related behavior is being made available.

### Nigerian Pidgin support issues

The Android system does not formally support Nigerian Pidgin (Naija)
despite the fact that it has a recognized ISO 639-3 language code.

Naija is a creole language which means it's mostly a derivative of
English with vernacular adaptations (such as recreated words and grammar
alterations). I think that because it's mostly a derivative language and
is mainly used for casual speaking (vs. formal communications), there
isn't as much of a desire on the Android side to formally support it as
a UI language.

Fortunately, the Oppia Android app's localization system already
supports forcing the system to rendering app strings that are not
natively supported. However, this results in several considerations and
has turned up one new issue that needed addressing:
- Custom language overriding only works by matching _both_ language and
region, so the language strings needed to be moved to ``values-pcm-rNG``
(for Nigeria locking). This doesn't stop the language from being used
outside Nigeria, it's just a limitation in Android's resource qualifier
system when working with custom languages.
- It's not yet clear how the change in the values structure will affect
Translatewiki--some additional work might be needed there (which will
become clear once this PR is merged & Translatewiki attempts another
branch sync).
- Custom languages don't have the benefit of guaranteeing rendering
support, so the language's script largely comes to mind. Fortunately, as
a derivative of English Naija uses Latin-based script so there are no
concerns with language rendering compatibility.
- An issue was found in the localization system when handling fallbacks.
Since Naija is English-based, this PR has configured its fallback
language to be English. This led to the system actually prioritizing
English app string translations rather than forcing the Naija strings.
This required the changes that can be seen in ``AndroidLocaleFactory``.

### ``DecodeUserStudyEventString`` utility

A new utility was introduced to decode the compressed Base64 string of
events logs that can be exported from devices being used for user
studies (i.e. whose admins have access to the learner analytics screen).
These logs represent the entirety of both pending and uploaded logs
since the introduction of the feature (but only for devices that have
the learner study enabled).

The utility reads an input file containing a single instance of the
string (and automatically strips newline and horizontal space formatting
since the output from the app includes line-wrapping) and outputs it to
one of three indicated formats: textproto, JSON, or Yaml.

The script can be run in a local terminal from this branch (or
``develop`` once it's checked in) at the repository root by running:

```sh
bazel run //scripts:decode_user_study_event_string -- $(pwd)/input.log $(pwd)/output.json
```

(where 'input.log' exists in the local repository root, and
'output.json' will be written to the local repository root).

For use outside of Bazel, one can use a pre-built deployment Jar file by
running:

```sh
java -jar decode_user_study_event_string_deploy.jar input.log output.json
```

(Note that the error output for this command will be assuming Bazel is
being used, so some adjustment may be needed to interpret CLI errors
when using the deploy Jar).

### Third-party dependency updates
Some new dependencies were needed for the new
``DecodeUserStudyEventString`` utility to make the implementation much
simpler:
- Protobuf's Java util
(https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.util)
for conversion from proto to json.
- A converter from JSON to Yaml (since there's no direct proto-to-yaml
conversion): https://github.com/xlate/yaml-json.
- The Jakarta JSON API (required by the converter):
https://jakarta.ee/specifications/platform/9/apidocs/jakarta/json/json.
- The Jakarta JSON Parsson implementation (runtime dependency required
by the converter): https://github.com/eclipse-ee4j/parsson.
- Snakeyaml implementation (runtime dependency required by the
converter): https://github.com/snakeyaml/snakeyaml.

This required an update to maven_install.json, but no changes are needed
in tracked Maven dependency licenses since these are not dependencies
that are deployed with the app to end users.

The above do result in an incidental update to Gson 2.8.6 (from the
current 2.8.5 used). I don't expect that this actually will affect the
release much since Gson isn't used broadly, and this is a minor update
to Gson.

### Exemptions & test notes
Two new files were exempted for tests:
- ``PlatformParameterAlphaModule``: while we can test modules, I'm not
actually keen on testing the platform parameter modules at this time
because staging is generally messy at the moment with a lot of
duplication across multiple modules, so the test complexity isn't small.
A lot of the platform parameter system needs to be streamlined, but
that's largely dependent on #1720 being finished.
- ``DecodeUserStudyEventString`` while not particularly difficult to
test, this is a special local analytics tool that will rarely be used
and is very unlikely to break. Since I'm strapped for time on this PR,
I'm forgoing adding tests for this utility.

Regarding broad testing coverage, everything has had corresponding
testing additions or changes where applicable. This PR might not have
quite as much testing thoroughness as other PRs, but it does largely
cover the core scenarios.

## 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

Spotlights changes before/after:
| Old spotlights background | New spotlights background |
|--------|--------|
|
https://github.com/oppia/oppia-android/assets/12983742/a8df7807-1bb6-45be-b53a-6d057f4a5931
|
https://github.com/oppia/oppia-android/assets/12983742/e499f4b6-4609-4e58-871f-a09ebd09a80d
|

Video demonstrating the new functionality in the app, including alpha
access to the learner analytics screen and support for both Nigerian
Pidgin and Arabic (and via the in-app language selector):


https://github.com/oppia/oppia-android/assets/12983742/c0a92393-a8a3-4634-af5b-2e7fc35ecd97

---------

Co-authored-by: translatewiki.net <[email protected]>
  • Loading branch information
BenHenning and translatewiki authored Jun 6, 2023
1 parent f727c06 commit 8c81c98
Show file tree
Hide file tree
Showing 70 changed files with 2,800 additions and 627 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ import org.oppia.android.domain.oppialogger.OppiaLogger
import org.oppia.android.domain.oppialogger.analytics.AnalyticsController
import org.oppia.android.util.data.AsyncResult
import org.oppia.android.util.data.DataProviders.Companion.toLiveData
import org.oppia.android.util.locale.OppiaLocale
import org.oppia.android.util.logging.SyncStatusManager
import org.oppia.android.util.logging.SyncStatusManager.SyncStatus
import java.io.ByteArrayOutputStream
import java.security.MessageDigest
import java.util.Base64
import java.util.zip.GZIPOutputStream
import javax.inject.Inject
Expand All @@ -31,6 +33,7 @@ class ControlButtonsViewModel private constructor(
private val activity: AppCompatActivity,
private val analyticsController: AnalyticsController,
private val syncStatusManager: SyncStatusManager,
private val machineLocale: OppiaLocale.MachineLocale,
private val viewModels: List<ProfileListItemViewModel>
) : ProfileListItemViewModel(ProfileListViewModel.ProfileListItemViewType.SHARE_IDS) {
private var monitoredUploadProgress: LiveData<ForceSyncProgress> =
Expand Down Expand Up @@ -73,10 +76,17 @@ class ControlButtonsViewModel private constructor(
)
}
is SyncStatusItemViewModel -> {
val halfLineCount = BASE64_LINE_WRAP_LIMIT / 2
val logsStr = logs?.toCompressedBase64()
listOf(
"Current sync status: ${viewModel.syncStatus.value}.",
"Event log encoding integrity checks:",
"- First $halfLineCount chars of encoded string: ${logsStr?.take(halfLineCount)}",
"- Last $halfLineCount chars of encoded string: ${logsStr?.takeLast(halfLineCount)}",
"- SHA-1 hash (unwrapped event string): ${logsStr?.computeSha1Hash(machineLocale)}",
"- Total event string length (unwrapped): ${logsStr?.length}",
"Encoded event logs:"
) + (logs?.toCompressedBase64()?.chunked(BASE64_LINE_WRAP_LIMIT) ?: listOf("Missing"))
) + (logsStr?.chunked(BASE64_LINE_WRAP_LIMIT) ?: listOf("Missing"))
}
else -> null
}
Expand Down Expand Up @@ -198,12 +208,13 @@ class ControlButtonsViewModel private constructor(
private val oppiaLogger: OppiaLogger,
private val activity: AppCompatActivity,
private val analyticsController: AnalyticsController,
private val syncStatusManager: SyncStatusManager
private val syncStatusManager: SyncStatusManager,
private val machineLocale: OppiaLocale.MachineLocale
) {
/** Returns a new [ControlButtonsViewModel]. */
fun create(viewModels: List<ProfileListItemViewModel>): ControlButtonsViewModel {
return ControlButtonsViewModel(
oppiaLogger, activity, analyticsController, syncStatusManager, viewModels
oppiaLogger, activity, analyticsController, syncStatusManager, machineLocale, viewModels
)
}
}
Expand All @@ -219,5 +230,13 @@ class ControlButtonsViewModel private constructor(
}.toByteArray()
return Base64.getEncoder().encodeToString(compressedMessage)
}

private fun String.computeSha1Hash(machineLocale: OppiaLocale.MachineLocale): String {
return machineLocale.run {
MessageDigest.getInstance("SHA-1")
.digest(this@computeSha1Hash.toByteArray())
.joinToString("") { "%02x".formatForMachines(it) }
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterM
import org.oppia.android.domain.oppialogger.exceptions.UncaughtExceptionLoggerModule
import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule
import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule
import org.oppia.android.domain.platformparameter.PlatformParameterModule
import org.oppia.android.domain.platformparameter.PlatformParameterAlphaModule
import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule
import org.oppia.android.domain.platformparameter.syncup.PlatformParameterSyncUpWorkerModule
import org.oppia.android.domain.question.QuestionModule
Expand Down Expand Up @@ -85,7 +85,7 @@ import javax.inject.Singleton
ApplicationStartupListenerModule::class, LogReportWorkerModule::class,
WorkManagerConfigurationModule::class, HintsAndSolutionConfigModule::class,
FirebaseLogUploaderModule::class, NetworkModule::class,
PlatformParameterModule::class, PlatformParameterSingletonModule::class,
PlatformParameterAlphaModule::class, PlatformParameterSingletonModule::class,
ExplorationStorageModule::class, DeveloperOptionsModule::class,
PlatformParameterSyncUpWorkerModule::class, NetworkConfigProdModule::class, AssetModule::class,
LocaleProdModule::class, ActivityRecreatorProdModule::class, ActivityRouterModule::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,9 @@ class NavigationDrawerFragmentPresenter @Inject constructor(

override fun onDrawerClosed(drawerView: View) {
super.onDrawerClosed(drawerView)
fragment.activity!!.invalidateOptionsMenu()
// It's possible in some rare cases for the activity to be gone while the drawer is
// closing (possibly an out-of-lifecycle call from the AndroidX component).
fragment.activity?.invalidateOptionsMenu()
StatusBarColor.statusBarColorUpdate(
R.color.component_color_shared_activity_status_bar_color,
activity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class PromotedStoryViewModel(

/**
* Starts [ResumeLessonActivity] if a saved exploration is selected or [ExplorationActivity] if an
* un-started recommended story is selected. */
* un-started recommended story is selected.
*/
fun clickOnPromotedStoryTile(@Suppress("UNUSED_PARAMETER") v: View) {
promotedStoryClickListener.promotedStoryClicked(promotedStory)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private const val OPTIONS_ITEM_VIEW_MODEL_LIST_PROVIDER_ID =
/** Options settings view model for the recycler view in [OptionsFragment]. */
@FragmentScope
class OptionControlsViewModel @Inject constructor(
val activity: AppCompatActivity,
activity: AppCompatActivity,
private val profileManagementController: ProfileManagementController,
private val oppiaLogger: OppiaLogger,
@EnableLanguageSelectionUi private val enableLanguageSelectionUi: PlatformParameterValue<Boolean>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ class AudioFragmentPresenter @Inject constructor(
AudioLanguage.FRENCH_AUDIO_LANGUAGE -> "fr"
AudioLanguage.CHINESE_AUDIO_LANGUAGE -> "zh"
AudioLanguage.BRAZILIAN_PORTUGUESE_LANGUAGE -> "pt"
AudioLanguage.ARABIC_LANGUAGE -> "ar"
AudioLanguage.NIGERIAN_PIDGIN_LANGUAGE -> "pcm"
AudioLanguage.NO_AUDIO, AudioLanguage.UNRECOGNIZED, AudioLanguage.AUDIO_LANGUAGE_UNSPECIFIED,
AudioLanguage.ENGLISH_AUDIO_LANGUAGE -> "en"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import androidx.appcompat.view.ContextThemeWrapper
import org.oppia.android.R
import org.oppia.android.app.fragment.FragmentComponentImpl
import org.oppia.android.app.fragment.InjectableDialogFragment
import java.util.Locale
import org.oppia.android.app.model.AudioLanguage
import org.oppia.android.app.translation.AppLanguageResourceHandler
import org.oppia.android.util.locale.OppiaLocale
import javax.inject.Inject
import kotlin.collections.ArrayList

private const val LANGUAGE_LIST_ARGUMENT_KEY = "LanguageDialogFragment.language_list"
Expand All @@ -18,6 +21,9 @@ private const val SELECTED_INDEX_ARGUMENT_KEY = "LanguageDialogFragment.selected
* DialogFragment that controls language selection in audio and written translations.
*/
class LanguageDialogFragment : InjectableDialogFragment() {
@Inject lateinit var appLanguageResourceHandler: AppLanguageResourceHandler
@Inject lateinit var machineLocale: OppiaLocale.MachineLocale

companion object {
/**
* This function is responsible for displaying content in DialogFragment.
Expand Down Expand Up @@ -55,13 +61,21 @@ class LanguageDialogFragment : InjectableDialogFragment() {
val languageNameArrayList = ArrayList<String>()

for (languageCode in languageCodeArrayList) {
val audioLanguage = when (machineLocale.run { languageCode.toMachineLowerCase() }) {
"hi" -> AudioLanguage.HINDI_AUDIO_LANGUAGE
"fr" -> AudioLanguage.FRENCH_AUDIO_LANGUAGE
"zh" -> AudioLanguage.CHINESE_AUDIO_LANGUAGE
"pt", "pt-br" -> AudioLanguage.BRAZILIAN_PORTUGUESE_LANGUAGE
"ar" -> AudioLanguage.ARABIC_LANGUAGE
"pcm" -> AudioLanguage.NIGERIAN_PIDGIN_LANGUAGE
else -> AudioLanguage.ENGLISH_AUDIO_LANGUAGE
}
if (languageCode == "hi-en") {
languageNameArrayList.add("Hinglish")
} else {
// TODO(#3791): Remove this dependency.
val locale = Locale(languageCode)
val name = locale.getDisplayLanguage(locale)
languageNameArrayList.add(name)
languageNameArrayList.add(
appLanguageResourceHandler.computeLocalizedDisplayName(audioLanguage)
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import org.oppia.android.domain.translation.TranslationController
import org.oppia.android.util.data.AsyncResult
import org.oppia.android.util.data.DataProviders.Companion.toLiveData
import org.oppia.android.util.locale.OppiaLocale
import org.oppia.android.util.platformparameter.EnableLearnerStudyAnalytics
import org.oppia.android.util.platformparameter.EnableFastLanguageSwitchingInLesson
import org.oppia.android.util.platformparameter.PlatformParameterValue
import javax.inject.Inject

Expand All @@ -39,7 +39,8 @@ class StateViewModel @Inject constructor(
private val oppiaLogger: OppiaLogger,
private val fragment: Fragment,
private val profileManagementController: ProfileManagementController,
@EnableLearnerStudyAnalytics private val enableLearnerStudy: PlatformParameterValue<Boolean>
@EnableFastLanguageSwitchingInLesson
private val enableFastLanguageSwitchingInLesson: PlatformParameterValue<Boolean>
) : ObservableViewModel() {
val itemList: ObservableList<StateItemViewModel> = ObservableArrayList()
val rightItemList: ObservableList<StateItemViewModel> = ObservableArrayList()
Expand All @@ -52,7 +53,7 @@ class StateViewModel @Inject constructor(
val isHintBulbVisible = ObservableField(false)
val isHintOpenedAndUnRevealed = ObservableField(false)

val hasSupportForSwitchingToSwahili: Boolean = enableLearnerStudy.value
val hasSupportForSwitchingToSwahili: Boolean = enableFastLanguageSwitchingInLesson.value
val hasSwahiliTranslations: LiveData<Boolean> by lazy {
Transformations.map(
explorationProgressController.getCurrentState().toLiveData(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import org.oppia.android.domain.profile.ProfileManagementController
import org.oppia.android.util.data.AsyncResult
import org.oppia.android.util.data.DataProviders.Companion.toLiveData
import org.oppia.android.util.platformparameter.EnableDownloadsSupport
import org.oppia.android.util.platformparameter.EnableFastLanguageSwitchingInLesson
import org.oppia.android.util.platformparameter.EnableLearnerStudyAnalytics
import org.oppia.android.util.platformparameter.PlatformParameterValue
import javax.inject.Inject
Expand All @@ -21,15 +22,18 @@ class ProfileEditViewModel @Inject constructor(
private val oppiaLogger: OppiaLogger,
private val profileManagementController: ProfileManagementController,
@EnableDownloadsSupport private val enableDownloadsSupport: PlatformParameterValue<Boolean>,
@EnableLearnerStudyAnalytics private val enableLearnerStudy: PlatformParameterValue<Boolean>
@EnableLearnerStudyAnalytics private val enableLearnerStudy: PlatformParameterValue<Boolean>,
@EnableFastLanguageSwitchingInLesson
private val enableFastLanguageSwitchingInLesson: PlatformParameterValue<Boolean>
) : ObservableViewModel() {
private lateinit var profileId: ProfileId

/** Whether the admin is allowed to mark chapters as finished. */
val isAllowedToMarkFinishedChapters: Boolean = enableLearnerStudy.value

/** Whether the admin can allow learners to quickly switch content languages within a lesson. */
val isAllowedToEnableQuickLessonLanguageSwitching: Boolean = enableLearnerStudy.value
val isAllowedToEnableQuickLessonLanguageSwitching: Boolean =
enableFastLanguageSwitchingInLesson.value

/** List of all the current profiles registered in the app [ProfileListFragment]. */
val profile: LiveData<Profile> by lazy {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class SpotlightFragment : InjectableFragment(), SpotlightNavigationListener, Spo
if (targetList.isNullOrEmpty()) return
spotlight = Spotlight.Builder(activity)
.setTargets(targetList)
.setBackgroundColorRes(R.color.component_color_shared_close_spotlight_button_color)
.setBackgroundColorRes(R.color.component_color_shared_spotlight_overlay_background_color)
.setDuration(500L)
.setAnimation(AccelerateInterpolator(0.5f))
.setOnSpotlightListener(object : OnSpotlightListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ class AppLanguageResourceHandler @Inject constructor(
AudioLanguage.FRENCH_AUDIO_LANGUAGE -> getLocalizedDisplayName("fr")
AudioLanguage.CHINESE_AUDIO_LANGUAGE -> getLocalizedDisplayName("zh")
AudioLanguage.BRAZILIAN_PORTUGUESE_LANGUAGE -> getLocalizedDisplayName("pt", "BR")
AudioLanguage.ARABIC_LANGUAGE -> getLocalizedDisplayName("ar", "EG")
AudioLanguage.NIGERIAN_PIDGIN_LANGUAGE ->
resources.getString(R.string.nigerian_pidgin_localized_language_name)
AudioLanguage.NO_AUDIO, AudioLanguage.AUDIO_LANGUAGE_UNSPECIFIED, AudioLanguage.UNRECOGNIZED,
AudioLanguage.ENGLISH_AUDIO_LANGUAGE -> getLocalizedDisplayName("en")
}
Expand All @@ -180,6 +183,8 @@ class AppLanguageResourceHandler @Inject constructor(
OppiaLanguage.ENGLISH -> resources.getString(R.string.english_localized_language_name)
OppiaLanguage.ARABIC -> resources.getString(R.string.arabic_localized_language_name)
OppiaLanguage.HINGLISH -> resources.getString(R.string.hinglish_localized_language_name)
OppiaLanguage.NIGERIAN_PIDGIN ->
resources.getString(R.string.nigerian_pidgin_localized_language_name)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import org.oppia.android.app.model.OppiaLanguage.ENGLISH
import org.oppia.android.app.model.OppiaLanguage.HINDI
import org.oppia.android.app.model.OppiaLanguage.HINGLISH
import org.oppia.android.app.model.OppiaLanguage.LANGUAGE_UNSPECIFIED
import org.oppia.android.app.model.OppiaLanguage.NIGERIAN_PIDGIN
import org.oppia.android.app.model.OppiaLanguage.PORTUGUESE
import org.oppia.android.app.model.OppiaLanguage.SWAHILI
import org.oppia.android.app.model.OppiaLanguage.UNRECOGNIZED
Expand Down Expand Up @@ -72,8 +73,8 @@ class MathExpressionAccessibilityUtil @Inject constructor(
): String? {
return when (language) {
ENGLISH -> expression.toHumanReadableEnglishString(divAsFraction)
ARABIC, HINDI, HINGLISH, PORTUGUESE, BRAZILIAN_PORTUGUESE, SWAHILI, LANGUAGE_UNSPECIFIED,
UNRECOGNIZED -> null
ARABIC, HINDI, HINGLISH, PORTUGUESE, BRAZILIAN_PORTUGUESE, SWAHILI, NIGERIAN_PIDGIN,
LANGUAGE_UNSPECIFIED, UNRECOGNIZED -> null
}
}

Expand All @@ -91,8 +92,8 @@ class MathExpressionAccessibilityUtil @Inject constructor(
): String? {
return when (language) {
ENGLISH -> equation.toHumanReadableEnglishString(divAsFraction)
ARABIC, HINDI, HINGLISH, PORTUGUESE, BRAZILIAN_PORTUGUESE, SWAHILI, LANGUAGE_UNSPECIFIED,
UNRECOGNIZED -> null
ARABIC, HINDI, HINGLISH, PORTUGUESE, BRAZILIAN_PORTUGUESE, SWAHILI, NIGERIAN_PIDGIN,
LANGUAGE_UNSPECIFIED, UNRECOGNIZED -> null
}
}

Expand Down
Loading

0 comments on commit 8c81c98

Please sign in to comment.