diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b4a1de1c04a..d2c51eaa7e2 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -250,6 +250,7 @@ WORKSPACE @oppia/android-app-infrastructure-reviewers .bazelrc @oppia/android-app-infrastructure-reviewers .bazelversion @oppia/android-app-infrastructure-reviewers /tools/android/ @oppia/android-app-infrastructure-reviewers +/tools/kotlin/ @oppia/android-app-infrastructure-reviewers # Configurations for Bazel-built Android App Bundles. /bundle_config.pb.json @oppia/android-dev-workflow-reviewers diff --git a/app/src/main/java/org/oppia/android/app/administratorcontrols/AdministratorControlsActivity.kt b/app/src/main/java/org/oppia/android/app/administratorcontrols/AdministratorControlsActivity.kt index fe9aca347f4..f357a02a2ae 100644 --- a/app/src/main/java/org/oppia/android/app/administratorcontrols/AdministratorControlsActivity.kt +++ b/app/src/main/java/org/oppia/android/app/administratorcontrols/AdministratorControlsActivity.kt @@ -138,7 +138,7 @@ class AdministratorControlsActivity : if (fragment is ProfileEditFragment) { administratorControlsActivityPresenter.handleOnBackPressed() } else { - @Suppress("DEPRECATION") // TODO: Fix this properly or file a bug. + @Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher. super.onBackPressed() } } diff --git a/app/src/main/java/org/oppia/android/app/administratorcontrols/appversion/AppVersionActivity.kt b/app/src/main/java/org/oppia/android/app/administratorcontrols/appversion/AppVersionActivity.kt index 0c80eac7390..e41600bb929 100644 --- a/app/src/main/java/org/oppia/android/app/administratorcontrols/appversion/AppVersionActivity.kt +++ b/app/src/main/java/org/oppia/android/app/administratorcontrols/appversion/AppVersionActivity.kt @@ -23,7 +23,7 @@ class AppVersionActivity : InjectableAutoLocalizedAppCompatActivity() { override fun onOptionsItemSelected(item: MenuItem): Boolean { if (item.itemId == android.R.id.home) { - @Suppress("DEPRECATION") // TODO: Fix this properly or file a bug. + @Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher. onBackPressed() } return super.onOptionsItemSelected(item) diff --git a/app/src/main/java/org/oppia/android/app/administratorcontrols/learneranalytics/ProfileAndDeviceIdActivity.kt b/app/src/main/java/org/oppia/android/app/administratorcontrols/learneranalytics/ProfileAndDeviceIdActivity.kt index 33f04e2687a..cf6fb025db6 100644 --- a/app/src/main/java/org/oppia/android/app/administratorcontrols/learneranalytics/ProfileAndDeviceIdActivity.kt +++ b/app/src/main/java/org/oppia/android/app/administratorcontrols/learneranalytics/ProfileAndDeviceIdActivity.kt @@ -28,7 +28,7 @@ class ProfileAndDeviceIdActivity : InjectableAutoLocalizedAppCompatActivity() { override fun onOptionsItemSelected(item: MenuItem): Boolean { if (item.itemId == android.R.id.home) { - @Suppress("DEPRECATION") // TODO: Fix this properly or file a bug. + @Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher. onBackPressed() } return super.onOptionsItemSelected(item) diff --git a/app/src/main/java/org/oppia/android/app/devoptions/markchapterscompleted/MarkChaptersCompletedActivity.kt b/app/src/main/java/org/oppia/android/app/devoptions/markchapterscompleted/MarkChaptersCompletedActivity.kt index e169d07a3d8..0c93279a099 100644 --- a/app/src/main/java/org/oppia/android/app/devoptions/markchapterscompleted/MarkChaptersCompletedActivity.kt +++ b/app/src/main/java/org/oppia/android/app/devoptions/markchapterscompleted/MarkChaptersCompletedActivity.kt @@ -33,7 +33,7 @@ class MarkChaptersCompletedActivity : InjectableAutoLocalizedAppCompatActivity() override fun onOptionsItemSelected(item: MenuItem): Boolean { if (item.itemId == android.R.id.home) { - @Suppress("DEPRECATION") // TODO: Fix this properly or file a bug. + @Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher. onBackPressed() } return super.onOptionsItemSelected(item) diff --git a/app/src/main/java/org/oppia/android/app/devoptions/markstoriescompleted/MarkStoriesCompletedActivity.kt b/app/src/main/java/org/oppia/android/app/devoptions/markstoriescompleted/MarkStoriesCompletedActivity.kt index 8633005dad6..5c26e1408a4 100644 --- a/app/src/main/java/org/oppia/android/app/devoptions/markstoriescompleted/MarkStoriesCompletedActivity.kt +++ b/app/src/main/java/org/oppia/android/app/devoptions/markstoriescompleted/MarkStoriesCompletedActivity.kt @@ -33,7 +33,7 @@ class MarkStoriesCompletedActivity : InjectableAutoLocalizedAppCompatActivity() override fun onOptionsItemSelected(item: MenuItem): Boolean { if (item.itemId == android.R.id.home) { - @Suppress("DEPRECATION") // TODO: Fix this properly or file a bug. + @Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher. onBackPressed() } return super.onOptionsItemSelected(item) diff --git a/app/src/main/java/org/oppia/android/app/devoptions/marktopicscompleted/MarkTopicsCompletedActivity.kt b/app/src/main/java/org/oppia/android/app/devoptions/marktopicscompleted/MarkTopicsCompletedActivity.kt index 4e0b61991ca..6801d2fcea0 100644 --- a/app/src/main/java/org/oppia/android/app/devoptions/marktopicscompleted/MarkTopicsCompletedActivity.kt +++ b/app/src/main/java/org/oppia/android/app/devoptions/marktopicscompleted/MarkTopicsCompletedActivity.kt @@ -34,7 +34,7 @@ class MarkTopicsCompletedActivity : InjectableAutoLocalizedAppCompatActivity() { override fun onOptionsItemSelected(item: MenuItem): Boolean { if (item.itemId == android.R.id.home) { - @Suppress("DEPRECATION") // TODO: Fix this properly or file a bug. + @Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher. onBackPressed() } return super.onOptionsItemSelected(item) diff --git a/app/src/main/java/org/oppia/android/app/options/OptionsActivity.kt b/app/src/main/java/org/oppia/android/app/options/OptionsActivity.kt index 874f0bb5916..ccbcea40b7b 100644 --- a/app/src/main/java/org/oppia/android/app/options/OptionsActivity.kt +++ b/app/src/main/java/org/oppia/android/app/options/OptionsActivity.kt @@ -83,7 +83,7 @@ class OptionsActivity : selectedFragment = if (savedInstanceState == null) { READING_TEXT_SIZE_FRAGMENT } else { - @Suppress("DEPRECATION") // TODO: Fix this properly or file a bug. + @Suppress("DEPRECATION") // TODO(#5405): Ensure the correct type is being retrieved. savedInstanceState.get(SELECTED_FRAGMENT_SAVED_KEY) as String } val extraOptionsTitle = diff --git a/app/src/main/java/org/oppia/android/app/options/ReadingTextSizeActivityPresenter.kt b/app/src/main/java/org/oppia/android/app/options/ReadingTextSizeActivityPresenter.kt index 7617ffc53a9..85eedd9d379 100644 --- a/app/src/main/java/org/oppia/android/app/options/ReadingTextSizeActivityPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/options/ReadingTextSizeActivityPresenter.kt @@ -28,7 +28,7 @@ class ReadingTextSizeActivityPresenter @Inject constructor( private fun setToolbar() { val readingTextSizeToolbar: Toolbar = activity.findViewById(R.id.reading_text_size_toolbar) readingTextSizeToolbar.setNavigationOnClickListener { - @Suppress("DEPRECATION") // TODO: Fix this properly or file a bug. + @Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher. activity.onBackPressed() } } diff --git a/app/src/main/java/org/oppia/android/app/player/exploration/ExplorationActivityPresenter.kt b/app/src/main/java/org/oppia/android/app/player/exploration/ExplorationActivityPresenter.kt index b2db7bfd960..54cde19b341 100644 --- a/app/src/main/java/org/oppia/android/app/player/exploration/ExplorationActivityPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/player/exploration/ExplorationActivityPresenter.kt @@ -111,7 +111,7 @@ class ExplorationActivityPresenter @Inject constructor( } binding.explorationToolbar.setNavigationOnClickListener { - @Suppress("DEPRECATION") // TODO: Fix this properly or file a bug. + @Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher. activity.onBackPressed() } diff --git a/app/src/main/java/org/oppia/android/app/player/state/StateFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/player/state/StateFragmentPresenter.kt index 8c9bd6cba4a..aea996137c5 100755 --- a/app/src/main/java/org/oppia/android/app/player/state/StateFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/player/state/StateFragmentPresenter.kt @@ -431,7 +431,7 @@ class StateFragmentPresenter @Inject constructor( activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager inputManager.hideSoftInputFromWindow( fragment.view!!.windowToken, - @Suppress("DEPRECATION") // TODO: Fix this properly or file a bug. + @Suppress("DEPRECATION") // TODO(#5406): Use the correct constant value here. InputMethodManager.SHOW_FORCED ) } diff --git a/app/src/main/java/org/oppia/android/app/resumelesson/ResumeLessonActivityPresenter.kt b/app/src/main/java/org/oppia/android/app/resumelesson/ResumeLessonActivityPresenter.kt index ffb7771810f..e6cbc39c507 100644 --- a/app/src/main/java/org/oppia/android/app/resumelesson/ResumeLessonActivityPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/resumelesson/ResumeLessonActivityPresenter.kt @@ -33,7 +33,7 @@ class ResumeLessonActivityPresenter @Inject constructor( activity.setSupportActionBar(resumeLessonToolbar) resumeLessonToolbar.setNavigationOnClickListener { - @Suppress("DEPRECATION") // TODO: Fix this properly or file a bug. + @Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher. activity.onBackPressed() } diff --git a/app/src/main/java/org/oppia/android/app/settings/profile/ProfileEditActivity.kt b/app/src/main/java/org/oppia/android/app/settings/profile/ProfileEditActivity.kt index 28d7b57217e..2e42ba5bbff 100644 --- a/app/src/main/java/org/oppia/android/app/settings/profile/ProfileEditActivity.kt +++ b/app/src/main/java/org/oppia/android/app/settings/profile/ProfileEditActivity.kt @@ -48,7 +48,7 @@ class ProfileEditActivity : InjectableAutoLocalizedAppCompatActivity() { override fun onBackPressed() { val isMultipane = intent.extras!!.getBoolean(IS_MULTIPANE_EXTRA_KEY, false) if (isMultipane) { - @Suppress("DEPRECATION") // TODO: Fix this properly or file a bug. + @Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher. super.onBackPressed() } else { val intent = Intent(this, ProfileListActivity::class.java) diff --git a/app/src/main/java/org/oppia/android/app/settings/profile/ProfileEditActivityPresenter.kt b/app/src/main/java/org/oppia/android/app/settings/profile/ProfileEditActivityPresenter.kt index d1b1f07c9a8..dd6b0f39e78 100644 --- a/app/src/main/java/org/oppia/android/app/settings/profile/ProfileEditActivityPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/settings/profile/ProfileEditActivityPresenter.kt @@ -26,7 +26,7 @@ class ProfileEditActivityPresenter @Inject constructor( toolbar.setNavigationOnClickListener { if (isMultipane) { - @Suppress("DEPRECATION") // TODO: Fix this properly or file a bug. + @Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher. activity.onBackPressed() } else { val intent = Intent(activity, ProfileListActivity::class.java) diff --git a/app/src/main/java/org/oppia/android/app/survey/SurveyFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/survey/SurveyFragmentPresenter.kt index c35491df56c..062a4d3864e 100644 --- a/app/src/main/java/org/oppia/android/app/survey/SurveyFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/survey/SurveyFragmentPresenter.kt @@ -334,7 +334,7 @@ class SurveyFragmentPresenter @Inject constructor( activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager inputManager.hideSoftInputFromWindow( fragment.view!!.windowToken, - @Suppress("DEPRECATION") // TODO: Fix this properly or file a bug. + @Suppress("DEPRECATION") // TODO(#5406): Use the correct constant value here. InputMethodManager.SHOW_FORCED ) } diff --git a/app/src/main/java/org/oppia/android/app/testing/FractionInputInteractionViewTestActivity.kt b/app/src/main/java/org/oppia/android/app/testing/FractionInputInteractionViewTestActivity.kt index 039e918d6a1..1e0a95cb7d9 100644 --- a/app/src/main/java/org/oppia/android/app/testing/FractionInputInteractionViewTestActivity.kt +++ b/app/src/main/java/org/oppia/android/app/testing/FractionInputInteractionViewTestActivity.kt @@ -3,7 +3,6 @@ package org.oppia.android.app.testing import android.content.Context import android.content.Intent import android.os.Bundle -import android.view.View import androidx.databinding.DataBindingUtil import org.oppia.android.R import org.oppia.android.app.activity.ActivityComponentImpl @@ -60,12 +59,9 @@ class FractionInputInteractionViewTestActivity : ) writtenTranslationContext = params.writtenTranslationContext binding.fractionInteractionViewModel = fractionInteractionViewModel - } - - /** Checks submit-time errors. */ - @Suppress("UNUSED_PARAMETER") // TODO: Fix this properly or file a bug. - fun getPendingAnswerErrorOnSubmitClick(v: View) { - fractionInteractionViewModel.checkPendingAnswerError(AnswerErrorCategory.SUBMIT_TIME) + binding.getPendingAnswerErrorOnSubmitClick = Runnable { + fractionInteractionViewModel.checkPendingAnswerError(AnswerErrorCategory.SUBMIT_TIME) + } } override fun onPendingAnswerErrorOrAvailabilityCheck( diff --git a/app/src/main/java/org/oppia/android/app/testing/RatioInputInteractionViewTestActivity.kt b/app/src/main/java/org/oppia/android/app/testing/RatioInputInteractionViewTestActivity.kt index 53a584fe15c..f307c69d318 100644 --- a/app/src/main/java/org/oppia/android/app/testing/RatioInputInteractionViewTestActivity.kt +++ b/app/src/main/java/org/oppia/android/app/testing/RatioInputInteractionViewTestActivity.kt @@ -3,7 +3,6 @@ package org.oppia.android.app.testing import android.content.Context import android.content.Intent import android.os.Bundle -import android.view.View import androidx.databinding.DataBindingUtil import org.oppia.android.R import org.oppia.android.app.activity.ActivityComponentImpl @@ -71,15 +70,10 @@ class RatioInputInteractionViewTestActivity : writtenTranslationContext = params.writtenTranslationContext binding.ratioInteractionInputViewModel = ratioExpressionInputInteractionViewModel - } - - /** - * Checks for submit time errors. - */ - @Suppress("UNUSED_PARAMETER") // TODO: Fix this properly or file a bug. - fun getPendingAnswerErrorOnSubmitClick(v: View) { - ratioExpressionInputInteractionViewModel - .checkPendingAnswerError(AnswerErrorCategory.SUBMIT_TIME) + binding.getPendingAnswerErrorOnSubmitClick = Runnable { + ratioExpressionInputInteractionViewModel + .checkPendingAnswerError(AnswerErrorCategory.SUBMIT_TIME) + } } override fun onAnswerReadyForSubmission(answer: UserAnswer) { } diff --git a/app/src/main/java/org/oppia/android/app/testing/TestFontScaleConfigurationUtilActivity.kt b/app/src/main/java/org/oppia/android/app/testing/TestFontScaleConfigurationUtilActivity.kt index 71f25dde212..03e8d29d3dd 100644 --- a/app/src/main/java/org/oppia/android/app/testing/TestFontScaleConfigurationUtilActivity.kt +++ b/app/src/main/java/org/oppia/android/app/testing/TestFontScaleConfigurationUtilActivity.kt @@ -17,7 +17,7 @@ class TestFontScaleConfigurationUtilActivity : InjectableAutoLocalizedAppCompatA override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) (activityComponent as ActivityComponentImpl).inject(this) - @Suppress("DEPRECATION") // TODO: Fix this properly or file a bug. + @Suppress("DEPRECATION") // TODO(#5405): Ensure the correct type is being retrieved. val readingTextSize = checkNotNull( intent.getSerializableExtra(FONT_SCALE_EXTRA_KEY) as? ReadingTextSize ) { "Expected $FONT_SCALE_EXTRA_KEY to be in intent extras." } diff --git a/app/src/main/java/org/oppia/android/app/testing/TextInputInteractionViewTestActivity.kt b/app/src/main/java/org/oppia/android/app/testing/TextInputInteractionViewTestActivity.kt index 04e25f4b8ac..2a175fb9429 100644 --- a/app/src/main/java/org/oppia/android/app/testing/TextInputInteractionViewTestActivity.kt +++ b/app/src/main/java/org/oppia/android/app/testing/TextInputInteractionViewTestActivity.kt @@ -1,7 +1,6 @@ package org.oppia.android.app.testing import android.os.Bundle -import android.view.View import androidx.databinding.DataBindingUtil import org.oppia.android.R import org.oppia.android.app.activity.ActivityComponentImpl @@ -51,12 +50,9 @@ class TextInputInteractionViewTestActivity : writtenTranslationContext = WrittenTranslationContext.getDefaultInstance() binding.textInputViewModel = textInputViewModel - } - - /** Checks submit-time errors. */ - @Suppress("UNUSED_PARAMETER") // TODO: Fix this properly or file a bug. - fun getPendingAnswerErrorOnSubmitClick(v: View) { - textInputViewModel.checkPendingAnswerError(AnswerErrorCategory.SUBMIT_TIME) + binding.getPendingAnswerErrorOnSubmitClick = Runnable { + textInputViewModel.checkPendingAnswerError(AnswerErrorCategory.SUBMIT_TIME) + } } override fun onPendingAnswerErrorOrAvailabilityCheck( diff --git a/app/src/main/java/org/oppia/android/app/topic/practice/TopicPracticeFragment.kt b/app/src/main/java/org/oppia/android/app/topic/practice/TopicPracticeFragment.kt index dcd910b68a6..d5cc29fc1d8 100644 --- a/app/src/main/java/org/oppia/android/app/topic/practice/TopicPracticeFragment.kt +++ b/app/src/main/java/org/oppia/android/app/topic/practice/TopicPracticeFragment.kt @@ -46,8 +46,8 @@ class TopicPracticeFragment : InjectableFragment() { var selectedSkillId = HashMap>() if (savedInstanceState != null) { selectedIdList = savedInstanceState.getIntegerArrayList(SUBTOPIC_ID_LIST_ARGUMENT_KEY)!! - // TODO(#4437): Convert this to a type-safe proto. - @Suppress("DEPRECATION") // TODO: Fix this properly or file a bug. + // TODO(#4986): Convert this to a type-safe proto. + @Suppress("DEPRECATION") // TODO(#5405): Ensure the correct type is being retrieved. @Suppress("UNCHECKED_CAST") // Not quite safe. selectedSkillId = savedInstanceState .getSerializable(SKILL_ID_LIST_ARGUMENT_KEY)!! as HashMap> diff --git a/app/src/main/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivityPresenter.kt b/app/src/main/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivityPresenter.kt index 0bd9755d36c..a97d28ce138 100644 --- a/app/src/main/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivityPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivityPresenter.kt @@ -47,7 +47,7 @@ class QuestionPlayerActivityPresenter @Inject constructor( activity.setSupportActionBar(binding.questionPlayerToolbar) binding.questionPlayerToolbar.setNavigationOnClickListener { - @Suppress("DEPRECATION") // TODO: Fix this properly or file a bug. + @Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher. activity.onBackPressed() } diff --git a/app/src/main/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerFragmentPresenter.kt index d536d0fc97c..78a978ba51c 100644 --- a/app/src/main/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerFragmentPresenter.kt @@ -315,7 +315,7 @@ class QuestionPlayerFragmentPresenter @Inject constructor( activity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager inputManager.hideSoftInputFromWindow( fragment.view!!.windowToken, - @Suppress("DEPRECATION") // TODO: Fix this properly or file a bug. + @Suppress("DEPRECATION") // TODO(#5406): Use the correct constant value here. InputMethodManager.SHOW_FORCED ) } diff --git a/app/src/main/java/org/oppia/android/app/walkthrough/end/WalkthroughFinalFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/walkthrough/end/WalkthroughFinalFragmentPresenter.kt index f2c2a9f4f74..f3f44e0875f 100644 --- a/app/src/main/java/org/oppia/android/app/walkthrough/end/WalkthroughFinalFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/walkthrough/end/WalkthroughFinalFragmentPresenter.kt @@ -106,7 +106,7 @@ class WalkthroughFinalFragmentPresenter @Inject constructor( } override fun goBack() { - @Suppress("DEPRECATION") // TODO: Fix this properly or file a bug. + @Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher. activity.onBackPressed() } } diff --git a/app/src/main/res/layout/activity_fraction_input_interaction_view_test.xml b/app/src/main/res/layout/activity_fraction_input_interaction_view_test.xml index ddd18d752d9..d472a7b47bf 100644 --- a/app/src/main/res/layout/activity_fraction_input_interaction_view_test.xml +++ b/app/src/main/res/layout/activity_fraction_input_interaction_view_test.xml @@ -10,6 +10,10 @@ + + diff --git a/app/src/main/res/layout/activity_ratio_input_interaction_view_test.xml b/app/src/main/res/layout/activity_ratio_input_interaction_view_test.xml index 58967b0727c..fe23c703dc8 100644 --- a/app/src/main/res/layout/activity_ratio_input_interaction_view_test.xml +++ b/app/src/main/res/layout/activity_ratio_input_interaction_view_test.xml @@ -10,6 +10,10 @@ + + diff --git a/app/src/main/res/layout/activity_text_input_interaction_view_test.xml b/app/src/main/res/layout/activity_text_input_interaction_view_test.xml index 10bb57bf9f8..89ef862f1fd 100644 --- a/app/src/main/res/layout/activity_text_input_interaction_view_test.xml +++ b/app/src/main/res/layout/activity_text_input_interaction_view_test.xml @@ -10,6 +10,10 @@ + + diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/AnalyticsController.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/AnalyticsController.kt index cbe5a89316d..76bac6fe92f 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/AnalyticsController.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/AnalyticsController.kt @@ -199,7 +199,6 @@ class AnalyticsController @Inject constructor( .addEventLogsToUpload(eventLog) .build() } else { - // TODO(#1433): Refactoring for logging exceptions to both console and exception loggers. val exception = IllegalStateException("Least Recent Event index absent -- EventLogCacheStoreSize is 0") consoleLogger.e("AnalyticsController", "Failure while caching event.", exception) diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsController.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsController.kt index 710679e58f3..f518ff6121e 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsController.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/PerformanceMetricsController.kt @@ -81,7 +81,6 @@ class PerformanceMetricsController @Inject constructor( .addOppiaMetricLog(oppiaMetricLog) .build() } else { - // TODO(#1433): Refactoring for logging exceptions to both console and exception loggers. val exception = IllegalStateException( "Least Recent Event index absent -- MetricLogStorageCacheSize is 0" diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/exceptions/ExceptionsController.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/exceptions/ExceptionsController.kt index 56c6f835565..16e8640a1c9 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/exceptions/ExceptionsController.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/exceptions/ExceptionsController.kt @@ -125,12 +125,12 @@ class ExceptionsController @Inject constructor( .addExceptionLog(exceptionLog) .build() } else { - // TODO(#1433): Refactoring for logging exceptions to both console and exception loggers. val exception = NullPointerException( "Least Recent Exception index absent -- ExceptionLogCacheStoreSize is 0" ) consoleLogger.e(EXCEPTIONS_CONTROLLER, exception.toString()) + exceptionLogger.logException(exception) } } return@storeDataAsync oppiaExceptionLogs.toBuilder().addExceptionLog(exceptionLog).build() diff --git a/scripts/src/java/org/oppia/android/scripts/license/MavenDependenciesRetriever.kt b/scripts/src/java/org/oppia/android/scripts/license/MavenDependenciesRetriever.kt index 33bcf996591..43f0193047c 100644 --- a/scripts/src/java/org/oppia/android/scripts/license/MavenDependenciesRetriever.kt +++ b/scripts/src/java/org/oppia/android/scripts/license/MavenDependenciesRetriever.kt @@ -192,40 +192,33 @@ class MavenDependenciesRetriever( finalDependenciesList: List ): Deferred { return CoroutineScope(scriptBgDispatcher).async { - val pomCandidates = finalDependenciesList.map { MavenListDependencyPomCandidate(it) } + val candidates = finalDependenciesList.map { MavenListDependencyPomCandidate(it) } + val undoneCandidates = candidates.filterTo(mutableSetOf()) { it.latestPomFileText == null } var attemptCount = 0 - var pomCandidatesToUpdate = pomCandidates.filter { - it.latestPomFileText == null && it.downloadTryCount < 10 - } - while (pomCandidatesToUpdate.isNotEmpty()) { + while (undoneCandidates.isNotEmpty() && attemptCount < 10) { println( "Attempt ${++attemptCount} to download POM files for" + - " ${pomCandidatesToUpdate.size}/${pomCandidates.size} Maven artifacts..." + " ${undoneCandidates.size}/${candidates.size} Maven artifacts..." ) - pomCandidatesToUpdate.map { pomCandidate -> + undoneCandidates -= undoneCandidates.map { pomCandidate -> CoroutineScope(scriptBgDispatcher).async { // Run blocking I/O operations on the I/O thread pool. withContext(Dispatchers.IO) { - mavenArtifactPropertyFetcher.scrapeText(pomCandidate.pomFileUrl) + pomCandidate to mavenArtifactPropertyFetcher.scrapeText(pomCandidate.pomFileUrl) } } - }.awaitAll().forEachIndexed { index, pomFileText -> - val pomCandidate = pomCandidatesToUpdate[index] - pomCandidate.latestPomFileText = pomFileText - pomCandidate.downloadTryCount++ - } - pomCandidatesToUpdate = pomCandidates.filter { - it.latestPomFileText == null && it.downloadTryCount < 10 + }.awaitAll().mapNotNullTo(mutableSetOf()) { (pomCandidate, pomFileText) -> + // Map back to the original failing candidate, and try to update its text. + pomCandidate.takeIf { pomFileText != null }?.also { it.latestPomFileText = pomFileText } } } - val failedToDownload = pomCandidates.filter { it.latestPomFileText == null } - check(failedToDownload.isEmpty()) { - "Failed to download ${failedToDownload.size}/${pomCandidates.size} POM files:" + - " $failedToDownload." + check(undoneCandidates.isEmpty()) { + "Failed to download ${undoneCandidates.size}/${candidates.size} POM files:" + + " $undoneCandidates." } return@async MavenDependencyList.newBuilder().apply { this.addAllMavenDependency( - pomCandidates.map { pomCandidate -> + candidates.map { pomCandidate -> MavenDependency.newBuilder().apply { this.artifactName = pomCandidate.dep.coord.reducedCoordinateString this.artifactVersion = pomCandidate.dep.coord.version @@ -483,8 +476,7 @@ class MavenDependenciesRetriever( private data class MavenListDependencyPomCandidate( val dep: MavenListDependency, - var latestPomFileText: String? = null, - var downloadTryCount: Int = 0 + var latestPomFileText: String? = null ) { private val repoBaseUrl: String get() = dep.repoUrls.firstOrNull() ?: error("No repo URL found for artifact: $dep.") diff --git a/utility/src/main/java/org/oppia/android/util/extensions/BundleExtensions.kt b/utility/src/main/java/org/oppia/android/util/extensions/BundleExtensions.kt index c9bde0186cd..d2a955011b2 100644 --- a/utility/src/main/java/org/oppia/android/util/extensions/BundleExtensions.kt +++ b/utility/src/main/java/org/oppia/android/util/extensions/BundleExtensions.kt @@ -72,7 +72,7 @@ fun Intent.getProtoExtra(name: String, defaultValue: T): T { */ fun Bundle.getStringFromBundle(key: String): String? = getString(key) -// TODO: Migrate this to BundleCompat. +// TODO(#5405): Migrate this to BundleCompat. private inline fun Bundle.getTypedSerializable(name: String): T? { return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { getSerializableAboveApi32(name, T::class.java) diff --git a/utility/src/test/java/org/oppia/android/util/extensions/BundleExtensionsTest.kt b/utility/src/test/java/org/oppia/android/util/extensions/BundleExtensionsTest.kt index b4a094a8c93..384ff2df1f2 100644 --- a/utility/src/test/java/org/oppia/android/util/extensions/BundleExtensionsTest.kt +++ b/utility/src/test/java/org/oppia/android/util/extensions/BundleExtensionsTest.kt @@ -195,7 +195,7 @@ class BundleExtensionsTest { assertThat(intent).extras().hasSize(1) assertThat(intent).extras().containsKey("first_extra") - // TODO: Convert this to a type check with getSerializableExtra once Robolectric can be updated. + // TODO(#5405): Convert this to getSerializableExtra once Robolectric can be updated. assertThat(intent.getStringExtra("first_extra")).isNull() }