Skip to content
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

Fix #52: Finalize release 0.11 #5010

Merged
merged 23 commits into from
Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
e8f60f0
Prepare for 0.11 release.
BenHenning Jun 1, 2023
de0aaf0
Add support for decoding base64 event log strings.
BenHenning Jun 1, 2023
78dad17
Localisation updates from https://translatewiki.net.
translatewiki Jun 1, 2023
524607b
Merge branch 'translatewiki-prs' into finalize-release-0.11
BenHenning Jun 1, 2023
5d2712a
Pull latest pcm translations.
BenHenning Jun 1, 2023
509d05a
Add support for Nigerian Pidgin (Haija).
BenHenning Jun 1, 2023
702b711
Reduce & correct output when building AABs.
BenHenning Jun 1, 2023
898a94c
Merge branch 'develop' into finalize-release-0.11
BenHenning Jun 1, 2023
a088fca
Bunch of fixes.
BenHenning Jun 2, 2023
e98d83a
Enable spotlights & some other items.
BenHenning Jun 2, 2023
c5aeb48
Fixed a few things.
BenHenning Jun 2, 2023
dc4317c
Fix tests.
BenHenning Jun 3, 2023
5feac86
Follow up CI fixes and cleanup.
BenHenning Jun 3, 2023
d739210
Fix broken Gradle tests.
BenHenning Jun 3, 2023
ee8cd21
Fix several things.
BenHenning Jun 5, 2023
cbae5d8
Bunch of small changes.
BenHenning Jun 5, 2023
0de2a15
Merge remote-tracking branch 'origin/finalize-release-0.11' into fina…
BenHenning Jun 5, 2023
2a8c1f4
Merge branch 'develop' into finalize-release-0.11
BenHenning Jun 5, 2023
bd5fb45
Fix broken tests + other cleanups.
BenHenning Jun 5, 2023
83cf204
Fix broken CI tests.
BenHenning Jun 5, 2023
07b2ebf
Merge branch 'develop' into finalize-release-0.11
BenHenning Jun 5, 2023
a19e624
Address reviewer comments.
BenHenning Jun 5, 2023
18b9cd3
Lighten up spotlights background more.
BenHenning Jun 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
adhiamboperes marked this conversation as resolved.
Show resolved Hide resolved
// 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)
adhiamboperes marked this conversation as resolved.
Show resolved Hide resolved
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