Skip to content

Commit 0506c5d

Browse files
authored
[RunAllTests] Fix part of #3974: Cherry-pick MR3 release blocker fixes (#3975)
* Fix #3946: Fix solution automatically revealing after first hint reveal (#3955) * Fix solution auto showing after hint reveal. See #3946 & PR for specifics. * Add translations for new hint/solution. * Lint fixes. * Add TODO. * Fix Gradle-variant tests. * Fix #3937: Ensure ViewEventLogsViewModel builds for alpha builds (#3957) * Ensure ViewEventLogsViewModel builds for alpha. * BUILD file lint fix. * Fix #3939 & #3938: Fix KitKat crash & SVG rendering issues (#3963) * Fix KitKat crash when opening Help menu. * Fix SVG rendering on SDKs 19-23 (incl). * Add regex check to prohibit Delegates. * Lint fixes. * Add exemption for regex script test. * Update file_content_validation_checks.textproto Grammar fix in error. * Update RegexPatternValidationCheckTest.kt Copy grammar fix to test copy of error. * Update version.bzl (#3964) Bump version codes for another RC of release-0.6. * Embed proguard.map in optimized AAB builds. (#3973)
1 parent de345f9 commit 0506c5d

File tree

19 files changed

+999
-296
lines changed

19 files changed

+999
-296
lines changed

app/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@ kt_android_library(
648648
"//third_party:androidx_databinding_databinding-runtime",
649649
"//utility",
650650
"//utility/src/main/java/org/oppia/android/util/extensions:context_extensions",
651+
"//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_event_logger",
651652
"//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module",
652653
# TODO(#59): Remove 'debug_util_module' once we completely migrate to Bazel from Gradle as
653654
# we can then directly exclude debug files from the build and thus won't be requiring this module.

app/src/main/java/org/oppia/android/app/help/HelpActivity.kt

+2-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import org.oppia.android.app.help.thirdparty.ThirdPartyDependencyListActivity
1414
import org.oppia.android.app.translation.AppLanguageResourceHandler
1515
import org.oppia.android.util.extensions.getStringFromBundle
1616
import javax.inject.Inject
17-
import kotlin.properties.Delegates
1817

1918
const val HELP_OPTIONS_TITLE_SAVED_KEY = "HelpActivity.help_options_title"
2019
const val SELECTED_FRAGMENT_SAVED_KEY = "HelpActivity.selected_fragment"
@@ -45,8 +44,6 @@ class HelpActivity :
4544

4645
private lateinit var selectedFragment: String
4746
private lateinit var selectedHelpOptionsTitle: String
48-
private var selectedDependencyIndex by Delegates.notNull<Int>()
49-
private var selectedLicenseIndex by Delegates.notNull<Int>()
5047

5148
override fun onCreate(savedInstanceState: Bundle?) {
5249
super.onCreate(savedInstanceState)
@@ -57,9 +54,9 @@ class HelpActivity :
5754
)
5855
selectedFragment =
5956
savedInstanceState?.getStringFromBundle(SELECTED_FRAGMENT_SAVED_KEY) ?: FAQ_LIST_FRAGMENT_TAG
60-
selectedDependencyIndex =
57+
val selectedDependencyIndex =
6158
savedInstanceState?.getInt(THIRD_PARTY_DEPENDENCY_INDEX_SAVED_KEY) ?: 0
62-
selectedLicenseIndex = savedInstanceState?.getInt(LICENSE_INDEX_SAVED_KEY) ?: 0
59+
val selectedLicenseIndex = savedInstanceState?.getInt(LICENSE_INDEX_SAVED_KEY) ?: 0
6360
selectedHelpOptionsTitle = savedInstanceState?.getStringFromBundle(HELP_OPTIONS_TITLE_SAVED_KEY)
6461
?: resourceHandler.getStringInLocale(R.string.faq_activity_title)
6562
helpActivityPresenter.handleOnCreate(

app/src/main/java/org/oppia/android/app/help/HelpActivityPresenter.kt

+12-7
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import org.oppia.android.app.help.thirdparty.LicenseTextViewerFragment
1818
import org.oppia.android.app.help.thirdparty.ThirdPartyDependencyListFragment
1919
import org.oppia.android.app.translation.AppLanguageResourceHandler
2020
import javax.inject.Inject
21-
import kotlin.properties.Delegates
2221

2322
/** The presenter for [HelpActivity]. */
2423
@ActivityScope
@@ -31,8 +30,8 @@ class HelpActivityPresenter @Inject constructor(
3130

3231
private lateinit var selectedFragmentTag: String
3332
private lateinit var selectedHelpOptionTitle: String
34-
private var selectedDependencyIndex by Delegates.notNull<Int>()
35-
private var selectedLicenseIndex by Delegates.notNull<Int>()
33+
private var selectedDependencyIndex: Int? = null
34+
private var selectedLicenseIndex: Int? = null
3635

3736
fun handleOnCreate(
3837
helpOptionsTitle: String,
@@ -60,7 +59,7 @@ class HelpActivityPresenter @Inject constructor(
6059
val titleTextView =
6160
activity.findViewById<TextView>(R.id.options_activity_selected_options_title)
6261
if (titleTextView != null) {
63-
setMultipaneContainerTitle(helpOptionsTitle!!)
62+
setMultipaneContainerTitle(helpOptionsTitle)
6463
}
6564
val isMultipane = activity.findViewById<FrameLayout>(R.id.multipane_options_container) != null
6665
if (isMultipane) {
@@ -140,8 +139,8 @@ class HelpActivityPresenter @Inject constructor(
140139
outState.putString(HELP_OPTIONS_TITLE_SAVED_KEY, titleTextView.text.toString())
141140
}
142141
outState.putString(SELECTED_FRAGMENT_SAVED_KEY, selectedFragmentTag)
143-
outState.putInt(THIRD_PARTY_DEPENDENCY_INDEX_SAVED_KEY, selectedDependencyIndex)
144-
outState.putInt(LICENSE_INDEX_SAVED_KEY, selectedLicenseIndex)
142+
selectedDependencyIndex?.let { outState.putInt(THIRD_PARTY_DEPENDENCY_INDEX_SAVED_KEY, it) }
143+
selectedLicenseIndex?.let { outState.putInt(LICENSE_INDEX_SAVED_KEY, it) }
145144
}
146145

147146
private fun setUpToolbar() {
@@ -156,7 +155,13 @@ class HelpActivityPresenter @Inject constructor(
156155
val currentFragment = getMultipaneOptionsFragment()
157156
if (currentFragment != null) {
158157
when (currentFragment) {
159-
is LicenseTextViewerFragment -> handleLoadLicenseListFragment(selectedDependencyIndex)
158+
is LicenseTextViewerFragment -> {
159+
handleLoadLicenseListFragment(
160+
checkNotNull(selectedDependencyIndex) {
161+
"Expected dependency index to be selected & defined"
162+
}
163+
)
164+
}
160165
is LicenseListFragment -> handleLoadThirdPartyDependencyListFragment()
161166
}
162167
}

app/src/sharedTest/java/org/oppia/android/app/player/state/StateFragmentTest.kt

+1
Original file line numberDiff line numberDiff line change
@@ -2603,6 +2603,7 @@ class StateFragmentTest {
26032603
targetTextViewId: Int
26042604
) {
26052605
scrollToViewType(SELECTION_INTERACTION)
2606+
// First, check that the option matches what's expected by the test.
26062607
onView(
26072608
atPositionOnView(
26082609
recyclerViewId = R.id.selection_interaction_recyclerview,

0 commit comments

Comments
 (0)