diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index d2c51eaa7e2..fdf7a2db439 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -163,6 +163,7 @@ # Utilities that are primarily used for frontend/UI purposes. /utility/src/*/java/org/oppia/android/util/accessibility/ @oppia/android-frontend-reviewers /utility/src/*/java/org/oppia/android/util/statusbar/ @oppia/android-frontend-reviewers +/utility/src/main/java/org/oppia/android/util/enumfilter/ @oppia/android-frontend-reviewers /utility/src/*/java/org/oppia/android/util/extensions/ @oppia/android-frontend-reviewers /utility/src/*/java/org/oppia/android/util/parser/html @oppia/android-frontend-reviewers /utility/src/*/res/**/*.xml @oppia/android-frontend-reviewers diff --git a/.github/workflows/build_tests.yml b/.github/workflows/build_tests.yml index 7a024172368..cc05bacff3b 100644 --- a/.github/workflows/build_tests.yml +++ b/.github/workflows/build_tests.yml @@ -426,19 +426,6 @@ 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 - build_oppia_beta_aab: name: Build Oppia AAB (beta flavor) runs-on: ${{ matrix.os }} diff --git a/.github/workflows/comment_coverage_report.yml b/.github/workflows/comment_coverage_report.yml index 16c1ae0da63..0cc70da29a2 100644 --- a/.github/workflows/comment_coverage_report.yml +++ b/.github/workflows/comment_coverage_report.yml @@ -17,6 +17,8 @@ jobs: check_code_coverage_completed: name: Check code coverage completed runs-on: ubuntu-latest + outputs: + conclusion: ${{ steps.wait-for-coverage.outputs.run-conclusion }} steps: - name: Wait for code coverage to complete id: wait-for-coverage @@ -27,6 +29,13 @@ jobs: allowed-conclusions: | success failure + action_required + + - name: Conclusion Analysis + if: steps.wait-for-coverage.outputs.run-conclusion == 'action_required' + run: | + echo "::error::First-time contributor workflows require manual approval. After approval, please re-run the comment coverage workflows to post the coverage report." + exit 1 comment_coverage_report: name: Comment Code Coverage Report @@ -60,7 +69,7 @@ jobs: const run = runs[0]; if(!run) { - core.setFailed('Could not find a succesful workflow run for the PR'); + core.setFailed('Could not find a successful workflow run for the PR'); return; } diff --git a/.github/workflows/developer_onboarding_notification.yml b/.github/workflows/developer_onboarding_notification.yml new file mode 100644 index 00000000000..7d8f94cafd6 --- /dev/null +++ b/.github/workflows/developer_onboarding_notification.yml @@ -0,0 +1,73 @@ +name: Celebrating Initial Contributions + +on: + pull_request_target: + types: [closed] + +permissions: + pull-requests: write + +jobs: + comment_on_merged_pull_request: + if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop' + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set Environment Variables + env: + AUTHOR: ${{ github.event.pull_request.user.login }} + REPO: ${{ github.event.repository.name }} + OWNER: ${{ github.event.repository.owner.login }} + run: | + echo "AUTHOR=${AUTHOR}" >> $GITHUB_ENV + echo "REPO=${REPO}" >> $GITHUB_ENV + echo "OWNER=${OWNER}" >> $GITHUB_ENV + + - name: Count Merged Pull Requests + id: count_merged_pull_requests + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const author = process.env.AUTHOR; + const repo = process.env.REPO; + const owner = process.env.OWNER; + const { data } = await github.rest.search.issuesAndPullRequests({ + q: `repo:${owner}/${repo} type:pr state:closed author:${author}` + }); + const prCount = data.items.filter(pr => pr.pull_request.merged_at).length; + core.exportVariable('PR_COUNT', prCount); + + - name: Comment on the Merged Pull Request + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const prCount = parseInt(process.env.PR_COUNT); + const author = process.env.AUTHOR; + const mention = 'adhiamboperes'; + const prNumber = context.payload.pull_request.number; + + let message; + if (prCount === 1) { + message = `✨ **Fantastic work @${author}!** Your very first PR to Oppia has been merged! 🎉🥳\n\n` + + `You've just taken your first step into open-source, and we couldn’t be happier to have you onboard. 🙌\n` + + `If you're feeling adventurous, why not dive into another issue and keep contributing? The community would love to see more from you! 🚀\n\n` + + `For any support, feel free to reach out to the developer onboarding lead: @${mention}. Happy coding! 👩‍💻👨‍💻`; + } else if (prCount === 2) { + message = `👏 **Well done @${author}!** Two PRs merged already! 🎉🥳\n\n` + + `With your second PR, you're on a roll, and your contributions are already making a difference. 🌟\n` + + `This means you may be eligible to join the Oppia dev team as a collaborator! 🎉 If you're interested, please fill out [this form](https://forms.gle/NxPjimCMqsSTNUgu5) and become an even more integral part of the community. 🌱\n\n` + + `Looking forward to seeing even more contributions from you. The developer onboarding lead: @${mention} is here if you need any help! Keep up the great work! 🚀`; + } + + if (prCount === 1 || prCount === 2) { + await github.rest.issues.createComment({ + owner: process.env.OWNER, + repo: process.env.REPO, + issue_number: prNumber, + body: message + }); + } diff --git a/app/BUILD.bazel b/app/BUILD.bazel index 35036cf44fa..cbeefc86af0 100644 --- a/app/BUILD.bazel +++ b/app/BUILD.bazel @@ -939,7 +939,6 @@ TEST_DEPS = [ "//utility/src/main/java/org/oppia/android/util/accessibility:test_module", "//utility/src/main/java/org/oppia/android/util/caching:asset_prod_module", "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/math:math_expression_parser", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f036a892fbf..7dfcc70bd01 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -348,6 +348,9 @@ android:name=".app.onboarding.IntroActivity" android:label="@string/onboarding_learner_intro_activity_title" android:theme="@style/OppiaThemeWithoutActionBar" /> + > { - override fun onChanged(startUpStateResult: AsyncResult?) { - when (startUpStateResult) { - null, is AsyncResult.Pending -> { - // Do nothing. - } - is AsyncResult.Success -> { - liveData.removeObserver(this) - - if (startUpStateResult.value.startupMode == - AppStartupState.StartupMode.USER_NOT_YET_ONBOARDED - ) { - analyticsController.logAppOnboardedEvent(profileId) - } - } - is AsyncResult.Failure -> { - oppiaLogger.e( - "ClassroomListFragment", - "Failed to retrieve app startup state" - ) - } - } - } - } - ) - } - private fun logHomeActivityEvent() { analyticsController.logImportantEvent( oppiaLogger.createOpenHomeContext(), diff --git a/app/src/main/java/org/oppia/android/app/databinding/TextInputLayoutBindingAdapters.java b/app/src/main/java/org/oppia/android/app/databinding/TextInputLayoutBindingAdapters.java index d0dd35c2a77..dfac960ef8f 100644 --- a/app/src/main/java/org/oppia/android/app/databinding/TextInputLayoutBindingAdapters.java +++ b/app/src/main/java/org/oppia/android/app/databinding/TextInputLayoutBindingAdapters.java @@ -1,8 +1,17 @@ package org.oppia.android.app.databinding; +import android.app.Activity; +import android.content.Context; +import android.content.ContextWrapper; +import android.view.View; +import android.widget.AutoCompleteTextView; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.databinding.BindingAdapter; import com.google.android.material.textfield.TextInputLayout; +import org.oppia.android.app.model.OppiaLanguage; +import org.oppia.android.app.translation.AppLanguageActivityInjectorProvider; +import org.oppia.android.app.translation.AppLanguageResourceHandler; /** Holds all custom binding adapters that bind to [TextInputLayout]. */ public final class TextInputLayoutBindingAdapters { @@ -15,4 +24,37 @@ public static void setErrorMessage( ) { textInputLayout.setError(errorMessage); } + + /** Binding adapter for setting the text of an [AutoCompleteTextView]. */ + @BindingAdapter({"languageSelection", "filter"}) + public static void setLanguageSelection( + @NonNull AutoCompleteTextView textView, + @Nullable OppiaLanguage selectedItem, + Boolean filter) { + textView.setText(getAppLanguageResourceHandler(textView) + .computeLocalizedDisplayName(selectedItem), filter); + } + + private static AppLanguageResourceHandler getAppLanguageResourceHandler(View view) { + AppLanguageActivityInjectorProvider provider = + (AppLanguageActivityInjectorProvider) getAttachedActivity(view); + return provider.getAppLanguageActivityInjector().getAppLanguageResourceHandler(); + } + + private static Activity getAttachedActivity(View view) { + Context context = view.getContext(); + while (context != null && !(context instanceof Activity)) { + if (!(context instanceof ContextWrapper)) { + throw new IllegalStateException( + "Encountered context in view (" + view + ") that doesn't wrap a parent context: " + + context + ); + } + context = ((ContextWrapper) context).getBaseContext(); + } + if (context == null) { + throw new IllegalStateException("Failed to find base Activity for view: " + view); + } + return (Activity) context; + } } diff --git a/app/src/main/java/org/oppia/android/app/drawer/ExitProfileDialogFragment.kt b/app/src/main/java/org/oppia/android/app/drawer/ExitProfileDialogFragment.kt index 7900163e9a5..2dfdd918fc7 100644 --- a/app/src/main/java/org/oppia/android/app/drawer/ExitProfileDialogFragment.kt +++ b/app/src/main/java/org/oppia/android/app/drawer/ExitProfileDialogFragment.kt @@ -70,7 +70,6 @@ class ExitProfileDialogFragment : InjectableDialogFragment() { dialog.dismiss() } .setPositiveButton(R.string.home_activity_back_dialog_exit) { _, _ -> - // TODO(#3641): Investigate on using finish instead of intent. val intent = ProfileChooserActivity.createProfileChooserActivity(activity!!) if (!restoreLastCheckedItem) { intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) diff --git a/app/src/main/java/org/oppia/android/app/help/thirdparty/LicenseTextViewerFragment.kt b/app/src/main/java/org/oppia/android/app/help/thirdparty/LicenseTextViewerFragment.kt index 64d3585b5a5..3e8a5dc9dce 100644 --- a/app/src/main/java/org/oppia/android/app/help/thirdparty/LicenseTextViewerFragment.kt +++ b/app/src/main/java/org/oppia/android/app/help/thirdparty/LicenseTextViewerFragment.kt @@ -19,8 +19,7 @@ class LicenseTextViewerFragment : InjectableFragment() { companion object { /** Argument key for LicenseTextViewerFragment. */ - private const val LICENSE_TEXT_VIEWER_FRAGMENT_ARGUMENTS_KEY = - "LicenseTextViewerFragment.arguments" + const val LICENSE_TEXT_VIEWER_FRAGMENT_ARGUMENTS_KEY = "LicenseTextViewerFragment.arguments" /** Returns an instance of [LicenseTextViewerFragment]. */ fun newInstance(dependencyIndex: Int, licenseIndex: Int): LicenseTextViewerFragment { diff --git a/app/src/main/java/org/oppia/android/app/home/HomeFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/home/HomeFragmentPresenter.kt index b3ef5d04e3f..17d41e62f1f 100644 --- a/app/src/main/java/org/oppia/android/app/home/HomeFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/home/HomeFragmentPresenter.kt @@ -5,7 +5,6 @@ import android.view.View import android.view.ViewGroup import androidx.appcompat.app.AppCompatActivity import androidx.fragment.app.Fragment -import androidx.lifecycle.Observer import androidx.recyclerview.widget.GridLayoutManager import org.oppia.android.R import org.oppia.android.app.fragment.FragmentScope @@ -13,7 +12,6 @@ import org.oppia.android.app.home.promotedlist.ComingSoonTopicListViewModel import org.oppia.android.app.home.promotedlist.PromotedStoryListViewModel import org.oppia.android.app.home.topiclist.AllTopicsViewModel import org.oppia.android.app.home.topiclist.TopicSummaryViewModel -import org.oppia.android.app.model.AppStartupState import org.oppia.android.app.model.ProfileId import org.oppia.android.app.model.TopicSummary import org.oppia.android.app.recyclerview.BindableAdapter @@ -25,14 +23,11 @@ import org.oppia.android.databinding.HomeFragmentBinding import org.oppia.android.databinding.PromotedStoryListBinding import org.oppia.android.databinding.TopicSummaryViewBinding import org.oppia.android.databinding.WelcomeBinding -import org.oppia.android.domain.onboarding.AppStartupStateController import org.oppia.android.domain.oppialogger.OppiaLogger import org.oppia.android.domain.oppialogger.analytics.AnalyticsController import org.oppia.android.domain.profile.ProfileManagementController import org.oppia.android.domain.topic.TopicListController 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.parser.html.StoryHtmlParserEntityType import org.oppia.android.util.parser.html.TopicHtmlParserEntityType import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId @@ -53,7 +48,6 @@ class HomeFragmentPresenter @Inject constructor( private val dateTimeUtil: DateTimeUtil, private val translationController: TranslationController, private val multiTypeBuilderFactory: BindableAdapter.MultiTypeBuilder.Factory, - private val appStartupStateController: AppStartupStateController ) { private val routeToTopicPlayStoryListener = activity as RouteToTopicPlayStoryListener private lateinit var binding: HomeFragmentBinding @@ -103,45 +97,9 @@ class HomeFragmentPresenter @Inject constructor( it.viewModel = homeViewModel } - logAppOnboardedEvent() - return binding.root } - private fun logAppOnboardedEvent() { - val startupStateProvider = appStartupStateController.getAppStartupState() - val liveData = startupStateProvider.toLiveData() - liveData.observe( - activity, - object : Observer> { - override fun onChanged(startUpStateResult: AsyncResult?) { - when (startUpStateResult) { - null, is AsyncResult.Pending -> { - // Do nothing - } - is AsyncResult.Success -> { - liveData.removeObserver(this) - - if (startUpStateResult.value.startupMode == - AppStartupState.StartupMode.USER_NOT_YET_ONBOARDED - ) { - analyticsController.logAppOnboardedEvent( - ProfileId.newBuilder().setInternalId(internalProfileId).build() - ) - } - } - is AsyncResult.Failure -> { - oppiaLogger.e( - "HomeFragment", - "Failed to retrieve app startup state" - ) - } - } - } - } - ) - } - private fun createRecyclerViewAdapter(): BindableAdapter { return multiTypeBuilderFactory.create { viewModel -> when (viewModel) { diff --git a/app/src/main/java/org/oppia/android/app/onboarding/AudioLanguageFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/onboarding/AudioLanguageFragmentPresenter.kt index 3a238d4b010..43ac0698801 100644 --- a/app/src/main/java/org/oppia/android/app/onboarding/AudioLanguageFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/onboarding/AudioLanguageFragmentPresenter.kt @@ -1,17 +1,31 @@ package org.oppia.android.app.onboarding +import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.inputmethod.EditorInfo +import android.widget.AdapterView import android.widget.ArrayAdapter import androidx.appcompat.app.AppCompatActivity import androidx.fragment.app.Fragment import com.google.android.material.appbar.AppBarLayout import org.oppia.android.R +import org.oppia.android.app.home.HomeActivity +import org.oppia.android.app.model.AudioLanguageFragmentStateBundle +import org.oppia.android.app.model.AudioTranslationLanguageSelection +import org.oppia.android.app.model.OppiaLanguage +import org.oppia.android.app.model.ProfileId +import org.oppia.android.app.options.AudioLanguageFragment.Companion.FRAGMENT_SAVED_STATE_KEY import org.oppia.android.app.options.AudioLanguageSelectionViewModel import org.oppia.android.app.translation.AppLanguageResourceHandler import org.oppia.android.databinding.AudioLanguageSelectionFragmentBinding +import org.oppia.android.domain.oppialogger.OppiaLogger +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.extensions.getProto +import org.oppia.android.util.extensions.putProto import javax.inject.Inject /** The presenter for [AudioLanguageFragment]. */ @@ -19,9 +33,13 @@ class AudioLanguageFragmentPresenter @Inject constructor( private val fragment: Fragment, private val activity: AppCompatActivity, private val appLanguageResourceHandler: AppLanguageResourceHandler, - private val audioLanguageSelectionViewModel: AudioLanguageSelectionViewModel + private val audioLanguageSelectionViewModel: AudioLanguageSelectionViewModel, + private val translationController: TranslationController, + private val oppiaLogger: OppiaLogger ) { private lateinit var binding: AudioLanguageSelectionFragmentBinding + private lateinit var selectedLanguage: OppiaLanguage + private lateinit var supportedLanguages: List /** * Returns a newly inflated view to render the fragment with an evaluated audio language as the @@ -29,9 +47,10 @@ class AudioLanguageFragmentPresenter @Inject constructor( */ fun handleCreateView( inflater: LayoutInflater, - container: ViewGroup? + container: ViewGroup?, + profileId: ProfileId, + outState: Bundle? ): View { - // Hide toolbar as it's not needed in this layout. The toolbar is created by a shared activity // and is required in OptionsFragment. activity.findViewById(R.id.reading_list_app_bar_layout).visibility = View.GONE @@ -41,33 +60,110 @@ class AudioLanguageFragmentPresenter @Inject constructor( container, /* attachToRoot= */ false ) - binding.lifecycleOwner = fragment + + val savedSelectedLanguage = outState?.getProto( + FRAGMENT_SAVED_STATE_KEY, + AudioLanguageFragmentStateBundle.getDefaultInstance() + )?.selectedLanguage + + binding.apply { + lifecycleOwner = fragment + viewModel = audioLanguageSelectionViewModel + } + + audioLanguageSelectionViewModel.updateProfileId(profileId) + + savedSelectedLanguage?.let { + if (it != OppiaLanguage.LANGUAGE_UNSPECIFIED) { + setSelectedLanguage(it) + } else { + observePreselectedLanguage() + } + } ?: observePreselectedLanguage() binding.audioLanguageText.text = appLanguageResourceHandler.getStringInLocaleWithWrapping( R.string.audio_language_fragment_text, appLanguageResourceHandler.getStringInLocale(R.string.app_name) ) - binding.onboardingNavigationBack.setOnClickListener { - activity.finish() - } + binding.onboardingNavigationBack.setOnClickListener { activity.finish() } - val adapter = ArrayAdapter( - fragment.requireContext(), - R.layout.onboarding_language_dropdown_item, - R.id.onboarding_language_text_view, - audioLanguageSelectionViewModel.availableAudioLanguages + audioLanguageSelectionViewModel.supportedOppiaLanguagesLiveData.observe( + fragment, + { languages -> + supportedLanguages = languages + val adapter = ArrayAdapter( + fragment.requireContext(), + R.layout.onboarding_language_dropdown_item, + R.id.onboarding_language_text_view, + languages.map { appLanguageResourceHandler.computeLocalizedDisplayName(it) } + ) + binding.audioLanguageDropdownList.setAdapter(adapter) + } ) binding.audioLanguageDropdownList.apply { - setAdapter(adapter) - setText( - audioLanguageSelectionViewModel.defaultLanguageSelection, - false - ) setRawInputType(EditorInfo.TYPE_NULL) + + onItemClickListener = + AdapterView.OnItemClickListener { _, _, position, _ -> + val selectedItem = adapter.getItem(position) as? String + selectedItem?.let { + selectedLanguage = supportedLanguages.associateBy { oppiaLanguage -> + appLanguageResourceHandler.computeLocalizedDisplayName(oppiaLanguage) + }[it] ?: OppiaLanguage.ENGLISH + } + } + } + + binding.onboardingNavigationContinue.setOnClickListener { + updateSelectedAudioLanguage(selectedLanguage, profileId).also { + val intent = HomeActivity.createHomeActivity(fragment.requireContext(), profileId) + fragment.startActivity(intent) + // Finish this activity as well as all activities immediately below it in the current + // task so that the user cannot navigate back to the onboarding flow by pressing the + // back button once onboarding is complete + fragment.activity?.finishAffinity() + } } return binding.root } + + private fun observePreselectedLanguage() { + audioLanguageSelectionViewModel.languagePreselectionLiveData.observe( + fragment, + { selectedLanguage -> setSelectedLanguage(selectedLanguage) } + ) + } + + private fun setSelectedLanguage(selectedLanguage: OppiaLanguage) { + this.selectedLanguage = selectedLanguage + audioLanguageSelectionViewModel.selectedAudioLanguage.set(selectedLanguage) + } + + private fun updateSelectedAudioLanguage(selectedLanguage: OppiaLanguage, profileId: ProfileId) { + val audioLanguageSelection = + AudioTranslationLanguageSelection.newBuilder().setSelectedLanguage(selectedLanguage).build() + translationController.updateAudioTranslationContentLanguage(profileId, audioLanguageSelection) + .toLiveData().observe(fragment) { + when (it) { + is AsyncResult.Failure -> + oppiaLogger.e( + "AudioLanguageFragment", + "Failed to set the selected language.", + it.error + ) + else -> {} // Do nothing. + } + } + } + + /** Save the current dropdown selection to be retrieved on configuration change. */ + fun handleSavedState(outState: Bundle) { + outState.putProto( + FRAGMENT_SAVED_STATE_KEY, + AudioLanguageFragmentStateBundle.newBuilder().setSelectedLanguage(selectedLanguage).build() + ) + } } diff --git a/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileActivity.kt b/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileActivity.kt index 7a0fcb956e1..44cb30b2c92 100644 --- a/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileActivity.kt +++ b/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileActivity.kt @@ -5,8 +5,11 @@ import android.content.Intent import android.os.Bundle import org.oppia.android.app.activity.ActivityComponentImpl import org.oppia.android.app.activity.InjectableAutoLocalizedAppCompatActivity +import org.oppia.android.app.model.CreateProfileActivityParams import org.oppia.android.app.model.ScreenName.CREATE_PROFILE_ACTIVITY +import org.oppia.android.util.extensions.getProtoExtra import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.decorateWithScreenName +import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId import javax.inject.Inject /** Activity for displaying a new learner profile creation flow. */ @@ -18,7 +21,13 @@ class CreateProfileActivity : InjectableAutoLocalizedAppCompatActivity() { super.onCreate(savedInstanceState) (activityComponent as ActivityComponentImpl).inject(this) - learnerProfileActivityPresenter.handleOnCreate() + val profileId = intent.extractCurrentUserProfileId() + val profileType = intent.getProtoExtra( + CREATE_PROFILE_PARAMS_KEY, + CreateProfileActivityParams.getDefaultInstance() + ).profileType + + learnerProfileActivityPresenter.handleOnCreate(profileId, profileType) } companion object { diff --git a/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileActivityPresenter.kt b/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileActivityPresenter.kt index 2fcba3da31e..86f4d548a49 100644 --- a/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileActivityPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileActivityPresenter.kt @@ -1,11 +1,20 @@ package org.oppia.android.app.onboarding +import android.os.Bundle import androidx.appcompat.app.AppCompatActivity import androidx.databinding.DataBindingUtil import org.oppia.android.R +import org.oppia.android.app.model.CreateProfileFragmentArguments +import org.oppia.android.app.model.ProfileId +import org.oppia.android.app.model.ProfileType import org.oppia.android.databinding.CreateProfileActivityBinding +import org.oppia.android.util.extensions.putProto +import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.decorateWithUserProfileId import javax.inject.Inject +/** Argument key for [CreateProfileFragment] arguments. */ +const val CREATE_PROFILE_FRAGMENT_ARGS = "CreateProfileFragment.args" + private const val TAG_CREATE_PROFILE_ACTIVITY_FRAGMENT = "TAG_CREATE_PROFILE_ACTIVITY_FRAGMENT" /** Presenter for [CreateProfileActivity]. */ @@ -15,7 +24,7 @@ class CreateProfileActivityPresenter @Inject constructor( private lateinit var binding: CreateProfileActivityBinding /** Handle creation and binding of the CreateProfileActivity layout. */ - fun handleOnCreate() { + fun handleOnCreate(profileId: ProfileId, profileType: ProfileType) { binding = DataBindingUtil.setContentView(activity, R.layout.create_profile_activity) binding.apply { lifecycleOwner = activity @@ -23,6 +32,16 @@ class CreateProfileActivityPresenter @Inject constructor( if (getNewLearnerProfileFragment() == null) { val createLearnerProfileFragment = CreateProfileFragment() + + val args = Bundle().apply { + val fragmentArgs = + CreateProfileFragmentArguments.newBuilder().setProfileType(profileType).build() + putProto(CREATE_PROFILE_FRAGMENT_ARGS, fragmentArgs) + decorateWithUserProfileId(profileId) + } + + createLearnerProfileFragment.arguments = args + activity.supportFragmentManager.beginTransaction().add( R.id.profile_fragment_placeholder, createLearnerProfileFragment, diff --git a/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileFragment.kt b/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileFragment.kt index ac09fc5fbd9..7e308004cf1 100644 --- a/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileFragment.kt +++ b/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileFragment.kt @@ -9,6 +9,9 @@ import android.view.ViewGroup import androidx.activity.result.contract.ActivityResultContracts import org.oppia.android.app.fragment.FragmentComponentImpl import org.oppia.android.app.fragment.InjectableFragment +import org.oppia.android.app.model.CreateProfileFragmentArguments +import org.oppia.android.util.extensions.getProto +import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId import javax.inject.Inject /** Fragment for displaying a new learner profile creation flow. */ @@ -33,6 +36,23 @@ class CreateProfileFragment : InjectableFragment() { createProfileFragmentPresenter.handleOnActivityResult(result.data) } } - return createProfileFragmentPresenter.handleCreateView(inflater, container) + + val profileId = checkNotNull(arguments?.extractCurrentUserProfileId()) { + "Expected CreateProfileFragment to have a profileId argument." + } + val profileType = checkNotNull( + arguments?.getProto( + CREATE_PROFILE_FRAGMENT_ARGS, CreateProfileFragmentArguments.getDefaultInstance() + )?.profileType + ) { + "Expected CreateProfileFragment to have a profileType argument." + } + + return createProfileFragmentPresenter.handleCreateView( + inflater, + container, + profileId, + profileType + ) } } diff --git a/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileFragmentPresenter.kt index 10193abe3ec..44c1aad1746 100644 --- a/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileFragmentPresenter.kt @@ -2,6 +2,7 @@ package org.oppia.android.app.onboarding import android.content.Intent import android.graphics.PorterDuff +import android.net.Uri import android.provider.MediaStore import android.text.Editable import android.text.TextWatcher @@ -11,13 +12,24 @@ import android.view.ViewGroup import android.widget.ImageView import androidx.activity.result.ActivityResultLauncher import androidx.appcompat.app.AppCompatActivity +import androidx.core.content.ContextCompat import androidx.core.content.res.ResourcesCompat import androidx.fragment.app.Fragment import org.oppia.android.R import org.oppia.android.app.fragment.FragmentScope +import org.oppia.android.app.model.IntroActivityParams +import org.oppia.android.app.model.ProfileId +import org.oppia.android.app.model.ProfileType +import org.oppia.android.app.translation.AppLanguageResourceHandler import org.oppia.android.databinding.CreateProfileFragmentBinding +import org.oppia.android.domain.oppialogger.OppiaLogger +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.extensions.putProtoExtra import org.oppia.android.util.parser.image.ImageLoader import org.oppia.android.util.parser.image.ImageViewTarget +import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.decorateWithUserProfileId import javax.inject.Inject /** Presenter for [CreateProfileFragment]. */ @@ -25,23 +37,37 @@ import javax.inject.Inject class CreateProfileFragmentPresenter @Inject constructor( private val fragment: Fragment, private val activity: AppCompatActivity, + private val imageLoader: ImageLoader, private val createProfileViewModel: CreateProfileViewModel, - private val imageLoader: ImageLoader + private val profileManagementController: ProfileManagementController, + private val oppiaLogger: OppiaLogger, + private val appLanguageResourceHandler: AppLanguageResourceHandler ) { private lateinit var binding: CreateProfileFragmentBinding private lateinit var uploadImageView: ImageView private lateinit var selectedImage: String + private lateinit var profileId: ProfileId + private lateinit var profileType: ProfileType + private var selectedImageUri: Uri? = null /** Launcher for picking an image from device gallery. */ lateinit var activityResultLauncher: ActivityResultLauncher /** Initialize layout bindings. */ - fun handleCreateView(inflater: LayoutInflater, container: ViewGroup?): View { + fun handleCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + profileId: ProfileId, + profileType: ProfileType + ): View { binding = CreateProfileFragmentBinding.inflate( inflater, container, /* attachToRoot= */ false ) + this.profileId = profileId + this.profileType = profileType + binding.let { it.lifecycleOwner = fragment it.viewModel = createProfileViewModel @@ -68,11 +94,8 @@ class CreateProfileFragmentPresenter @Inject constructor( binding.onboardingNavigationContinue.setOnClickListener { val nickname = binding.createProfileNicknameEdittext.text.toString().trim() - createProfileViewModel.hasErrorMessage.set(nickname.isBlank()) - - if (createProfileViewModel.hasErrorMessage.get() != true) { - val intent = IntroActivity.createIntroActivity(activity, nickname) - fragment.startActivity(intent) + if (!checkNicknameAndUpdateError(nickname)) { + updateProfileDetails(nickname) } } @@ -89,10 +112,22 @@ class CreateProfileFragmentPresenter @Inject constructor( return binding.root } + private fun checkNicknameAndUpdateError(nickname: String): Boolean { + val hasError = nickname.isBlank() + createProfileViewModel.hasErrorMessage.set(hasError) + createProfileViewModel.errorMessage.set( + appLanguageResourceHandler.getStringInLocale( + R.string.create_profile_activity_nickname_error + ) + ) + return hasError + } + /** Receive the result of image upload and load it into the image view. */ fun handleOnActivityResult(intent: Intent?) { intent?.let { binding.createProfilePicturePrompt.visibility = View.GONE + selectedImageUri = intent.data selectedImage = checkNotNull(intent.data.toString()) { "Could not find the selected image." } imageLoader.loadBitmap( @@ -107,19 +142,108 @@ class CreateProfileFragmentPresenter @Inject constructor( binding.onboardingNavigationBack.setOnClickListener { activity.finish() } binding.createProfileEditPictureIcon.setOnClickListener { - activityResultLauncher.launch( - galleryIntent - ) + activityResultLauncher.launch(galleryIntent) } binding.createProfilePicturePrompt.setOnClickListener { - activityResultLauncher.launch( - galleryIntent - ) + activityResultLauncher.launch(galleryIntent) } binding.createProfileUserImageView.setOnClickListener { - activityResultLauncher.launch( - galleryIntent - ) + activityResultLauncher.launch(galleryIntent) } } + + private fun updateProfileDetails(profileName: String) { + profileManagementController.updateNewProfileDetails( + profileId = profileId, + profileType = profileType, + avatarImagePath = selectedImageUri, + colorRgb = selectUniqueRandomColor(), + newName = profileName, + isAdmin = true + ).toLiveData().observe( + fragment, + { result -> + when (result) { + is AsyncResult.Success -> { + createProfileViewModel.hasErrorMessage.set(false) + + val params = IntroActivityParams.newBuilder() + .setProfileNickname(profileName) + .build() + + val intent = + IntroActivity.createIntroActivity(activity).apply { + putProtoExtra(IntroActivity.PARAMS_KEY, params) + decorateWithUserProfileId(profileId) + } + + fragment.startActivity(intent) + } + is AsyncResult.Failure -> { + createProfileViewModel.hasErrorMessage.set(true) + + val errorMessage = when (result.error) { + is ProfileManagementController.ProfileNameOnlyLettersException -> + appLanguageResourceHandler.getStringInLocale( + R.string.add_profile_error_name_only_letters + ) + is ProfileManagementController.UnknownProfileTypeException -> + appLanguageResourceHandler.getStringInLocale( + R.string.add_profile_error_missing_profile_type + ) + else -> { + appLanguageResourceHandler.getStringInLocale( + R.string.add_profile_default_error_message + ) + } + } + + createProfileViewModel.errorMessage.set(errorMessage) + + oppiaLogger.e( + "CreateProfileFragment", + "Failed to update profile details.", + result.error + ) + } + is AsyncResult.Pending -> {} + } + } + ) + } + + /** Randomly selects a color for the new profile that is not already in use. */ + private fun selectUniqueRandomColor(): Int { + return ContextCompat.getColor(fragment.requireContext(), COLORS_LIST.random()) + } + + private companion object { + private val COLORS_LIST = listOf( + R.color.component_color_avatar_background_1_color, + R.color.component_color_avatar_background_2_color, + R.color.component_color_avatar_background_3_color, + R.color.component_color_avatar_background_4_color, + R.color.component_color_avatar_background_5_color, + R.color.component_color_avatar_background_6_color, + R.color.component_color_avatar_background_7_color, + R.color.component_color_avatar_background_8_color, + R.color.component_color_avatar_background_9_color, + R.color.component_color_avatar_background_10_color, + R.color.component_color_avatar_background_11_color, + R.color.component_color_avatar_background_12_color, + R.color.component_color_avatar_background_13_color, + R.color.component_color_avatar_background_14_color, + R.color.component_color_avatar_background_15_color, + R.color.component_color_avatar_background_16_color, + R.color.component_color_avatar_background_17_color, + R.color.component_color_avatar_background_18_color, + R.color.component_color_avatar_background_19_color, + R.color.component_color_avatar_background_20_color, + R.color.component_color_avatar_background_21_color, + R.color.component_color_avatar_background_22_color, + R.color.component_color_avatar_background_23_color, + R.color.component_color_avatar_background_24_color, + R.color.component_color_avatar_background_25_color + ) + } } diff --git a/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileViewModel.kt b/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileViewModel.kt index e6ef763f23c..fa5deceb2da 100644 --- a/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileViewModel.kt +++ b/app/src/main/java/org/oppia/android/app/onboarding/CreateProfileViewModel.kt @@ -9,6 +9,9 @@ import javax.inject.Inject @FragmentScope class CreateProfileViewModel @Inject constructor() : ObservableViewModel() { - /** ObservableField that tracks whether creating a nickname has triggered an error condition. */ + /** [ObservableField] that tracks whether creating a profile has triggered an error condition. */ val hasErrorMessage = ObservableField(false) + + /** [ObservableField] that tracks the error message to be displayed to the user. */ + val errorMessage = ObservableField("") } diff --git a/app/src/main/java/org/oppia/android/app/onboarding/IntroActivity.kt b/app/src/main/java/org/oppia/android/app/onboarding/IntroActivity.kt index 9ca2991707d..17daf8c3ec4 100644 --- a/app/src/main/java/org/oppia/android/app/onboarding/IntroActivity.kt +++ b/app/src/main/java/org/oppia/android/app/onboarding/IntroActivity.kt @@ -8,8 +8,8 @@ import org.oppia.android.app.activity.InjectableAutoLocalizedAppCompatActivity import org.oppia.android.app.model.IntroActivityParams import org.oppia.android.app.model.ScreenName.INTRO_ACTIVITY import org.oppia.android.util.extensions.getProtoExtra -import org.oppia.android.util.extensions.putProtoExtra import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.decorateWithScreenName +import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId import javax.inject.Inject /** The activity for showing the learner welcome screen. */ @@ -17,43 +17,30 @@ class IntroActivity : InjectableAutoLocalizedAppCompatActivity() { @Inject lateinit var onboardingLearnerIntroActivityPresenter: IntroActivityPresenter - private lateinit var profileNickname: String - override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) (activityComponent as ActivityComponentImpl).inject(this) - val params = intent.extractParams() - this.profileNickname = params.profileNickname + val profileNickname = + intent.getProtoExtra(PARAMS_KEY, IntroActivityParams.getDefaultInstance()).profileNickname + + val profileId = intent.extractCurrentUserProfileId() - onboardingLearnerIntroActivityPresenter.handleOnCreate(profileNickname) + onboardingLearnerIntroActivityPresenter.handleOnCreate(profileNickname, profileId) } companion object { - private const val PARAMS_KEY = "OnboardingIntroActivity.params" + /** Argument key for [IntroActivity]'s intent parameters. */ + const val PARAMS_KEY = "OnboardingIntroActivity.params" /** * A convenience function for creating a new [OnboardingLearnerIntroActivity] intent by prefilling * common params needed by the activity. */ - fun createIntroActivity(context: Context, profileNickname: String): Intent { - val params = IntroActivityParams.newBuilder() - .setProfileNickname(profileNickname) - .build() - return createOnboardingLearnerIntroActivity(context, params) - } - - private fun createOnboardingLearnerIntroActivity( - context: Context, - params: IntroActivityParams - ): Intent { + fun createIntroActivity(context: Context): Intent { return Intent(context, IntroActivity::class.java).apply { - putProtoExtra(PARAMS_KEY, params) decorateWithScreenName(INTRO_ACTIVITY) } } - - private fun Intent.extractParams() = - getProtoExtra(PARAMS_KEY, IntroActivityParams.getDefaultInstance()) } } diff --git a/app/src/main/java/org/oppia/android/app/onboarding/IntroActivityPresenter.kt b/app/src/main/java/org/oppia/android/app/onboarding/IntroActivityPresenter.kt index 7615fbc1c75..52bd6058eb3 100644 --- a/app/src/main/java/org/oppia/android/app/onboarding/IntroActivityPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/onboarding/IntroActivityPresenter.kt @@ -5,13 +5,17 @@ import androidx.appcompat.app.AppCompatActivity import androidx.databinding.DataBindingUtil import org.oppia.android.R import org.oppia.android.app.activity.ActivityScope +import org.oppia.android.app.model.IntroFragmentArguments +import org.oppia.android.app.model.ProfileId import org.oppia.android.databinding.IntroActivityBinding +import org.oppia.android.util.extensions.putProto +import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.decorateWithUserProfileId import javax.inject.Inject private const val TAG_LEARNER_INTRO_FRAGMENT = "TAG_INTRO_FRAGMENT" -/** Argument key for bundling the profileId. */ -const val PROFILE_NICKNAME_ARGUMENT_KEY = "profile_nickname" +/** Argument key for bundling the profile nickname. */ +const val PROFILE_NICKNAME_ARGUMENT_KEY = "IntroFragment.Arguments" /** The Presenter for [IntroActivity]. */ @ActivityScope @@ -21,15 +25,21 @@ class IntroActivityPresenter @Inject constructor( private lateinit var binding: IntroActivityBinding /** Handle creation and binding of the [IntroActivity] layout. */ - fun handleOnCreate(profileNickname: String) { + fun handleOnCreate(profileNickname: String, profileId: ProfileId) { binding = DataBindingUtil.setContentView(activity, R.layout.intro_activity) binding.lifecycleOwner = activity if (getIntroFragment() == null) { val introFragment = IntroFragment() - val args = Bundle() - args.putString(PROFILE_NICKNAME_ARGUMENT_KEY, profileNickname) + val argumentsProto = + IntroFragmentArguments.newBuilder().setProfileNickname(profileNickname).build() + + val args = Bundle().apply { + decorateWithUserProfileId(profileId) + putProto(PROFILE_NICKNAME_ARGUMENT_KEY, argumentsProto) + } + introFragment.arguments = args activity.supportFragmentManager.beginTransaction().add( diff --git a/app/src/main/java/org/oppia/android/app/onboarding/IntroFragment.kt b/app/src/main/java/org/oppia/android/app/onboarding/IntroFragment.kt index 0c954d2df85..6c3e40bc529 100644 --- a/app/src/main/java/org/oppia/android/app/onboarding/IntroFragment.kt +++ b/app/src/main/java/org/oppia/android/app/onboarding/IntroFragment.kt @@ -7,7 +7,9 @@ import android.view.View import android.view.ViewGroup import org.oppia.android.app.fragment.FragmentComponentImpl import org.oppia.android.app.fragment.InjectableFragment -import org.oppia.android.util.extensions.getStringFromBundle +import org.oppia.android.app.model.IntroFragmentArguments +import org.oppia.android.util.extensions.getProto +import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId import javax.inject.Inject /** Fragment that contains the introduction message for new learners. */ @@ -26,13 +28,25 @@ class IntroFragment : InjectableFragment() { savedInstanceState: Bundle? ): View? { val profileNickname = - checkNotNull(arguments?.getStringFromBundle(PROFILE_NICKNAME_ARGUMENT_KEY)) { + checkNotNull( + arguments?.getProto( + PROFILE_NICKNAME_ARGUMENT_KEY, + IntroFragmentArguments.getDefaultInstance() + ) + ) { "Expected profileNickname to be included in the arguments for IntroFragment." + }.profileNickname + + val profileId = + checkNotNull(arguments?.extractCurrentUserProfileId()) { + "Expected profileId to be included in the arguments for IntroFragment." } + return introFragmentPresenter.handleCreateView( inflater, container, - profileNickname + profileNickname, + profileId ) } } diff --git a/app/src/main/java/org/oppia/android/app/onboarding/IntroFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/onboarding/IntroFragmentPresenter.kt index 50fa51300c7..ac7739d5ad3 100644 --- a/app/src/main/java/org/oppia/android/app/onboarding/IntroFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/onboarding/IntroFragmentPresenter.kt @@ -7,9 +7,11 @@ import androidx.appcompat.app.AppCompatActivity import androidx.fragment.app.Fragment import org.oppia.android.R import org.oppia.android.app.model.AudioLanguage +import org.oppia.android.app.model.ProfileId import org.oppia.android.app.options.AudioLanguageActivity import org.oppia.android.app.translation.AppLanguageResourceHandler import org.oppia.android.databinding.LearnerIntroFragmentBinding +import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.decorateWithUserProfileId import javax.inject.Inject /** The presenter for [IntroFragment]. */ @@ -25,6 +27,7 @@ class IntroFragmentPresenter @Inject constructor( inflater: LayoutInflater, container: ViewGroup?, profileNickname: String, + profileId: ProfileId ): View { binding = LearnerIntroFragmentBinding.inflate( inflater, @@ -51,6 +54,7 @@ class IntroFragmentPresenter @Inject constructor( fragment.requireContext(), AudioLanguage.ENGLISH_AUDIO_LANGUAGE ) + intent.decorateWithUserProfileId(profileId) fragment.startActivity(intent) } diff --git a/app/src/main/java/org/oppia/android/app/onboarding/OnboardingAppLanguageViewModel.kt b/app/src/main/java/org/oppia/android/app/onboarding/OnboardingAppLanguageViewModel.kt new file mode 100644 index 00000000000..d792861aab3 --- /dev/null +++ b/app/src/main/java/org/oppia/android/app/onboarding/OnboardingAppLanguageViewModel.kt @@ -0,0 +1,28 @@ +package org.oppia.android.app.onboarding + +import androidx.lifecycle.LiveData +import androidx.lifecycle.MutableLiveData +import org.oppia.android.app.model.OppiaLanguage +import org.oppia.android.app.viewmodel.ObservableViewModel +import javax.inject.Inject + +/** ViewModel for managing language selection in [OnboardingFragment]. */ +class OnboardingAppLanguageViewModel @Inject constructor() : ObservableViewModel() { + /** The selected app language displayed in the language dropdown. */ + val languageSelectionLiveData: LiveData get() = _languageSelectionLiveData + private val _languageSelectionLiveData = MutableLiveData() + + /** Get the list of app supported languages to be displayed in the language dropdown. */ + val supportedAppLanguagesList: LiveData> get() = _supportedAppLanguagesList + private val _supportedAppLanguagesList = MutableLiveData>() + + /** Sets the app language selection. */ + fun setSelectedLanguageLivedata(language: OppiaLanguage) { + _languageSelectionLiveData.value = language + } + + /** Sets the list of app supported languages to be displayed in the language dropdown. */ + fun setSupportedAppLanguages(languageList: List) { + _supportedAppLanguagesList.value = languageList + } +} diff --git a/app/src/main/java/org/oppia/android/app/onboarding/OnboardingFragment.kt b/app/src/main/java/org/oppia/android/app/onboarding/OnboardingFragment.kt index 677a4a08515..5c207579761 100644 --- a/app/src/main/java/org/oppia/android/app/onboarding/OnboardingFragment.kt +++ b/app/src/main/java/org/oppia/android/app/onboarding/OnboardingFragment.kt @@ -34,9 +34,16 @@ class OnboardingFragment : InjectableFragment() { savedInstanceState: Bundle? ): View? { return if (enableOnboardingFlowV2.value) { - onboardingFragmentPresenter.handleCreateView(inflater, container) + onboardingFragmentPresenter.handleCreateView(inflater, container, savedInstanceState) } else { onboardingFragmentPresenterV1.handleCreateView(inflater, container) } } + + override fun onSaveInstanceState(outState: Bundle) { + super.onSaveInstanceState(outState) + if (enableOnboardingFlowV2.value) { + onboardingFragmentPresenter.saveToSavedInstanceState(outState) + } + } } diff --git a/app/src/main/java/org/oppia/android/app/onboarding/OnboardingFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/onboarding/OnboardingFragmentPresenter.kt index 79bd8dc270c..332fd930117 100644 --- a/app/src/main/java/org/oppia/android/app/onboarding/OnboardingFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/onboarding/OnboardingFragmentPresenter.kt @@ -1,33 +1,78 @@ package org.oppia.android.app.onboarding +import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.view.inputmethod.EditorInfo +import android.widget.AdapterView +import android.widget.ArrayAdapter import androidx.appcompat.app.AppCompatActivity import androidx.fragment.app.Fragment +import androidx.lifecycle.LiveData +import androidx.lifecycle.Transformations import org.oppia.android.R import org.oppia.android.app.fragment.FragmentScope +import org.oppia.android.app.model.AppLanguageSelection +import org.oppia.android.app.model.OnboardingFragmentStateBundle +import org.oppia.android.app.model.OppiaLanguage +import org.oppia.android.app.model.Profile +import org.oppia.android.app.model.ProfileId import org.oppia.android.app.translation.AppLanguageResourceHandler import org.oppia.android.databinding.OnboardingAppLanguageSelectionFragmentBinding +import org.oppia.android.domain.oppialogger.OppiaLogger +import org.oppia.android.domain.profile.ProfileManagementController +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.extensions.getProto +import org.oppia.android.util.extensions.putProto +import org.oppia.android.util.locale.OppiaLocale +import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.decorateWithUserProfileId import javax.inject.Inject +private const val ONBOARDING_FRAGMENT_SAVED_STATE_KEY = "OnboardingFragment.saved_state" + /** The presenter for [OnboardingFragment]. */ @FragmentScope class OnboardingFragmentPresenter @Inject constructor( private val activity: AppCompatActivity, private val fragment: Fragment, - private val appLanguageResourceHandler: AppLanguageResourceHandler + private val appLanguageResourceHandler: AppLanguageResourceHandler, + private val profileManagementController: ProfileManagementController, + private val oppiaLogger: OppiaLogger, + private val translationController: TranslationController, + private val onboardingAppLanguageViewModel: OnboardingAppLanguageViewModel ) { private lateinit var binding: OnboardingAppLanguageSelectionFragmentBinding + private var profileId: ProfileId = ProfileId.getDefaultInstance() + private lateinit var selectedLanguage: OppiaLanguage + private lateinit var supportedLanguages: List /** Handle creation and binding of the [OnboardingFragment] layout. */ - fun handleCreateView(inflater: LayoutInflater, container: ViewGroup?): View { + fun handleCreateView(inflater: LayoutInflater, container: ViewGroup?, outState: Bundle?): View { binding = OnboardingAppLanguageSelectionFragmentBinding.inflate( inflater, container, /* attachToRoot= */ false ) + val savedSelectedLanguage = outState?.getProto( + ONBOARDING_FRAGMENT_SAVED_STATE_KEY, + OnboardingFragmentStateBundle.getDefaultInstance() + )?.selectedLanguage + + if (savedSelectedLanguage != null) { + selectedLanguage = savedSelectedLanguage + onboardingAppLanguageViewModel.setSelectedLanguageLivedata(savedSelectedLanguage) + } else { + initializeSelectedLanguageToSystemLanguage() + } + + retrieveSupportedLanguages() + + subscribeToGetProfileList() + binding.apply { lifecycleOwner = fragment @@ -36,13 +81,198 @@ class OnboardingFragmentPresenter @Inject constructor( appLanguageResourceHandler.getStringInLocale(R.string.app_name) ) + onboardingAppLanguageViewModel.supportedAppLanguagesList.observe( + fragment, + { languagesList -> + supportedLanguages = languagesList + val adapter = ArrayAdapter( + fragment.requireContext(), + R.layout.onboarding_language_dropdown_item, + R.id.onboarding_language_text_view, + languagesList.map { appLanguageResourceHandler.computeLocalizedDisplayName(it) } + ) + onboardingLanguageDropdown.setAdapter(adapter) + } + ) + + onboardingAppLanguageViewModel.languageSelectionLiveData.observe( + fragment, + { language -> + selectedLanguage = language + onboardingLanguageDropdown.setText( + appLanguageResourceHandler.computeLocalizedDisplayName( + language + ), + false + ) + } + ) + + onboardingLanguageDropdown.apply { + setRawInputType(EditorInfo.TYPE_NULL) + + onItemClickListener = + AdapterView.OnItemClickListener { _, _, position, _ -> + adapter.getItem(position).let { selectedItem -> + selectedItem?.let { + selectedLanguage = supportedLanguages.associateBy { oppiaLanguage -> + appLanguageResourceHandler.computeLocalizedDisplayName(oppiaLanguage) + }[it] ?: OppiaLanguage.ENGLISH + onboardingAppLanguageViewModel.setSelectedLanguageLivedata(selectedLanguage) + } + } + } + } + onboardingLanguageLetsGoButton.setOnClickListener { - val intent = - OnboardingProfileTypeActivity.createOnboardingProfileTypeActivityIntent(activity) - fragment.startActivity(intent) + updateSelectedLanguage(selectedLanguage).also { + val intent = + OnboardingProfileTypeActivity.createOnboardingProfileTypeActivityIntent(activity) + intent.decorateWithUserProfileId(profileId) + fragment.startActivity(intent) + } } } return binding.root } + + private val existingProfiles: LiveData> by lazy { + Transformations.map( + profileManagementController.getProfiles().toLiveData(), + ::processGetProfilesResult + ) + } + + /** Save the current dropdown selection to be retrieved on configuration change. */ + fun saveToSavedInstanceState(outState: Bundle) { + outState.putProto( + ONBOARDING_FRAGMENT_SAVED_STATE_KEY, + OnboardingFragmentStateBundle.newBuilder().setSelectedLanguage(selectedLanguage).build() + ) + } + + private fun updateSelectedLanguage(selectedLanguage: OppiaLanguage) { + val selection = AppLanguageSelection.newBuilder().setSelectedLanguage(selectedLanguage).build() + translationController.updateAppLanguage(profileId, selection).toLiveData() + .observe( + fragment, + { result -> + when (result) { + is AsyncResult.Failure -> oppiaLogger.e( + "OnboardingFragment", + "Failed to set AppLanguageSelection", + result.error + ) + else -> {} // Do nothing. The user should be able to progress regardless of the result. + } + } + ) + } + + private fun initializeSelectedLanguageToSystemLanguage() { + translationController.getSystemLanguageLocale().toLiveData().observe( + fragment, + { result -> + onboardingAppLanguageViewModel.setSelectedLanguageLivedata( + processSystemLanguageResult(result) + ) + } + ) + } + + private fun processSystemLanguageResult( + result: AsyncResult + ): OppiaLanguage { + return when (result) { + is AsyncResult.Success -> { + result.value.getCurrentLanguage() + } + is AsyncResult.Failure -> { + oppiaLogger.e( + "OnboardingFragment", + "Failed to retrieve system language locale.", + result.error + ) + OppiaLanguage.ENGLISH + } + is AsyncResult.Pending -> OppiaLanguage.ENGLISH + } + } + + private fun retrieveSupportedLanguages() { + translationController.getSupportedAppLanguages().toLiveData().observe( + fragment, + { result -> + when (result) { + is AsyncResult.Success -> { + onboardingAppLanguageViewModel.setSupportedAppLanguages(result.value) + } + is AsyncResult.Failure -> { + oppiaLogger.e( + "OnboardingFragment", + "Failed to retrieve supported language list.", + result.error + ) + } + is AsyncResult.Pending -> {} + } + } + ) + } + + private fun subscribeToGetProfileList() { + existingProfiles.observe( + fragment, + { profilesList -> + if (!profilesList.isNullOrEmpty()) { + profileId = profilesList.first().id + } else { + createDefaultProfile() + } + } + ) + } + + private fun processGetProfilesResult(profilesResult: AsyncResult>): List { + val profileList = when (profilesResult) { + is AsyncResult.Failure -> { + oppiaLogger.e( + "OnboardingFragment", "Failed to retrieve the list of profiles", profilesResult.error + ) + emptyList() + } + is AsyncResult.Pending -> emptyList() + is AsyncResult.Success -> profilesResult.value + } + + return profileList + } + + private fun createDefaultProfile() { + profileManagementController.addProfile( + name = "Admin", // TODO(#4938): Refactor to empty name once proper admin profile creation flow + // is implemented. + pin = "", + avatarImagePath = null, + allowDownloadAccess = true, + colorRgb = -10710042, + isAdmin = true + ).toLiveData() + .observe( + fragment, + { result -> + when (result) { + is AsyncResult.Success -> subscribeToGetProfileList() + is AsyncResult.Failure -> { + oppiaLogger.e( + "OnboardingFragment", "Error creating the default profile", result.error + ) + activity.finish() + } + is AsyncResult.Pending -> {} + } + } + ) + } } diff --git a/app/src/main/java/org/oppia/android/app/onboarding/OnboardingProfileTypeActivity.kt b/app/src/main/java/org/oppia/android/app/onboarding/OnboardingProfileTypeActivity.kt index 3be8b397e83..223ade63fb8 100644 --- a/app/src/main/java/org/oppia/android/app/onboarding/OnboardingProfileTypeActivity.kt +++ b/app/src/main/java/org/oppia/android/app/onboarding/OnboardingProfileTypeActivity.kt @@ -7,6 +7,7 @@ import org.oppia.android.app.activity.ActivityComponentImpl import org.oppia.android.app.activity.InjectableAutoLocalizedAppCompatActivity import org.oppia.android.app.model.ScreenName.ONBOARDING_PROFILE_TYPE_ACTIVITY import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.decorateWithScreenName +import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId import javax.inject.Inject /** The activity for showing the profile type selection screen. */ @@ -18,7 +19,9 @@ class OnboardingProfileTypeActivity : InjectableAutoLocalizedAppCompatActivity() super.onCreate(savedInstanceState) (activityComponent as ActivityComponentImpl).inject(this) - onboardingProfileTypeActivityPresenter.handleOnCreate() + val profileId = intent.extractCurrentUserProfileId() + + onboardingProfileTypeActivityPresenter.handleOnCreate(profileId) } companion object { diff --git a/app/src/main/java/org/oppia/android/app/onboarding/OnboardingProfileTypeActivityPresenter.kt b/app/src/main/java/org/oppia/android/app/onboarding/OnboardingProfileTypeActivityPresenter.kt index 48c0792a006..e251658bbae 100644 --- a/app/src/main/java/org/oppia/android/app/onboarding/OnboardingProfileTypeActivityPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/onboarding/OnboardingProfileTypeActivityPresenter.kt @@ -1,10 +1,13 @@ package org.oppia.android.app.onboarding +import android.os.Bundle import androidx.appcompat.app.AppCompatActivity import androidx.databinding.DataBindingUtil import org.oppia.android.R import org.oppia.android.app.activity.ActivityScope +import org.oppia.android.app.model.ProfileId import org.oppia.android.databinding.OnboardingProfileTypeActivityBinding +import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.decorateWithUserProfileId import javax.inject.Inject private const val TAG_PROFILE_TYPE_FRAGMENT = "TAG_PROFILE_TYPE_FRAGMENT" @@ -17,7 +20,7 @@ class OnboardingProfileTypeActivityPresenter @Inject constructor( private lateinit var binding: OnboardingProfileTypeActivityBinding /** Handle creation and binding of the OnboardingProfileTypeActivity layout. */ - fun handleOnCreate() { + fun handleOnCreate(profileId: ProfileId) { binding = DataBindingUtil.setContentView(activity, R.layout.onboarding_profile_type_activity) binding.apply { lifecycleOwner = activity @@ -25,6 +28,11 @@ class OnboardingProfileTypeActivityPresenter @Inject constructor( if (getOnboardingProfileTypeFragment() == null) { val onboardingProfileTypeFragment = OnboardingProfileTypeFragment() + val args = Bundle().apply { + decorateWithUserProfileId(profileId) + } + onboardingProfileTypeFragment.arguments = args + activity.supportFragmentManager.beginTransaction().add( R.id.profile_type_fragment_placeholder, onboardingProfileTypeFragment, diff --git a/app/src/main/java/org/oppia/android/app/onboarding/OnboardingProfileTypeFragment.kt b/app/src/main/java/org/oppia/android/app/onboarding/OnboardingProfileTypeFragment.kt index 128788b3c4d..a4b594e9e15 100644 --- a/app/src/main/java/org/oppia/android/app/onboarding/OnboardingProfileTypeFragment.kt +++ b/app/src/main/java/org/oppia/android/app/onboarding/OnboardingProfileTypeFragment.kt @@ -7,6 +7,7 @@ import android.view.View import android.view.ViewGroup import org.oppia.android.app.fragment.FragmentComponentImpl import org.oppia.android.app.fragment.InjectableFragment +import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId import javax.inject.Inject /** Fragment that contains the profile type selection flow of the app. */ @@ -24,6 +25,9 @@ class OnboardingProfileTypeFragment : InjectableFragment() { container: ViewGroup?, savedInstanceState: Bundle? ): View? { - return onboardingProfileTypeFragmentPresenter.handleCreateView(inflater, container) + val profileId = checkNotNull(arguments?.extractCurrentUserProfileId()) { + "Expected OnboardingProfileTypeFragment to have a profileId argument." + } + return onboardingProfileTypeFragmentPresenter.handleCreateView(inflater, container, profileId) } } diff --git a/app/src/main/java/org/oppia/android/app/onboarding/OnboardingProfileTypeFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/onboarding/OnboardingProfileTypeFragmentPresenter.kt index 72ae543dd0c..5d8a7734007 100644 --- a/app/src/main/java/org/oppia/android/app/onboarding/OnboardingProfileTypeFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/onboarding/OnboardingProfileTypeFragmentPresenter.kt @@ -5,10 +5,18 @@ import android.view.View import android.view.ViewGroup import androidx.appcompat.app.AppCompatActivity import androidx.fragment.app.Fragment +import org.oppia.android.app.model.CreateProfileActivityParams +import org.oppia.android.app.model.ProfileId +import org.oppia.android.app.model.ProfileType import org.oppia.android.app.profile.ProfileChooserActivity import org.oppia.android.databinding.OnboardingProfileTypeFragmentBinding +import org.oppia.android.util.extensions.putProtoExtra +import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.decorateWithUserProfileId import javax.inject.Inject +/** Argument key for [CreateProfileActivity] intent parameters. */ +const val CREATE_PROFILE_PARAMS_KEY = "CreateProfileActivity.params" + /** The presenter for [OnboardingProfileTypeFragment]. */ class OnboardingProfileTypeFragmentPresenter @Inject constructor( private val fragment: Fragment, @@ -17,7 +25,11 @@ class OnboardingProfileTypeFragmentPresenter @Inject constructor( private lateinit var binding: OnboardingProfileTypeFragmentBinding /** Handle creation and binding of the OnboardingProfileTypeFragment layout. */ - fun handleCreateView(inflater: LayoutInflater, container: ViewGroup?): View { + fun handleCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + profileId: ProfileId + ): View { binding = OnboardingProfileTypeFragmentBinding.inflate( inflater, container, @@ -29,11 +41,21 @@ class OnboardingProfileTypeFragmentPresenter @Inject constructor( profileTypeLearnerNavigationCard.setOnClickListener { val intent = CreateProfileActivity.createProfileActivityIntent(activity) + intent.apply { + decorateWithUserProfileId(profileId) + putProtoExtra( + CREATE_PROFILE_PARAMS_KEY, + CreateProfileActivityParams.newBuilder() + .setProfileType(ProfileType.SOLE_LEARNER) + .build() + ) + } fragment.startActivity(intent) } profileTypeSupervisorNavigationCard.setOnClickListener { val intent = ProfileChooserActivity.createProfileChooserActivity(activity) + // TODO(#4938): Add profileId and ProfileType to intent extras. fragment.startActivity(intent) } diff --git a/app/src/main/java/org/oppia/android/app/options/AudioLanguageActivity.kt b/app/src/main/java/org/oppia/android/app/options/AudioLanguageActivity.kt index 7042393f3d4..48b3c1ef4b5 100644 --- a/app/src/main/java/org/oppia/android/app/options/AudioLanguageActivity.kt +++ b/app/src/main/java/org/oppia/android/app/options/AudioLanguageActivity.kt @@ -14,6 +14,7 @@ import org.oppia.android.util.extensions.getProtoExtra import org.oppia.android.util.extensions.putProto import org.oppia.android.util.extensions.putProtoExtra import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.decorateWithScreenName +import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId import javax.inject.Inject /** The activity to change the Default Audio language of the app. */ @@ -23,8 +24,10 @@ class AudioLanguageActivity : InjectableAutoLocalizedAppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) (activityComponent as ActivityComponentImpl).inject(this) + val profileId = intent.extractCurrentUserProfileId() audioLanguageActivityPresenter.handleOnCreate( - savedInstanceState?.retrieveLanguageFromSavedState() ?: intent.retrieveLanguageFromParams() + savedInstanceState?.retrieveLanguageFromSavedState() ?: intent.retrieveLanguageFromParams(), + profileId ) } diff --git a/app/src/main/java/org/oppia/android/app/options/AudioLanguageActivityPresenter.kt b/app/src/main/java/org/oppia/android/app/options/AudioLanguageActivityPresenter.kt index cb33ecf7c0e..fa4e149207d 100644 --- a/app/src/main/java/org/oppia/android/app/options/AudioLanguageActivityPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/options/AudioLanguageActivityPresenter.kt @@ -8,6 +8,7 @@ import org.oppia.android.R import org.oppia.android.app.activity.ActivityScope import org.oppia.android.app.model.AudioLanguage import org.oppia.android.app.model.AudioLanguageActivityResultBundle +import org.oppia.android.app.model.ProfileId import org.oppia.android.databinding.AudioLanguageActivityBinding import org.oppia.android.util.extensions.putProtoExtra import javax.inject.Inject @@ -18,7 +19,7 @@ class AudioLanguageActivityPresenter @Inject constructor(private val activity: A private lateinit var audioLanguage: AudioLanguage /** Handles when the activity is first created. */ - fun handleOnCreate(audioLanguage: AudioLanguage) { + fun handleOnCreate(audioLanguage: AudioLanguage, profileId: ProfileId) { this.audioLanguage = audioLanguage val binding: AudioLanguageActivityBinding = @@ -27,7 +28,7 @@ class AudioLanguageActivityPresenter @Inject constructor(private val activity: A finishWithResult() } if (getAudioLanguageFragment() == null) { - val audioLanguageFragment = AudioLanguageFragment.newInstance(audioLanguage) + val audioLanguageFragment = AudioLanguageFragment.newInstance(audioLanguage, profileId) activity.supportFragmentManager.beginTransaction() .add(R.id.audio_language_fragment_container, audioLanguageFragment).commitNow() } diff --git a/app/src/main/java/org/oppia/android/app/options/AudioLanguageFragment.kt b/app/src/main/java/org/oppia/android/app/options/AudioLanguageFragment.kt index 4cb067f8cc7..06e0e2cac1c 100644 --- a/app/src/main/java/org/oppia/android/app/options/AudioLanguageFragment.kt +++ b/app/src/main/java/org/oppia/android/app/options/AudioLanguageFragment.kt @@ -10,11 +10,14 @@ import org.oppia.android.app.fragment.InjectableFragment import org.oppia.android.app.model.AudioLanguage import org.oppia.android.app.model.AudioLanguageFragmentArguments import org.oppia.android.app.model.AudioLanguageFragmentStateBundle +import org.oppia.android.app.model.ProfileId import org.oppia.android.app.onboarding.AudioLanguageFragmentPresenter import org.oppia.android.util.extensions.getProto import org.oppia.android.util.extensions.putProto import org.oppia.android.util.platformparameter.EnableOnboardingFlowV2 import org.oppia.android.util.platformparameter.PlatformParameterValue +import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.decorateWithUserProfileId +import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId import javax.inject.Inject /** The fragment to change the default audio language of the app. */ @@ -41,9 +44,18 @@ class AudioLanguageFragment : InjectableFragment(), AudioLanguageRadioButtonList checkNotNull( savedInstanceState?.retrieveLanguageFromSavedState() ?: arguments?.retrieveLanguageFromArguments() - ) { "Expected arguments to be passed to AudioLanguageFragment" } + ) { "Expected arguments to be passed to AudioLanguageFragment." } + return if (enableOnboardingFlowV2.value) { - audioLanguageFragmentPresenter.handleCreateView(inflater, container) + val profileId = checkNotNull(arguments?.extractCurrentUserProfileId()) { + "Expected a profileId argument to be passed to AudioLanguageFragment." + } + audioLanguageFragmentPresenter.handleCreateView( + inflater, + container, + profileId, + savedInstanceState + ) } else { audioLanguageFragmentPresenterV1.handleOnCreateView(inflater, container, audioLanguage) } @@ -51,7 +63,9 @@ class AudioLanguageFragment : InjectableFragment(), AudioLanguageRadioButtonList override fun onSaveInstanceState(outState: Bundle) { super.onSaveInstanceState(outState) - if (!enableOnboardingFlowV2.value) { + if (enableOnboardingFlowV2.value) { + audioLanguageFragmentPresenter.handleSavedState(outState) + } else { val state = AudioLanguageFragmentStateBundle.newBuilder().apply { audioLanguage = audioLanguageFragmentPresenterV1.getLanguageSelected() }.build() @@ -67,19 +81,22 @@ class AudioLanguageFragment : InjectableFragment(), AudioLanguageRadioButtonList companion object { private const val FRAGMENT_ARGUMENTS_KEY = "AudioLanguageFragment.arguments" - private const val FRAGMENT_SAVED_STATE_KEY = "AudioLanguageFragment.saved_state" + + /** Argument key for the [AudioLanguageFragment] saved instance state bundle. */ + const val FRAGMENT_SAVED_STATE_KEY = "AudioLanguageFragment.saved_state" /** * Returns a new [AudioLanguageFragment] corresponding to the specified [AudioLanguage] (as the * initial selection). */ - fun newInstance(audioLanguage: AudioLanguage): AudioLanguageFragment { + fun newInstance(audioLanguage: AudioLanguage, profileId: ProfileId): AudioLanguageFragment { return AudioLanguageFragment().apply { arguments = Bundle().apply { val args = AudioLanguageFragmentArguments.newBuilder().apply { this.audioLanguage = audioLanguage }.build() putProto(FRAGMENT_ARGUMENTS_KEY, args) + decorateWithUserProfileId(profileId) } } } diff --git a/app/src/main/java/org/oppia/android/app/options/AudioLanguageSelectionViewModel.kt b/app/src/main/java/org/oppia/android/app/options/AudioLanguageSelectionViewModel.kt index 5e25aaabf5d..27b40c88b34 100644 --- a/app/src/main/java/org/oppia/android/app/options/AudioLanguageSelectionViewModel.kt +++ b/app/src/main/java/org/oppia/android/app/options/AudioLanguageSelectionViewModel.kt @@ -1,19 +1,59 @@ package org.oppia.android.app.options +import androidx.databinding.ObservableField import androidx.fragment.app.Fragment +import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData +import androidx.lifecycle.Transformations import org.oppia.android.app.fragment.FragmentScope +import org.oppia.android.app.model.AppLanguageSelection import org.oppia.android.app.model.AudioLanguage +import org.oppia.android.app.model.OppiaLanguage +import org.oppia.android.app.model.ProfileId import org.oppia.android.app.translation.AppLanguageResourceHandler import org.oppia.android.app.viewmodel.ObservableViewModel +import org.oppia.android.domain.oppialogger.OppiaLogger +import org.oppia.android.domain.translation.TranslationController +import org.oppia.android.util.data.AsyncResult +import org.oppia.android.util.data.DataProvider +import org.oppia.android.util.data.DataProviders.Companion.combineWith +import org.oppia.android.util.data.DataProviders.Companion.toLiveData +import org.oppia.android.util.locale.OppiaLocale import javax.inject.Inject -/** Language list view model for the recycler view in [AudioLanguageFragment]. */ +private const val PRE_SELECTED_LANGUAGE_PROVIDER_ID = "systemLanguage+appLanguageProvider" + +/** ViewModel for managing language selection in [AudioLanguageFragment]. */ @FragmentScope class AudioLanguageSelectionViewModel @Inject constructor( private val fragment: Fragment, - private val appLanguageResourceHandler: AppLanguageResourceHandler + private val appLanguageResourceHandler: AppLanguageResourceHandler, + private val translationController: TranslationController, + private val oppiaLogger: OppiaLogger ) : ObservableViewModel() { + private lateinit var profileId: ProfileId + + /** An [ObservableField] to bind the resolved audio language to the dropdown text. */ + val selectedAudioLanguage = ObservableField(OppiaLanguage.LANGUAGE_UNSPECIFIED) + + /** The [LiveData] representing the language to be displayed by default in the dropdown menu. */ + val languagePreselectionLiveData: LiveData by lazy { + Transformations.map(languagePreselectionProvider.toLiveData()) { languageResult -> + return@map when (languageResult) { + is AsyncResult.Failure -> { + oppiaLogger.e( + "AudioLanguageFragment", + "Failed to retrieve language information.", + languageResult.error + ) + OppiaLanguage.LANGUAGE_UNSPECIFIED + } + is AsyncResult.Pending -> OppiaLanguage.LANGUAGE_UNSPECIFIED + is AsyncResult.Success -> languageResult.value + } + } + } + /** The [AudioLanguage] currently selected in the radio button list. */ val selectedLanguage = MutableLiveData() @@ -22,6 +62,67 @@ class AudioLanguageSelectionViewModel @Inject constructor( AudioLanguage.values().filter { it !in IGNORED_AUDIO_LANGUAGES }.map(::createItemViewModel) } + /** Get the list of app supported languages to be displayed in the language dropdown. */ + val availableAudioLanguages: LiveData> get() = _availableAudioLanguages + private val _availableAudioLanguages = MutableLiveData>() + + /** Sets the list of audio languages supported by the app based on [OppiaLanguage]. */ + val supportedOppiaLanguagesLiveData: LiveData> by lazy { + Transformations.map( + translationController.getSupportedAppLanguages().toLiveData() + ) { supportedLanguagesResult -> + return@map when (supportedLanguagesResult) { + is AsyncResult.Failure -> { + oppiaLogger.e( + "AudioLanguageFragment", + "Failed to retrieve supported languages.", + supportedLanguagesResult.error + ) + listOf() + } + is AsyncResult.Pending -> listOf() + is AsyncResult.Success -> supportedLanguagesResult.value + } + } + } + + // TODO(#4938): Update the pre-selection logic to include the admin profile audio language for + // non-sole learners. + private val languagePreselectionProvider: DataProvider by lazy { + appLanguageSelectionProvider.combineWith( + systemLanguageProvider, + PRE_SELECTED_LANGUAGE_PROVIDER_ID + ) { appLanguageSelection: AppLanguageSelection, displayLocale: OppiaLocale.DisplayLocale -> + val appLanguage = appLanguageSelection.selectedLanguage + val systemLanguage = displayLocale.getCurrentLanguage() + computePreselection(appLanguage, systemLanguage) + } + } + + private val appLanguageSelectionProvider: DataProvider by lazy { + translationController.getAppLanguageSelection(profileId) + } + + private val systemLanguageProvider: DataProvider by lazy { + translationController.getSystemLanguageLocale() + } + + /** Receives and sets the current profileId in this viewModel. */ + fun updateProfileId(profileId: ProfileId) { + this.profileId = profileId + } + + private fun computePreselection( + appLanguage: OppiaLanguage, + systemLanguage: OppiaLanguage + ): OppiaLanguage { + return when { + appLanguage != OppiaLanguage.LANGUAGE_UNSPECIFIED -> appLanguage + systemLanguage != OppiaLanguage.LANGUAGE_UNSPECIFIED -> systemLanguage + else -> OppiaLanguage.LANGUAGE_UNSPECIFIED + } + } + private fun createItemViewModel(language: AudioLanguage): AudioLanguageItemViewModel { return AudioLanguageItemViewModel( language, @@ -31,19 +132,6 @@ class AudioLanguageSelectionViewModel @Inject constructor( ) } - // TODO(#4938): Update the pre-selection logic. - /** The pre-selected [AudioLanguage] to be shown in the language selection dropdown. */ - val defaultLanguageSelection = getLanguageDisplayName(AudioLanguage.ENGLISH_AUDIO_LANGUAGE) - - /** The list of [AudioLanguage]s supported by the app. */ - val availableAudioLanguages: List by lazy { - AudioLanguage.values().filter { it !in IGNORED_AUDIO_LANGUAGES }.map(::getLanguageDisplayName) - } - - private fun getLanguageDisplayName(audioLanguage: AudioLanguage): String { - return appLanguageResourceHandler.computeLocalizedDisplayName(audioLanguage) - } - private companion object { private val IGNORED_AUDIO_LANGUAGES = listOf( 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 52a993a52f6..60220f2e02e 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 @@ -55,7 +55,8 @@ class OptionsActivity : // used to initially load the suitable fragment in the case of multipane. private var isFirstOpen = true private lateinit var selectedFragment: String - private var profileId: Int? = -1 + private lateinit var profileId: ProfileId + private var internalProfileId: Int = -1 private lateinit var readingTextSizeLauncher: ActivityResultLauncher private lateinit var audioLanguageLauncher: ActivityResultLauncher @@ -94,7 +95,8 @@ class OptionsActivity : OptionsActivityParams.getDefaultInstance() ) val isFromNavigationDrawer = args?.isFromNavigationDrawer ?: false - profileId = intent.extractCurrentUserProfileId().internalId + profileId = intent.extractCurrentUserProfileId() + internalProfileId = profileId.internalId if (savedInstanceState != null) { isFirstOpen = false } @@ -116,7 +118,7 @@ class OptionsActivity : extraOptionsTitle, isFirstOpen, selectedFragment, - profileId!! + internalProfileId ) title = resourceHandler.getStringInLocale(R.string.menu_options) @@ -153,15 +155,15 @@ class OptionsActivity : AppLanguageActivity.createAppLanguageActivityIntent( this, oppiaLanguage, - profileId!! + internalProfileId ) ) } override fun routeAudioLanguageList(audioLanguage: AudioLanguage) { - audioLanguageLauncher.launch( - AudioLanguageActivity.createAudioLanguageActivityIntent(this, audioLanguage) - ) + val intent = AudioLanguageActivity.createAudioLanguageActivityIntent(this, audioLanguage) + intent.decorateWithUserProfileId(profileId) + audioLanguageLauncher.launch(intent) } override fun routeReadingTextSize(readingTextSize: ReadingTextSize) { @@ -191,7 +193,7 @@ class OptionsActivity : optionActivityPresenter.setExtraOptionTitle( resourceHandler.getStringInLocale(R.string.audio_language) ) - optionActivityPresenter.loadAudioLanguageFragment(audioLanguage) + optionActivityPresenter.loadAudioLanguageFragment(audioLanguage, profileId) } override fun onSaveInstanceState(outState: Bundle) { diff --git a/app/src/main/java/org/oppia/android/app/options/OptionsActivityPresenter.kt b/app/src/main/java/org/oppia/android/app/options/OptionsActivityPresenter.kt index ccdff3ba113..e611795f4b8 100644 --- a/app/src/main/java/org/oppia/android/app/options/OptionsActivityPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/options/OptionsActivityPresenter.kt @@ -11,6 +11,7 @@ import org.oppia.android.app.activity.ActivityScope import org.oppia.android.app.drawer.NavigationDrawerFragment import org.oppia.android.app.model.AudioLanguage import org.oppia.android.app.model.OppiaLanguage +import org.oppia.android.app.model.ProfileId import org.oppia.android.app.model.ReadingTextSize import javax.inject.Inject @@ -135,8 +136,8 @@ class OptionsActivityPresenter @Inject constructor( * * @param audioLanguage the initially selected audio language */ - fun loadAudioLanguageFragment(audioLanguage: AudioLanguage) { - val audioLanguageFragment = AudioLanguageFragment.newInstance(audioLanguage) + fun loadAudioLanguageFragment(audioLanguage: AudioLanguage, profileId: ProfileId) { + val audioLanguageFragment = AudioLanguageFragment.newInstance(audioLanguage, profileId) activity.supportFragmentManager .beginTransaction() .replace(R.id.multipane_options_container, audioLanguageFragment) diff --git a/app/src/main/java/org/oppia/android/app/player/audio/AudioFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/player/audio/AudioFragmentPresenter.kt index 60f4214458e..db1b92f4f8c 100644 --- a/app/src/main/java/org/oppia/android/app/player/audio/AudioFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/player/audio/AudioFragmentPresenter.kt @@ -11,12 +11,10 @@ import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AppCompatActivity import androidx.fragment.app.Fragment import androidx.lifecycle.LiveData -import androidx.lifecycle.Observer import androidx.lifecycle.Transformations import org.oppia.android.R import org.oppia.android.app.fragment.FragmentScope import org.oppia.android.app.model.AudioLanguage -import org.oppia.android.app.model.CellularDataPreference import org.oppia.android.app.model.ProfileId import org.oppia.android.app.model.Spotlight import org.oppia.android.app.model.State @@ -38,7 +36,6 @@ import javax.inject.Inject const val TAG_LANGUAGE_DIALOG = "LANGUAGE_DIALOG" private const val TAG_CELLULAR_DATA_DIALOG = "CELLULAR_DATA_DIALOG" -const val AUDIO_FRAGMENT_PROFILE_ID_ARGUMENT_KEY = "AUDIO_FRAGMENT_PROFILE_ID_ARGUMENT_KEY" /** The presenter for [AudioFragment]. */ @FragmentScope @@ -75,7 +72,7 @@ class AudioFragmentPresenter @Inject constructor( cellularAudioDialogController.getCellularDataPreference().toLiveData() .observe( fragment, - Observer> { + { if (it is AsyncResult.Success) { showCellularDataDialog = !it.value.hideDialog useCellularData = it.value.useCellularData @@ -103,7 +100,7 @@ class AudioFragmentPresenter @Inject constructor( }) audioViewModel.playStatusLiveData.observe( fragment, - Observer { + { prepared = it != UiAudioPlayStatus.LOADING && it != UiAudioPlayStatus.FAILED binding.audioProgressSeekBar.isEnabled = prepared @@ -156,7 +153,7 @@ class AudioFragmentPresenter @Inject constructor( private fun subscribeToAudioLanguageLiveData() { retrieveAudioLanguageCode().observe( activity, - Observer { result -> + { result -> audioViewModel.selectedLanguageCode = result audioViewModel.loadMainContentAudio(allowAutoPlay = false, reloadingContent = false) } diff --git a/app/src/main/java/org/oppia/android/app/player/state/itemviewmodel/SelectionInteractionViewModel.kt b/app/src/main/java/org/oppia/android/app/player/state/itemviewmodel/SelectionInteractionViewModel.kt index d5f4b7016c7..2d1e9c44304 100644 --- a/app/src/main/java/org/oppia/android/app/player/state/itemviewmodel/SelectionInteractionViewModel.kt +++ b/app/src/main/java/org/oppia/android/app/player/state/itemviewmodel/SelectionInteractionViewModel.kt @@ -213,7 +213,6 @@ class SelectionInteractionViewModel private constructor( false } !areCheckboxesBound() -> { - // De-select all other items to simulate a radio button group. choiceItems.forEach { item -> item.isAnswerSelected.set(false) } selectedItems.clear() selectedItems += itemIndex @@ -228,7 +227,6 @@ class SelectionInteractionViewModel private constructor( true } else -> { - // Do not change the current status if it isn't valid to do so. isCurrentlySelected } } diff --git a/app/src/main/java/org/oppia/android/app/policies/PoliciesFragment.kt b/app/src/main/java/org/oppia/android/app/policies/PoliciesFragment.kt index 06cd8bf8b67..44a2111579f 100644 --- a/app/src/main/java/org/oppia/android/app/policies/PoliciesFragment.kt +++ b/app/src/main/java/org/oppia/android/app/policies/PoliciesFragment.kt @@ -12,7 +12,8 @@ import org.oppia.android.util.extensions.getProto import org.oppia.android.util.extensions.putProto import javax.inject.Inject -private const val POLICIES_FRAGMENT_POLICY_PAGE_ARGUMENT_PROTO = "PoliciesFragment.policy_page" +/** Argument key for PoliciesFragment. */ +const val POLICIES_FRAGMENT_POLICY_PAGE_ARGUMENT_PROTO = "PoliciesFragment.policy_page" /** Fragment that contains policies flow of the app. */ class PoliciesFragment : InjectableFragment() { diff --git a/app/src/main/java/org/oppia/android/app/profile/AddProfileActivity.kt b/app/src/main/java/org/oppia/android/app/profile/AddProfileActivity.kt index 1acff5fd581..c7d0e60857c 100644 --- a/app/src/main/java/org/oppia/android/app/profile/AddProfileActivity.kt +++ b/app/src/main/java/org/oppia/android/app/profile/AddProfileActivity.kt @@ -44,10 +44,7 @@ class AddProfileActivity : InjectableAutoLocalizedAppCompatActivity() { } override fun onSupportNavigateUp(): Boolean { - // TODO(#3641): Investigate on using finish instead of intent. - val intent = Intent(this, ProfileChooserActivity::class.java) - intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) - startActivity(intent) + finish() return false } diff --git a/app/src/main/java/org/oppia/android/app/survey/surveyitemviewmodel/MarketFitItemsViewModel.kt b/app/src/main/java/org/oppia/android/app/survey/surveyitemviewmodel/MarketFitItemsViewModel.kt index e2b7fe43a5e..bef9347e3d0 100644 --- a/app/src/main/java/org/oppia/android/app/survey/surveyitemviewmodel/MarketFitItemsViewModel.kt +++ b/app/src/main/java/org/oppia/android/app/survey/surveyitemviewmodel/MarketFitItemsViewModel.kt @@ -12,6 +12,7 @@ import org.oppia.android.app.survey.PreviousAnswerHandler import org.oppia.android.app.survey.SelectedAnswerAvailabilityReceiver import org.oppia.android.app.survey.SelectedAnswerHandler import org.oppia.android.app.translation.AppLanguageResourceHandler +import org.oppia.android.util.enumfilter.filterByEnumCondition import javax.inject.Inject /** [SurveyAnswerItemViewModel] for the market fit question options. */ @@ -98,8 +99,12 @@ class MarketFitItemsViewModel @Inject constructor( private fun getMarketFitOptions(): ObservableList { val appName = resourceHandler.getStringInLocale(R.string.app_name) val observableList = ObservableArrayList() - observableList += MarketFitAnswer.values() - .filter { it.isValid() } + val filteredmarketFitAnswer = filterByEnumCondition( + MarketFitAnswer.values().toList(), + { marketFitAnswer -> marketFitAnswer }, + { marketFitAnswer -> marketFitAnswer.isValid() } + ) + observableList += filteredmarketFitAnswer .mapIndexed { index, marketFitAnswer -> when (marketFitAnswer) { MarketFitAnswer.VERY_DISAPPOINTED -> MultipleChoiceOptionContentViewModel( diff --git a/app/src/main/java/org/oppia/android/app/survey/surveyitemviewmodel/UserTypeItemsViewModel.kt b/app/src/main/java/org/oppia/android/app/survey/surveyitemviewmodel/UserTypeItemsViewModel.kt index 14482c2775e..a03a78d10c8 100644 --- a/app/src/main/java/org/oppia/android/app/survey/surveyitemviewmodel/UserTypeItemsViewModel.kt +++ b/app/src/main/java/org/oppia/android/app/survey/surveyitemviewmodel/UserTypeItemsViewModel.kt @@ -12,6 +12,7 @@ import org.oppia.android.app.survey.SelectedAnswerAvailabilityReceiver import org.oppia.android.app.survey.SelectedAnswerHandler import org.oppia.android.app.translation.AppLanguageResourceHandler import org.oppia.android.app.viewmodel.ObservableArrayList +import org.oppia.android.util.enumfilter.filterByEnumCondition import javax.inject.Inject /** [SurveyAnswerItemViewModel] for providing the type of user question options. */ @@ -97,46 +98,36 @@ class UserTypeItemsViewModel @Inject constructor( private fun getUserTypeOptions(): ObservableArrayList { val observableList = ObservableArrayList() - observableList += UserTypeAnswer.values() - .filter { it.isValid() } - .mapIndexed { index, userTypeOption -> - when (userTypeOption) { - UserTypeAnswer.LEARNER -> - MultipleChoiceOptionContentViewModel( - resourceHandler.getStringInLocale( - R.string.user_type_answer_learner - ), - index, - this - ) - UserTypeAnswer.TEACHER -> MultipleChoiceOptionContentViewModel( - resourceHandler.getStringInLocale( - R.string.user_type_answer_teacher - ), - index, - this - ) - - UserTypeAnswer.PARENT -> - MultipleChoiceOptionContentViewModel( - resourceHandler.getStringInLocale( - R.string.user_type_answer_parent - ), - index, - this - ) - - UserTypeAnswer.OTHER -> - MultipleChoiceOptionContentViewModel( - resourceHandler.getStringInLocale( - R.string.user_type_answer_other - ), - index, - this - ) - else -> throw IllegalStateException("Invalid UserTypeAnswer") - } + val filteredUserTypes = filterByEnumCondition( + UserTypeAnswer.values().toList(), + { userTypeAnswer -> userTypeAnswer }, + { userTypeAnswer -> userTypeAnswer.isValid() } + ) + observableList += filteredUserTypes.mapIndexed { index, userTypeOption -> + when (userTypeOption) { + UserTypeAnswer.LEARNER -> MultipleChoiceOptionContentViewModel( + resourceHandler.getStringInLocale(R.string.user_type_answer_learner), + index, + this + ) + UserTypeAnswer.TEACHER -> MultipleChoiceOptionContentViewModel( + resourceHandler.getStringInLocale(R.string.user_type_answer_teacher), + index, + this + ) + UserTypeAnswer.PARENT -> MultipleChoiceOptionContentViewModel( + resourceHandler.getStringInLocale(R.string.user_type_answer_parent), + index, + this + ) + UserTypeAnswer.OTHER -> MultipleChoiceOptionContentViewModel( + resourceHandler.getStringInLocale(R.string.user_type_answer_other), + index, + this + ) + else -> throw IllegalStateException("Invalid UserTypeAnswer") } + } return observableList } diff --git a/app/src/main/java/org/oppia/android/app/testing/ColorBindingAdaptersTestActivity.kt b/app/src/main/java/org/oppia/android/app/testing/ColorBindingAdaptersTestActivity.kt index 9d8878c520f..d9b99d434e1 100644 --- a/app/src/main/java/org/oppia/android/app/testing/ColorBindingAdaptersTestActivity.kt +++ b/app/src/main/java/org/oppia/android/app/testing/ColorBindingAdaptersTestActivity.kt @@ -6,7 +6,7 @@ import android.os.Bundle import org.oppia.android.R import org.oppia.android.app.activity.InjectableAutoLocalizedAppCompatActivity -/** Test activity for ViewBindingAdapters. */ +/** Test activity for ColorBindingAdapters. */ class ColorBindingAdaptersTestActivity : InjectableAutoLocalizedAppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) diff --git a/app/src/main/java/org/oppia/android/app/testing/TextInputLayoutBindingAdaptersTestActivity.kt b/app/src/main/java/org/oppia/android/app/testing/TextInputLayoutBindingAdaptersTestActivity.kt new file mode 100644 index 00000000000..02fcec01b90 --- /dev/null +++ b/app/src/main/java/org/oppia/android/app/testing/TextInputLayoutBindingAdaptersTestActivity.kt @@ -0,0 +1,26 @@ +package org.oppia.android.app.testing + +import android.content.Context +import android.content.Intent +import android.os.Bundle +import org.oppia.android.R +import org.oppia.android.app.activity.InjectableAutoLocalizedAppCompatActivity + +/** Test activity for [TextInputLayoutBindingAdapters]. */ +class TextInputLayoutBindingAdaptersTestActivity : InjectableAutoLocalizedAppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.text_input_layout_binding_adapters_test_activity) + + supportFragmentManager.beginTransaction().add( + R.id.background, + TextInputLayoutBindingAdaptersTestFragment() + ).commitNow() + } + + companion object { + /** Intent to open this activity. */ + fun createIntent(context: Context): Intent = + Intent(context, TextInputLayoutBindingAdaptersTestActivity::class.java) + } +} diff --git a/app/src/main/java/org/oppia/android/app/testing/TextInputLayoutBindingAdaptersTestFragment.kt b/app/src/main/java/org/oppia/android/app/testing/TextInputLayoutBindingAdaptersTestFragment.kt new file mode 100644 index 00000000000..ce0167f7b33 --- /dev/null +++ b/app/src/main/java/org/oppia/android/app/testing/TextInputLayoutBindingAdaptersTestFragment.kt @@ -0,0 +1,30 @@ +package org.oppia.android.app.testing + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import org.oppia.android.app.fragment.InjectableFragment +import org.oppia.android.databinding.TextInputLayoutBindingAdaptersTestFragmentBinding + +/** Test-only fragment for verifying behaviors of [TextInputLayoutBindingAdapters]. */ +class TextInputLayoutBindingAdaptersTestFragment : InjectableFragment() { + + private lateinit var binding: TextInputLayoutBindingAdaptersTestFragmentBinding + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View { + binding = TextInputLayoutBindingAdaptersTestFragmentBinding.inflate( + inflater, + container, + false + ) + + binding.lifecycleOwner = this@TextInputLayoutBindingAdaptersTestFragment + + return binding.root + } +} diff --git a/app/src/main/java/org/oppia/android/app/topic/lessons/TopicLessonsFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/topic/lessons/TopicLessonsFragmentPresenter.kt index 66a5a32b2df..1f38909e9d3 100644 --- a/app/src/main/java/org/oppia/android/app/topic/lessons/TopicLessonsFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/topic/lessons/TopicLessonsFragmentPresenter.kt @@ -30,6 +30,7 @@ import org.oppia.android.domain.oppialogger.OppiaLogger import org.oppia.android.util.accessibility.AccessibilityService import org.oppia.android.util.data.AsyncResult import org.oppia.android.util.data.DataProviders.Companion.toLiveData +import org.oppia.android.util.enumfilter.filterByEnumCondition import javax.inject.Inject /** The presenter for [TopicLessonsFragment]. */ @@ -161,18 +162,18 @@ class TopicLessonsFragmentPresenter @Inject constructor( val chapterSummaries = storySummaryViewModel .storySummary.chapterList - val completedChapterCount = - chapterSummaries.map(ChapterSummary::getChapterPlayState) - .filter { - it == ChapterPlayState.COMPLETED - } - .size + val completedChapterCount = filterByEnumCondition( + chapterSummaries.map(ChapterSummary::getChapterPlayState), + { it }, + { it == ChapterPlayState.COMPLETED } + ).size + val inProgressChapterCount = - chapterSummaries.map(ChapterSummary::getChapterPlayState) - .filter { - it == ChapterPlayState.IN_PROGRESS_SAVED - } - .size + filterByEnumCondition( + chapterSummaries.map(ChapterSummary::getChapterPlayState), + { it }, + { it == ChapterPlayState.IN_PROGRESS_SAVED } + ).size val storyPercentage: Int = (completedChapterCount * 100) / storySummaryViewModel.storySummary.chapterCount diff --git a/app/src/main/res/drawable/learner_otter.xml b/app/src/main/res/drawable/learner_otter.xml index 2fba3df3a5f..69f037bdca9 100644 --- a/app/src/main/res/drawable/learner_otter.xml +++ b/app/src/main/res/drawable/learner_otter.xml @@ -2,7 +2,8 @@ android:width="180dp" android:height="180dp" android:viewportWidth="500" - android:viewportHeight="500"> + android:viewportHeight="500" + android:autoMirrored="true"> + android:viewportHeight="167" + android:autoMirrored="true"> diff --git a/app/src/main/res/drawable/parent_teacher_otter.xml b/app/src/main/res/drawable/parent_teacher_otter.xml index abeec4882c4..8671cb9dbbf 100644 --- a/app/src/main/res/drawable/parent_teacher_otter.xml +++ b/app/src/main/res/drawable/parent_teacher_otter.xml @@ -2,7 +2,8 @@ android:width="180dp" android:height="180dp" android:viewportWidth="500" - android:viewportHeight="500"> + android:viewportHeight="500" + android:autoMirrored="true"> + + + + diff --git a/app/src/main/res/drawable/splash_page.xml b/app/src/main/res/drawable/splash_page.xml index 96790799d5d..a95dba7e5eb 100644 --- a/app/src/main/res/drawable/splash_page.xml +++ b/app/src/main/res/drawable/splash_page.xml @@ -3,12 +3,6 @@ android:height="640dp" android:viewportWidth="360" android:viewportHeight="640"> - - - - diff --git a/app/src/main/res/layout-land/audio_language_selection_fragment.xml b/app/src/main/res/layout-land/audio_language_selection_fragment.xml index ed683db064e..28cc53ec8f1 100644 --- a/app/src/main/res/layout-land/audio_language_selection_fragment.xml +++ b/app/src/main/res/layout-land/audio_language_selection_fragment.xml @@ -3,6 +3,13 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:card_view="http://schemas.android.com/apk/res-auto"> + + + + + + android:padding="@dimen/onboarding_shared_padding_small" + app:filter="@{false}" + app:languageSelection="@{viewModel.selectedAudioLanguage}"/> diff --git a/app/src/main/res/layout-land/create_profile_fragment.xml b/app/src/main/res/layout-land/create_profile_fragment.xml index 93c01c2f32d..aa839f0e2e9 100644 --- a/app/src/main/res/layout-land/create_profile_fragment.xml +++ b/app/src/main/res/layout-land/create_profile_fragment.xml @@ -124,7 +124,7 @@ android:layout_marginStart="@dimen/phone_shared_margin_xl" android:layout_marginTop="@dimen/phone_shared_margin_small" android:layout_marginEnd="@dimen/phone_shared_margin_medium" - android:text="@string/create_profile_activity_nickname_error" + android:text="@{viewModel.errorMessage}" android:visibility="@{viewModel.hasErrorMessage ? View.VISIBLE : View.GONE}" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/create_profile_nickname_edittext" /> diff --git a/app/src/main/res/layout-land/onboarding_app_language_selection_fragment.xml b/app/src/main/res/layout-land/onboarding_app_language_selection_fragment.xml index 06652937c5a..cbe45fadc7a 100644 --- a/app/src/main/res/layout-land/onboarding_app_language_selection_fragment.xml +++ b/app/src/main/res/layout-land/onboarding_app_language_selection_fragment.xml @@ -96,6 +96,7 @@ app:startIconTint="@color/component_color_shared_black_background_color"> + + + + + + android:padding="@dimen/onboarding_shared_padding_small" + app:filter="@{false}" + app:languageSelection="@{viewModel.selectedAudioLanguage}" /> diff --git a/app/src/main/res/layout-sw600dp-land/create_profile_fragment.xml b/app/src/main/res/layout-sw600dp-land/create_profile_fragment.xml index 5eba49ebb23..3e33448c69f 100644 --- a/app/src/main/res/layout-sw600dp-land/create_profile_fragment.xml +++ b/app/src/main/res/layout-sw600dp-land/create_profile_fragment.xml @@ -121,7 +121,7 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/tablet_shared_margin_x_small" android:layout_marginEnd="@dimen/tablet_shared_margin_small" - android:text="@string/create_profile_activity_nickname_error" + android:text="@{viewModel.errorMessage}" android:visibility="@{viewModel.hasErrorMessage ? View.VISIBLE : View.GONE}" app:layout_constraintStart_toStartOf="@id/create_profile_nickname_edittext" app:layout_constraintTop_toBottomOf="@id/create_profile_nickname_edittext" /> diff --git a/app/src/main/res/layout-sw600dp-land/onboarding_app_language_selection_fragment.xml b/app/src/main/res/layout-sw600dp-land/onboarding_app_language_selection_fragment.xml index a319e663457..7b27335c708 100644 --- a/app/src/main/res/layout-sw600dp-land/onboarding_app_language_selection_fragment.xml +++ b/app/src/main/res/layout-sw600dp-land/onboarding_app_language_selection_fragment.xml @@ -105,6 +105,7 @@ app:startIconTint="@color/component_color_shared_black_background_color"> + + + + + + android:padding="@dimen/onboarding_shared_padding_small" + app:filter="@{false}" + app:languageSelection="@{viewModel.selectedAudioLanguage}" /> diff --git a/app/src/main/res/layout-sw600dp-port/create_profile_fragment.xml b/app/src/main/res/layout-sw600dp-port/create_profile_fragment.xml index 0edd5932959..689c67ae91f 100644 --- a/app/src/main/res/layout-sw600dp-port/create_profile_fragment.xml +++ b/app/src/main/res/layout-sw600dp-port/create_profile_fragment.xml @@ -120,7 +120,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="@dimen/tablet_shared_margin_small" - android:text="@string/create_profile_activity_nickname_error" + android:text="@{viewModel.errorMessage}" android:visibility="@{viewModel.hasErrorMessage ? View.VISIBLE : View.GONE}" app:layout_constraintStart_toStartOf="@id/create_profile_nickname_edittext" app:layout_constraintTop_toBottomOf="@id/create_profile_nickname_edittext" /> diff --git a/app/src/main/res/layout-sw600dp-port/onboarding_app_language_selection_fragment.xml b/app/src/main/res/layout-sw600dp-port/onboarding_app_language_selection_fragment.xml index 9425ffc352d..e2fc66f56c0 100644 --- a/app/src/main/res/layout-sw600dp-port/onboarding_app_language_selection_fragment.xml +++ b/app/src/main/res/layout-sw600dp-port/onboarding_app_language_selection_fragment.xml @@ -104,6 +104,7 @@ app:startIconTint="@color/component_color_shared_black_background_color"> + + + + + + android:padding="@dimen/onboarding_shared_padding_small" + app:filter="@{false}" + app:languageSelection="@{viewModel.selectedAudioLanguage}" /> diff --git a/app/src/main/res/layout/create_profile_fragment.xml b/app/src/main/res/layout/create_profile_fragment.xml index ab53fbfc69a..40f8c4116f3 100644 --- a/app/src/main/res/layout/create_profile_fragment.xml +++ b/app/src/main/res/layout/create_profile_fragment.xml @@ -123,7 +123,7 @@ android:layout_marginStart="@dimen/phone_shared_margin_xl" android:layout_marginTop="@dimen/phone_shared_margin_small" android:layout_marginEnd="@dimen/phone_shared_margin_medium" - android:text="@string/create_profile_activity_nickname_error" + android:text="@{viewModel.errorMessage}" android:visibility="@{viewModel.hasErrorMessage ? View.VISIBLE : View.GONE}" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/create_profile_nickname_edittext" /> diff --git a/app/src/main/res/layout/onboarding_app_language_selection_fragment.xml b/app/src/main/res/layout/onboarding_app_language_selection_fragment.xml index 2c711918350..9737d8f8a59 100644 --- a/app/src/main/res/layout/onboarding_app_language_selection_fragment.xml +++ b/app/src/main/res/layout/onboarding_app_language_selection_fragment.xml @@ -100,6 +100,7 @@ app:startIconTint="@color/component_color_shared_black_background_color"> + diff --git a/app/src/main/res/layout/text_input_layout_binding_adapters_test_fragment.xml b/app/src/main/res/layout/text_input_layout_binding_adapters_test_fragment.xml new file mode 100644 index 00000000000..1beae3f8b41 --- /dev/null +++ b/app/src/main/res/layout/text_input_layout_binding_adapters_test_fragment.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 81bca583bed..251a04d4bcd 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -4,10 +4,11 @@ * Meno25 * MohamedMedhat * Mouradeq +* SamarBenNafa * Sarah zoubida * Seanlip --> - + أعلى قائمة التنقل خيارات التنزيلات @@ -23,13 +24,13 @@ تشغيل الصوت إيقاف الصوت مؤقتًا صوت %s غير متوفر. - موافق + نعم إلغاء لغة الصوت غير متصل بالإنترنت من فضلك تأكد من وجود اتصال بالإنترنت عن طريق شبكة الوايفاي أو بيانات الهاتف، ثم حاول مرة أخرى. - حسنًا - موافق + نعم + نعم إلغاء متصل بالإنترنت عن طريق بيانات الهاتف تشغيل الصوت عبر الإنترنت قد يستخدم الكثير من بيانات الهاتف. @@ -91,10 +92,10 @@ الموضوع: %s موضوع المواضيع قيد التقدم - فصل %s: %s - تم انهاء الفصل %s الذي يحمل عنوان %s - الفصل %s الذي يحمل عنوان %s ما زال قيد التقدم - قم بإنهاء الفصل %s: %s لكي تفتح هذا الفصل. + الفصل %1$s: %2$s + تم الانتهاء من الفصل %1$s بعنوان %2$s + الفصل %1$s بعنوان %2$s قيد التنفيذ + أكمل الفصل %1$s : %2$s لفتح هذا الفصل. أكمل الفصل السابق لفتح هذا الفصل. أدخل النص. أدخل كسر عشري في الصيغة (بسط/مقام)، أو عدد كسري في الصيغة (عدد بسط/مقام). @@ -149,7 +150,7 @@ المواضيع التي تم تنزيلها تم التنزيل وضع الممارسة - السؤال %s من أصل %s + السؤال %1$s من %2$s تمّ تم الإنتهاء تم الإنتهاء من جميع الأسئلة! يمكنك بدأ مجموعة أسئلة أخرى، أو العودة للموضوع. @@ -167,12 +168,12 @@ لا يجب أن يحتوي أي رقم في الكسر العشري على أكثر من 7 أرقام. من فضلك إبدأ إجابتك برقم (0 او 0.5 على سبيل المثال) من فضلك قم بإدخال رقم صالح. - (–يمكن أن تحتوي الإجابة على 15 رقمًا (0-9) على الأكثر أو الرموز (. أو - من فضلك قم بكتابة نسبة تتكون من أرقام مفصولة بنقطتين رأسيتين (1:2 أو 1:2:3 على سبيل المثال). - من فضلك أدخل نسبة صحيحة (1:2 أو 1:2:3 على سبيل المثال) - إجابتك تحتوي على نقطتين رأسيتين (:) متتاليتين. - عدد الحدود لا يساوي العدد المطلوب. - لا يمكن أن تحتوي النسب على 0 كعنصر. + (–يمكن أن تحتوي الإجابة على 15 رقمًا (0-9) على الأكثر أو الرموز (. أو + يرجى كتابة نسبة تتكون من أرقام مفصولة بعلامات نقطية (على سبيل المثال 1:2 أو 1:2:3). + الرجاء إدخال نسبة صالحة (على سبيل المثال 1:2 أو 1:2:3). + إجابتك تحتوي على علامتي نقطتين (:) بجانب بعضهما البعض. + عدد المصطلحات لا يساوي عدد المصطلحات المطلوبة. + لا يمكن للنسب أن تحتوي على 0 كعنصر. الحجم مجهول %s بايت %s ك.ب @@ -180,7 +181,7 @@ %s ج.ب صحيح! الموضوع: %s - + و لا فصل فصلًا واحدًا فصلان @@ -188,7 +189,7 @@ %s من الفصول %s من الفصول - + و لا قصة قصة واحدة قصتان @@ -197,14 +198,14 @@ %s من القصص - و لا فصل مكتمل - فصل %s مكتمل من %s - فصلان %s مكتملان من %s - %sفصول مكتملة من %s - %s فصول مكتملة من %s - %s فصول مكتملة من %s + لا فصل + %1$s من %2$s فصل مكتمل + فصلان + فصول قليلة + فصول كثيرة + %1$s من %2$s فصل مكتمل - + و لا درس درسًا واحدًا درسان @@ -212,7 +213,7 @@ %s درس %s درس - + و لا قصة مكتملة قصة واحدة مكتملة قصتان مكتملتان @@ -220,7 +221,7 @@ %s قصة مكتملة %s قصة مكتملة - + و لا موضوع في تقدم موضوع واحد في تقدم موضوعان في تقدم @@ -285,7 +286,7 @@ تخطي التالي ابدأ - شاشة العرض %s من %s + الشريحة %1$s من %2$s أهلًا، %s! من فضلك أدخل رقم التعريف الشخصي الخاص بالمشرف. من فضلك أدخل رقم التعريف الشخصي الخاص بك. @@ -350,7 +351,7 @@ اختيار من المعرض إعادة تسمية الملف الشخصي الاسم الجديد - حفظ + يحفظ إعادة ضبط رقم التعريف الشخصي أدخل رقم تعريف شخصي جديد للمستخدم كي يستخدمه عند الدخول إلى ملفه الشخصي. رقم تعريف شخصي مكون من 3 أرقام @@ -383,12 +384,12 @@ تم تثبيت آخر إصدار في %s. قم باستخدام رقم الإصدار في الأعلى للإبلاغ عن أعطال التطبيق. إصدار التطبيق لغة التطبيق - لغة الصوت الافتراضية + لغة الصوت المفضلة حجم النص المقروء حجم النص المقروء سيظهر نص القصة بهذا الشكل. أ - الصوت الافتراضي + اللغة الصوتية المفضلة لغة التطبيق حجم النص المقروء صغير @@ -411,14 +412,14 @@ عظيم هيّا نبدأ. نعم - …لا + …لا اختر موضوعًا\nآخرًا. هل أنت مهتم بـ:\n%s ملاحظة جديدة متاحة لا يوجد تلميح جديد متاح إظهار الملاحظات والحل تلميح %s - العودة للسابق + يغلق الملاحظات عرض الحل عرض الحل @@ -443,13 +444,13 @@ تحريك العنصر إلى الأعلى عند %s أعلى أسفل - %s %s + %1$s %2$s topic_revision_recyclerview_tag ongoing_recycler_view_tag برجاء اختيار خيار واحد على الأقل. - إصدار تطبيق غير مدعوم - هذا الإصدار من التطبيق لم يعد مدعومًا. من فضلك قم بتحديث التطبيق من خلال متجر بلاي (Play Store) - إغلاق التطبيق + إصدار التطبيق غير مدعوم + لم يعد هذا الإصدار من التطبيق مدعومًا. يرجى تحديثه عبر متجر Play. + إغلاق التطبيق بناء المطور ألفا بيتا @@ -461,8 +462,8 @@ مرحبًا! يتم الآن تحديث تطبيقك إلى إصدار التوفر العام. إذا واجهت مشاكل أثناء استخدام التطبيق ، أو كانت لديك أسئلة ، فيرجى الاتصال بنا على android-feedback@oppia.org. لا تظهر هذه الرسالة مرة أخرى نعم - إلى - أدخل نسبة في الصيغة س:ص. + ل + أدخل النسبة بالصيغة x:y. انقر هنا لإدخال نص. أصغر حجمًا للنص أكبر حجمًا للنص @@ -498,19 +499,31 @@ شروط الخدمة باستخدام %s ، فإنك توافق على<br><oppia-noninteractive-policy link=\"tos\"> شروط الخدمة</oppia-noninteractive-policy> و<oppia-noninteractive-policy link=\"privacy\"> سياسة الخصوصية</oppia-noninteractive-policy> . يرجى زيارة <a href=\"https://www.oppia.org/terms\">هذه الصفحة</a> للحصول على أحدث نسخة من هذه الشروط. - كيف يمكنني إنشاء ملف تعريف(حساب) جديد؟ - كيف يمكنني حذف ملف التعريف(حساب)؟ ما هي %s؟ من هو المشرف؟ + كيف يمكنني إنشاء ملف تعريف(حساب) جديد؟ + كيف أحصل على التطبيق باللغة الخاصة بي؟ + لقد وجدت خطأً. كيف يمكنني الإبلاغ عنه؟ + لماذا هناك دروس الرياضيات فقط؟ + هل ستقوم بعمل المزيد من الدروس؟ لماذا لا يتم تحميل مشغل الاستكشاف؟ لماذا لا يتم تشغيل الصوت الخاص بي؟ + كيف يمكنني حذف ملف التعريف(حساب)؟ + كيف أقوم بتحديث التطبيق؟ + كيف أقوم بتحديث نظام التشغيل Android الخاص بي؟ لا أجد سؤالي هنا. ماذا الان؟ - <p>إذا كانت هذه هي المرة الأولى التي تنشئ فيها ملفًا شخصيًا وليس لديك رقم تعريف شخصي: <ol><li> من منتقي الملف الشخصي ، اضغط على<strong> قم بإعداد ملفات تعريف متعددة</strong></li><li> قم بإنشاء رقم تعريف شخصي و<strong>احفظ</strong></li><li> املأ جميع البيانات للملف الشخصي.<ol><li>(اختياري) قم بتحميل صورة.</li> <li>إدخال اسم.</li> <li>(اختياري) قم بتعيين رقم تعريف شخصي مكون من 3 أرقام.</li></ol></li><li> اضغط<strong>إنشاء</strong> . تمت إضافة هذا الملف الشخصي إلى منتقي ملف التعريف الخاص بك!</li></ol></p><p> إذا قمت بإنشاء ملف تعريف من قبل ولديك رقم تعريف شخصي:<ol><li> من منتقي الملف الشخصي ، اضغط على<strong>إضافة الملف الشخصي</strong></li> <li> أدخل رقم التعريف الشخصي الخاص بك وانقر فوق<strong>إرسال</strong></li><li> املأ جميع الحقول للملف الشخصي. <ol> <li>(اختياري) قم بتحميل صورة.</li> <li>إدخال اسم.</li> <li>(اختياري) قم بتعيين رقم تعريف شخصي مكون من 3 أرقام. </li></ol></li><li> اضغط<strong>إنشاء</strong> . تمت إضافة هذا الملف الشخصي إلى منتقي ملف التعريف الخاص بك!</li></ol></p><br><p> ملاحظة: فقط ال<u>مدير</u> قادر على إدارة الملفات الشخصية.</p> - <p>بمجرد حذف ملف التعريف:</p><ol><li>لا يمكن استعادة ملف التعريف.</li><li>سيتم حذف معلومات الملف الشخصي مثل الاسم والصور والتقدم بشكل دائم.</li></ol><p>لحذف ملف تعريف (باستثناء<u>المسؤول</u>):</p><ol><li> من الصفحة الرئيسية للمسؤول ، اضغط على زر القائمة أعلى اليسار.</li><li> اضغط على<strong>ضوابط المسؤول</strong>. </li><li> اضغط على<strong>تحرير ملفات التعريف</strong>.</li><li> اضغط على الملف الشخصي الذي ترغب في حذفه.</li><li> في الجزء السفلي من الشاشة ، انقر فوق<strong>حذف الملف الشخصي</strong>. </li><li> اضغط<strong>حذف</strong>لتأكيد الحذف. </li></ol><p><br></p><p> ملاحظة:<u>المسؤول</u>فقط هو القادر على إدارة الملفات الشخصية.</p> <p>%1$s <i>\"أو-بي-يا\"</i>(فنلندية) - \"للتعلم\"</p><p><br></p><p>%1$sمهمتنا هي مساعدة أي شخص على تعلم أي شيء يريده بطريقة فعالة وممتعة.</p><p><br></p><p>من خلال إنشاء مجموعة من الدروس المجانية عالية الجودة والفعالة بشكل واضح بمساعدة معلمين من جميع أنحاء العالم ، تهدف %1$s إلى تزويد الطلاب بتعليم جيد - بغض النظر عن مكان وجودهم أو الموارد التقليدية التي يمكنهم الوصول إليها.</p><p><br></p><p>كطالب ، يمكنك أن تبدأ مغامرتك التعليمية من خلال تصفح الموضوعات المدرجة في الصفحة الرئيسية!</p> - <p>المشرف هو المستخدم الرئيسي الذي يدير ملفات التعريف والإعدادات لكل ملف تعريف على حسابه. هم على الأرجح والدك أو معلمك أو وصي عليك الذي أنشأ هذا الملف الشخصي لك.</p><p><br></p><p>يمكن للمسؤولين إدارة الملفات الشخصية وتعيين أرقام التعريف الشخصية وتغيير الإعدادات الأخرى ضمن حساباتهم. بناءً على ملف التعريف الخاص بك ، قد تكون أذونات المسؤول مطلوبة لبعض الميزات مثل تنزيل الموضوعات وتغيير رقم التعريف الشخصي وغير ذلك.</p><p><br></p><p>لمعرفة من هو المسؤول لديك ، انتقل إلى منتقي الملف الشخصي. الملف الشخصي الأول المدرج ولديه \"المسؤول\" مكتوب باسمه هو المسؤول.</p> - <p>إذا لم يتم تحميل مشغل الاستكشاف</p><p><br></p><p>تحقق لمعرفة ما إذا كان التطبيق محدثًا أم لا:</p><p> <ul> <li> انتقل إلى متجر Play وتأكد من تحديث التطبيق إلى أحدث إصدار </li></ul><p><br></p><p>تحقق من اتصالك بالإنترنت:</p><ul><li> إذا كان اتصالك بالإنترنت بطيئًا ، فحاول إعادة الاتصال بشبكة Wi-Fi أو الاتصال بشبكة أخرى. </li></ul><p>اطلب من المشرف التحقق من أجهزتهم واتصال الإنترنت:</p><ul><li> اطلب من المشرف استكشاف الأخطاء وإصلاحها باستخدام الخطوات المذكورة أعلاه </li></ul><p>أخبرنا إذا كنت لا تزال تواجه مشكلات في التحميل:</p><ul><li> أبلغ عن مشكلة عن طريق الاتصال بنا على admin@oppia.org. </li></ul> - <p>إذا لم يتم تشغيل الصوت الخاص بك</p><p><br></p><p>تحقق لمعرفة ما إذا كان التطبيق محدثًا أم لا:</p><ul><li>انتقل إلى متجر Play وتأكد من تحديث التطبيق إلى أحدث إصدار</li></ul><p><br></p><p>تحقق من اتصالك بالإنترنت:</p><ul><li>إذا كان اتصالك بالإنترنت بطيئًا ، فحاول إعادة الاتصال بشبكة Wi-Fi أو الاتصال بشبكة أخرى. قد يتسبب الإنترنت البطيء في تحميل الصوت بشكل غير منتظم ، مما يجعل من الصعب تشغيله.</li></ul><p><br></p><p>اطلب من المسؤول التحقق من أجهزتهم واتصال الإنترنت:</p><ul><li>اطلب من المسؤول استكشاف الأخطاء وإصلاحها باستخدام الخطوات المذكورة أعلاه</li></ul><p><br></p><p>أخبرنا إذا كنت لا تزال تواجه مشكلات في التحميل:</p><ul><li>أبلغ عن مشكلة عن طريق الاتصال بنا على admin@oppia.org.</li></ul> + <p>المدير هو المستخدم الرئيسي الذي يدير الملفات الشخصية وإعدادات كل ملف على حسابه. من المحتمل أن يكونوا والديك أو معلمك أو وليكك الشخص الذي قام بإنشاء هذا الملف الشخصي لك.</p><p><br/></p><p>لدى المديرين القدرة على إدارة الملفات الشخصية وتعيين الرمز الرقمية والتحديد الإعدادات الأخرى تحت حسابهم. اعتمادا على ملفك الشخصي، قد تكون هناك حاجة إلى إذنات الإدارة لميزات معينة مثل تغيير رمز الرقم الشخصي، وغيرها.</p><p><br/></p><p>لمعرفة من هو مديرك، اذهب إلى خيار الملفات الشخصية. أول ملف تعريف مدرج ويتم كتابة \"المنظم\" تحت اسمهم هو المدير.</p> + <p>إذا كانت هذه هي المرة الأولى التي تقوم فيها بإنشاء ملف تعريف و لم يكن لديك رمز PIN: من خيار الملف تعريف، اضغط على إعداد ملف تعبير عدة. إخلق رقم PIN و حفظ. املأ جميع الحقول للملف الشخصي. (اختياري) تحميل صورة. أدخل اسمك (اختياري) تعيين رقم PIN 3 رقمي. اضغط على \"إنشاء\" هذا الملف الشخصي يضاف إلى اختيار الملف الشخصى الخاص بك!<ol><li>من اختيار الملفات الشخصية، اضغط على إعداد الملفات الملفات الأخرى.</li><li><strong>إبق</strong> رقم PIN و حفظ.</li><li>املأ جميع الحقول للملف الشخصي. (اختياري) تحميل صورة. أدخل اسمك (اختياري) تعيين رقم PIN 3 رقمي.<ol><li> (اختياري) تحميل صورة.</li><li>أدخل اسمك</li><li> (اختياري) تعيين رقم PIN 3 رقمي.</li></ol></li><li>اضغط على \"إنشاء\" هذا الملف الشخصي يضاف إلى اختيار الملف الشخصى الخاص بك!</li></ol></p><p>إذا كنت قد أنشأت ملفاً ملفاَ ملفاُ ملفاٌ ملفاٍ ملفاِ ملفا ً ملفا (PIN): من خيار الملفاً الملفاَ، اضغط على إضافة الملفاُ الملفاِ. أدخل رقم رسومك وتقرّب على \"إرسال\". املأ جميع الحقول للملف الشخصي. (اختياري) تحميل صورة. أدخل اسمك (اختياري) تعيين رقم PIN 3 رقمي. اضغط على \"إنشاء\" هذا الملف الشخصي يضاف إلى اختيار الملف الشخصى الخاص بك!<ol><li>من اختيار الملفات الشخصية، اضغط على إضافة الملفات.</li><li>أدخل رقم رسومك وتقرّب على \"<strong>إرسال</strong>\".</li><li>املأ جميع الحقول للملف الشخصي. (اختياري) تحميل صورة. أدخل اسمك (اختياري) تعيين رقم PIN 3 رقمي.<ol><li> (اختياري) تحميل صورة.</li><li>أدخل اسمك</li><li> (اختياري) تعيين رقم PIN 3 رقمي.</li></ol></li><li>اضغط على \"إنشاء\" هذا الملف الشخصي يضاف إلى اختيار الملف الشخصى الخاص بك!</li></ol></p><p><br/></p><p>ملاحظة: إدارة الملفات الشخصية يمكن <u>المدير</u> فقط.</p> + <p>التطبيق %s يدعم حاليا اللغة الإنجليزية والبرتغالية البرازيلية والعربية والسواحيلية والبيدجينية النيجيرية. اختر إحدى هذه اللغات من القائمة، في الخيارات. لطلب التطبيق باللغة التي تتحدث بها، يرجى الاتصال بنا على <strong>admin@oppia.org</strong>.</p> + <p><ol><li>من خلال %s شاشة التطبيق الرئيسية، اضغط على القائمة في أعلى الزاوية اليسرى</li><li>اضغط على <strong>مشاركة التعليقات</strong>.</li><li>اتبع التعليمات للإبلاغ عن الأخطاء أو مشاركة التعليقات</li></ol></p> + <p>%1$s مهمتها مساعدة المتعلمين على اكتساب المهارات الحياتية اللازمة. الرياضيات مهارة أساسية في الحياة اليومية1%$s سوف تقدم دروسا جديدة في العلوم وغيرها من المواد قريبا!</p> + <p>أجل, %s سوف تقدم دروسا جديدة في العلوم وفي مواد أخرى قريبا. الرجاء زيارتنا مجددا لمعرفة كل ماهو جديد!</p> + <p>إذا لم يتم تحميل جهاز التحقيق</p><p><br/></p><p>تحقق من تحديث التطبيق:</p><ul><li>اذهب إلى متجر Play وتأكد من تحديث التطبيق إلى أحدث إصدار</li></ul><p><br/></p><p>تحقق من اتصالك بالإنترنت:</p><ul><li>إذا كان اتصال الإنترنت بطيء، حاول إعادة الاتصال بشبكة واي فاي الخاصة بك أو الاتصال بشبك آخر.</li></ul><p>اطلب من المدير التحقق من جهازك و اتصالك بالإنترنت:</p><ul><li>احصل على المدير لإصلاح المشاكل باستخدام الخطوات أعلاه</li></ul><p><br/></p><p>أخبرنا إذا كان لديك مشاكل مع الحملة:</p><ul><li>إبلاغ عن مشكلة عن طريق الاتصال بنا على admin@oppia.org.</li></ul> + <p>إذا كان صوتك لا يعزف</p><p><br/></p><p>تحقق من تحديث التطبيق:</p><ul><li>اذهب إلى متجر Play وتأكد من تحديث التطبيق إلى أحدث إصدار</li></ul><p><br/></p><p>تحقق من اتصالك بالإنترنت:</p><ul><li>إذا كان اتصال الإنترنت بطيء، حاول إعادة الاتصال بشبكة واي فاي الخاصة بك أو الاتصال بشبك آخر. إن الإنترنت البطيء قد يسبب تحميل الصوت بشكل غير منتظم مما يجعل من الصعب تشغيله.</li></ul><p><br/></p><p>اطلب من المدير التحقق من جهازك و اتصالك بالإنترنت:</p><ul><li>احصل على المدير لإصلاح المشاكل باستخدام الخطوات أعلاه</li></ul><p><br/></p><p>أخبرنا إذا كان لديك مشاكل مع الحملة:</p><ul><li>إبلاغ عن مشكلة عن طريق الاتصال بنا على admin@oppia.org.</li></ul> + <p>بمجرد حذف الملف الشخصي:</p><ol><li>لا يمكن استعادة الملف</li><li>سيتم حذف معلومات الملف الشخصي مثل الاسم والصور والتقدم بشكل دائم.</li></ol><p>لإزالة ملف تعريف (باستثناء <u>المدير</u>):</p><ol><li>من صفحة الرئيسية للمدير، اضغط على زر القائمة في الجزء العلوي اليسرى.</li><li>اضغط على <strong>التحكمات الإدارية</strong></li><li>اضغط على <strong>تحرير الملفات الشخصية</strong>.</li><li>اضغط على الملف الشخصي الذي تريد حذفه.</li><li>في أسفل الشاشة، اضغط على <strong>حذف الملف الشخصي</strong>.</li><li>اضغط على حذف لتأكيد الحذف.</li></ol><p><br/></p><p>ملاحظة: إدارة الملفات الشخصية يمكن <u>المدير</u> فقط.</p> + <p><ol><li>افتح تطبيق Google Play Store</li><li>ابحث عن %s التطبيق</li><li>اضغط على تحديث</li></ol></p> + <p><ol><li>اضغط على تطبيق الإعدادات في هاتفك</li><li>اضغط على تحديثات النظام</li><li>اضغط على تحديثات النظام واتبع التعليمات لتحديث نظام تشغيل Android الخاص بك</li></ol></p> <p> إذا لم تتمكن من العثور على سؤالك أو كنت ترغب في الإبلاغ عن خطأ ، فاتصل بنا على admin@oppia.org. </p> نشاط اختبار جزء تحرير ملف التعريف يتحكم المسؤول في نشاط اختبار التجزئة diff --git a/app/src/main/res/values-pcm-rNG/strings.xml b/app/src/main/res/values-pcm-rNG/strings.xml index 5e98c6d7d17..0774dae0c11 100644 --- a/app/src/main/res/values-pcm-rNG/strings.xml +++ b/app/src/main/res/values-pcm-rNG/strings.xml @@ -94,11 +94,11 @@ Topic: %s Topic Topics wey dey in Progress - Chapter %s: %s - Chapter %s with title %s don complete - Chapter %s with title %s dey in progress - Complete Chapter %s: %s to unlock dis chapter. - Chapter %s: %s dey locked currently. Abeg complete chapter %s: %s to fit unlock dis chapter. + Chapter %s: %s + Chapter %s with title %s don complete + Chapter %s with title %s dey in progress + Complete Chapter %s: %s to unlock dis chapter. + Chapter %s: %s dey locked currently. Abeg complete chapter %s: %s to fit unlock dis chapter. Finish the chapter wey dey before to fit open dis chapter Enter text. Enter fraction wey dey in di form x/x, or mixed nomba wey dey in di form x x/x. @@ -153,7 +153,7 @@ Topic Wey You Don Download You don download am Practice Mode - Question %s of %s + Question %s of %s Complete Finished You don finish all of di questions! You fit choose to play anoda set of questions, or go back to di topic. @@ -192,7 +192,7 @@ 1 Story %s Stories - + %s of %s Chapter Completed %s of %s Chapters Completed @@ -267,7 +267,7 @@ Skip Next Get Started - Slide %s of %s + Slide %s of %s Hi, %s! Abeg put your Administrator PIN. Abeg put your PIN. @@ -426,7 +426,7 @@ Move item up to %s Up Down - %s %s + %s %s 0 minutes ago a minute ago @@ -463,11 +463,11 @@ Beta Notice Hello! Your app don dey update to di Beta version. If you experience any problems while you dey use di app, or get any questions, abeg contact us at android-feedback@oppia.org. No show dis message again - OK + OK General Availability Notice Hello! Your app don dey update to di General Availability version. If you experience any problems while you dey use di app, or get any questions, abeg contact us at android-feedback@oppia.org. No show dis message again - OK + OK to Enter a ratio in di form x:y. Tap here to put text. @@ -514,24 +514,19 @@ I see bug for di app. How I fit report am? Why only math lessons dey available? Una go dey create more lessons? - Why di Exploration player no dey load? + Why di Exploration player no dey load? Why my audio no dey play? How I go delete a profile? How I fit update di app? How I fit update my Android OS? I no dey find my question here. What now? <p>%1$s <i>\"O-pee-yah\"</i> (Finnish) - \"to learn\"</p><p><br></p><p>%1$s\'s mission na to help anyone learn anything dey want in an effective and enjoyable way.</p><p><br></p><p>By creating a set of free, high-quality, demonstrably effective lessons with di help of educators from around di world, %1$s dey aim to provide students with quality education — regardless of where dem dey or di traditional resources wey dem get access to.</p><p><br></p><p>As a student, you fit start your learning adventure by browsing di topics listed on di Home Page!</p> - <p>An Administrator na di main user wey dey manage profiles and settings for every profile on top their account. They fit be your parent, teacher, or guardian wey don create dis profile for you. </p><p><br></p><p>Administrators get di ability to manage profiles, assign PINs, and change other settings under their account. Depending on your profile, Administrator permissions fit dey required for some features such as changing your PIN, and more. </p><p><br></p><p>To see who your Administrator be, go di Profile Chooser. Di first profile fot di list and get \"Administrator\" written under their name na di Administrator. </p> - <p>If na your first time creating a profile and not have a PIN:<ol><li>From di Profile Chooser, tap on <strong>Set up Multiple Profiles</strong>.</li><li>Create a PIN and <strong>Save</strong>.</li><li>Fill in all boxes for di profile.<ol><li>(Optional) Upload a photo.</li><li>Enter a name.</li><li>(Optional) Assign a 3-digit PIN.</li></ol></li><li>Tap <strong>Create</strong>. Dis profile go add to your Profile Chooser!</li></ol></p><p> If you don create a profile before and you get a PIN:<ol><li>From di Profile Chooser, tap on <strong>Add Profile</strong>. </li><li>Enter your PIN and tap <strong>Submit</strong>. </li><li>Fill in all boxes for di profile.<ol><li> (Optional) Upload a photo. </li><li> Enter a name. </li><li> (Optional) Assign a 3-digit PIN. </li></ol></li><li>Tap <strong>Create</strong>. Dis profile go add to your Profile Chooser!</li></ol></p><br><p>Note: Only di <u>Administrator</u> go dey able to manage profiles.</p> - <p>The %s app dey support English, Brazilian Portuguese, Arabic, Swahili, and Nigerian Pidgin. Select one of these languages for di menu, under Options. To ask for the app for your language, abeg contact us for admin@oppia.org.</p> - <p>
  1. From your %s app home screen, tap the menu for di top left corner.
  2. Tap Share feedback.
  3. Follow di instructions to report di bug or share feedback.
</p>
-

%1$s mission na to help learners gain necessary life skills. Math na essential skill for everyday life. %1$s go dey offer new lessons on science and other subjects very soon!

-

Yes, %s go dey offer new lessons on science and other subjects very soon. Abeg check back for updates!

- <p>If di Exploration Player no dey load</p><p><br></p><p>Check to see if di app dey up to date:</p><p><ul><li> Go to di Play Store and make sure sey di app dey updated to di latest version </li></ul><p><br></p><p>Check your internet connection:</p><ul><li> If your internet connection dey slow, try re-connecting to your Wi-Fi network or connecting to a different network. </li></ul><p>Ask di Administrator to check their device and internet connection:</p><ul><li> Get di Administrator to troubleshoot using di steps above </li></ul><p>Let us know if you still dey get issues with loading:</p><ul><li> Report a problem by contacting us at admin@oppia.org. </li></ul> - <p>If your audio no dey play</p><p><br></p><p>Check to see if di app dey up to date:</p><ul><li> Go to di Play Store and make sure sey di app dey updated to di latest version </li></ul><p><br></p><p>Check your internet connection:</p><ul><li> If your internet connection dey slow, try re-connecting to your Wi-Fi network or connecting to a different network. Slow internet fit cause di audio to load irregularly, and go make am difficult to play. </li></ul><p><br></p><p>Ask di Administrator to check their device and internet connection:</p><ul><li> Get di Administrator to troubleshoot using di steps for up</li></ul><p><br></p><p>Let us know if you still dey get issues with loading:</p><ul><li> Report a problem by contacting us at admin@oppia.org. </li></ul> - <p>Once profile don delete:</p><ol><li>Di profile no fit dey recovered. </li><li> Profile information such as name, photos, and progress go permanently delete. </li></ol><p>To delete a profile (excluding the <u>Administrator\'s</u>):</p><ol><li> From di Administrator\'s Home Page, tap on di menu button on di top left. </li><li>Tap on <strong>Administrator Controls</strong>. </li><li>Tap on <strong>Edit Profiles</strong>. </li><li>Tap on di Profile wey you wan delete. </li><li>For di bottom of di screen, tap <strong>Profile Deletion</strong>. </li><li>Tap <strong>Delete</strong> to confirm deletion. </li></ol><p><br></p><p>Note: Only di <u>Administrator</u> go dey able to manage profiles.</p> -

  1. Open di Google Play Store app.
  2. Search for di %s app.
  3. Tap Update.

-
  1. Tap your phone\'s Settings app.
  2. Tap System updates.
  3. Tap System updates and follow di instructions to update your Android operating system.
+ <p>An Administrator na di main user wey dey manage profiles and settings for every profile on top their account. They fit be your parent, teacher, or guardian wey don create dis profile for you. </p><p><br></p><p>Administrators get di ability to manage profiles, assign PINs, and change other settings under their account. Depending on your profile, Administrator permissions fit dey required for some features such as changing your PIN, and more. </p><p><br></p><p>To see who your Administrator be, go di Profile Chooser. Di first profile fot di list and get \"Administrator\" written under their name na di Administrator. </p> + <p>If na your first time creating a profile and not have a PIN:<ol><li>From di Profile Chooser, tap on <strong>Set up Multiple Profiles</strong>.</li><li>Create a PIN and <strong>Save</strong>.</li><li>Fill in all boxes for di profile.<ol><li>(Optional) Upload a photo.</li><li>Enter a name.</li><li>(Optional) Assign a 3-digit PIN.</li></ol></li><li>Tap <strong>Create</strong>. Dis profile go add to your Profile Chooser!</li></ol></p><p> If you don create a profile before and you get a PIN:<ol><li>From di Profile Chooser, tap on <strong>Add Profile</strong>. </li><li>Enter your PIN and tap <strong>Submit</strong>. </li><li>Fill in all boxes for di profile.<ol><li> (Optional) Upload a photo. </li><li> Enter a name. </li><li> (Optional) Assign a 3-digit PIN. </li></ol></li><li>Tap <strong>Create</strong>. Dis profile go add to your Profile Chooser!</li></ol></p><br><p>Note: Only di <u>Administrator</u> go dey able to manage profiles.</p> + <p>The %s app dey support English, Brazilian Portuguese, Arabic, Swahili, and Nigerian Pidgin. Select one of these languages for di menu, under Options. To ask for the app for your language, abeg contact us for .</p> + <p>If di Exploration Player no dey load</p><p><br></p><p>Check to see if di app dey up to date:</p><p><ul><li> Go to di Play Store and make sure sey di app dey updated to di latest version </li></ul><p><br></p><p>Check your internet connection:</p><ul><li> If your internet connection dey slow, try re-connecting to your Wi-Fi network or connecting to a different network. </li></ul><p>Ask di Administrator to check their device and internet connection:</p><ul><li> Get di Administrator to troubleshoot using di steps above </li></ul><p>Let us know if you still dey get issues with loading:</p><ul><li> Report a problem by contacting us at admin@oppia.org. </li></ul> + <p>If your audio no dey play</p><p><br></p><p>Check to see if di app dey up to date:</p><ul><li> Go to di Play Store and make sure sey di app dey updated to di latest version </li></ul><p><br></p><p>Check your internet connection:</p><ul><li> If your internet connection dey slow, try re-connecting to your Wi-Fi network or connecting to a different network. Slow internet fit cause di audio to load irregularly, and go make am difficult to play. </li></ul><p><br></p><p>Ask di Administrator to check their device and internet connection:</p><ul><li> Get di Administrator to troubleshoot using di steps for up</li></ul><p><br></p><p>Let us know if you still dey get issues with loading:</p><ul><li> Report a problem by contacting us at admin@oppia.org. </li></ul> + <p>Once profile don delete:</p><ol><li>Di profile no fit dey recovered. </li><li> Profile information such as name, photos, and progress go permanently delete. </li></ol><p>To delete a profile (excluding the <u>Administrator\'s</u>):</p><ol><li> From di Administrator\'s Home Page, tap on di menu button on di top left. </li><li>Tap on <strong>Administrator Controls</strong>. </li><li>Tap on <strong>Edit Profiles</strong>. </li><li>Tap on di Profile wey you wan delete. </li><li>For di bottom of di screen, tap <strong>Profile Deletion</strong>. </li><li>Tap <strong>Delete</strong> to confirm deletion. </li></ol><p><br></p><p>Note: Only di <u>Administrator</u> go dey able to manage profiles.</p> <p>If you no fit find your question or you go like to report a bug, contact us for admin@oppia.org.</p> Profile Edit Fragment Test Activity Administrator Controls Fragment Test Activity diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 9711a238ba1..63042bc8413 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -1,13 +1,17 @@ @@ -16,6 +20,7 @@ Meus Downloads Ajuda Reprodutor de Exploração + Explorar Ajuda Fechar Trocar Perfil @@ -26,18 +31,20 @@ Tocar áudio Pausar áudio %s o áudio não está disponível. - OK + Ok Cancelar Idioma de Áudio Atualmente Offline Certifique-se de que o Wi-Fi ou os dados móveis estejam ativados e tente novamente. - OK - OK + Ok + Ok Cancelar Atualmente em Dados Móveis O streaming de áudio pode usar muitos dados móveis. Não mostre esta mensagem novamente Cartão de Conceito + Cartão Conceitual 1 + Cartão Conceitual 2 Cartão de Revisão Pretende ir para a página do tópico? Seu progresso não será salvo. @@ -71,13 +78,16 @@ Voltar ao cartão anterior Avançar para o próximo cartão Enviar + Enviar Repetir Retornar ao Tópico Respostas Anteriores (%s) Cliques em %s + Selecione uma imagem para continuar. Aprender Novamente Veja Mais Veja Menos + Esta é uma visualização de texto de exemplo FAQs Perguntas em Destaque Perguntas Frequentes @@ -94,11 +104,11 @@ Tópico: %s Tópico Tópicos em Andamento - Capítulo %s: %s - O capítulo %s com o título %s foi concluído - O capítulo %s com o título %s está em andamento - Conclua o capítulo %s: %s para desbloquear este capítulo. - O capítulo %s: %s está bloqueado no momento. Conclua o capítulo %s: %s para desbloquear esse capítulo. + Capítulo %s: %s + O capítulo %s com o título %s foi concluído + O capítulo %s com o título %s está em andamento + Conclua o capítulo %s: %s para desbloquear este capítulo. + O capítulo %s: %s está bloqueado no momento. Conclua o capítulo %s: %s para desbloquear esse capítulo. Conclua o capítulo anterior para desbloquear este capítulo. Inserir texto. Insira uma fração na forma x/x, ou um número misto na forma x x/x. @@ -106,8 +116,11 @@ Digite um número. Escreva números com unidades aqui. Digite uma expressão aqui, usando apenas números. + Insira uma expressão numérica para continuar. Digite uma expressão aqui. + Insira uma expressão algébrica para continuar. Digite uma equação aqui. + Insira uma equação para continuar. Por favor, remova os espaços entre os números em sua resposta. Feche ou remova os parênteses. Por favor, remova os parênteses ao redor da resposta inteira: \'%s\'. @@ -153,7 +166,7 @@ Tópico Baixado Baixado Modo de Prática - Questão %s de %s + Questão %s de %s Concluído Concluído Você concluiu todas as perguntas! Você pode escolher reproduzir outro conjunto de perguntas ou retornar ao tópico. @@ -169,14 +182,19 @@ Insira uma fração válida (por exemplo, 5/3 ou 1 2/3) Por favor, não coloque 0 no denominador Nenhum dos números da fração deve ter mais de 7 dígitos. + Insira uma fração para continuar. Comece sua resposta com um número (por exemplo, \"0\" em 0,5) Por favor, insira um número válido. A resposta pode conter no máximo 15 dígitos (0–9) ou símbolos (. ou -). - Escreva uma proporção que consista em dígitos separados por dois pontos (por exemplo, 1:2 ou 1:2:3). - Insira uma proporção válida (por exemplo, 1:2 ou 1:2:3). - Sua resposta tem dois dois-pontos (:) do lado um do outro. - O número de termos não é igual ao exigido. - Proporções não podem ter 0 como elemento. + Digite um número para continuar. + Escreva uma proporção que consista em dígitos separados por dois pontos (por exemplo, 1:2 ou 1:2:3). + Insira uma proporção válida (por exemplo, 1:2 ou 1:2:3). + Sua resposta tem dois pontos (:) próximos um do outro. + O número de termos não é igual aos termos exigidos. + As proporções não podem ter 0 como elemento. + Insira uma proporção para continuar. + Digite o texto para continuar. + Escolha uma resposta para continuar. Tamanho desconhecido %s Bytes %s KB @@ -192,7 +210,7 @@ %s História %s Histórias
- + %s de %s Capítulo Concluído %s de %s Capítulos Concluídos @@ -265,7 +283,7 @@ Pular Próximo Começar - Slide %s de %s + Slide %s de %s Olá, %s! Por favor, insira o PIN do Administrador. Por favor, insira seu PIN. @@ -307,6 +325,8 @@ Início A partir de agora, você pode ver as lições recomendadas para você aqui. Selecione um Tópico para começar + Início + Salas de aula Perfis Editar Perfil Criado em %s @@ -330,7 +350,7 @@ Escolha da Biblioteca Renomear Perfil Novo Nome - salvar + Salvar Redefinir PIN Insira um novo PIN para o usuário usar ao acessar seu perfil. PIN de 3 Dígitos @@ -343,6 +363,7 @@ Requerido Botão de Voltar Próximo + Análise de estudo do aluno Geral Editar conta Gerenciamento de Perfil @@ -363,12 +384,12 @@ A última atualização foi instalada em %s. Use o número da versão acima para enviar feedback sobre erros. Versão do Aplicativo Idioma do Aplicativo - Idioma Padrão de Áudio + Idioma de áudio preferido Tamanho do Texto de Leitura Tamanho do Texto de Leitura O texto da história ficará assim. A - Áudio Padrão + Idioma de áudio preferido Idioma do Aplicativo Tamanho do Texto de Leitura Pequeno @@ -391,7 +412,7 @@ Ótimo Vamos começar. Sim - Não… + Não… Escolha um\ntópico diferente. Você está interessado em:\n%s? Nova dica disponível @@ -417,19 +438,31 @@ Voltar para a lição Explicação: Se dois itens forem iguais, junte-os. + Organize as caixas para continuar. Link para o item %s Desvincular itens em %s Mover o item para baixo para %s Mover o item para cima para %s Para cima Para baixo - %s %s + %s %s topic_revision_recyclerview_tag ongoing_recycler_view_tag Por favor, selecione todas as alternativas corretas. - Versão do aplicativo não suportada + Versão do aplicativo não suportada Esta versão do aplicativo não é mais suportada. Atualize-a na Play Store. Fechar aplicativo + Atualização do aplicativo necessária + Uma nova versão de %s já está disponível. A nova versão é mais segura e melhora sua experiência de aprendizado.\n\nEsta versão não é mais suportada. Para continuar usando o aplicativo, atualize para a versão mais recente. + Atualizar + Fechar App + Nova atualização disponível + Uma nova versão de %s já está disponível. Recomendamos que você atualize o aplicativo para corrigir bugs e melhorar a experiência de aprendizado. + Dispensar + Atualizar + Atualize seu sistema operacional Android + Recomendamos atualizar seu sistema operacional Android para aproveitar os novos recursos e lições do %s.\n\nVisite o aplicativo Configurações do seu telefone para atualizar seu sistema operacional. + Dispensar Versão do desenvolvedor Alfa Beta @@ -441,9 +474,11 @@ Olá! Seu aplicativo está sendo atualizado para a versão de disponibilidade geral. Se você tiver problemas ao usar o aplicativo ou tiver dúvidas, entre em contato conosco em android-feedback@oppia.org. Não exibir esta mensagem novamente OK - para - Insira uma razão no formato x:y. + para + Insira uma proporção no formato x:y. Clique aqui para inserir texto. + Escreva o dígito aqui. + Escreva aqui. Menor tamanho de texto Maior tamanho de texto Em Breve @@ -481,16 +516,28 @@ O que é %s? Quem é um administrador? Como posso criar um novo perfil? + Como faço para obter o aplicativo no meu idioma? + Achei um bug. Como posso reportar? + Por que só há aulas de matemática? + Vocês vão criar mais lições? Por que a exploração não está carregando? Por que meu áudio não está tocando? Como posso deletar um perfil? + Como eu atualizo o aplicativo? + Como eu atualizo meu sistema operacional Android? Não consigo encontrar minha pergunta aqui. E agora? <p>%1$s <i>\"O-pee-yah\"</i> (Finnish) - \"aprender\"</p><p><br></p><p>%1$s tem a missão de ajudar qualquer pessoa a aprender o que quiser de uma forma eficaz e agradável.</p><p><br></p><p>Ao criar um conjunto de aulas gratuitas, de alta qualidade e comprovadamente eficazes com a ajuda de educadores de todo o mundo, %1$s visa proporcionar aos alunos uma educação de qualidade - independentemente de onde estejam ou a quais recursos tradicionais tenham acesso.</p><p><br></p><p>Como estudante, você pode começar sua aventura de aprendizado navegando pelos tópicos listados na página inicial!</p> - <p>Um administrador é o usuário principal que gerencia perfis e configurações para cada perfil em sua conta. Provavelmente, eles são seus pais, professores ou responsáveis ​​que criaram este perfil para você.</p><p><br></p><p>Os administradores podem gerenciar perfis, atribuir PINs e alterar outras configurações em suas contas. Dependendo do seu perfil, as permissões de administrador podem ser necessárias para determinados recursos, como download de tópicos, alteração do PIN e mais. </p><p><br></p><p>Para ver quem é o seu administrador, vá para o Seletor de perfil. O primeiro perfil listado e com \"Administrador\" escrito em seu nome é o Administrador. </p> - <p>Se é a sua primeira vez criando um perfil e você não tem um PIN:<ol> <li> No Seletor de Perfil, toque em <strong>Configurar Múltiplos Perfis</strong>. </li> <li> Crie um PIN e <strong>Salvar</strong>. </li> <li> Preencha todos os campos do perfil. <ol> <li> (Opcional) Carregue uma foto. </li> <li> Insira um nome. </li> <li> (Opcional) Atribua um PIN de 3 dígitos. </li></ol></li><li> 4. Toque em <strong>Criar</strong>. Este perfil está adicionado ao seu Seletor de Perfil! </li></ol></p><p> Se você já criou um perfil antes e tem um PIN: <ol> <li>No Seletor de Perfil, toque em <strong>Adicionar Perfil</strong>. </li> <li> 2. Digite seu PIN e toque em <strong>Enviar</strong>. </li> <li> Preencha todos os campos do perfil. <ol> <li> (Opcional) Carregue uma foto. </li> <li> Insira um nome. </li> <li> (Opcional) Atribua um PIN de 3 dígitos. </li> </ol> </li> <li> 4. Toque em <strong>Criar</strong>. Este perfil está adicionado ao seu Seletor de Perfil! </li></ol></p><br><p> Nota: Apenas o <u>Administrador</u> pode gerenciar perfis.</p> - <p>Se a exploração não estiver carregando</p><p><br></p><p>Verifique se o aplicativo está atualizado:</p><p> <ul> <li> Acesse a Play Store e certifique-se de que o aplicativo esteja atualizado com a versão mais recente </li></ul><p><br></p><p>Verifique sua conexão com a internet:</p><ul><li> Se sua conexão com a Internet estiver lenta, tente se reconectar à rede Wi-Fi ou conectar-se a uma rede diferente. </li></ul><p>Peça ao administrador para verificar o dispositivo e a conexão com a Internet:</p><ul><li> Peça ao administrador para solucionar o problema usando as etapas acima </li></ul><p>Informe-nos se você ainda tiver problemas com o carregamento::</p><ul><li> Relate um problema entrando em contato conosco em admin@oppia.org. </li> </ul> - <p>Se o seu áudio não estiver tocando</p><p><br></p><p>Verifique se o aplicativo está atualizado:</p><ul><li> Acesse a Play Store e certifique-se de que o aplicativo esteja atualizado com a versão mais recente </li></ul><p><br></p><p>Verifique sua conexão com a internet:</p><ul><li> Se sua conexão com a Internet estiver lenta, tente se reconectar à rede Wi-Fi ou conectar-se a uma rede diferente. A Internet lenta pode fazer com que o áudio carregue irregularmente, dificultando a reprodução. </li></ul><p><br></p><p>Peça ao administrador para verificar o dispositivo e a conexão com a Internet:</p><ul><li> Peça ao administrador para solucionar o problema usando as etapas acima</li></ul><p><br></p><p>Informe-nos se você ainda tiver problemas com o carregamento:</p><ul><li> Relate um problema entrando em contato conosco em admin@oppia.org. </li></ul> - <p>Depois que um perfil é deletado:</p> <ol><li>O perfil não pode ser recuperado. </li> <li> As informações do perfil, como nome, fotos e progresso, serão excluídas permanentemente. </li></ol><p>Para deletar um perfil(excluindo o do <u>Administrador</u>):</p> <ol><li>Na página inicial do administrador, toque no botão de menu no canto superior esquerdo.</li> <li>Toque em <strong>Controles do Administrador</strong>.</li> <li>3. Toque em <strong>Editar Perfis</strong>.</li> <li>4. Toque no perfil que deseja excluir.</li> <li>5. Na parte inferior da tela, toque em <strong>Exclusão de Perfil</strong>.</li> <li>6. Toque em <strong>Deletar</strong> para confirmar a exclusão.</li></ol><p><br></p><p>Nota: Apenas o <u>Administrador</u> pode gerenciar perfis.</p> + <p>Um administrador é o usuário principal que gerencia perfis e configurações de cada perfil da conta. Provavelmente foram seus pais, professores ou responsáveis ​​que criaram este perfil para você.</p><p><br></p><p>Os administradores podem gerenciar perfis, atribuir PINs e alterar outras configurações. sob sua conta. Dependendo do seu perfil, podem ser necessárias permissões de administrador para determinados recursos, como alteração do PIN e muito mais.</p><p><br></p><p>Para ver quem é o seu administrador, acesse o Perfil. Seletor. O primeiro perfil listado e com \"Administrador\" escrito em seu nome é o Administrador.</p> + <p>Se for a primeira vez que você cria um perfil e você não tem um PIN:<ol><li>No Seletor de perfil, toque em <strong>Configurar vários perfis</strong>.</li>< li>Crie um PIN e <strong>Salve</strong>.</li><li>Preencha todos os campos do perfil.<ol><li>(Opcional) Faça upload de uma foto.</li><li> Digite um nome.</li><li>(Opcional) Atribua um PIN de três dígitos.</li></ol></li><li>Toque em <strong>Criar</strong>. Este perfil será adicionado ao seu Seletor de perfil!</li></ol></p><p>Se você já criou um perfil e possui um PIN:<ol><li>No Seletor de perfil, toque em < strong>Adicionar perfil</strong>.</li><li>Insira seu PIN e toque em <strong>Enviar</strong>.</li><li>Preencha todos os campos do perfil.<ol><li >(Opcional) Faça upload de uma foto.</li><li>Digite um nome.</li><li>(Opcional) Atribua um PIN de três dígitos.</li></ol></li><li >Toque em <strong>Criar</strong>. Este perfil é adicionado ao seu Seletor de perfil!</li></ol></p><p><br></p><p>Observação: somente o <u>Administrador</u> pode gerenciar perfis.</p> + <p>O aplicativo %s atualmente oferece suporte a inglês, português do Brasil, árabe, suaíli e pidgin nigeriano. Escolha um desses idiomas no menu, em Opções. Para solicitar o aplicativo em seu idioma, entre em contato conosco pelo e-mail <strong>admin@oppia.org</strong>.</p> + <p><ol><li>Na tela inicial do aplicativo %s, toque no menu no canto superior esquerdo.</li><li>Toque em <strong>Compartilhar feedback</strong>.</li><li >Siga as instruções para relatar o bug ou compartilhar comentários.</li></ol></p> + <p>A missão do %1$s é ajudar os alunos a adquirir as habilidades necessárias para a vida. A matemática é uma habilidade essencial na vida cotidiana. %1$s oferecerá novas aulas sobre ciências e outros assuntos em breve!</p> + <p>Sim, %s oferecerá novas aulas sobre ciências e outros assuntos em breve. Por favor, volte para atualizações!</p> + <p>Se o Exploration Player não estiver carregando</p><p><br></p><p>Verifique se o aplicativo está atualizado:</p><ul><li>Acesse na Play Store e verifique se o aplicativo está atualizado para a versão mais recente</li></ul><p><br></p><p>Verifique sua conexão com a Internet:</p><ul><li> Se sua conexão com a Internet estiver lenta, tente reconectar-se à rede Wi-Fi ou conectar-se a uma rede diferente.</li></ul><p>Peça ao administrador para verificar o dispositivo e a conexão com a Internet:</p> <ul><li>Peça ao administrador para solucionar o problema usando as etapas acima</li></ul><p><br></p><p>Informe-nos se você ainda tiver problemas com o carregamento:</p ><ul><li>Informe um problema entrando em contato conosco pelo e-mail admin@oppia.org.</li></ul> + <p>Se o áudio não estiver sendo reproduzido</p><p><br></p><p>Verifique se o aplicativo está atualizado:</p><ul><li>Vá para o Play Store e verifique se o aplicativo está atualizado para a versão mais recente</li></ul><p><br></p><p>Verifique sua conexão com a Internet:</p><ul><li>Se sua conexão com a Internet está lenta, tente reconectar-se à sua rede Wi-Fi ou conectar-se a uma rede diferente. A Internet lenta pode fazer com que o áudio carregue irregularmente, dificultando a reprodução.</li></ul><p><br></p><p>Peça ao administrador para verificar o dispositivo e a conexão com a Internet:</ p><ul><li>Peça ao administrador para solucionar o problema usando as etapas acima</li></ul><p><br></p><p>Informe-nos se você ainda tiver problemas com o carregamento:< /p><ul><li>Informe um problema entrando em contato conosco pelo e-mail admin@oppia.org.</li></ul> + <p>Depois que um perfil for excluído:</p><ol><li>O perfil não poderá ser recuperado.</li><li>As informações do perfil, como nome, fotos e progresso, serão excluídas permanentemente.</li </ol><p>Para excluir um perfil (excluindo o <u>Administrador</u>):</p><ol><li>Na página inicial do administrador, toque no botão de menu no canto superior esquerdo .</li><li>Toque em <strong>Controles do administrador</strong>.</li><li>Toque em <strong>Editar perfis</strong>.</li><li>Toque no perfil você deseja excluir.</li><li>Na parte inferior da tela, toque em <strong>Exclusão de perfil</strong>.</li><li>Toque em <strong>Excluir</strong> para confirmar a exclusão .</li></ol><p><br></p><p>Nota: Somente o <u>Administrador</u> pode gerenciar perfis.</p> + <p><ol><li>Abra o aplicativo Google Play Store.</li><li>Procure o aplicativo %s.</li><li>Toque em Atualizar.</li></ol></ p> + <p><ol><li>Toque no aplicativo Configurações do seu telefone.</li><li>Toque em Atualizações do sistema.</li><li>Toque em Atualizações do sistema e siga as instruções para atualizar seu sistema operacional Android.</li </ol></p> <p>Se você não consegue encontrar sua pergunta ou gostaria de relatar um problema, entre em contato conosco em admin@oppia.org.</p> Atividade de Teste de Fragmento de Edição de Perfil Controle Administrativo da Atividade de Teste de Fragmento @@ -532,4 +579,52 @@ Em uma escala de 0 a 10, qual é a probabilidade de você recomendar %s a um amigo ou colega? O subtópico anterior é %s O próximo subtópico é %s + Informações do aplicativo + Seta de sobreposição do cursor + Fechar cursor + Botão de navegação do estado anterior + Ícone de opções do desenvolvedor + Ícone de controles do administrador + Menu de opções + Botão Anterior + Próximo botão + Ícone de idioma + Ícone de configuração + Visualização da imagem da foto do perfil + Ícone de cadeado + Estado de download + Conteúdo HTML + Bem vindo a %s! + Aprenda matemática gratuitamente, a qualquer hora! + Feito para estudantes de 7 a 14 anos + Selecione um idioma para começar + Você pode alterar sua seleção de idioma a qualquer momento nas configurações do aplicativo + Vamos lá! + Selecione o tipo de perfil + Conte-nos mais sobre você! + Sou estudante e quero aprender coisas novas! + Sou pai, professor ou responsável por um aluno. + PASSO 2 DE 5 + Criar perfil + Como devemos chamá-lo? + Apelido + Toque aqui para adicionar uma foto + Clique na caixa acima para digitar seu apelido. + Editar foto do perfil + Foto do perfil atual + PASSO 3 DE 5 + Bem-vindo + Bem-vindo, %s! + Aprenda matemática através de aulas divertidas baseadas em histórias. + Experimente questões práticas para testar seu conhecimento. + Obtenha feedback para melhorar usando as correções de %s. + PASSO 4 DE 5 + Lontra fofa usando óculos. + Lontra fofa com livros. + Mamãe e bebê lontra. + Voltar + Continuar + Em %s, você pode ouvir as lições! + Selecione a lingua do áudio para ouvir às lições + Passo 5 de 5
diff --git a/app/src/main/res/values-sw/strings.xml b/app/src/main/res/values-sw/strings.xml index 17d2fd54cec..f827cae27ef 100644 --- a/app/src/main/res/values-sw/strings.xml +++ b/app/src/main/res/values-sw/strings.xml @@ -1,6 +1,7 @@ @@ -76,10 +77,10 @@ mada: %s mada mada zinazoendelea - Sura ya %s: %s - Sura ya %s yenye kichwa %s imekamilika - Sura ya %s yenye kichwa %s inaendelea - Kamilisha Sura ya %s: %s ili kufungua sura hii. + Sura ya %s: %s + Sura ya %s yenye kichwa %s imekamilika + Sura ya %s yenye kichwa %s inaendelea + Kamilisha Sura ya %s: %s ili kufungua sura hii. Ingiza maandishi. Ingiza sehemu katika mpangilio huu x/x, au nambari iliyochanganywa katika mpangilio huu x/x. Ingiza sehemu katika mpangilio huu X/X. @@ -133,7 +134,7 @@ Mada Imepakuliwa Imepakuliwa Hali ya Mazoezi - Swali %s kati ya %s + Swali %s kati ya %s imekamilika imekamilika Umemaliza maswali yote! Unaweza kuchagua kucheza seti nyingine ya maswali, au kurudi kwenye mada. @@ -172,7 +173,7 @@ Hadithi 1 Hadithi %s - + %s kati ya Sura %s Imekamilika %s ya Sura %s Imekamilika @@ -237,7 +238,7 @@ Ruka Inayofuata Anza - Slaidi %s ya %s + Slaidi %s ya %s Habari, %s! Tafadhali weka Nambari yako ya Siri ya Msimamizi. Tafadhali weka Nambari yako ya Siri. @@ -374,13 +375,15 @@ Hamisha kipengee juu hadi %s Juu Chini - %s %s + %s %s mada_marudio_mtazamo wa kuchakata tena_tag Inaendelea_kuchakata tena_mtazamo_tag Tafadhali chagua angalau chaguo moja. Toleo la programu lisilotumika Toleo hili la programu halitumiki tena. Tafadhali isasishe kupitia hifadhi ya michezo. Funga programu + Sawa + Sawa kwa Weka uwiano katika fomu x:y. Maandishi madogo zaidi @@ -425,16 +428,10 @@ Jinsi gani naweza kusasisha mfumo wangu wa Android? Sijapata swali langu hapa. Nini sasa? <p>%1$s <i>\"O-pee-yah\"</i> (Kifini) - \"kujifunza\"</p><p><br></p><p>%1$s\'s dhamira ni kumsaidia mtu yeyote kujifunza chochote anachotaka kwa njia bora na ya kufurahisha.</p><p><br></p><p>Kwa kuunda seti ya masomo yasiyolipishwa, ya ubora wa juu, na yenye matokeo kwa usaidizi. ya waelimishaji kutoka duniani kote, %1$s inalenga kuwapa wanafunzi elimu bora — bila kujali walipo au ni nyenzo gani za jadi wanazoweza kufikia.</p><p><br></p><p> Kama mwanafunzi, unaweza kuanza safari yako ya kujifunza kwa kuvinjari mada zilizoorodheshwa kwenye Ukurasa wa Mwanzo!</p> - <p>Msimamizi ndiye mtumiaji mkuu anayedhibiti wasifu na mipangilio ya kila wasifu kwenye akaunti yake.Uwezekano mkubwa ni mzazi, mwalimu au mlezi wako aliyekuundia wasifu huu. </p><p><br></p><p>Wasimamizi wana uwezo wa kudhibiti wasifu, kugawa Nambari ya Siri, na kubadilisha mipangilio mingine chini ya akaunti yao. Kulingana na wasifu wako, ruhusa za Msimamizi zinaweza kuhitajika kwa vipengele fulani kama vile kupakua Mada, kubadilisha Nambari yako ya Siri na zaidi. </p><p><br></p><p>Ili kujua Msimamizi wako ni nani, nenda kwa Kichagua Wasifu. Wasifu wa kwanza ulioorodheshwa na una \"Msimamizi\" iliyoandikwa chini ya jina lake ni Msimamizi. </p> - <p>Ikiwa ni mara yako ya kwanza kuunda wasifu na huna Nambari ya Siri: <ol> <li> Kutoka kwa Kichagua Wasifu, gusa <strong>Weka Wasifu Nyingi</strong>. </li> <li> Unda Nambari ya Siri na <strong>Hifadhi</strong>. </li> <li> Jaza sehemu zote za wasifu. <ol><li> (Si lazima) Pakia picha. </li> <li> Weka jina. </li> <li> (Si lazima) Weka Nambari ya Siri yenye tarakimu 3.</li></ol></li><li>Gusa <strong>Unda</strong>. Wasifu huu umeongezwa kwa Kichagua Wasifu wako! </li></ol></p><p> Ikiwa umeunda wasifu hapo awali na una Nambari ya Siri: <ol><li> Kutoka kwa Kichagua Wasifu, gusa <strong>Ongeza Wasifu</strong>. </li><li>Weka Nambari yako ya Siri na uguse <strong>Wasilisha</strong>. </li><li> Jaza sehemu zote za wasifu. <ol><li> (Si lazima) Pakia picha. </li> <li> Weka jina. </li> <li> (Si lazima) Weka Nambari ya Siri yenye tarakimu 3. </li></ol></li><li> Gusa <strong>Unda</strong>. Wasifu huu umeongezwa kwa Kichagua Wasifu wako! </li></ol></p><br><p> Kumbuka: <u>Msimamizi pekee</u> ndiye anayeweza kudhibiti wasifu.</p> -

Programu ya %s kwa sasa inasaidia Kiingereza, Kireno cha Brazil, Kiarabu, Kiswahili, na Kipidgin cha Nigeria. Chagua moja ya lugha hizi kwenye menyu, chini ya Chaguo. Ili kuomba programu kwa lugha yako, tafadhali wasiliana nasi kwa admin@oppia.org.

-

  1. Kutoka kwenye skrini kuu ya programu yako ya %s, bonyeza menyu kwenye kona ya juu kushoto.
  2. Bonyeza Shiriki Maoni.
  3. Fuata maagizo ya kuripoti mdudu au kushiriki maoni.

-

Malengo ya %1$s ni kusaidia wanafunzi kupata stadi muhimu za maisha. Hisabati ni stadi muhimu katika maisha ya kila siku. %1$s itatoa masomo mapya kuhusu sayansi na masomo mengine hivi karibuni!

-

Ndiyo, %s itatoa masomo mapya kuhusu sayansi na masomo mengine hivi karibuni. Tafadhali rudia kwa ajili ya habari mpya!

- <p>Ikiwa Kicheza Ugunduzi hakipakii</p><p><br></p><p>Angalia kama programu imesasishwa:</p><p> <ul> <li> Nenda kwenye Hifadhi ya Michezo na uhakikishe kuwa programu imesasishwa hadi toleo lake jipya zaidi </li> </ul> <p><br></p><p>Angalia muunganisho wako wa mtandao:</p><ul><li> Ikiwa muunganisho wako wa mtandao ni wa polepole, jaribu kuunganisha tena kwenye mtandao wako wa Wi-Fi au unganisha kwenye mtandao tofauti. </li></ul><p>Uliza Msimamizi aangalie kifaa chake na muunganisho wa mtandao:</p><ul><li> Pata Msimamizi kusuluhisha kwa kutumia hatua hapo juu </li></ul><p>Tujulishe ikiwa bado una matatizo ya upakiaji:</p><ul><li> Ripoti tatizo kwa kuwasiliana nasi kwa admin@oppia.org. </li></ul> - <p>Ikiwa sauti yako haichezi</p><p><br></p><p>Angalia ili kuona kama programu imesasishwa:</p><ul><li> Nenda kwenye Hifadhi ya Michezo na uhakikishe kuwa programu imesasishwa hadi toleo lake jipya zaidi </li></ul><p><br></p><p>Angalia muunganisho wako wa mtandao:</p><ul><li> Iwapo muunganisho wako wa mtandao ni wa polepole, jaribu kuunganisha tena kwenye mtandao wako wa Wi-Fi au unganisha kwenye mtandao tofauti. Mtandao wa polepole unaweza kusababisha sauti kupakia kwa njia isiyo ya kawaida, na kuifanya iwe vigumu kucheza. </li></ul><p><br></p><p>Uliza Msimamizi aangalie kifaa chake na muunganisho wa mtandao:</p><ul><li> Wasiliana na Msimamizi ili asuluhishe kwa kutumia hatua hapo juu</li></ul><p><br></p><p>Tujulishe ikiwa bado una matatizo ya upakiaji:</p><ul><li> Ripoti tatizo kwa kuwasiliana nasi kwa admin@oppia.org. </li></ul> - <p>Wasifu unapofutwa:</p><ol><li> Wasifu hauwezi kurejeshwa. </li><li> Taarifa ya wasifu kama vile jina, picha na maendeleo yatafutwa kabisa. </li></ol><p>Ili kufuta wasifu (bila kujumuisha <u>Msimamizi</u>):</p> <ol><li> Kutoka kwa Ukurasa wa Mwanzo wa Msimamizi, gusa kitufe cha menyu kilicho upande wa juu kushoto. </li><li> Gusa <strong>Vidhibiti vya Msimamizi</strong>. </li><li> Gusa <strong>Hariri Wasifu</strong>. </li><li> Gonga Wasifu ambao ungependa kufuta. </li><li> Katika sehemu ya chini ya skrini, gusa <strong>Ufutaji wa Wasifu</strong>. </li><li> Gusa <strong>Futa</strong> ili kuthibitisha kufuta.</li></ol><p><br></p><p>Kumbuka: <u>Msimamizi</u> pekee ndiye anayeweza kudhibiti wasifu.</p> -

  1. Fungua programu ya Duka la Google Play.
  2. Tafuta programu ya %s.
  3. Bonyeza Sasisha.

-

  1. Bonyeza programu ya Mipangilio kwenye simu yako.
  2. Bonyeza Sasisho la mfumo.
  3. Bonyeza Sasisho la mfumo na fuata maagizo ya kusasisha mfumo wako wa uendeshaji wa Android.

+ <p>Msimamizi ndiye mtumiaji mkuu anayedhibiti wasifu na mipangilio ya kila wasifu kwenye akaunti yake.Uwezekano mkubwa ni mzazi, mwalimu au mlezi wako aliyekuundia wasifu huu. </p><p><br></p><p>Wasimamizi wana uwezo wa kudhibiti wasifu, kugawa Nambari ya Siri, na kubadilisha mipangilio mingine chini ya akaunti yao. Kulingana na wasifu wako, ruhusa za Msimamizi zinaweza kuhitajika kwa vipengele fulani kama vile kupakua Mada, kubadilisha Nambari yako ya Siri na zaidi. </p><p><br></p><p>Ili kujua Msimamizi wako ni nani, nenda kwa Kichagua Wasifu. Wasifu wa kwanza ulioorodheshwa na una \"Msimamizi\" iliyoandikwa chini ya jina lake ni Msimamizi. </p> + <p>Ikiwa ni mara yako ya kwanza kuunda wasifu na huna Nambari ya Siri: <ol> <li> Kutoka kwa Kichagua Wasifu, gusa <strong>Weka Wasifu Nyingi</strong>. </li> <li> Unda Nambari ya Siri na <strong>Hifadhi</strong>. </li> <li> Jaza sehemu zote za wasifu. <ol><li> (Si lazima) Pakia picha. </li> <li> Weka jina. </li> <li> (Si lazima) Weka Nambari ya Siri yenye tarakimu 3.</li></ol></li><li>Gusa <strong>Unda</strong>. Wasifu huu umeongezwa kwa Kichagua Wasifu wako! </li></ol></p><p> Ikiwa umeunda wasifu hapo awali na una Nambari ya Siri: <ol><li> Kutoka kwa Kichagua Wasifu, gusa <strong>Ongeza Wasifu</strong>. </li><li>Weka Nambari yako ya Siri na uguse <strong>Wasilisha</strong>. </li><li> Jaza sehemu zote za wasifu. <ol><li> (Si lazima) Pakia picha. </li> <li> Weka jina. </li> <li> (Si lazima) Weka Nambari ya Siri yenye tarakimu 3. </li></ol></li><li> Gusa <strong>Unda</strong>. Wasifu huu umeongezwa kwa Kichagua Wasifu wako! </li></ol></p><br><p> Kumbuka: <u>Msimamizi pekee</u> ndiye anayeweza kudhibiti wasifu.</p> + <p>Ikiwa Kicheza Ugunduzi hakipakii</p><p><br></p><p>Angalia kama programu imesasishwa:</p><p> <ul> <li> Nenda kwenye Hifadhi ya Michezo na uhakikishe kuwa programu imesasishwa hadi toleo lake jipya zaidi </li> </ul> <p><br></p><p>Angalia muunganisho wako wa mtandao:</p><ul><li> Ikiwa muunganisho wako wa mtandao ni wa polepole, jaribu kuunganisha tena kwenye mtandao wako wa Wi-Fi au unganisha kwenye mtandao tofauti. </li></ul><p>Uliza Msimamizi aangalie kifaa chake na muunganisho wa mtandao:</p><ul><li> Pata Msimamizi kusuluhisha kwa kutumia hatua hapo juu </li></ul><p>Tujulishe ikiwa bado una matatizo ya upakiaji:</p><ul><li> Ripoti tatizo kwa kuwasiliana nasi kwa admin@oppia.org. </li></ul> + <p>Ikiwa sauti yako haichezi</p><p><br></p><p>Angalia ili kuona kama programu imesasishwa:</p><ul><li> Nenda kwenye Hifadhi ya Michezo na uhakikishe kuwa programu imesasishwa hadi toleo lake jipya zaidi </li></ul><p><br></p><p>Angalia muunganisho wako wa mtandao:</p><ul><li> Iwapo muunganisho wako wa mtandao ni wa polepole, jaribu kuunganisha tena kwenye mtandao wako wa Wi-Fi au unganisha kwenye mtandao tofauti. Mtandao wa polepole unaweza kusababisha sauti kupakia kwa njia isiyo ya kawaida, na kuifanya iwe vigumu kucheza. </li></ul><p><br></p><p>Uliza Msimamizi aangalie kifaa chake na muunganisho wa mtandao:</p><ul><li> Wasiliana na Msimamizi ili asuluhishe kwa kutumia hatua hapo juu</li></ul><p><br></p><p>Tujulishe ikiwa bado una matatizo ya upakiaji:</p><ul><li> Ripoti tatizo kwa kuwasiliana nasi kwa admin@oppia.org. </li></ul> + <p>Wasifu unapofutwa:</p><ol><li> Wasifu hauwezi kurejeshwa. </li><li> Taarifa ya wasifu kama vile jina, picha na maendeleo yatafutwa kabisa. </li></ol><p>Ili kufuta wasifu (bila kujumuisha <u>Msimamizi</u>):</p> <ol><li> Kutoka kwa Ukurasa wa Mwanzo wa Msimamizi, gusa kitufe cha menyu kilicho upande wa juu kushoto. </li><li> Gusa <strong>Vidhibiti vya Msimamizi</strong>. </li><li> Gusa <strong>Hariri Wasifu</strong>. </li><li> Gonga Wasifu ambao ungependa kufuta. </li><li> Katika sehemu ya chini ya skrini, gusa <strong>Ufutaji wa Wasifu</strong>. </li><li> Gusa <strong>Futa</strong> ili kuthibitisha kufuta.</li></ol><p><br></p><p>Kumbuka: <u>Msimamizi</u> pekee ndiye anayeweza kudhibiti wasifu.</p> <p>Ikiwa huwezi kupata swali lako au ungependa kuripoti hitilafu, wasiliana nasi kwa admin@oppia.org.</p>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 319d70ff93a..0c43c5e2c26 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -92,11 +92,11 @@ Topics in Progress %s\%% %s - Chapter %s: %s - Chapter %s with title %s is completed - Chapter %s with title %s is in progress - Complete Chapter %s: %s to unlock this chapter. - Chapter %s: %s is currently locked. Please complete chapter %s: %s to unlock this chapter. + Chapter %1$s: %2$s + Chapter %1$s with title %2$s is completed + Chapter %1$s with title %2$s is in progress + Complete Chapter %1$s: %2$s to unlock this chapter. + Chapter %1$s: %2$s is currently locked. Please complete chapter %3$s: %4$s to unlock this chapter. Complete the previous chapter to unlock this chapter. Enter text. Enter a fraction in the form x/x, or a mixed number in the form x x/x. @@ -154,7 +154,7 @@ Topic Downloaded Downloaded Practice Mode - Question %s of %s + Question %1$s of %2$s Complete Finished You have finished all of the questions! You can choose to play another set of questions, or return to the topic. @@ -190,7 +190,7 @@ %s GB Correct! Topic: %s - %s %s! + %1$s %2$s! 1 Chapter %s Chapters @@ -200,8 +200,8 @@ %s Stories - %s of %s Chapter Completed - %s of %s Chapters Completed + %1$s of %2$s Chapter Completed + %1$s of %2$s Chapters Completed 1 Lesson @@ -261,6 +261,8 @@ This name is already in use by another profile. Please enter a valid name for this profile. Please choose a profile name that doesn\'t include numbers or symbols. + Profile type unknown. + An error occurred while creating a profile. Your PIN should be 3 digits long. Please make sure that both PINs match. More information on 3-digit PINs. @@ -278,7 +280,7 @@ Skip Next Get Started - Slide %s of %s + Slide %1$s of %2$s Hi, %s! Please enter your Administrator PIN. @@ -463,7 +465,7 @@ Move item up to %s Up Down - %s %s + %1$s %2$s a minute ago %s minutes ago diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 61eaea05390..32fcd43fce6 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -74,7 +74,8 @@ diff --git a/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/AdministratorControlsActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/AdministratorControlsActivityTest.kt index 96da1bb908e..ed5e44231c5 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/AdministratorControlsActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/AdministratorControlsActivityTest.kt @@ -120,7 +120,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -928,7 +927,7 @@ class AdministratorControlsActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/AdministratorControlsFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/AdministratorControlsFragmentTest.kt index 7a3e7cee59b..a80860e37ea 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/AdministratorControlsFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/AdministratorControlsFragmentTest.kt @@ -8,6 +8,7 @@ import android.view.ViewParent import android.widget.FrameLayout import androidx.appcompat.app.AppCompatActivity import androidx.core.widget.NestedScrollView +import androidx.drawerlayout.widget.DrawerLayout import androidx.test.core.app.ActivityScenario.launch import androidx.test.core.app.ApplicationProvider import androidx.test.espresso.Espresso.onView @@ -23,6 +24,7 @@ import androidx.test.espresso.matcher.ViewMatchers.isClickable import androidx.test.espresso.matcher.ViewMatchers.isRoot import androidx.test.espresso.util.HumanReadables import androidx.test.ext.junit.runners.AndroidJUnit4 +import com.google.common.truth.Truth.assertThat import dagger.Component import org.hamcrest.Matcher import org.hamcrest.Matchers @@ -44,6 +46,7 @@ import org.oppia.android.app.application.ApplicationStartupListenerModule import org.oppia.android.app.application.testing.TestingBuildFlavorModule import org.oppia.android.app.devoptions.DeveloperOptionsModule import org.oppia.android.app.devoptions.DeveloperOptionsStarterModule +import org.oppia.android.app.model.AdministratorControlsFragmentArguments import org.oppia.android.app.player.state.itemviewmodel.SplitScreenInteractionModule import org.oppia.android.app.recyclerview.RecyclerViewMatcher.Companion.atPositionOnView import org.oppia.android.app.recyclerview.RecyclerViewMatcher.Companion.scrollToPosition @@ -98,9 +101,9 @@ import org.oppia.android.testing.time.FakeOppiaClockModule import org.oppia.android.util.accessibility.AccessibilityTestModule import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule +import org.oppia.android.util.extensions.getProto import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -434,6 +437,36 @@ class AdministratorControlsFragmentTest { } } + @Test + fun testFragmentArguments_afterCreation_areCorrect() { + launch( + createAdministratorControlsFragmentTestActivityIntent( + profileId = internalProfileId + ) + ).use { scenario -> + testCoroutineDispatchers.runCurrent() + scenario.onActivity { activity -> + + val administratorControlsFragment = activity.supportFragmentManager + .findFragmentById(R.id.administrator_controls_fragment_test_activity_fragment_container) + as AdministratorControlsFragment + val isMultipane = activity + .findViewById(R.id.administrator_controls_activity_drawer_layout) != null + + val arguments = checkNotNull(administratorControlsFragment.arguments) { + "Expected arguments to be passed to AdministratorControlsFragment" + } + val args = arguments.getProto( + ADMINISTRATOR_CONTROLS_FRAGMENT_ARGUMENTS_KEY, + AdministratorControlsFragmentArguments.getDefaultInstance() + ) + val receivedIsMultipane = args.isMultipane + + assertThat(receivedIsMultipane).isEqualTo(isMultipane) + } + } + } + private fun clickAutoUpdateTopicContainer() { onView( atPositionOnView( @@ -616,7 +649,7 @@ class AdministratorControlsFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/AppVersionActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/AppVersionActivityTest.kt index 49a66d5c398..e8f5dc07884 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/AppVersionActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/AppVersionActivityTest.kt @@ -94,7 +94,6 @@ import org.oppia.android.util.extensions.getVersionName import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -307,7 +306,7 @@ class AppVersionActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/learneranalytics/BUILD.bazel b/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/learneranalytics/BUILD.bazel index 847369f8d0e..1c98702393b 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/learneranalytics/BUILD.bazel +++ b/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/learneranalytics/BUILD.bazel @@ -28,7 +28,6 @@ app_test( "//utility/src/main/java/org/oppia/android/util/accessibility:test_module", "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", ], @@ -65,7 +64,6 @@ app_test( "//utility/src/main/java/org/oppia/android/util/accessibility:test_module", "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", ], diff --git a/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/learneranalytics/ProfileAndDeviceIdActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/learneranalytics/ProfileAndDeviceIdActivityTest.kt index cdcd5f47c24..cdbbd25578d 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/learneranalytics/ProfileAndDeviceIdActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/learneranalytics/ProfileAndDeviceIdActivityTest.kt @@ -85,7 +85,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusManager import org.oppia.android.util.logging.SyncStatusModule @@ -227,7 +226,7 @@ class ProfileAndDeviceIdActivityTest { SyncStatusModule::class, SplitScreenInteractionModule::class, NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, MetricLogSchedulerModule::class, - TestingBuildFlavorModule::class, EventLoggingConfigurationModule::class, + TestingBuildFlavorModule::class, ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ApplicationLifecycleModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class diff --git a/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/learneranalytics/ProfileAndDeviceIdFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/learneranalytics/ProfileAndDeviceIdFragmentTest.kt index df161b770ae..890275fa0a6 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/learneranalytics/ProfileAndDeviceIdFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/learneranalytics/ProfileAndDeviceIdFragmentTest.kt @@ -122,7 +122,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.locale.OppiaLocale -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusManager.SyncStatus import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -1139,7 +1138,7 @@ class ProfileAndDeviceIdFragmentTest { SyncStatusTestModule::class, SplitScreenInteractionModule::class, NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, MathEquationInputModule::class, MetricLogSchedulerModule::class, - TestingBuildFlavorModule::class, EventLoggingConfigurationModule::class, + TestingBuildFlavorModule::class, ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ApplicationLifecycleModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class diff --git a/app/src/sharedTest/java/org/oppia/android/app/classroom/ClassroomListActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/classroom/ClassroomListActivityTest.kt index 845096edd39..7de41f91535 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/classroom/ClassroomListActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/classroom/ClassroomListActivityTest.kt @@ -76,7 +76,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -185,7 +184,7 @@ class ClassroomListActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/classroom/ClassroomListFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/classroom/ClassroomListFragmentTest.kt index c7986a03eb5..9a9e863143b 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/classroom/ClassroomListFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/classroom/ClassroomListFragmentTest.kt @@ -112,7 +112,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.locale.OppiaLocale -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -902,7 +901,7 @@ class ClassroomListFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class, TestImageLoaderModule::class, ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/completedstorylist/CompletedStoryListActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/completedstorylist/CompletedStoryListActivityTest.kt index 2d7afaf5f53..4b0c5d0e6a3 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/completedstorylist/CompletedStoryListActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/completedstorylist/CompletedStoryListActivityTest.kt @@ -100,7 +100,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -539,7 +538,7 @@ class CompletedStoryListActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/customview/LessonThumbnailImageViewTest.kt b/app/src/sharedTest/java/org/oppia/android/app/customview/LessonThumbnailImageViewTest.kt index 1a289adbc5a..821f649f615 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/customview/LessonThumbnailImageViewTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/customview/LessonThumbnailImageViewTest.kt @@ -75,7 +75,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -177,7 +176,7 @@ class LessonThumbnailImageViewTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/customview/interaction/BUILD.bazel b/app/src/sharedTest/java/org/oppia/android/app/customview/interaction/BUILD.bazel index c30d27bb755..79c19ba42e5 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/customview/interaction/BUILD.bazel +++ b/app/src/sharedTest/java/org/oppia/android/app/customview/interaction/BUILD.bazel @@ -34,7 +34,6 @@ app_test( "//third_party:robolectric_android-all", "//utility/src/main/java/org/oppia/android/util/accessibility:test_module", "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", ], diff --git a/app/src/sharedTest/java/org/oppia/android/app/customview/interaction/MathExpressionInteractionsViewTest.kt b/app/src/sharedTest/java/org/oppia/android/app/customview/interaction/MathExpressionInteractionsViewTest.kt index 3bf69aba46a..8c276551e21 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/customview/interaction/MathExpressionInteractionsViewTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/customview/interaction/MathExpressionInteractionsViewTest.kt @@ -97,7 +97,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -1806,7 +1805,7 @@ class MathExpressionInteractionsViewTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/databinding/AppCompatCheckBoxBindingAdaptersTest.kt b/app/src/sharedTest/java/org/oppia/android/app/databinding/AppCompatCheckBoxBindingAdaptersTest.kt index f16aec0eff3..10bf38da63b 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/databinding/AppCompatCheckBoxBindingAdaptersTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/databinding/AppCompatCheckBoxBindingAdaptersTest.kt @@ -76,7 +76,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -168,7 +167,7 @@ class AppCompatCheckBoxBindingAdaptersTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/databinding/BUILD.bazel b/app/src/sharedTest/java/org/oppia/android/app/databinding/BUILD.bazel index 91bc0418d6b..c6c438cc60e 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/databinding/BUILD.bazel +++ b/app/src/sharedTest/java/org/oppia/android/app/databinding/BUILD.bazel @@ -70,7 +70,6 @@ app_test( "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", "//utility/src/main/java/org/oppia/android/util/data:data_providers", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", ], @@ -106,7 +105,6 @@ app_test( "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", "//utility/src/main/java/org/oppia/android/util/data:data_providers", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", ], @@ -142,7 +140,6 @@ app_test( "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", "//utility/src/main/java/org/oppia/android/util/data:data_providers", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", ], @@ -178,7 +175,6 @@ app_test( "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", "//utility/src/main/java/org/oppia/android/util/data:data_providers", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", ], @@ -214,7 +210,6 @@ app_test( "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", "//utility/src/main/java/org/oppia/android/util/data:data_providers", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", ], @@ -250,7 +245,6 @@ app_test( "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", "//utility/src/main/java/org/oppia/android/util/data:data_providers", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", ], @@ -286,7 +280,6 @@ app_test( "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", "//utility/src/main/java/org/oppia/android/util/data:data_providers", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", ], @@ -322,7 +315,6 @@ app_test( "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", "//utility/src/main/java/org/oppia/android/util/data:data_providers", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", ], @@ -358,7 +350,6 @@ app_test( "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", "//utility/src/main/java/org/oppia/android/util/data:data_providers", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", ], @@ -394,7 +385,6 @@ app_test( "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", "//utility/src/main/java/org/oppia/android/util/data:data_providers", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", ], diff --git a/app/src/sharedTest/java/org/oppia/android/app/databinding/CircularProgressIndicatorAdaptersTest.kt b/app/src/sharedTest/java/org/oppia/android/app/databinding/CircularProgressIndicatorAdaptersTest.kt index 8f7c78964ac..8eeeb56da65 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/databinding/CircularProgressIndicatorAdaptersTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/databinding/CircularProgressIndicatorAdaptersTest.kt @@ -81,7 +81,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -299,7 +298,7 @@ class CircularProgressIndicatorAdaptersTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/databinding/ColorBindingAdaptersTest.kt b/app/src/sharedTest/java/org/oppia/android/app/databinding/ColorBindingAdaptersTest.kt index 393311789b3..da7268e6ca5 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/databinding/ColorBindingAdaptersTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/databinding/ColorBindingAdaptersTest.kt @@ -78,7 +78,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -91,7 +90,7 @@ import org.robolectric.annotation.LooperMode import javax.inject.Inject import javax.inject.Singleton -/** Tests for [MarginBindingAdapters]. */ +/** Tests for [ColorBindingAdapters]. */ @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) @Config( @@ -183,7 +182,7 @@ class ColorBindingAdaptersTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/databinding/DrawableBindingAdaptersTest.kt b/app/src/sharedTest/java/org/oppia/android/app/databinding/DrawableBindingAdaptersTest.kt index 19c12c8d35b..cfa195714fa 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/databinding/DrawableBindingAdaptersTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/databinding/DrawableBindingAdaptersTest.kt @@ -80,7 +80,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -188,7 +187,7 @@ class DrawableBindingAdaptersTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/databinding/ImageViewBindingAdaptersTest.kt b/app/src/sharedTest/java/org/oppia/android/app/databinding/ImageViewBindingAdaptersTest.kt index 55011df1067..3caa12ca21e 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/databinding/ImageViewBindingAdaptersTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/databinding/ImageViewBindingAdaptersTest.kt @@ -85,7 +85,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -230,7 +229,7 @@ class ImageViewBindingAdaptersTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/databinding/MarginBindingAdaptersTest.kt b/app/src/sharedTest/java/org/oppia/android/app/databinding/MarginBindingAdaptersTest.kt index 826d629d355..0ac0a8483b9 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/databinding/MarginBindingAdaptersTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/databinding/MarginBindingAdaptersTest.kt @@ -90,7 +90,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -351,7 +350,7 @@ class MarginBindingAdaptersTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/databinding/StateAssemblerMarginBindingAdaptersTest.kt b/app/src/sharedTest/java/org/oppia/android/app/databinding/StateAssemblerMarginBindingAdaptersTest.kt index 5cb77082e7c..c2f0e9d5eb4 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/databinding/StateAssemblerMarginBindingAdaptersTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/databinding/StateAssemblerMarginBindingAdaptersTest.kt @@ -88,7 +88,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -506,7 +505,7 @@ class StateAssemblerMarginBindingAdaptersTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/databinding/StateAssemblerPaddingBindingAdaptersTest.kt b/app/src/sharedTest/java/org/oppia/android/app/databinding/StateAssemblerPaddingBindingAdaptersTest.kt index 404ddf2ce36..32d07d6feb9 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/databinding/StateAssemblerPaddingBindingAdaptersTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/databinding/StateAssemblerPaddingBindingAdaptersTest.kt @@ -86,7 +86,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -504,7 +503,7 @@ class StateAssemblerPaddingBindingAdaptersTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/databinding/TextInputLayoutBindingAdaptersTest.kt b/app/src/sharedTest/java/org/oppia/android/app/databinding/TextInputLayoutBindingAdaptersTest.kt new file mode 100644 index 00000000000..953d52cf8de --- /dev/null +++ b/app/src/sharedTest/java/org/oppia/android/app/databinding/TextInputLayoutBindingAdaptersTest.kt @@ -0,0 +1,238 @@ +package org.oppia.android.app.databinding + +import android.app.Application +import android.content.Context +import android.widget.AutoCompleteTextView +import androidx.appcompat.app.AppCompatActivity +import androidx.test.core.app.ActivityScenario +import androidx.test.core.app.ApplicationProvider +import androidx.test.espresso.intent.Intents +import androidx.test.ext.junit.runners.AndroidJUnit4 +import com.google.android.material.textfield.TextInputLayout +import com.google.common.truth.Truth.assertThat +import dagger.Component +import org.junit.After +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.oppia.android.R +import org.oppia.android.app.activity.ActivityComponent +import org.oppia.android.app.activity.ActivityComponentFactory +import org.oppia.android.app.activity.route.ActivityRouterModule +import org.oppia.android.app.application.ApplicationComponent +import org.oppia.android.app.application.ApplicationInjector +import org.oppia.android.app.application.ApplicationInjectorProvider +import org.oppia.android.app.application.ApplicationModule +import org.oppia.android.app.application.ApplicationStartupListenerModule +import org.oppia.android.app.application.testing.TestingBuildFlavorModule +import org.oppia.android.app.devoptions.DeveloperOptionsModule +import org.oppia.android.app.devoptions.DeveloperOptionsStarterModule +import org.oppia.android.app.model.OppiaLanguage +import org.oppia.android.app.player.state.itemviewmodel.SplitScreenInteractionModule +import org.oppia.android.app.shim.ViewBindingShimModule +import org.oppia.android.app.testing.TextInputLayoutBindingAdaptersTestActivity +import org.oppia.android.app.translation.testing.ActivityRecreatorTestModule +import org.oppia.android.data.backends.gae.NetworkConfigProdModule +import org.oppia.android.data.backends.gae.NetworkModule +import org.oppia.android.domain.classify.InteractionsModule +import org.oppia.android.domain.classify.rules.algebraicexpressioninput.AlgebraicExpressionInputModule +import org.oppia.android.domain.classify.rules.continueinteraction.ContinueModule +import org.oppia.android.domain.classify.rules.dragAndDropSortInput.DragDropSortInputModule +import org.oppia.android.domain.classify.rules.fractioninput.FractionInputModule +import org.oppia.android.domain.classify.rules.imageClickInput.ImageClickInputModule +import org.oppia.android.domain.classify.rules.itemselectioninput.ItemSelectionInputModule +import org.oppia.android.domain.classify.rules.mathequationinput.MathEquationInputModule +import org.oppia.android.domain.classify.rules.multiplechoiceinput.MultipleChoiceInputModule +import org.oppia.android.domain.classify.rules.numberwithunits.NumberWithUnitsRuleModule +import org.oppia.android.domain.classify.rules.numericexpressioninput.NumericExpressionInputModule +import org.oppia.android.domain.classify.rules.numericinput.NumericInputRuleModule +import org.oppia.android.domain.classify.rules.ratioinput.RatioInputModule +import org.oppia.android.domain.classify.rules.textinput.TextInputRuleModule +import org.oppia.android.domain.exploration.ExplorationProgressModule +import org.oppia.android.domain.exploration.ExplorationStorageModule +import org.oppia.android.domain.hintsandsolution.HintsAndSolutionConfigModule +import org.oppia.android.domain.hintsandsolution.HintsAndSolutionProdModule +import org.oppia.android.domain.onboarding.ExpirationMetaDataRetrieverModule +import org.oppia.android.domain.oppialogger.LogStorageModule +import org.oppia.android.domain.oppialogger.LoggingIdentifierModule +import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule +import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule +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.PlatformParameterSingletonModule +import org.oppia.android.domain.question.QuestionModule +import org.oppia.android.domain.workmanager.WorkManagerConfigurationModule +import org.oppia.android.testing.TestImageLoaderModule +import org.oppia.android.testing.TestLogReportingModule +import org.oppia.android.testing.espresso.EditTextInputAction +import org.oppia.android.testing.firebase.TestAuthenticationModule +import org.oppia.android.testing.robolectric.RobolectricModule +import org.oppia.android.testing.threading.TestCoroutineDispatchers +import org.oppia.android.testing.threading.TestDispatcherModule +import org.oppia.android.testing.time.FakeOppiaClockModule +import org.oppia.android.util.accessibility.AccessibilityTestModule +import org.oppia.android.util.caching.AssetModule +import org.oppia.android.util.caching.testing.CachingTestModule +import org.oppia.android.util.gcsresource.GcsResourceModule +import org.oppia.android.util.locale.LocaleProdModule +import org.oppia.android.util.logging.LoggerModule +import org.oppia.android.util.logging.SyncStatusModule +import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule +import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule +import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule +import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule +import org.oppia.android.util.parser.image.ImageParsingModule +import org.robolectric.annotation.Config +import org.robolectric.annotation.LooperMode +import javax.inject.Inject +import javax.inject.Singleton + +/** Tests for [TextInputLayoutBindingAdapters]. */ +@RunWith(AndroidJUnit4::class) +@LooperMode(LooperMode.Mode.PAUSED) +@Config( + application = TextInputLayoutBindingAdaptersTest.TestApplication::class, + qualifiers = "port-xxhdpi" +) +class TextInputLayoutBindingAdaptersTest { + @Inject + lateinit var context: Context + + @Inject + lateinit var testCoroutineDispatchers: TestCoroutineDispatchers + + @Inject + lateinit var editTextInputAction: EditTextInputAction + + @Before + fun setUp() { + setUpTestApplicationComponent() + Intents.init() + testCoroutineDispatchers.registerIdlingResource() + } + + @After + fun tearDown() { + testCoroutineDispatchers.registerIdlingResource() + Intents.release() + } + + @Test + fun testBindingAdapters_setErrorMessage_setsMessageCorrectly() { + launchActivity().use { scenario -> + scenario?.onActivity { activity -> + val testView: TextInputLayout = activity.findViewById(R.id.test_text_input_view) + TextInputLayoutBindingAdapters.setErrorMessage(testView, "Some error message.") + assertThat(testView.error).isEqualTo("Some error message.") + } + } + } + + @Test + fun testBindingAdapters_setSelection_filterDisabled_setsSelectionCorrectly() { + launchActivity().use { scenario -> + scenario?.onActivity { activity -> + val testView: AutoCompleteTextView = activity.findViewById(R.id.test_autocomplete_view) + TextInputLayoutBindingAdapters.setLanguageSelection(testView, OppiaLanguage.ENGLISH, false) + assertThat(testView.text.toString()).isEqualTo("English") + } + } + } + + @Test + fun testBindingAdapters_setSelection_filterEnabled_setsSelectionCorrectly() { + launchActivity().use { scenario -> + scenario?.onActivity { activity -> + val testView: AutoCompleteTextView = activity.findViewById(R.id.test_autocomplete_view) + TextInputLayoutBindingAdapters.setLanguageSelection(testView, OppiaLanguage.ENGLISH, true) + assertThat(testView.text.toString()).isEqualTo("English") + } + } + } + + @Test + fun testBindingAdapters_setSelection_arabicLanguage_setsSelectionCorrectly() { + launchActivity().use { scenario -> + scenario?.onActivity { activity -> + val testView: AutoCompleteTextView = activity.findViewById(R.id.test_autocomplete_view) + TextInputLayoutBindingAdapters.setLanguageSelection(testView, OppiaLanguage.ARABIC, true) + assertThat(testView.text.toString()).isEqualTo( + context.getString(R.string.arabic_localized_language_name) + ) + } + } + } + + private fun launchActivity(): + ActivityScenario? { + val scenario = ActivityScenario.launch( + TextInputLayoutBindingAdaptersTestActivity.createIntent(context) + ) + testCoroutineDispatchers.runCurrent() + return scenario + } + + private fun setUpTestApplicationComponent() { + ApplicationProvider.getApplicationContext().inject(this) + } + + // TODO(#59): Figure out a way to reuse modules instead of needing to re-declare them. + @Singleton + @Component( + modules = [ + RobolectricModule::class, + PlatformParameterModule::class, PlatformParameterSingletonModule::class, + TestDispatcherModule::class, ApplicationModule::class, + LoggerModule::class, ContinueModule::class, FractionInputModule::class, + ItemSelectionInputModule::class, MultipleChoiceInputModule::class, + NumberWithUnitsRuleModule::class, NumericInputRuleModule::class, TextInputRuleModule::class, + DragDropSortInputModule::class, ImageClickInputModule::class, InteractionsModule::class, + GcsResourceModule::class, TestImageLoaderModule::class, ImageParsingModule::class, + HtmlParserEntityTypeModule::class, QuestionModule::class, TestLogReportingModule::class, + AccessibilityTestModule::class, LogStorageModule::class, CachingTestModule::class, + ExpirationMetaDataRetrieverModule::class, + ViewBindingShimModule::class, RatioInputModule::class, WorkManagerConfigurationModule::class, + ApplicationStartupListenerModule::class, LogReportWorkerModule::class, + HintsAndSolutionConfigModule::class, HintsAndSolutionProdModule::class, + FirebaseLogUploaderModule::class, FakeOppiaClockModule::class, + DeveloperOptionsStarterModule::class, DeveloperOptionsModule::class, + ExplorationStorageModule::class, NetworkModule::class, NetworkConfigProdModule::class, + NetworkConnectionUtilDebugModule::class, NetworkConnectionDebugUtilModule::class, + AssetModule::class, LocaleProdModule::class, ActivityRecreatorTestModule::class, + NumericExpressionInputModule::class, AlgebraicExpressionInputModule::class, + MathEquationInputModule::class, SplitScreenInteractionModule::class, + LoggingIdentifierModule::class, ApplicationLifecycleModule::class, + SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, + ActivityRouterModule::class, + CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, + TestAuthenticationModule::class + ] + ) + interface TestApplicationComponent : ApplicationComponent { + @Component.Builder + interface Builder : ApplicationComponent.Builder { + override fun build(): TestApplicationComponent + } + + fun inject(textInputLayoutBindingAdaptersTest: TextInputLayoutBindingAdaptersTest) + } + + class TestApplication : Application(), ActivityComponentFactory, ApplicationInjectorProvider { + private val component: TestApplicationComponent by lazy { + DaggerTextInputLayoutBindingAdaptersTest_TestApplicationComponent.builder() + .setApplication(this) + .build() as TestApplicationComponent + } + + fun inject(textInputLayoutBindingAdaptersTest: TextInputLayoutBindingAdaptersTest) { + component.inject(textInputLayoutBindingAdaptersTest) + } + + override fun createActivityComponent(activity: AppCompatActivity): ActivityComponent { + return component.getActivityComponentBuilderProvider().get().setActivity(activity).build() + } + + override fun getApplicationInjector(): ApplicationInjector = component + } +} diff --git a/app/src/sharedTest/java/org/oppia/android/app/databinding/TextViewBindingAdaptersTest.kt b/app/src/sharedTest/java/org/oppia/android/app/databinding/TextViewBindingAdaptersTest.kt index bc00e284c6c..9bb4cab6bb1 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/databinding/TextViewBindingAdaptersTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/databinding/TextViewBindingAdaptersTest.kt @@ -79,7 +79,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -310,7 +309,7 @@ class TextViewBindingAdaptersTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/databinding/ViewBindingAdaptersTest.kt b/app/src/sharedTest/java/org/oppia/android/app/databinding/ViewBindingAdaptersTest.kt index aeb0d606ddb..92afe7e3b60 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/databinding/ViewBindingAdaptersTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/databinding/ViewBindingAdaptersTest.kt @@ -83,7 +83,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -238,7 +237,7 @@ class ViewBindingAdaptersTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/DeveloperOptionsActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/DeveloperOptionsActivityTest.kt index 9210e687ffa..47401fc5216 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/DeveloperOptionsActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/DeveloperOptionsActivityTest.kt @@ -104,7 +104,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -342,7 +341,7 @@ class DeveloperOptionsActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/DeveloperOptionsFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/DeveloperOptionsFragmentTest.kt index 9f91c2dbd19..a25c1f61952 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/DeveloperOptionsFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/DeveloperOptionsFragmentTest.kt @@ -98,7 +98,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -661,7 +660,7 @@ class DeveloperOptionsFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkChaptersCompletedActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkChaptersCompletedActivityTest.kt index 78dfe47defd..c831fcb7050 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkChaptersCompletedActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkChaptersCompletedActivityTest.kt @@ -89,7 +89,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -271,7 +270,7 @@ class MarkChaptersCompletedActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkChaptersCompletedFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkChaptersCompletedFragmentTest.kt index 2ce4a9323ab..cd7818cd864 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkChaptersCompletedFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkChaptersCompletedFragmentTest.kt @@ -99,7 +99,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.extensions.getProto import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -1089,7 +1088,7 @@ class MarkChaptersCompletedFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkStoriesCompletedActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkStoriesCompletedActivityTest.kt index d9e860e8473..4600d53176b 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkStoriesCompletedActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkStoriesCompletedActivityTest.kt @@ -79,7 +79,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -202,7 +201,7 @@ class MarkStoriesCompletedActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkStoriesCompletedFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkStoriesCompletedFragmentTest.kt index f8ab0bbacef..6579e471da1 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkStoriesCompletedFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkStoriesCompletedFragmentTest.kt @@ -91,7 +91,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -623,7 +622,7 @@ class MarkStoriesCompletedFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkTopicsCompletedActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkTopicsCompletedActivityTest.kt index 6358140af44..0d6195ea12b 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkTopicsCompletedActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkTopicsCompletedActivityTest.kt @@ -79,7 +79,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -202,7 +201,7 @@ class MarkTopicsCompletedActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkTopicsCompletedFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkTopicsCompletedFragmentTest.kt index 91cc3ee71f2..11d886f7814 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkTopicsCompletedFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/MarkTopicsCompletedFragmentTest.kt @@ -91,7 +91,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -602,7 +601,7 @@ class MarkTopicsCompletedFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/ViewEventLogsActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/ViewEventLogsActivityTest.kt index 8ea77d0c034..66172c2e8d1 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/ViewEventLogsActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/ViewEventLogsActivityTest.kt @@ -79,7 +79,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.DebugLogReportingModule @@ -192,7 +191,7 @@ class ViewEventLogsActivityTest { LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, PerformanceMetricsAssessorModule::class, PerformanceMetricsConfigurationsModule::class, - TestingBuildFlavorModule::class, EventLoggingConfigurationModule::class, + TestingBuildFlavorModule::class, ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/ViewEventLogsFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/ViewEventLogsFragmentTest.kt index f40406b79fd..e4952bffb71 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/ViewEventLogsFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/ViewEventLogsFragmentTest.kt @@ -95,7 +95,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.AnalyticsEventLogger -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.ExceptionLogger import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule @@ -755,7 +754,7 @@ class ViewEventLogsFragmentTest { LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, PerformanceMetricsAssessorModule::class, PerformanceMetricsConfigurationsModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class, ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/forcenetworktype/ForceNetworkTypeActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/forcenetworktype/ForceNetworkTypeActivityTest.kt index e5fd7723e09..832e378cae9 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/forcenetworktype/ForceNetworkTypeActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/forcenetworktype/ForceNetworkTypeActivityTest.kt @@ -80,7 +80,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -193,7 +192,7 @@ class ForceNetworkTypeActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/forcenetworktype/ForceNetworkTypeFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/forcenetworktype/ForceNetworkTypeFragmentTest.kt index b6010476622..46872bc9b64 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/forcenetworktype/ForceNetworkTypeFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/forcenetworktype/ForceNetworkTypeFragmentTest.kt @@ -84,7 +84,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -400,7 +399,7 @@ class ForceNetworkTypeFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/mathexpressionparser/BUILD.bazel b/app/src/sharedTest/java/org/oppia/android/app/devoptions/mathexpressionparser/BUILD.bazel index 0a49195e96c..8f3db957dcc 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/mathexpressionparser/BUILD.bazel +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/mathexpressionparser/BUILD.bazel @@ -31,7 +31,6 @@ app_test( "//third_party:robolectric_android-all", "//utility/src/main/java/org/oppia/android/util/accessibility:test_module", "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", ], @@ -64,7 +63,6 @@ app_test( "//third_party:robolectric_android-all", "//utility/src/main/java/org/oppia/android/util/accessibility:test_module", "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", ], diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/mathexpressionparser/MathExpressionParserActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/mathexpressionparser/MathExpressionParserActivityTest.kt index 9ffd7fcabe5..3070fd11dd2 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/mathexpressionparser/MathExpressionParserActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/mathexpressionparser/MathExpressionParserActivityTest.kt @@ -77,7 +77,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -178,7 +177,7 @@ class MathExpressionParserActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/devoptions/mathexpressionparser/MathExpressionParserFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/devoptions/mathexpressionparser/MathExpressionParserFragmentTest.kt index a381f85a049..36b378e0a2d 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/devoptions/mathexpressionparser/MathExpressionParserFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/devoptions/mathexpressionparser/MathExpressionParserFragmentTest.kt @@ -87,7 +87,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -1418,7 +1417,7 @@ class MathExpressionParserFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/faq/FAQListFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/faq/FAQListFragmentTest.kt index 875f395be75..5e032dfec9a 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/faq/FAQListFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/faq/FAQListFragmentTest.kt @@ -91,7 +91,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -260,7 +259,7 @@ class FAQListFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/faq/FAQSingleActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/faq/FAQSingleActivityTest.kt index f4f947fde89..d38ddf5fd17 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/faq/FAQSingleActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/faq/FAQSingleActivityTest.kt @@ -87,7 +87,6 @@ import org.oppia.android.util.gcsresource.DefaultResourceBucketName import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -239,7 +238,7 @@ class FAQSingleActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/faq/FaqListActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/faq/FaqListActivityTest.kt index 815dac646ad..c9399fab764 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/faq/FaqListActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/faq/FaqListActivityTest.kt @@ -74,7 +74,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -166,7 +165,7 @@ class FaqListActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/help/HelpActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/help/HelpActivityTest.kt index ca9cbf486ad..fed5e5d83ab 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/help/HelpActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/help/HelpActivityTest.kt @@ -74,7 +74,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -169,7 +168,7 @@ class HelpActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/help/HelpFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/help/HelpFragmentTest.kt index e378a684dd9..fade98c9349 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/help/HelpFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/help/HelpFragmentTest.kt @@ -110,7 +110,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.extensions.getProto import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -1481,7 +1480,7 @@ class HelpFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/home/HomeActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/home/HomeActivityTest.kt index b6962460974..46df59bfa2f 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/home/HomeActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/home/HomeActivityTest.kt @@ -144,7 +144,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -2063,7 +2062,7 @@ class HomeActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/home/RecentlyPlayedFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/home/RecentlyPlayedFragmentTest.kt index 9cf3f4ebf3e..39af6751825 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/home/RecentlyPlayedFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/home/RecentlyPlayedFragmentTest.kt @@ -124,7 +124,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -132,6 +131,7 @@ import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule import org.oppia.android.util.parser.image.ImageParsingModule +import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject @@ -1650,6 +1650,31 @@ class RecentlyPlayedFragmentTest { } } + @Test + fun testFragmentArguments_afterCreation_areCorrect() { + ActivityScenario.launch( + createRecentlyPlayedActivityIntent( + internalProfileId = internalProfileId, + RecentlyPlayedActivityTitle.STORIES_FOR_YOU + ) + ).use { scenario -> + testCoroutineDispatchers.runCurrent() + scenario.onActivity { activity -> + + val recentlyPlayedFragment = activity.supportFragmentManager + .findFragmentById(R.id.recently_played_fragment_placeholder) as RecentlyPlayedFragment + + val arguments = checkNotNull(recentlyPlayedFragment.arguments) { + "Expected arguments to be passed to RecentlyPlayedFragment" + } + val profileId = arguments.extractCurrentUserProfileId() + val receivedInternalProfileId = profileId.internalId + + assertThat(receivedInternalProfileId).isEqualTo(internalProfileId) + } + } + } + private fun setUpTestFragment(activity: RecentlyPlayedActivity) { activity.supportFragmentManager .beginTransaction() @@ -1684,7 +1709,7 @@ class RecentlyPlayedFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/home/TopicSummaryViewModelTest.kt b/app/src/sharedTest/java/org/oppia/android/app/home/TopicSummaryViewModelTest.kt index 2a5c4e54f36..c97c82d7242 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/home/TopicSummaryViewModelTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/home/TopicSummaryViewModelTest.kt @@ -76,7 +76,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -389,7 +388,7 @@ class TopicSummaryViewModelTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/home/WelcomeViewModelTest.kt b/app/src/sharedTest/java/org/oppia/android/app/home/WelcomeViewModelTest.kt index 726c76c7f73..f7c504ae8c4 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/home/WelcomeViewModelTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/home/WelcomeViewModelTest.kt @@ -74,7 +74,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -362,7 +361,7 @@ class WelcomeViewModelTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/home/promotedlist/PromotedStoryListViewModelTest.kt b/app/src/sharedTest/java/org/oppia/android/app/home/promotedlist/PromotedStoryListViewModelTest.kt index f7da7a5d2d2..80d3d215180 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/home/promotedlist/PromotedStoryListViewModelTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/home/promotedlist/PromotedStoryListViewModelTest.kt @@ -76,7 +76,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -375,7 +374,7 @@ class PromotedStoryListViewModelTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/home/promotedlist/PromotedStoryViewModelTest.kt b/app/src/sharedTest/java/org/oppia/android/app/home/promotedlist/PromotedStoryViewModelTest.kt index 859b55572f1..ae6037af1de 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/home/promotedlist/PromotedStoryViewModelTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/home/promotedlist/PromotedStoryViewModelTest.kt @@ -74,7 +74,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -401,7 +400,7 @@ class PromotedStoryViewModelTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/mydownloads/MyDownloadsActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/mydownloads/MyDownloadsActivityTest.kt index 98eee4d1a68..289fdb8386e 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/mydownloads/MyDownloadsActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/mydownloads/MyDownloadsActivityTest.kt @@ -82,7 +82,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -197,7 +196,7 @@ class MyDownloadsActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/mydownloads/MyDownloadsFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/mydownloads/MyDownloadsFragmentTest.kt index cdd24a8e73b..e76c11e9756 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/mydownloads/MyDownloadsFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/mydownloads/MyDownloadsFragmentTest.kt @@ -81,7 +81,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -238,7 +237,7 @@ class MyDownloadsFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/notice/BUILD.bazel b/app/src/sharedTest/java/org/oppia/android/app/notice/BUILD.bazel index fae6ecc5a23..f065383e9a5 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/notice/BUILD.bazel +++ b/app/src/sharedTest/java/org/oppia/android/app/notice/BUILD.bazel @@ -35,7 +35,6 @@ app_test( "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", "//utility/src/main/java/org/oppia/android/util/locale/testing:test_module", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_util_module", @@ -72,7 +71,6 @@ app_test( "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", "//utility/src/main/java/org/oppia/android/util/locale/testing:test_module", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_util_module", @@ -103,7 +101,6 @@ app_test( "//utility/src/main/java/org/oppia/android/util/accessibility:test_module", "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", "//utility/src/main/java/org/oppia/android/util/extensions:context_extensions", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", ], ) @@ -132,7 +129,6 @@ app_test( "//utility/src/main/java/org/oppia/android/util/accessibility:test_module", "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", "//utility/src/main/java/org/oppia/android/util/extensions:context_extensions", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", ], ) @@ -161,7 +157,6 @@ app_test( "//utility/src/main/java/org/oppia/android/util/accessibility:test_module", "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", "//utility/src/main/java/org/oppia/android/util/extensions:context_extensions", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", ], ) diff --git a/app/src/sharedTest/java/org/oppia/android/app/notice/BetaNoticeDialogFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/notice/BetaNoticeDialogFragmentTest.kt index 2155cb3d671..b7f7a024d13 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/notice/BetaNoticeDialogFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/notice/BetaNoticeDialogFragmentTest.kt @@ -86,7 +86,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -249,7 +248,7 @@ class BetaNoticeDialogFragmentTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, TestingBuildFlavorModule::class, CachingTestModule::class, MetricLogSchedulerModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/notice/ForcedAppDeprecationNoticeDialogFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/notice/ForcedAppDeprecationNoticeDialogFragmentTest.kt index 161210eaddd..558b356daac 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/notice/ForcedAppDeprecationNoticeDialogFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/notice/ForcedAppDeprecationNoticeDialogFragmentTest.kt @@ -85,7 +85,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -238,7 +237,7 @@ class ForcedAppDeprecationNoticeDialogFragmentTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, TestingBuildFlavorModule::class, CachingTestModule::class, MetricLogSchedulerModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/notice/GeneralAvailabilityUpgradeNoticeDialogFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/notice/GeneralAvailabilityUpgradeNoticeDialogFragmentTest.kt index 328c63583ef..098f4fb8144 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/notice/GeneralAvailabilityUpgradeNoticeDialogFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/notice/GeneralAvailabilityUpgradeNoticeDialogFragmentTest.kt @@ -86,7 +86,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -256,7 +255,7 @@ class GeneralAvailabilityUpgradeNoticeDialogFragmentTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, TestingBuildFlavorModule::class, CachingTestModule::class, MetricLogSchedulerModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/notice/OptionalAppDeprecationNoticeDialogFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/notice/OptionalAppDeprecationNoticeDialogFragmentTest.kt index 8ef96d1613f..3f099affbc4 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/notice/OptionalAppDeprecationNoticeDialogFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/notice/OptionalAppDeprecationNoticeDialogFragmentTest.kt @@ -87,7 +87,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.extensions.getVersionCode import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -247,7 +246,7 @@ class OptionalAppDeprecationNoticeDialogFragmentTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, TestingBuildFlavorModule::class, CachingTestModule::class, MetricLogSchedulerModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/notice/OsDeprecationNoticeDialogFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/notice/OsDeprecationNoticeDialogFragmentTest.kt index 630f1f84aac..8c44a36dc31 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/notice/OsDeprecationNoticeDialogFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/notice/OsDeprecationNoticeDialogFragmentTest.kt @@ -86,7 +86,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -229,7 +228,7 @@ class OsDeprecationNoticeDialogFragmentTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, TestingBuildFlavorModule::class, CachingTestModule::class, MetricLogSchedulerModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/onboarding/CreateProfileActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/onboarding/CreateProfileActivityTest.kt index 3763cf7d57c..6255d92d7e0 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/onboarding/CreateProfileActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/onboarding/CreateProfileActivityTest.kt @@ -75,7 +75,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -181,7 +180,7 @@ class CreateProfileActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/onboarding/CreateProfileFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/onboarding/CreateProfileFragmentTest.kt index 5e9c8ada80e..f45cebfb42f 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/onboarding/CreateProfileFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/onboarding/CreateProfileFragmentTest.kt @@ -20,6 +20,7 @@ import androidx.test.espresso.intent.Intents.intended import androidx.test.espresso.intent.Intents.intending import androidx.test.espresso.intent.matcher.IntentMatchers.hasAction import androidx.test.espresso.intent.matcher.IntentMatchers.hasComponent +import androidx.test.espresso.intent.matcher.IntentMatchers.hasExtraWithKey import androidx.test.espresso.matcher.ViewMatchers.Visibility import androidx.test.espresso.matcher.ViewMatchers.isDisplayed import androidx.test.espresso.matcher.ViewMatchers.isRoot @@ -28,13 +29,10 @@ import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.ext.junit.runners.AndroidJUnit4 import com.google.common.truth.Truth.assertThat -import com.google.protobuf.MessageLite import dagger.Component -import org.hamcrest.Description import org.hamcrest.Matcher import org.hamcrest.Matchers.allOf import org.hamcrest.Matchers.not -import org.hamcrest.TypeSafeMatcher import org.junit.After import org.junit.Before import org.junit.Rule @@ -52,10 +50,14 @@ import org.oppia.android.app.application.ApplicationStartupListenerModule import org.oppia.android.app.application.testing.TestingBuildFlavorModule import org.oppia.android.app.devoptions.DeveloperOptionsModule import org.oppia.android.app.devoptions.DeveloperOptionsStarterModule +import org.oppia.android.app.model.CreateProfileActivityParams import org.oppia.android.app.model.IntroActivityParams +import org.oppia.android.app.model.ProfileId +import org.oppia.android.app.model.ProfileType import org.oppia.android.app.player.state.itemviewmodel.SplitScreenInteractionModule import org.oppia.android.app.shim.ViewBindingShimModule import org.oppia.android.app.translation.testing.ActivityRecreatorTestModule +import org.oppia.android.app.utility.EspressoTestsMatchers.hasProtoExtra import org.oppia.android.app.utility.OrientationChangeAction.Companion.orientationLandscape import org.oppia.android.data.backends.gae.NetworkConfigProdModule import org.oppia.android.data.backends.gae.NetworkModule @@ -87,6 +89,7 @@ import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule import org.oppia.android.domain.workmanager.WorkManagerConfigurationModule +import org.oppia.android.testing.DisableAccessibilityChecks import org.oppia.android.testing.OppiaTestRule import org.oppia.android.testing.TestImageLoaderModule import org.oppia.android.testing.TestLogReportingModule @@ -94,6 +97,7 @@ import org.oppia.android.testing.espresso.EditTextInputAction import org.oppia.android.testing.firebase.TestAuthenticationModule import org.oppia.android.testing.junit.InitializeDefaultLocaleRule import org.oppia.android.testing.platformparameter.TestPlatformParameterModule +import org.oppia.android.testing.profile.ProfileTestHelper import org.oppia.android.testing.robolectric.RobolectricModule import org.oppia.android.testing.threading.TestCoroutineDispatchers import org.oppia.android.testing.threading.TestDispatcherModule @@ -101,10 +105,9 @@ import org.oppia.android.testing.time.FakeOppiaClockModule import org.oppia.android.util.accessibility.AccessibilityTestModule import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule -import org.oppia.android.util.extensions.getProtoExtra +import org.oppia.android.util.extensions.putProtoExtra import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -113,6 +116,8 @@ import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule import org.oppia.android.util.parser.image.ImageParsingModule import org.oppia.android.util.parser.image.TestGlideImageLoader +import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.decorateWithUserProfileId +import org.oppia.android.util.profile.PROFILE_ID_INTENT_DECORATOR import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject @@ -128,18 +133,27 @@ import javax.inject.Singleton qualifiers = "port-xxhdpi" ) class CreateProfileFragmentTest { - @get:Rule val initializeDefaultLocaleRule = InitializeDefaultLocaleRule() - @get:Rule val oppiaTestRule = OppiaTestRule() - @Inject lateinit var testCoroutineDispatchers: TestCoroutineDispatchers - @Inject lateinit var context: Context - @Inject lateinit var editTextInputAction: EditTextInputAction - @Inject lateinit var testGlideImageLoader: TestGlideImageLoader + @get:Rule + val initializeDefaultLocaleRule = InitializeDefaultLocaleRule() + @get:Rule + val oppiaTestRule = OppiaTestRule() + @Inject + lateinit var testCoroutineDispatchers: TestCoroutineDispatchers + @Inject + lateinit var context: Context + @Inject + lateinit var editTextInputAction: EditTextInputAction + @Inject + lateinit var testGlideImageLoader: TestGlideImageLoader + @Inject + lateinit var profileTestHelper: ProfileTestHelper @Before fun setUp() { Intents.init() setUpTestApplicationComponent() testCoroutineDispatchers.registerIdlingResource() + profileTestHelper.createDefaultAdminProfile() } @After @@ -195,6 +209,7 @@ class CreateProfileFragmentTest { closeSoftKeyboard() ) testCoroutineDispatchers.runCurrent() + onView(withId(R.id.onboarding_navigation_continue)) .perform(click()) testCoroutineDispatchers.runCurrent() @@ -203,13 +218,15 @@ class CreateProfileFragmentTest { intended( allOf( hasComponent(IntroActivity::class.java.name), - hasProtoExtra("OnboardingIntroActivity.params", expectedParams) + hasProtoExtra(IntroActivity.PARAMS_KEY, expectedParams), + hasExtraWithKey(PROFILE_ID_INTENT_DECORATOR) ) ) } } @Test + @DisableAccessibilityChecks fun testFragment_continueButtonClicked_filledNickname_doesNotShowErrorText() { launchNewLearnerProfileActivity().use { onView(withId(R.id.create_profile_nickname_edittext)) @@ -218,11 +235,12 @@ class CreateProfileFragmentTest { closeSoftKeyboard() ) testCoroutineDispatchers.runCurrent() + onView(withId(R.id.onboarding_navigation_continue)) .perform(click()) testCoroutineDispatchers.runCurrent() - onView(withText(R.string.create_profile_activity_nickname_error)) + onView(withId(R.id.create_profile_nickname_error)) .check(matches(withEffectiveVisibility(Visibility.GONE))) } } @@ -244,6 +262,7 @@ class CreateProfileFragmentTest { onView(withId(R.id.onboarding_navigation_continue)) .perform(click()) testCoroutineDispatchers.runCurrent() + onView(withText(R.string.create_profile_activity_nickname_error)) .check(matches(isDisplayed())) @@ -253,6 +272,7 @@ class CreateProfileFragmentTest { closeSoftKeyboard() ) testCoroutineDispatchers.runCurrent() + onView(withId(R.id.onboarding_navigation_continue)) .perform(click()) testCoroutineDispatchers.runCurrent() @@ -261,7 +281,8 @@ class CreateProfileFragmentTest { intended( allOf( hasComponent(IntroActivity::class.java.name), - hasProtoExtra("OnboardingIntroActivity.params", expectedParams) + hasProtoExtra(IntroActivity.PARAMS_KEY, expectedParams), + hasExtraWithKey(PROFILE_ID_INTENT_DECORATOR) ) ) } @@ -290,12 +311,15 @@ class CreateProfileFragmentTest { @Test fun testFragment_landscapeMode_filledNickname_continueButtonClicked_launchesLearnerIntroScreen() { launchNewLearnerProfileActivity().use { + onView(isRoot()).perform(orientationLandscape()) + onView(withId(R.id.create_profile_nickname_edittext)) .perform( editTextInputAction.appendText("John"), closeSoftKeyboard() ) testCoroutineDispatchers.runCurrent() + onView(withId(R.id.onboarding_navigation_continue)) .perform(click()) testCoroutineDispatchers.runCurrent() @@ -304,7 +328,8 @@ class CreateProfileFragmentTest { intended( allOf( hasComponent(IntroActivity::class.java.name), - hasProtoExtra("OnboardingIntroActivity.params", expectedParams) + hasProtoExtra(IntroActivity.PARAMS_KEY, expectedParams), + hasExtraWithKey(PROFILE_ID_INTENT_DECORATOR) ) ) } @@ -365,7 +390,8 @@ class CreateProfileFragmentTest { intended( allOf( hasComponent(IntroActivity::class.java.name), - hasProtoExtra("OnboardingIntroActivity.params", expectedParams) + hasProtoExtra(IntroActivity.PARAMS_KEY, expectedParams), + hasExtraWithKey(PROFILE_ID_INTENT_DECORATOR) ) ) } @@ -451,6 +477,155 @@ class CreateProfileFragmentTest { } } + @Test + fun testFragment_inputNameWithNumbers_showsNameOnlyLettersError() { + launchNewLearnerProfileActivity().use { + onView(withId(R.id.create_profile_nickname_edittext)) + .perform( + editTextInputAction.appendText("John123"), + closeSoftKeyboard() + ) + + testCoroutineDispatchers.runCurrent() + + onView(withId(R.id.onboarding_navigation_continue)).perform(click()) + testCoroutineDispatchers.runCurrent() + + onView(withId(R.id.create_profile_nickname_error)) + .check(matches(withText(R.string.add_profile_error_name_only_letters))) + } + } + + @Test + fun testFragment_landscape_inputNameWithNumbers_showsNameOnlyLettersError() { + launchNewLearnerProfileActivity().use { + onView(isRoot()).perform(orientationLandscape()) + + onView(withId(R.id.create_profile_nickname_edittext)) + .perform( + editTextInputAction.appendText("John123"), + closeSoftKeyboard() + ) + + testCoroutineDispatchers.runCurrent() + + onView(withId(R.id.onboarding_navigation_continue)).perform(click()) + testCoroutineDispatchers.runCurrent() + + onView(withId(R.id.create_profile_nickname_error)) + .check(matches(withText(R.string.add_profile_error_name_only_letters))) + } + } + + @Test + fun testFragment_inputNameWithNumbers_configChange_errorIsRetained() { + launchNewLearnerProfileActivity().use { + onView(withId(R.id.create_profile_nickname_edittext)) + .perform( + editTextInputAction.appendText("John123"), + closeSoftKeyboard() + ) + testCoroutineDispatchers.runCurrent() + + onView(withId(R.id.onboarding_navigation_continue)).perform(click()) + testCoroutineDispatchers.runCurrent() + + onView(withId(R.id.create_profile_nickname_error)) + .check(matches(withText(R.string.add_profile_error_name_only_letters))) + + onView(isRoot()).perform(orientationLandscape()) + testCoroutineDispatchers.runCurrent() + + onView(withText(R.string.add_profile_error_name_only_letters)) + .check(matches(withEffectiveVisibility(Visibility.VISIBLE))) + } + } + + @Test + fun testFragment_inputNameWithNumbers_thenInputNameWithLetters_errorIsCleared() { + launchNewLearnerProfileActivity().use { + onView(withId(R.id.create_profile_nickname_edittext)) + .perform( + editTextInputAction.appendText("John123"), + closeSoftKeyboard() + ) + testCoroutineDispatchers.runCurrent() + + onView(withId(R.id.onboarding_navigation_continue)).perform(click()) + testCoroutineDispatchers.runCurrent() + + onView(withId(R.id.create_profile_nickname_error)) + .check(matches(withText(R.string.add_profile_error_name_only_letters))) + + onView(withId(R.id.create_profile_nickname_edittext)) + .perform( + editTextInputAction.appendText("John"), + closeSoftKeyboard() + ) + testCoroutineDispatchers.runCurrent() + + onView(withId(R.id.create_profile_nickname_error)) + .check(matches(withEffectiveVisibility(Visibility.GONE))) + } + } + + @Test + fun testFragment_inputNameWithNumbers_configChange_thenInputNameWithLetters_errorIsCleared() { + launchNewLearnerProfileActivity().use { + onView(withId(R.id.create_profile_nickname_edittext)) + .perform( + editTextInputAction.appendText("John123"), + closeSoftKeyboard() + ) + testCoroutineDispatchers.runCurrent() + + onView(withId(R.id.onboarding_navigation_continue)).perform(click()) + testCoroutineDispatchers.runCurrent() + + onView(withId(R.id.create_profile_nickname_error)) + .check(matches(withText(R.string.add_profile_error_name_only_letters))) + + onView(isRoot()).perform(orientationLandscape()) + testCoroutineDispatchers.runCurrent() + + onView(withId(R.id.create_profile_nickname_edittext)) + .perform( + editTextInputAction.appendText("John"), + closeSoftKeyboard() + ) + testCoroutineDispatchers.runCurrent() + + onView(withId(R.id.create_profile_nickname_error)) + .check(matches(withEffectiveVisibility(Visibility.GONE))) + } + } + + @Test + fun testFragment_profileTypeArgumentMissing_showsUnknownProfileTypeError() { + val intent = CreateProfileActivity.createProfileActivityIntent(context) + // Not adding the profile type intent parameter to trigger the exception. + intent.decorateWithUserProfileId(ProfileId.newBuilder().setInternalId(0).build()) + + val scenario = ActivityScenario.launch(intent) + testCoroutineDispatchers.runCurrent() + + scenario.use { + onView(withId(R.id.create_profile_nickname_edittext)) + .perform( + editTextInputAction.appendText("John"), + closeSoftKeyboard() + ) + + testCoroutineDispatchers.runCurrent() + + onView(withId(R.id.onboarding_navigation_continue)).perform(click()) + testCoroutineDispatchers.runCurrent() + + onView(withId(R.id.create_profile_nickname_error)) + .check(matches(withText(R.string.add_profile_error_missing_profile_type))) + } + } + private fun createGalleryPickActivityResultStub(): Instrumentation.ActivityResult { val resources: Resources = context.resources val imageUri = Uri.parse( @@ -466,27 +641,19 @@ class CreateProfileFragmentTest { private fun launchNewLearnerProfileActivity(): ActivityScenario? { - val scenario = ActivityScenario.launch( - CreateProfileActivity.createProfileActivityIntent(context) + val intent = CreateProfileActivity.createProfileActivityIntent(context) + intent.decorateWithUserProfileId(ProfileId.newBuilder().setInternalId(0).build()) + intent.putProtoExtra( + CREATE_PROFILE_PARAMS_KEY, + CreateProfileActivityParams.newBuilder() + .setProfileType(ProfileType.SOLE_LEARNER) + .build() ) + val scenario = ActivityScenario.launch(intent) testCoroutineDispatchers.runCurrent() return scenario } - private fun hasProtoExtra(keyName: String, expectedProto: T): Matcher { - val defaultProto = expectedProto.newBuilderForType().build() - return object : TypeSafeMatcher() { - override fun describeTo(description: Description) { - description.appendText("Intent with extra: $keyName and proto value: $expectedProto") - } - - override fun matchesSafely(intent: Intent): Boolean { - return intent.hasExtra(keyName) && - intent.getProtoExtra(keyName, defaultProto) == expectedProto - } - } - } - private fun setUpTestApplicationComponent() { ApplicationProvider.getApplicationContext().inject(this) } @@ -518,7 +685,7 @@ class CreateProfileFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class, TestImageLoaderModule::class, ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/onboarding/IntroActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/onboarding/IntroActivityTest.kt index 11ded15d116..c0f92b58bca 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/onboarding/IntroActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/onboarding/IntroActivityTest.kt @@ -75,7 +75,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -110,8 +109,6 @@ class IntroActivityTest { @Inject lateinit var testCoroutineDispatchers: TestCoroutineDispatchers - private val testProfileNickname = "John" - @Before fun setUp() { Intents.init() @@ -126,10 +123,7 @@ class IntroActivityTest { @Test fun testActivity_createIntent_verifyScreenNameInIntent() { val screenName = - IntroActivity.createIntroActivity( - context, - testProfileNickname - ) + IntroActivity.createIntroActivity(context) .extractCurrentAppScreenName() assertThat(screenName).isEqualTo(ScreenName.INTRO_ACTIVITY) @@ -151,10 +145,7 @@ class IntroActivityTest { private fun launchOnboardingLearnerIntroActivity(): ActivityScenario? { val scenario = ActivityScenario.launch( - IntroActivity.createIntroActivity( - context, - testProfileNickname - ) + IntroActivity.createIntroActivity(context) ) testCoroutineDispatchers.runCurrent() return scenario @@ -191,7 +182,7 @@ class IntroActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/onboarding/IntroFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/onboarding/IntroFragmentTest.kt index 72fea853fbc..0db62fa800b 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/onboarding/IntroFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/onboarding/IntroFragmentTest.kt @@ -9,6 +9,9 @@ import androidx.test.espresso.Espresso.onView import androidx.test.espresso.action.ViewActions.click import androidx.test.espresso.assertion.ViewAssertions.matches import androidx.test.espresso.intent.Intents +import androidx.test.espresso.intent.Intents.intended +import androidx.test.espresso.intent.matcher.IntentMatchers.hasComponent +import androidx.test.espresso.intent.matcher.IntentMatchers.hasExtraWithKey import androidx.test.espresso.matcher.ViewMatchers import androidx.test.espresso.matcher.ViewMatchers.isDisplayed import androidx.test.espresso.matcher.ViewMatchers.withId @@ -33,6 +36,8 @@ import org.oppia.android.app.application.ApplicationStartupListenerModule import org.oppia.android.app.application.testing.TestingBuildFlavorModule import org.oppia.android.app.devoptions.DeveloperOptionsModule import org.oppia.android.app.devoptions.DeveloperOptionsStarterModule +import org.oppia.android.app.model.IntroActivityParams +import org.oppia.android.app.options.AudioLanguageActivity import org.oppia.android.app.player.state.itemviewmodel.SplitScreenInteractionModule import org.oppia.android.app.shim.ViewBindingShimModule import org.oppia.android.app.translation.testing.ActivityRecreatorTestModule @@ -79,9 +84,9 @@ import org.oppia.android.testing.time.FakeOppiaClockModule import org.oppia.android.util.accessibility.AccessibilityTestModule import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule +import org.oppia.android.util.extensions.putProtoExtra import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -90,6 +95,7 @@ import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule import org.oppia.android.util.parser.image.GlideImageLoaderModule import org.oppia.android.util.parser.image.ImageParsingModule +import org.oppia.android.util.profile.PROFILE_ID_INTENT_DECORATOR import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject @@ -185,21 +191,8 @@ class IntroFragmentTest { onView(withId(R.id.onboarding_navigation_continue)).perform(click()) testCoroutineDispatchers.runCurrent() - // Do nothing for now, but will fail once navigation is implemented - onView(withId(R.id.onboarding_learner_intro_title)) - .check(matches(withText("Welcome, John!"))) - onView(withText(R.string.onboarding_learner_intro_classroom_text)) - .check(matches(isDisplayed())) - onView(withText(R.string.onboarding_learner_intro_practice_text)) - .check(matches(isDisplayed())) - onView( - withText( - context.getString( - R.string.onboarding_learner_intro_feedback_text, - context.getString(R.string.app_name) - ) - ) - ).check(matches(isDisplayed())) + intended(hasComponent(AudioLanguageActivity::class.java.name)) + intended(hasExtraWithKey(PROFILE_ID_INTENT_DECORATOR)) } } @@ -211,31 +204,21 @@ class IntroFragmentTest { onView(withId(R.id.onboarding_navigation_continue)).perform(click()) testCoroutineDispatchers.runCurrent() - // Do nothing for now, but will fail once navigation is implemented - onView(withId(R.id.onboarding_learner_intro_title)) - .check(matches(withText("Welcome, John!"))) - onView(withText(R.string.onboarding_learner_intro_classroom_text)) - .check(matches(isDisplayed())) - onView(withText(R.string.onboarding_learner_intro_practice_text)) - .check(matches(isDisplayed())) - onView( - withText( - context.getString( - R.string.onboarding_learner_intro_feedback_text, - context.getString(R.string.app_name) - ) - ) - ).check(matches(isDisplayed())) + intended(hasComponent(AudioLanguageActivity::class.java.name)) + intended(hasExtraWithKey(PROFILE_ID_INTENT_DECORATOR)) } } private fun launchOnboardingLearnerIntroActivity(): ActivityScenario? { + val params = IntroActivityParams.newBuilder() + .setProfileNickname(testProfileNickname) + .build() + val scenario = ActivityScenario.launch( - IntroActivity.createIntroActivity( - context, - testProfileNickname - ) + IntroActivity.createIntroActivity(context).apply { + putProtoExtra(IntroActivity.PARAMS_KEY, params) + } ) testCoroutineDispatchers.runCurrent() return scenario @@ -272,7 +255,7 @@ class IntroFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingActivityTest.kt index d35c89af96e..2345101ede4 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingActivityTest.kt @@ -73,7 +73,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -164,7 +163,7 @@ class OnboardingActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingFragmentTest.kt index 46f1b08fe88..c985ce11ab4 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingFragmentTest.kt @@ -5,8 +5,10 @@ import android.content.Context import android.content.res.Resources import android.view.View import androidx.appcompat.app.AppCompatActivity +import androidx.core.view.ViewCompat import androidx.test.core.app.ActivityScenario.launch import androidx.test.core.app.ApplicationProvider +import androidx.test.espresso.Espresso.onData import androidx.test.espresso.Espresso.onView import androidx.test.espresso.UiController import androidx.test.espresso.ViewAction @@ -19,6 +21,8 @@ import androidx.test.espresso.assertion.ViewAssertions.matches import androidx.test.espresso.intent.Intents import androidx.test.espresso.intent.Intents.intended import androidx.test.espresso.intent.matcher.IntentMatchers.hasComponent +import androidx.test.espresso.intent.matcher.IntentMatchers.hasExtraWithKey +import androidx.test.espresso.matcher.RootMatchers.withDecorView import androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom import androidx.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed import androidx.test.espresso.matcher.ViewMatchers.isDisplayed @@ -29,10 +33,13 @@ import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.viewpager2.widget.ViewPager2 +import com.google.common.truth.Truth.assertThat import dagger.Component +import org.hamcrest.CoreMatchers.`is` import org.hamcrest.CoreMatchers.allOf import org.hamcrest.CoreMatchers.not import org.hamcrest.Matcher +import org.hamcrest.core.IsInstanceOf.instanceOf import org.junit.After import org.junit.Rule import org.junit.Test @@ -49,6 +56,7 @@ import org.oppia.android.app.application.ApplicationStartupListenerModule import org.oppia.android.app.application.testing.TestingBuildFlavorModule import org.oppia.android.app.devoptions.DeveloperOptionsModule import org.oppia.android.app.devoptions.DeveloperOptionsStarterModule +import org.oppia.android.app.model.OppiaLanguage import org.oppia.android.app.player.state.itemviewmodel.SplitScreenInteractionModule import org.oppia.android.app.profile.ProfileChooserActivity import org.oppia.android.app.shim.ViewBindingShimModule @@ -85,9 +93,13 @@ import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule import org.oppia.android.domain.workmanager.WorkManagerConfigurationModule +import org.oppia.android.testing.BuildEnvironment import org.oppia.android.testing.OppiaTestRule +import org.oppia.android.testing.RunOn import org.oppia.android.testing.TestLogReportingModule +import org.oppia.android.testing.TestPlatform import org.oppia.android.testing.firebase.TestAuthenticationModule +import org.oppia.android.testing.junit.DefineAppLanguageLocaleContext import org.oppia.android.testing.junit.InitializeDefaultLocaleRule import org.oppia.android.testing.platformparameter.TestPlatformParameterModule import org.oppia.android.testing.robolectric.RobolectricModule @@ -97,21 +109,20 @@ import org.oppia.android.testing.time.FakeOppiaClockModule import org.oppia.android.util.accessibility.AccessibilityTestModule import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule -import org.oppia.android.util.gcsresource.DefaultResourceBucketName import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule -import org.oppia.android.util.parser.html.HtmlParser import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule import org.oppia.android.util.parser.image.GlideImageLoaderModule import org.oppia.android.util.parser.image.ImageParsingModule +import org.oppia.android.util.profile.PROFILE_ID_INTENT_DECORATOR import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode +import java.util.Locale import javax.inject.Inject import javax.inject.Singleton @@ -132,19 +143,12 @@ class OnboardingFragmentTest { @Inject lateinit var testCoroutineDispatchers: TestCoroutineDispatchers - @Inject - lateinit var htmlParserFactory: HtmlParser.Factory - @Inject lateinit var context: Context @Inject lateinit var appLanguageLocaleHandler: AppLanguageLocaleHandler - @Inject - @field:DefaultResourceBucketName - lateinit var resourceBucketName: String - @After fun tearDown() { testCoroutineDispatchers.unregisterIdlingResource() @@ -792,6 +796,299 @@ class OnboardingFragmentTest { } } + @Test + @RunOn(TestPlatform.ROBOLECTRIC, buildEnvironments = [BuildEnvironment.BAZEL]) + fun testOnboardingFragment_onboardingV2Enabled_englishLocale_englishIsPreselected() { + setUpTestWithOnboardingV2Enabled() + + launch(OnboardingActivity::class.java).use { + testCoroutineDispatchers.runCurrent() + + // Verify that the display locale is set up correctly (for string formatting). + val displayLocale = appLanguageLocaleHandler.getDisplayLocale() + val localeContext = displayLocale.localeContext + assertThat(localeContext.languageDefinition.language) + .isEqualTo(OppiaLanguage.ENGLISH) + + onView(withId(R.id.onboarding_language_dropdown)).check( + matches(withText(R.string.english_localized_language_name)) + ) + } + } + + @Test + fun testOnboardingFragment_onboardingV2Enabled_englishLocale_layoutIsLtr() { + setUpTestWithOnboardingV2Enabled() + launch(OnboardingActivity::class.java).use { + testCoroutineDispatchers.runCurrent() + + val displayLocale = appLanguageLocaleHandler.getDisplayLocale() + val layoutDirection = displayLocale.getLayoutDirection() + assertThat(layoutDirection).isEqualTo(ViewCompat.LAYOUT_DIRECTION_LTR) + } + } + + @Test + @DefineAppLanguageLocaleContext( + oppiaLanguageEnumId = OppiaLanguage.ARABIC_VALUE, + appStringIetfTag = "ar", + appStringAndroidLanguageId = "ar" + ) + @RunOn(TestPlatform.ROBOLECTRIC, buildEnvironments = [BuildEnvironment.BAZEL]) + fun testOnboardingFragment_onboardingV2Enabled_arabicLocale_arabicIsPreselected() { + setUpTestWithOnboardingV2Enabled() + forceDefaultLocale(EGYPT_ARABIC_LOCALE) + launch(OnboardingActivity::class.java).use { + testCoroutineDispatchers.runCurrent() + + // Verify that the display locale is set up correctly (for string formatting). + val displayLocale = appLanguageLocaleHandler.getDisplayLocale() + val localeContext = displayLocale.localeContext + assertThat(localeContext.languageDefinition.language) + .isEqualTo(OppiaLanguage.ARABIC) + + onView(withId(R.id.onboarding_language_dropdown)).check( + matches(withText(R.string.arabic_localized_language_name)) + ) + } + } + + @Test + @DefineAppLanguageLocaleContext( + oppiaLanguageEnumId = OppiaLanguage.ARABIC_VALUE, + appStringIetfTag = "ar", + appStringAndroidLanguageId = "ar" + ) + @RunOn(TestPlatform.ROBOLECTRIC) + fun testOnboardingFragment_onboardingV2Enabled_arabicLocale_layoutIsRtl() { + setUpTestWithOnboardingV2Enabled() + forceDefaultLocale(EGYPT_ARABIC_LOCALE) + launch(OnboardingActivity::class.java).use { + testCoroutineDispatchers.runCurrent() + + val displayLocale = appLanguageLocaleHandler.getDisplayLocale() + val layoutDirection = displayLocale.getLayoutDirection() + assertThat(layoutDirection).isEqualTo(ViewCompat.LAYOUT_DIRECTION_RTL) + } + } + + @Test + @DefineAppLanguageLocaleContext( + oppiaLanguageEnumId = OppiaLanguage.BRAZILIAN_PORTUGUESE_VALUE, + appStringIetfTag = "pt-BR", + appStringAndroidLanguageId = "pt", + appStringAndroidRegionId = "BR" + ) + @RunOn(TestPlatform.ROBOLECTRIC, buildEnvironments = [BuildEnvironment.BAZEL]) + fun testOnboardingFragment_onboardingV2Enabled_portugueseLocale_portugueseIsPreselected() { + setUpTestWithOnboardingV2Enabled() + forceDefaultLocale(BRAZIL_PORTUGUESE_LOCALE) + launch(OnboardingActivity::class.java).use { + testCoroutineDispatchers.runCurrent() + + // Verify that the display locale is set up correctly (for string formatting). + val displayLocale = appLanguageLocaleHandler.getDisplayLocale() + val localeContext = displayLocale.localeContext + assertThat(localeContext.languageDefinition.language) + .isEqualTo(OppiaLanguage.BRAZILIAN_PORTUGUESE) + + onView(withId(R.id.onboarding_language_dropdown)).check( + matches(withText(R.string.portuguese_localized_language_name)) + ) + } + } + + @Test + @DefineAppLanguageLocaleContext( + oppiaLanguageEnumId = OppiaLanguage.BRAZILIAN_PORTUGUESE_VALUE, + appStringIetfTag = "pt-BR", + appStringAndroidLanguageId = "pt", + appStringAndroidRegionId = "BR" + ) + @RunOn(TestPlatform.ROBOLECTRIC) + fun testOnboardingFragment_onboardingV2Enabled_portugueseLocale_layoutIsLtr() { + setUpTestWithOnboardingV2Enabled() + forceDefaultLocale(BRAZIL_PORTUGUESE_LOCALE) + launch(OnboardingActivity::class.java).use { + testCoroutineDispatchers.runCurrent() + + val displayLocale = appLanguageLocaleHandler.getDisplayLocale() + val layoutDirection = displayLocale.getLayoutDirection() + assertThat(layoutDirection).isEqualTo(ViewCompat.LAYOUT_DIRECTION_LTR) + } + } + + @Test + @DefineAppLanguageLocaleContext( + oppiaLanguageEnumId = OppiaLanguage.NIGERIAN_PIDGIN_VALUE, + appStringIetfTag = "pcm", + appStringAndroidLanguageId = "pcm", + appStringAndroidRegionId = "NG" + ) + @RunOn(TestPlatform.ROBOLECTRIC, buildEnvironments = [BuildEnvironment.BAZEL]) + fun testOnboardingFragment_onboardingV2Enabled_nigeriaLocale_naijaIsPreselected() { + setUpTestWithOnboardingV2Enabled() + forceDefaultLocale(NIGERIA_NAIJA_LOCALE) + launch(OnboardingActivity::class.java).use { + testCoroutineDispatchers.runCurrent() + + // Verify that the display locale is set up correctly (for string formatting). + val displayLocale = appLanguageLocaleHandler.getDisplayLocale() + val localeContext = displayLocale.localeContext + assertThat(localeContext.languageDefinition.language) + .isEqualTo(OppiaLanguage.NIGERIAN_PIDGIN) + + onView(withId(R.id.onboarding_language_dropdown)).check( + matches(withText(R.string.nigerian_pidgin_localized_language_name)) + ) + } + } + + @Test + @DefineAppLanguageLocaleContext( + oppiaLanguageEnumId = OppiaLanguage.NIGERIAN_PIDGIN_VALUE, + appStringIetfTag = "pcm", + appStringAndroidLanguageId = "pcm", + appStringAndroidRegionId = "NG" + ) + @RunOn(TestPlatform.ROBOLECTRIC) + fun testOnboardingFragment_onboardingV2Enabled_nigeriaLocale_layoutIsLtr() { + setUpTestWithOnboardingV2Enabled() + forceDefaultLocale(NIGERIA_NAIJA_LOCALE) + launch(OnboardingActivity::class.java).use { + testCoroutineDispatchers.runCurrent() + + val displayLocale = appLanguageLocaleHandler.getDisplayLocale() + val layoutDirection = displayLocale.getLayoutDirection() + assertThat(layoutDirection).isEqualTo(ViewCompat.LAYOUT_DIRECTION_LTR) + } + } + + @Test + @DefineAppLanguageLocaleContext( + oppiaLanguageEnumId = OppiaLanguage.LANGUAGE_UNSPECIFIED_VALUE, + appStringIetfTag = "fr", + appStringAndroidLanguageId = "fr-CA", + appStringAndroidRegionId = "CA" + ) + @RunOn(TestPlatform.ROBOLECTRIC, buildEnvironments = [BuildEnvironment.BAZEL]) + fun testOnboardingFragment_onboardingV2Enabled_unsupportedLocale_englishIsPreselected() { + setUpTestWithOnboardingV2Enabled() + forceDefaultLocale(CANADA_FRENCH_LOCALE) + launch(OnboardingActivity::class.java).use { + testCoroutineDispatchers.runCurrent() + + // Verify that the display locale is set up correctly (for string formatting). + val displayLocale = appLanguageLocaleHandler.getDisplayLocale() + val localeContext = displayLocale.localeContext + assertThat(localeContext.languageDefinition.language) + .isEqualTo(OppiaLanguage.LANGUAGE_UNSPECIFIED) + + onView(withId(R.id.onboarding_language_dropdown)).check( + matches(withText(R.string.english_localized_language_name)) + ) + } + } + + @Test + fun testFragment_onboardingV2Enabled_clickLetsGoButton_launchesProfileTypeScreen() { + setUpTestWithOnboardingV2Enabled() + launch(OnboardingActivity::class.java).use { + testCoroutineDispatchers.runCurrent() + // Verifies that the default language selection is set if the user does not make a selection. + onView(withId(R.id.onboarding_language_lets_go_button)).perform(click()) + testCoroutineDispatchers.runCurrent() + intended(hasComponent(OnboardingProfileTypeActivity::class.java.name)) + intended(hasExtraWithKey(PROFILE_ID_INTENT_DECORATOR)) + } + } + + @Test + @RunOn(TestPlatform.ROBOLECTRIC, buildEnvironments = [BuildEnvironment.BAZEL]) + fun testFragment_onboardingV2_languageSelectionChanged_languageIsUpdated() { + setUpTestWithOnboardingV2Enabled() + launch(OnboardingActivity::class.java).use { scenario -> + testCoroutineDispatchers.runCurrent() + + scenario.onActivity { activity -> + onView(withId(R.id.onboarding_language_dropdown)).perform(click()) + + onData(allOf(`is`(instanceOf(String::class.java)), `is`("Naijá"))) + .inRoot(withDecorView(not(`is`(activity.window.decorView)))) + .perform(click()) + + testCoroutineDispatchers.runCurrent() + + onView(withId(R.id.onboarding_language_dropdown)).check( + matches(withText(R.string.nigerian_pidgin_localized_language_name)) + ) + + onView(withId(R.id.onboarding_language_lets_go_button)).perform(click()) + testCoroutineDispatchers.runCurrent() + intended(hasComponent(OnboardingProfileTypeActivity::class.java.name)) + intended(hasExtraWithKey(PROFILE_ID_INTENT_DECORATOR)) + } + } + } + + @Test + @RunOn(TestPlatform.ROBOLECTRIC, buildEnvironments = [BuildEnvironment.BAZEL]) + fun testFragment_onboardingV2_languageSelectionChanged_configChange_languageIsUpdated() { + setUpTestWithOnboardingV2Enabled() + launch(OnboardingActivity::class.java).use { scenario -> + testCoroutineDispatchers.runCurrent() + + scenario.onActivity { activity -> + onView(withId(R.id.onboarding_language_dropdown)).perform(click()) + + onData(allOf(`is`(instanceOf(String::class.java)), `is`("Naijá"))) + .inRoot(withDecorView(not(`is`(activity.window.decorView)))) + .perform(click()) + + onView(isRoot()).perform(orientationLandscape()) + + testCoroutineDispatchers.runCurrent() + + // Verifies that the selected language is still set successfully after configuration change. + onView(withId(R.id.onboarding_language_lets_go_button)).perform(click()) + testCoroutineDispatchers.runCurrent() + intended(hasComponent(OnboardingProfileTypeActivity::class.java.name)) + intended(hasExtraWithKey(PROFILE_ID_INTENT_DECORATOR)) + } + } + } + + @Test + @RunOn(TestPlatform.ROBOLECTRIC, buildEnvironments = [BuildEnvironment.BAZEL]) + fun testFragment_onboardingV2_orientationChange_languageSelectionIsRestored() { + setUpTestWithOnboardingV2Enabled() + launch(OnboardingActivity::class.java).use { scenario -> + testCoroutineDispatchers.runCurrent() + + scenario.onActivity { activity -> + onView(withId(R.id.onboarding_language_dropdown)).perform(click()) + + onData(allOf(`is`(instanceOf(String::class.java)), `is`("Naijá"))) + .inRoot(withDecorView(not(`is`(activity.window.decorView)))) + .perform(click()) + + testCoroutineDispatchers.runCurrent() + + onView(isRoot()).perform(orientationLandscape()) + testCoroutineDispatchers.runCurrent() + + onView(withId(R.id.onboarding_language_dropdown)).check( + matches(withText(R.string.nigerian_pidgin_localized_language_name)) + ) + } + } + } + + private fun forceDefaultLocale(locale: Locale) { + context.applicationContext.resources.configuration.setLocale(locale) + Locale.setDefault(locale) + } + private fun setUpTestWithOnboardingV2Disabled() { TestPlatformParameterModule.forceEnableOnboardingFlowV2(false) setUp() @@ -859,7 +1156,7 @@ class OnboardingFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] @@ -890,4 +1187,11 @@ class OnboardingFragmentTest { override fun getApplicationInjector(): ApplicationInjector = component } + + private companion object { + private val BRAZIL_PORTUGUESE_LOCALE = Locale("pt", "BR") + private val EGYPT_ARABIC_LOCALE = Locale("ar", "EG") + private val NIGERIA_NAIJA_LOCALE = Locale("pcm", "NG") + private val CANADA_FRENCH_LOCALE = Locale("fr", "CA") + } } diff --git a/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingProfileTypeActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingProfileTypeActivityTest.kt index 82c3d74ae11..0c569d5941c 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingProfileTypeActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingProfileTypeActivityTest.kt @@ -75,7 +75,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -182,7 +181,7 @@ class OnboardingProfileTypeActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingProfileTypeFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingProfileTypeFragmentTest.kt index 2649e11c610..8493d3ae7ed 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingProfileTypeFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingProfileTypeFragmentTest.kt @@ -11,6 +11,7 @@ import androidx.test.espresso.assertion.ViewAssertions.matches import androidx.test.espresso.intent.Intents import androidx.test.espresso.intent.Intents.intended import androidx.test.espresso.intent.matcher.IntentMatchers.hasComponent +import androidx.test.espresso.intent.matcher.IntentMatchers.hasExtraWithKey import androidx.test.espresso.matcher.ViewMatchers.hasDescendant import androidx.test.espresso.matcher.ViewMatchers.isDisplayed import androidx.test.espresso.matcher.ViewMatchers.isRoot @@ -37,10 +38,13 @@ import org.oppia.android.app.application.ApplicationStartupListenerModule import org.oppia.android.app.application.testing.TestingBuildFlavorModule import org.oppia.android.app.devoptions.DeveloperOptionsModule import org.oppia.android.app.devoptions.DeveloperOptionsStarterModule +import org.oppia.android.app.model.CreateProfileActivityParams +import org.oppia.android.app.model.ProfileType import org.oppia.android.app.player.state.itemviewmodel.SplitScreenInteractionModule import org.oppia.android.app.profile.ProfileChooserActivity import org.oppia.android.app.shim.ViewBindingShimModule import org.oppia.android.app.translation.testing.ActivityRecreatorTestModule +import org.oppia.android.app.utility.EspressoTestsMatchers.hasProtoExtra import org.oppia.android.app.utility.OrientationChangeAction.Companion.orientationLandscape import org.oppia.android.data.backends.gae.NetworkConfigProdModule import org.oppia.android.data.backends.gae.NetworkModule @@ -87,7 +91,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.locale.OppiaLocale -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -96,6 +99,7 @@ import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule import org.oppia.android.util.parser.image.GlideImageLoaderModule import org.oppia.android.util.parser.image.ImageParsingModule +import org.oppia.android.util.profile.PROFILE_ID_INTENT_DECORATOR import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject @@ -257,12 +261,14 @@ class OnboardingProfileTypeFragmentTest { launchOnboardingProfileTypeActivity().use { onView(withId(R.id.profile_type_learner_navigation_card)).perform(click()) testCoroutineDispatchers.runCurrent() - // Does nothing for now, but should fail once navigation is implemented in a future PR. - onView(withId(R.id.profile_type_learner_navigation_card)) - .check(matches(isDisplayed())) - onView(withId(R.id.profile_type_supervisor_navigation_card)) - .check(matches(isDisplayed())) + val params = CreateProfileActivityParams.newBuilder() + .setProfileType(ProfileType.SOLE_LEARNER) + .build() + + intended(hasComponent(CreateProfileActivity::class.java.name)) + intended(hasExtraWithKey(PROFILE_ID_INTENT_DECORATOR)) + intended(hasProtoExtra(CREATE_PROFILE_PARAMS_KEY, params)) } } @@ -271,9 +277,17 @@ class OnboardingProfileTypeFragmentTest { launchOnboardingProfileTypeActivity().use { onView(isRoot()).perform(orientationLandscape()) testCoroutineDispatchers.runCurrent() + onView(withId(R.id.profile_type_learner_navigation_card)).perform(click()) testCoroutineDispatchers.runCurrent() + + val params = CreateProfileActivityParams.newBuilder() + .setProfileType(ProfileType.SOLE_LEARNER) + .build() + intended(hasComponent(CreateProfileActivity::class.java.name)) + intended(hasExtraWithKey(PROFILE_ID_INTENT_DECORATOR)) + intended(hasProtoExtra(CREATE_PROFILE_PARAMS_KEY, params)) } } @@ -361,7 +375,7 @@ class OnboardingProfileTypeFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/ongoingtopiclist/OngoingTopicListActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/ongoingtopiclist/OngoingTopicListActivityTest.kt index 7c6f16174d0..d5c066cb437 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/ongoingtopiclist/OngoingTopicListActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/ongoingtopiclist/OngoingTopicListActivityTest.kt @@ -98,7 +98,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -488,7 +487,7 @@ class OngoingTopicListActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/options/AppLanguageActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/options/AppLanguageActivityTest.kt index ba0831a5696..f5ff14491ba 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/options/AppLanguageActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/options/AppLanguageActivityTest.kt @@ -74,7 +74,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -173,7 +172,7 @@ class AppLanguageActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/options/AppLanguageFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/options/AppLanguageFragmentTest.kt index 074985b485b..2f32094463c 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/options/AppLanguageFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/options/AppLanguageFragmentTest.kt @@ -87,7 +87,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -356,7 +355,7 @@ class AppLanguageFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/options/AudioLanguageActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/options/AudioLanguageActivityTest.kt index 89bb88668cf..c2e00b7e1ec 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/options/AudioLanguageActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/options/AudioLanguageActivityTest.kt @@ -74,7 +74,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -164,7 +163,7 @@ class AudioLanguageActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/options/AudioLanguageFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/options/AudioLanguageFragmentTest.kt index b8aed771aaa..cb3fef2835f 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/options/AudioLanguageFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/options/AudioLanguageFragmentTest.kt @@ -6,10 +6,14 @@ import androidx.appcompat.app.AppCompatActivity import androidx.test.core.app.ActivityScenario import androidx.test.core.app.ActivityScenario.launch import androidx.test.core.app.ApplicationProvider +import androidx.test.espresso.Espresso.onData import androidx.test.espresso.Espresso.onView import androidx.test.espresso.action.ViewActions.click import androidx.test.espresso.assertion.ViewAssertions.matches import androidx.test.espresso.intent.Intents +import androidx.test.espresso.intent.Intents.intended +import androidx.test.espresso.intent.matcher.IntentMatchers.hasComponent +import androidx.test.espresso.matcher.RootMatchers.withDecorView import androidx.test.espresso.matcher.ViewMatchers.Visibility import androidx.test.espresso.matcher.ViewMatchers.isChecked import androidx.test.espresso.matcher.ViewMatchers.isRoot @@ -19,6 +23,11 @@ import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.ext.junit.runners.AndroidJUnit4 import com.google.common.truth.Truth.assertThat import dagger.Component +import org.hamcrest.CoreMatchers +import org.hamcrest.CoreMatchers.`is` +import org.hamcrest.CoreMatchers.instanceOf +import org.hamcrest.CoreMatchers.not +import org.hamcrest.core.AllOf.allOf import org.junit.After import org.junit.Rule import org.junit.Test @@ -35,6 +44,7 @@ import org.oppia.android.app.application.ApplicationStartupListenerModule import org.oppia.android.app.application.testing.TestingBuildFlavorModule import org.oppia.android.app.devoptions.DeveloperOptionsModule import org.oppia.android.app.devoptions.DeveloperOptionsStarterModule +import org.oppia.android.app.home.HomeActivity import org.oppia.android.app.model.AudioLanguage import org.oppia.android.app.model.AudioLanguage.BRAZILIAN_PORTUGUESE_LANGUAGE import org.oppia.android.app.model.AudioLanguage.ENGLISH_AUDIO_LANGUAGE @@ -75,8 +85,11 @@ import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule import org.oppia.android.domain.workmanager.WorkManagerConfigurationModule +import org.oppia.android.testing.BuildEnvironment import org.oppia.android.testing.OppiaTestRule +import org.oppia.android.testing.RunOn import org.oppia.android.testing.TestLogReportingModule +import org.oppia.android.testing.TestPlatform import org.oppia.android.testing.firebase.TestAuthenticationModule import org.oppia.android.testing.junit.InitializeDefaultLocaleRule import org.oppia.android.testing.platformparameter.TestPlatformParameterModule @@ -90,7 +103,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -311,22 +323,13 @@ class AudioLanguageFragmentTest { launch( createDefaultAudioActivityIntent(ENGLISH_AUDIO_LANGUAGE) ).use { + testCoroutineDispatchers.runCurrent() + onView(withId(R.id.onboarding_navigation_continue)).perform(click()) testCoroutineDispatchers.runCurrent() - // Do nothing for now, but will fail once navigation is implemented - onView(withId(R.id.audio_language_text)).check( - matches(withText("In Oppia, you can listen to lessons!")) - ) - onView(withId(R.id.audio_language_subtitle)).check( - matches(withText(context.getString(R.string.audio_language_fragment_subtitle))) - ) - onView(withId(R.id.onboarding_navigation_back)).check( - matches(withEffectiveVisibility(Visibility.VISIBLE)) - ) - onView(withId(R.id.onboarding_navigation_continue)).check( - matches(withEffectiveVisibility(Visibility.VISIBLE)) - ) + // Verifies that accepting the default language selection works correctly. + intended(hasComponent(HomeActivity::class.java.name)) } } @@ -341,19 +344,73 @@ class AudioLanguageFragmentTest { onView(withId(R.id.onboarding_navigation_continue)).perform(click()) testCoroutineDispatchers.runCurrent() - // Do nothing for now, but will fail once navigation is implemented - onView(withId(R.id.audio_language_text)).check( - matches(withText("In Oppia, you can listen to lessons!")) - ) - onView(withId(R.id.audio_language_subtitle)).check( - matches(withText(context.getString(R.string.audio_language_fragment_subtitle))) - ) - onView(withId(R.id.onboarding_navigation_back)).check( - matches(withEffectiveVisibility(Visibility.VISIBLE)) - ) - onView(withId(R.id.onboarding_navigation_continue)).check( - matches(withEffectiveVisibility(Visibility.VISIBLE)) - ) + // Verifies that accepting the default language selection works correctly. + intended(hasComponent(HomeActivity::class.java.name)) + } + } + + @Test + @RunOn(TestPlatform.ROBOLECTRIC, buildEnvironments = [BuildEnvironment.BAZEL]) + fun testFragment_languageSelectionChanged_selectionIsUpdated() { + initializeTestApplicationComponent(enableOnboardingFlowV2 = true) + launch( + createDefaultAudioActivityIntent(ENGLISH_AUDIO_LANGUAGE) + ).use { scenario -> + testCoroutineDispatchers.runCurrent() + + scenario.onActivity { activity -> + onView(withId(R.id.audio_language_dropdown_list)).perform(click()) + + onData(allOf(`is`(instanceOf(String::class.java)), `is`("Naijá"))) + .inRoot(withDecorView(not(`is`(activity.window.decorView)))) + .perform(click()) + + testCoroutineDispatchers.runCurrent() + + onView(withId(R.id.audio_language_dropdown_list)).check( + matches(withText(R.string.nigerian_pidgin_localized_language_name)) + ) + + onView(withId(R.id.onboarding_navigation_continue)).perform(click()) + testCoroutineDispatchers.runCurrent() + intended(hasComponent(HomeActivity::class.java.name)) + } + } + } + + @Test + @RunOn(TestPlatform.ROBOLECTRIC, buildEnvironments = [BuildEnvironment.BAZEL]) + fun testFragment_languageSelectionChanged_configChange_selectionIsUpdated() { + initializeTestApplicationComponent(enableOnboardingFlowV2 = true) + launch( + createDefaultAudioActivityIntent(ENGLISH_AUDIO_LANGUAGE) + ).use { scenario -> + testCoroutineDispatchers.runCurrent() + + scenario.onActivity { activity -> + onView(withId(R.id.audio_language_dropdown_list)).perform(click()) + + onData( + CoreMatchers.allOf( + `is`(instanceOf(String::class.java)), `is`("Naijá") + ) + ) + .inRoot(withDecorView(not(`is`(activity.window.decorView)))) + .perform(click()) + + onView(isRoot()).perform(orientationLandscape()) + testCoroutineDispatchers.runCurrent() + + // Verifies that the selected language is still set successfully after configuration change. + onView(withId(R.id.audio_language_dropdown_list)).check( + matches(withText(R.string.nigerian_pidgin_localized_language_name)) + ) + + onView(withId(R.id.onboarding_navigation_continue)).perform(click()) + testCoroutineDispatchers.runCurrent() + + intended(hasComponent(HomeActivity::class.java.name)) + } } } @@ -505,16 +562,14 @@ class AudioLanguageFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] ) interface TestApplicationComponent : ApplicationComponent { @Component.Builder - interface Builder : ApplicationComponent.Builder { - override fun build(): TestApplicationComponent - } + interface Builder : ApplicationComponent.Builder fun inject(audioLanguageFragmentTest: AudioLanguageFragmentTest) } diff --git a/app/src/sharedTest/java/org/oppia/android/app/options/OptionsActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/options/OptionsActivityTest.kt index 8a9b5e83586..c7209180411 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/options/OptionsActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/options/OptionsActivityTest.kt @@ -74,7 +74,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -169,7 +168,7 @@ class OptionsActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/options/OptionsFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/options/OptionsFragmentTest.kt index 5cb9b71ef75..07d94b978f7 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/options/OptionsFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/options/OptionsFragmentTest.kt @@ -102,7 +102,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -627,7 +626,7 @@ class OptionsFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/options/ReadingTextSizeActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/options/ReadingTextSizeActivityTest.kt index 046cd81fed2..5eb5c15332a 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/options/ReadingTextSizeActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/options/ReadingTextSizeActivityTest.kt @@ -73,7 +73,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -164,7 +163,7 @@ class ReadingTextSizeActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/options/ReadingTextSizeFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/options/ReadingTextSizeFragmentTest.kt index 1883d2459bf..5e1ef9f6c61 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/options/ReadingTextSizeFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/options/ReadingTextSizeFragmentTest.kt @@ -92,7 +92,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -354,7 +353,7 @@ class ReadingTextSizeFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/parser/HtmlParserTest.kt b/app/src/sharedTest/java/org/oppia/android/app/parser/HtmlParserTest.kt index 3d9c7be9364..1e1ca843c6a 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/parser/HtmlParserTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/parser/HtmlParserTest.kt @@ -121,7 +121,6 @@ import org.oppia.android.util.locale.DisplayLocaleImpl import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.locale.OppiaBidiFormatter import org.oppia.android.util.locale.OppiaLocale -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -914,7 +913,7 @@ class HtmlParserTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/player/audio/AudioFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/player/audio/AudioFragmentTest.kt index 382327eb863..dec40d9a790 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/player/audio/AudioFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/player/audio/AudioFragmentTest.kt @@ -102,7 +102,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -505,7 +504,7 @@ class AudioFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/player/exploration/BUILD.bazel b/app/src/sharedTest/java/org/oppia/android/app/player/exploration/BUILD.bazel index 4ba1c3f5b56..64a22de135b 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/player/exploration/BUILD.bazel +++ b/app/src/sharedTest/java/org/oppia/android/app/player/exploration/BUILD.bazel @@ -35,7 +35,6 @@ app_test( "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", "//utility/src/main/java/org/oppia/android/util/locale/testing:test_module", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_util_module", @@ -94,7 +93,6 @@ app_test( "//utility/src/main/java/org/oppia/android/util/data:data_providers", "//utility/src/main/java/org/oppia/android/util/locale/testing:test_module", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_util_module", diff --git a/app/src/sharedTest/java/org/oppia/android/app/player/exploration/BottomSheetOptionsMenuTest.kt b/app/src/sharedTest/java/org/oppia/android/app/player/exploration/BottomSheetOptionsMenuTest.kt index 7fb19f1484f..82572882642 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/player/exploration/BottomSheetOptionsMenuTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/player/exploration/BottomSheetOptionsMenuTest.kt @@ -82,7 +82,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -192,7 +191,7 @@ class BottomSheetOptionsMenuTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, TestingBuildFlavorModule::class, CachingTestModule::class, MetricLogSchedulerModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/player/exploration/ExplorationActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/player/exploration/ExplorationActivityTest.kt index 32d29315737..d5adce598af 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/player/exploration/ExplorationActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/player/exploration/ExplorationActivityTest.kt @@ -161,7 +161,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -2903,7 +2902,7 @@ class ExplorationActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/player/state/BUILD.bazel b/app/src/sharedTest/java/org/oppia/android/app/player/state/BUILD.bazel index 1264e021c84..9bdb9a1acc1 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/player/state/BUILD.bazel +++ b/app/src/sharedTest/java/org/oppia/android/app/player/state/BUILD.bazel @@ -45,7 +45,6 @@ app_test( "//utility/src/main/java/org/oppia/android/util/data:data_providers", "//utility/src/main/java/org/oppia/android/util/locale/testing:test_module", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_util_module", diff --git a/app/src/sharedTest/java/org/oppia/android/app/player/state/StateFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/player/state/StateFragmentTest.kt index 6bb74d198a5..6c96160dd4b 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/player/state/StateFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/player/state/StateFragmentTest.kt @@ -80,6 +80,7 @@ import org.oppia.android.app.devoptions.DeveloperOptionsModule import org.oppia.android.app.devoptions.DeveloperOptionsStarterModule import org.oppia.android.app.model.OppiaLanguage import org.oppia.android.app.model.ProfileId +import org.oppia.android.app.model.StateFragmentArguments import org.oppia.android.app.model.WrittenTranslationLanguageSelection import org.oppia.android.app.player.state.itemviewmodel.SplitScreenInteractionModule import org.oppia.android.app.player.state.itemviewmodel.StateItemViewModel @@ -177,9 +178,9 @@ import org.oppia.android.util.accessibility.AccessibilityTestModule import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.LoadImagesFromAssets import org.oppia.android.util.caching.LoadLessonProtosFromAssets +import org.oppia.android.util.extensions.getProto import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -5004,6 +5005,38 @@ class StateFragmentTest { } } + @Test + fun testFragmentArguments_afterCreation_areCorrect() { + setUpTestWithLanguageSwitchingFeatureOff() + launchForExploration( + FRACTIONS_EXPLORATION_ID_1, + shouldSavePartialProgress = false + ).use { scenario -> + startPlayingExploration() + + scenario.onActivity { activity -> + val stateFragment = activity.supportFragmentManager + .findFragmentById(R.id.state_fragment_placeholder) as StateFragment + + val args = + stateFragment.arguments?.getProto( + StateFragment.STATE_FRAGMENT_ARGUMENTS_KEY, + StateFragmentArguments.getDefaultInstance() + ) + + val receivedInternalProfileId = args?.internalProfileId ?: -1 + val receivedTopicId = args?.topicId!! + val receivedStoryId = args.storyId!! + val reveivedExplorationId = args.explorationId!! + + assertThat(receivedInternalProfileId).isEqualTo(profileId.internalId) + assertThat(receivedTopicId).isEqualTo(TEST_TOPIC_ID_0) + assertThat(receivedStoryId).isEqualTo(TEST_STORY_ID_0) + assertThat(reveivedExplorationId).isEqualTo(FRACTIONS_EXPLORATION_ID_1) + } + } + } + private fun addShadowMediaPlayerException(dataSource: Any, exception: Exception) { val classLoader = StateFragmentTest::class.java.classLoader!! val shadowMediaPlayerClass = classLoader.loadClass("org.robolectric.shadows.ShadowMediaPlayer") @@ -5766,7 +5799,7 @@ class StateFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/policies/PoliciesActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/policies/PoliciesActivityTest.kt index 2a2d4e8fb72..ff1e8c493c5 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/policies/PoliciesActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/policies/PoliciesActivityTest.kt @@ -93,7 +93,6 @@ import org.oppia.android.util.gcsresource.DefaultResourceBucketName import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -279,7 +278,7 @@ class PoliciesActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/policies/PoliciesFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/policies/PoliciesFragmentTest.kt index b6d16ecd926..df915e29461 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/policies/PoliciesFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/policies/PoliciesFragmentTest.kt @@ -52,6 +52,8 @@ import org.oppia.android.app.application.ApplicationStartupListenerModule import org.oppia.android.app.application.testing.TestingBuildFlavorModule import org.oppia.android.app.devoptions.DeveloperOptionsModule import org.oppia.android.app.devoptions.DeveloperOptionsStarterModule +import org.oppia.android.app.model.PoliciesActivityParams +import org.oppia.android.app.model.PoliciesFragmentArguments import org.oppia.android.app.model.PolicyPage import org.oppia.android.app.player.state.itemviewmodel.SplitScreenInteractionModule import org.oppia.android.app.shim.ViewBindingShimModule @@ -101,10 +103,11 @@ import org.oppia.android.testing.time.FakeOppiaClockModule import org.oppia.android.util.accessibility.AccessibilityTestModule import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule +import org.oppia.android.util.extensions.getProto +import org.oppia.android.util.extensions.getProtoExtra import org.oppia.android.util.gcsresource.DefaultResourceBucketName import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -325,6 +328,44 @@ class PoliciesFragmentTest { } } + @Test + fun testFragmentArguments_afterCreation_areCorrect() { + launch( + createPoliciesFragmentTestIntent( + getApplicationContext(), + PolicyPage.TERMS_OF_SERVICE + ) + ).use { scenario -> + testCoroutineDispatchers.runCurrent() + scenario.onActivity { activity -> + + val policiesFragment = activity.supportFragmentManager + .findFragmentById(R.id.policies_fragment_placeholder) as PoliciesFragment + + val policiesActivityParams = activity.intent.getProtoExtra( + PoliciesFragmentTestActivity.POLICIES_FRAGMENT_TEST_POLICY_PAGE_PARAMS_PROTO, + PoliciesActivityParams.getDefaultInstance() + ) + val policiesFragmentArguments = + PoliciesFragmentArguments + .newBuilder() + .setPolicyPage(policiesActivityParams.policyPage) + .build() + + val args = checkNotNull(policiesFragment.arguments) { + "Expected arguments to be passed to PoliciesFragment" + } + val receivedPolicies = + args.getProto( + POLICIES_FRAGMENT_POLICY_PAGE_ARGUMENT_PROTO, + PoliciesFragmentArguments.getDefaultInstance() + ) + + assertThat(receivedPolicies.policyPage).isEqualTo(policiesFragmentArguments.policyPage) + } + } + } + private fun setUpTestApplicationComponent() { getApplicationContext().inject(this) } @@ -359,7 +400,7 @@ class PoliciesFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/profile/AddProfileActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/profile/AddProfileActivityTest.kt index 6e4992389cd..b9aa2114cd6 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/profile/AddProfileActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/profile/AddProfileActivityTest.kt @@ -13,6 +13,7 @@ import androidx.appcompat.app.AppCompatActivity import androidx.test.core.app.ActivityScenario.launch import androidx.test.core.app.ApplicationProvider import androidx.test.espresso.Espresso.onView +import androidx.test.espresso.action.ViewActions import androidx.test.espresso.action.ViewActions.click import androidx.test.espresso.action.ViewActions.closeSoftKeyboard import androidx.test.espresso.action.ViewActions.pressImeActionButton @@ -114,7 +115,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -1749,6 +1749,15 @@ class AddProfileActivityTest { assertThat(currentScreenName).isEqualTo(ScreenName.ADD_PROFILE_ACTIVITY) } + @Test + fun testAddProfileActivity_onBackPressed_finishActivity() { + val scenario = launch(AddProfileActivity::class.java) + onView(isRoot()).perform(ViewActions.pressBack()) + testCoroutineDispatchers.runCurrent() + scenario.onActivity { activity -> + assertThat(activity.isFinishing).isTrue() + } + } private fun createAddProfileActivityIntent(): Intent { return AddProfileActivity.createAddProfileActivityIntent( ApplicationProvider.getApplicationContext(), @@ -1795,7 +1804,7 @@ class AddProfileActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/profile/AdminAuthActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/profile/AdminAuthActivityTest.kt index 3cab12f1fd5..38e7ecd8019 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/profile/AdminAuthActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/profile/AdminAuthActivityTest.kt @@ -96,7 +96,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -692,7 +691,7 @@ class AdminAuthActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/profile/AdminPinActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/profile/AdminPinActivityTest.kt index 33fc0a1fbb6..901aee82fcf 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/profile/AdminPinActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/profile/AdminPinActivityTest.kt @@ -107,7 +107,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -1109,7 +1108,7 @@ class AdminPinActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/profile/PinPasswordActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/profile/PinPasswordActivityTest.kt index 1e678cb7cdb..198b2890f6d 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/profile/PinPasswordActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/profile/PinPasswordActivityTest.kt @@ -106,7 +106,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -1260,7 +1259,7 @@ class PinPasswordActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/profile/ProfileChooserActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/profile/ProfileChooserActivityTest.kt index cf5339feb13..c7cf8e611c5 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/profile/ProfileChooserActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/profile/ProfileChooserActivityTest.kt @@ -74,7 +74,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -163,7 +162,7 @@ class ProfileChooserActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/profile/ProfileChooserFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/profile/ProfileChooserFragmentTest.kt index 322f5e2855d..15479e71e4f 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/profile/ProfileChooserFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/profile/ProfileChooserFragmentTest.kt @@ -101,7 +101,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -590,7 +589,7 @@ class ProfileChooserFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/profileprogress/ProfilePictureActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/profileprogress/ProfilePictureActivityTest.kt index f24675389c6..833d18873fb 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/profileprogress/ProfilePictureActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/profileprogress/ProfilePictureActivityTest.kt @@ -82,7 +82,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -219,7 +218,7 @@ class ProfilePictureActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/profileprogress/ProfileProgressActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/profileprogress/ProfileProgressActivityTest.kt index 50f62020d71..2e256508a1d 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/profileprogress/ProfileProgressActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/profileprogress/ProfileProgressActivityTest.kt @@ -73,7 +73,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -169,7 +168,7 @@ class ProfileProgressActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/profileprogress/ProfileProgressFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/profileprogress/ProfileProgressFragmentTest.kt index a9015c415da..55f87e96964 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/profileprogress/ProfileProgressFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/profileprogress/ProfileProgressFragmentTest.kt @@ -124,7 +124,6 @@ import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.EnableConsoleLog import org.oppia.android.util.logging.EnableFileLog -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.GlobalLogLevel import org.oppia.android.util.logging.LogLevel import org.oppia.android.util.logging.SyncStatusModule @@ -134,6 +133,7 @@ import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule import org.oppia.android.util.parser.image.GlideImageLoaderModule import org.oppia.android.util.parser.image.ImageParsingModule +import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId import org.oppia.android.util.profile.PROFILE_ID_INTENT_DECORATOR import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode @@ -826,6 +826,27 @@ class ProfileProgressFragmentTest { } } + @Test + fun testFragmentArguments_afterCreation_areCorrect() { + launch( + createProfileProgressActivityIntent(internalProfileId) + ).use { scenario -> + testCoroutineDispatchers.runCurrent() + scenario.onActivity { activity -> + + val profileProgressFragment = activity.supportFragmentManager + .findFragmentById(R.id.profile_progress_fragment_placeholder) as ProfileProgressFragment + + val args = checkNotNull(profileProgressFragment.arguments) { + "Expected arguments to be passed to ProfileProgressFragment" + } + val receivedInternalProfileId = args.extractCurrentUserProfileId().internalId + + assertThat(receivedInternalProfileId).isEqualTo(internalProfileId) + } + } + } + private fun createGalleryPickActivityResultStub(): Instrumentation.ActivityResult { val resources: Resources = context.resources val imageUri = Uri.parse( @@ -914,7 +935,7 @@ class ProfileProgressFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/recyclerview/BindableAdapterTest.kt b/app/src/sharedTest/java/org/oppia/android/app/recyclerview/BindableAdapterTest.kt index f896d8ec490..c948b006621 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/recyclerview/BindableAdapterTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/recyclerview/BindableAdapterTest.kt @@ -109,7 +109,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -682,7 +681,7 @@ class BindableAdapterTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/resumelesson/ResumeLessonActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/resumelesson/ResumeLessonActivityTest.kt index 40aeae59dcc..6f09f3ec034 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/resumelesson/ResumeLessonActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/resumelesson/ResumeLessonActivityTest.kt @@ -96,7 +96,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -241,7 +240,7 @@ class ResumeLessonActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/resumelesson/ResumeLessonFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/resumelesson/ResumeLessonFragmentTest.kt index 33da1eeed36..bd1dc7f6eee 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/resumelesson/ResumeLessonFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/resumelesson/ResumeLessonFragmentTest.kt @@ -103,7 +103,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.extensions.getProto import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -419,7 +418,7 @@ class ResumeLessonFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileEditActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileEditActivityTest.kt index cbee7ee1069..d63a296f378 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileEditActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileEditActivityTest.kt @@ -92,7 +92,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -371,7 +370,7 @@ class ProfileEditActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileEditFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileEditFragmentTest.kt index 811072493a6..b6ae6b60b22 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileEditFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileEditFragmentTest.kt @@ -106,7 +106,6 @@ import org.oppia.android.util.extensions.getProto import org.oppia.android.util.extensions.getProtoExtra import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -538,7 +537,7 @@ class ProfileEditFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileListActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileListActivityTest.kt index 8b3628f767e..17c7f4e5530 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileListActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileListActivityTest.kt @@ -73,7 +73,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -165,7 +164,7 @@ class ProfileListActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileListFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileListFragmentTest.kt index 742c20bd0f5..3afe87752cc 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileListFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileListFragmentTest.kt @@ -91,7 +91,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.extensions.getProto import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -421,7 +420,7 @@ class ProfileListFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileRenameActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileRenameActivityTest.kt index 8f15112e9fc..0a1d886dda6 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileRenameActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileRenameActivityTest.kt @@ -77,7 +77,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -191,7 +190,7 @@ class ProfileRenameActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileRenameFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileRenameFragmentTest.kt index 1fc5d9316d3..5d23d4efe82 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileRenameFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileRenameFragmentTest.kt @@ -94,7 +94,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -494,7 +493,7 @@ class ProfileRenameFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileResetPinActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileResetPinActivityTest.kt index 544ae8034d0..b42ac9f88ac 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileResetPinActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileResetPinActivityTest.kt @@ -78,7 +78,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -200,7 +199,7 @@ class ProfileResetPinActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileResetPinFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileResetPinFragmentTest.kt index c0e1541d8a3..ebf35ec36d6 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileResetPinFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/settings/profile/ProfileResetPinFragmentTest.kt @@ -97,7 +97,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.extensions.getProto import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -1099,7 +1098,7 @@ class ProfileResetPinFragmentTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/splash/BUILD.bazel b/app/src/sharedTest/java/org/oppia/android/app/splash/BUILD.bazel index 387ee6650f4..be9324b4937 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/splash/BUILD.bazel +++ b/app/src/sharedTest/java/org/oppia/android/app/splash/BUILD.bazel @@ -44,7 +44,6 @@ app_test( "//utility/src/main/java/org/oppia/android/util/data:data_providers", "//utility/src/main/java/org/oppia/android/util/locale/testing:test_module", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_util_module", diff --git a/app/src/sharedTest/java/org/oppia/android/app/splash/SplashActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/splash/SplashActivityTest.kt index 484a9696142..0cc3ccec366 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/splash/SplashActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/splash/SplashActivityTest.kt @@ -113,7 +113,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -1226,7 +1225,7 @@ class SplashActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/spotlight/SpotlightFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/spotlight/SpotlightFragmentTest.kt index 9fb017111e3..0609053aeec 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/spotlight/SpotlightFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/spotlight/SpotlightFragmentTest.kt @@ -86,7 +86,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.DefaultResourceBucketName import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -391,7 +390,7 @@ class SpotlightFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/story/StoryActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/story/StoryActivityTest.kt index 733b0efc911..117640c66e7 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/story/StoryActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/story/StoryActivityTest.kt @@ -96,7 +96,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -267,7 +266,7 @@ class StoryActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/story/StoryFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/story/StoryFragmentTest.kt index c8013552937..e478307ae65 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/story/StoryFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/story/StoryFragmentTest.kt @@ -136,7 +136,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.extensions.getProto import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -1045,7 +1044,7 @@ class StoryFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/survey/SurveyActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/survey/SurveyActivityTest.kt index 3634f6f4a24..e2258bdc5d6 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/survey/SurveyActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/survey/SurveyActivityTest.kt @@ -79,7 +79,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -192,7 +191,7 @@ class SurveyActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/survey/SurveyFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/survey/SurveyFragmentTest.kt index 332914c0c7c..358679a2b35 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/survey/SurveyFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/survey/SurveyFragmentTest.kt @@ -106,7 +106,6 @@ import org.oppia.android.util.extensions.getProto import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -647,7 +646,7 @@ class SurveyFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/testing/DragDropTestActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/testing/DragDropTestActivityTest.kt index 9417fedeb1b..6209e6b49fe 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/testing/DragDropTestActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/testing/DragDropTestActivityTest.kt @@ -82,7 +82,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -236,7 +235,7 @@ class DragDropTestActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/testing/FractionInputInteractionViewTestActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/testing/FractionInputInteractionViewTestActivityTest.kt index 45b86216d84..ce7a4b8fd92 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/testing/FractionInputInteractionViewTestActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/testing/FractionInputInteractionViewTestActivityTest.kt @@ -84,7 +84,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -577,7 +576,7 @@ class FractionInputInteractionViewTestActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/testing/ImageRegionSelectionInteractionViewTest.kt b/app/src/sharedTest/java/org/oppia/android/app/testing/ImageRegionSelectionInteractionViewTest.kt index a754284daaa..6b558212760 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/testing/ImageRegionSelectionInteractionViewTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/testing/ImageRegionSelectionInteractionViewTest.kt @@ -101,7 +101,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -455,7 +454,7 @@ class ImageRegionSelectionInteractionViewTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/testing/InputInteractionViewTestActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/testing/InputInteractionViewTestActivityTest.kt index abbb27b7dd5..92053254ccc 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/testing/InputInteractionViewTestActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/testing/InputInteractionViewTestActivityTest.kt @@ -84,7 +84,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -451,7 +450,7 @@ class InputInteractionViewTestActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/testing/NavigationDrawerActivityDebugTest.kt b/app/src/sharedTest/java/org/oppia/android/app/testing/NavigationDrawerActivityDebugTest.kt index e367b50c81a..36e5f90594f 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/testing/NavigationDrawerActivityDebugTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/testing/NavigationDrawerActivityDebugTest.kt @@ -114,7 +114,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -457,7 +456,7 @@ class NavigationDrawerActivityDebugTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/testing/NavigationDrawerActivityProdTest.kt b/app/src/sharedTest/java/org/oppia/android/app/testing/NavigationDrawerActivityProdTest.kt index c5a79951ef5..7075675cc9a 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/testing/NavigationDrawerActivityProdTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/testing/NavigationDrawerActivityProdTest.kt @@ -123,7 +123,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -1019,7 +1018,7 @@ class NavigationDrawerActivityProdTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/testing/RatioInputInteractionViewTestActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/testing/RatioInputInteractionViewTestActivityTest.kt index f766a7a1bb0..6f3fdc02b3d 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/testing/RatioInputInteractionViewTestActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/testing/RatioInputInteractionViewTestActivityTest.kt @@ -91,7 +91,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -445,7 +444,7 @@ class RatioInputInteractionViewTestActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/testing/TestFontScaleConfigurationUtilActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/testing/TestFontScaleConfigurationUtilActivityTest.kt index 7da565cf4a4..b714c9f31ba 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/testing/TestFontScaleConfigurationUtilActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/testing/TestFontScaleConfigurationUtilActivityTest.kt @@ -77,7 +77,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -211,7 +210,7 @@ class TestFontScaleConfigurationUtilActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/testing/TextInputInteractionViewTestActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/testing/TextInputInteractionViewTestActivityTest.kt index 078853e8adf..29356e45382 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/testing/TextInputInteractionViewTestActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/testing/TextInputInteractionViewTestActivityTest.kt @@ -83,7 +83,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -244,7 +243,7 @@ class TextInputInteractionViewTestActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class ] ) diff --git a/app/src/sharedTest/java/org/oppia/android/app/testing/TopicTestActivityForStoryTest.kt b/app/src/sharedTest/java/org/oppia/android/app/testing/TopicTestActivityForStoryTest.kt index bce20a77687..3585996ccf3 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/testing/TopicTestActivityForStoryTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/testing/TopicTestActivityForStoryTest.kt @@ -83,7 +83,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -212,7 +211,7 @@ class TopicTestActivityForStoryTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseListActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseListActivityTest.kt index 6ee2c2c8425..f3ef4c05bca 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseListActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseListActivityTest.kt @@ -74,7 +74,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -178,7 +177,7 @@ class LicenseListActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseListFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseListFragmentTest.kt index 5e6a627b086..d5cc68155f1 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseListFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseListFragmentTest.kt @@ -93,7 +93,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.extensions.getProto import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -408,7 +407,7 @@ class LicenseListFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseTextViewerActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseTextViewerActivityTest.kt index 8c447854ba7..9733daf8297 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseTextViewerActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseTextViewerActivityTest.kt @@ -83,7 +83,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -282,7 +281,7 @@ class LicenseTextViewerActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseTextViewerFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseTextViewerFragmentTest.kt index b397bcd214b..e003859baf0 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseTextViewerFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/thirdparty/LicenseTextViewerFragmentTest.kt @@ -12,6 +12,7 @@ import androidx.test.espresso.matcher.ViewMatchers.isRoot import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.ext.junit.runners.AndroidJUnit4 +import com.google.common.truth.Truth.assertThat import dagger.Component import org.junit.After import org.junit.Before @@ -31,6 +32,8 @@ import org.oppia.android.app.application.testing.TestingBuildFlavorModule import org.oppia.android.app.devoptions.DeveloperOptionsModule import org.oppia.android.app.devoptions.DeveloperOptionsStarterModule import org.oppia.android.app.help.thirdparty.LicenseTextViewerActivity +import org.oppia.android.app.help.thirdparty.LicenseTextViewerFragment +import org.oppia.android.app.model.LicenseTextViewerFragmentArguments import org.oppia.android.app.player.state.itemviewmodel.SplitScreenInteractionModule import org.oppia.android.app.shim.ViewBindingShimModule import org.oppia.android.app.translation.testing.ActivityRecreatorTestModule @@ -77,9 +80,9 @@ import org.oppia.android.testing.time.FakeOppiaClockModule import org.oppia.android.util.accessibility.AccessibilityTestModule import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule +import org.oppia.android.util.extensions.getProto import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -317,6 +320,36 @@ class LicenseTextViewerFragmentTest { } } + @Test + fun testFragmentArguments_afterCreation_areCorrect() { + launch( + createLicenseTextViewerActivity( + dependencyIndex = 3, + licenseIndex = 1 + ) + ).use { scenario -> + testCoroutineDispatchers.runCurrent() + scenario.onActivity { activity -> + + val licenseTextViewerFragment = activity.supportFragmentManager + .findFragmentById(R.id.license_text_viewer_fragment_placeholder) + as LicenseTextViewerFragment + val arguments = checkNotNull(licenseTextViewerFragment.arguments) { + "Expected arguments to be passed to LicenseTextViewerFragment" + } + val args = arguments.getProto( + LicenseTextViewerFragment.LICENSE_TEXT_VIEWER_FRAGMENT_ARGUMENTS_KEY, + LicenseTextViewerFragmentArguments.getDefaultInstance() + ) + val receivedDependencyIndex = args.dependencyIndex + val receivedLicenseIndex = args.licenseIndex + + assertThat(receivedDependencyIndex).isEqualTo(3) + assertThat(receivedLicenseIndex).isEqualTo(1) + } + } + } + private fun createLicenseTextViewerActivity(dependencyIndex: Int, licenseIndex: Int): Intent { return LicenseTextViewerActivity.createLicenseTextViewerActivityIntent( ApplicationProvider.getApplicationContext(), @@ -356,7 +389,7 @@ class LicenseTextViewerFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/thirdparty/ThirdPartyDependencyListActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/thirdparty/ThirdPartyDependencyListActivityTest.kt index 70d49bf0af0..95e617c29a8 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/thirdparty/ThirdPartyDependencyListActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/thirdparty/ThirdPartyDependencyListActivityTest.kt @@ -74,7 +74,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -175,7 +174,7 @@ class ThirdPartyDependencyListActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/thirdparty/ThirdPartyDependencyListFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/thirdparty/ThirdPartyDependencyListFragmentTest.kt index 08c49683c59..cd7e57c7a8a 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/thirdparty/ThirdPartyDependencyListFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/thirdparty/ThirdPartyDependencyListFragmentTest.kt @@ -92,7 +92,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.extensions.getProto import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -516,7 +515,7 @@ class ThirdPartyDependencyListFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/topic/TopicActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/topic/TopicActivityTest.kt index debec65d207..fd3abbeb87c 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/topic/TopicActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/topic/TopicActivityTest.kt @@ -97,7 +97,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -257,7 +256,7 @@ class TopicActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/topic/TopicFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/topic/TopicFragmentTest.kt index dc00a9ca748..e7ae27305ff 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/topic/TopicFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/topic/TopicFragmentTest.kt @@ -111,7 +111,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -1070,7 +1069,7 @@ class TopicFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/topic/conceptcard/ConceptCardFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/topic/conceptcard/ConceptCardFragmentTest.kt index ac21622d80e..1c6dc654f0b 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/topic/conceptcard/ConceptCardFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/topic/conceptcard/ConceptCardFragmentTest.kt @@ -120,7 +120,6 @@ import org.oppia.android.util.caching.LoadLessonProtosFromAssets import org.oppia.android.util.extensions.getProto import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -621,7 +620,7 @@ class ConceptCardFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/topic/info/TopicInfoFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/topic/info/TopicInfoFragmentTest.kt index cabd5945931..0c9a7360ce7 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/topic/info/TopicInfoFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/topic/info/TopicInfoFragmentTest.kt @@ -23,11 +23,13 @@ import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.rule.ActivityTestRule +import androidx.viewpager2.widget.ViewPager2 import com.google.common.truth.Truth.assertThat import dagger.Component import org.hamcrest.CoreMatchers import org.hamcrest.Description import org.hamcrest.Matcher +import org.hamcrest.Matchers.allOf import org.hamcrest.Matchers.containsString import org.hamcrest.TypeSafeMatcher import org.junit.After @@ -47,10 +49,13 @@ import org.oppia.android.app.application.ApplicationStartupListenerModule import org.oppia.android.app.application.testing.TestingBuildFlavorModule import org.oppia.android.app.devoptions.DeveloperOptionsModule import org.oppia.android.app.devoptions.DeveloperOptionsStarterModule +import org.oppia.android.app.model.TopicInfoFragmentArguments import org.oppia.android.app.player.state.itemviewmodel.SplitScreenInteractionModule import org.oppia.android.app.shim.ViewBindingShimModule import org.oppia.android.app.topic.TopicActivity import org.oppia.android.app.topic.TopicActivity.Companion.createTopicActivityIntent +import org.oppia.android.app.topic.TopicFragment +import org.oppia.android.app.topic.TopicTab import org.oppia.android.app.translation.testing.ActivityRecreatorTestModule import org.oppia.android.app.utility.EspressoTestsMatchers.withDrawable import org.oppia.android.app.utility.OrientationChangeAction.Companion.orientationLandscape @@ -101,9 +106,9 @@ import org.oppia.android.testing.time.FakeOppiaClockModule import org.oppia.android.util.accessibility.AccessibilityTestModule import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule +import org.oppia.android.util.extensions.getProto import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -111,6 +116,9 @@ import org.oppia.android.util.networking.NetworkConnectionDebugUtilModule import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule import org.oppia.android.util.parser.image.ImageParsingModule +import org.oppia.android.util.platformparameter.EnableExtraTopicTabsUi +import org.oppia.android.util.platformparameter.PlatformParameterValue +import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject @@ -154,6 +162,9 @@ class TopicInfoFragmentTest { @Inject lateinit var testCoroutineDispatchers: TestCoroutineDispatchers + @field:[Inject EnableExtraTopicTabsUi] + lateinit var enableExtraTopicTabsUi: PlatformParameterValue + @get:Rule var activityTestRule: ActivityTestRule = ActivityTestRule( TopicActivity::class.java, /* initialTouchMode= */ true, /* launchActivity= */ false @@ -454,6 +465,55 @@ class TopicInfoFragmentTest { return ActivityScenario.launch(intent) } + @Test + fun testFragmentArguments_afterCreation_areCorrect() { + launchTopicActivityIntent( + internalProfileId = internalProfileId, + classroomId = TEST_CLASSROOM_ID, + topicId = TEST_TOPIC_ID + ).use { scenario -> + clickInfoTab() + testCoroutineDispatchers.runCurrent() + scenario.onActivity { activity -> + + val topicFragment = activity.supportFragmentManager + .findFragmentById(R.id.topic_fragment_placeholder) as TopicFragment + val viewPager = topicFragment.requireView() + .findViewById(R.id.topic_tabs_viewpager) + val topicInfoFragment = topicFragment.childFragmentManager + .findFragmentByTag("f${viewPager.currentItem}") as TopicInfoFragment + + val args = topicInfoFragment.arguments?.getProto( + TopicInfoFragment.TOPIC_INFO_FRAGMENT_ARGUMENTS_KEY, + TopicInfoFragmentArguments.getDefaultInstance() + ) + val receivedInternalProfileId = topicInfoFragment + .arguments?.extractCurrentUserProfileId()?.internalId ?: -1 + val receivedTopicId = checkNotNull(args?.topicId) { + "Expected topic ID to be included in arguments for TopicInfoFragment." + } + + assertThat(receivedInternalProfileId).isEqualTo(internalProfileId) + assertThat(receivedTopicId).isEqualTo(TEST_TOPIC_ID) + } + } + } + + private fun clickInfoTab() { + onView( + allOf( + withText( + TopicTab.getTabForPosition( + position = 0, + enableExtraTopicTabsUi = enableExtraTopicTabsUi.value + ).name + ), + ViewMatchers.isDescendantOfA(withId(R.id.topic_tabs_container)) + ) + ).perform(click()) + testCoroutineDispatchers.runCurrent() + } + /** Custom function to set dummy text in the TextView. */ private fun setTextInTextView(value: String): ViewAction { return object : ViewAction { @@ -515,7 +575,7 @@ class TopicInfoFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/topic/lessons/TopicLessonsFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/topic/lessons/TopicLessonsFragmentTest.kt index 075b49e8ac0..9e5bd19027a 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/topic/lessons/TopicLessonsFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/topic/lessons/TopicLessonsFragmentTest.kt @@ -26,6 +26,8 @@ import androidx.test.espresso.matcher.ViewMatchers.withContentDescription import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.viewpager2.widget.ViewPager2 +import com.google.common.truth.Truth.assertThat import dagger.Component import org.hamcrest.Matchers.allOf import org.hamcrest.Matchers.containsString @@ -55,6 +57,7 @@ import org.oppia.android.app.model.Spotlight.FeatureCase.FIRST_CHAPTER import org.oppia.android.app.model.Spotlight.FeatureCase.TOPIC_LESSON_TAB import org.oppia.android.app.model.Spotlight.FeatureCase.TOPIC_REVISION_TAB import org.oppia.android.app.model.StoryActivityParams +import org.oppia.android.app.model.TopicLessonsFragmentArguments import org.oppia.android.app.player.exploration.ExplorationActivity import org.oppia.android.app.player.state.itemviewmodel.SplitScreenInteractionModule import org.oppia.android.app.recyclerview.RecyclerViewMatcher.Companion.atPosition @@ -64,6 +67,7 @@ import org.oppia.android.app.shim.ViewBindingShimModule import org.oppia.android.app.story.StoryActivity import org.oppia.android.app.story.StoryActivity.Companion.STORY_ACTIVITY_PARAMS_KEY import org.oppia.android.app.topic.TopicActivity +import org.oppia.android.app.topic.TopicFragment import org.oppia.android.app.topic.TopicTab import org.oppia.android.app.translation.testing.ActivityRecreatorTestModule import org.oppia.android.app.utility.EspressoTestsMatchers.hasProtoExtra @@ -124,9 +128,9 @@ import org.oppia.android.util.accessibility.AccessibilityTestModule import org.oppia.android.util.accessibility.FakeAccessibilityService import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule +import org.oppia.android.util.extensions.getProto import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -137,6 +141,7 @@ import org.oppia.android.util.parser.image.GlideImageLoaderModule import org.oppia.android.util.parser.image.ImageParsingModule import org.oppia.android.util.platformparameter.EnableExtraTopicTabsUi import org.oppia.android.util.platformparameter.PlatformParameterValue +import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject @@ -1205,6 +1210,78 @@ class TopicLessonsFragmentTest { } } + @Test + fun testFragmentArguments_afterCreation_areCorrect() { + launch( + createTopicPlayStoryActivityIntent( + internalProfileId, + TEST_CLASSROOM_ID_1, + RATIOS_TOPIC_ID, + RATIOS_STORY_ID_0 + ) + ).use { scenario -> + clickLessonTab() + testCoroutineDispatchers.runCurrent() + scenario.onActivity { activity -> + + val topicFragment = activity.supportFragmentManager + .findFragmentById(R.id.topic_fragment_placeholder) as TopicFragment + val viewPager = topicFragment.requireView() + .findViewById(R.id.topic_tabs_viewpager) + val topicLessonsFragment = topicFragment.childFragmentManager + .findFragmentByTag("f${viewPager.currentItem}") as TopicLessonsFragment + + val receivedInternalProfileId = topicLessonsFragment + .arguments?.extractCurrentUserProfileId()?.internalId ?: -1 + val args = topicLessonsFragment.arguments?.getProto( + TopicLessonsFragment.TOPIC_LESSONS_FRAGMENT_ARGUMENTS_KEY, + TopicLessonsFragmentArguments.getDefaultInstance() + ) + val receivedClassroomId = checkNotNull(args?.classroomId) { + "Expected classroom ID to be included in arguments for TopicLessonsFragment." + } + val receivedTopicId = checkNotNull(args?.topicId) { + "Expected topic ID to be included in arguments for TopicLessonsFragment." + } + val receivedStoryId = args?.storyId ?: "" + + assertThat(receivedInternalProfileId).isEqualTo(internalProfileId) + assertThat(receivedClassroomId).isEqualTo(TEST_CLASSROOM_ID_1) + assertThat(receivedTopicId).isEqualTo(RATIOS_TOPIC_ID) + assertThat(receivedStoryId).isEqualTo(RATIOS_STORY_ID_0) + } + } + } + + @Test + fun testTopicLessonsFragment_saveInstanceState_verifyCorrectStateRestored() { + launch( + createTopicPlayStoryActivityIntent( + internalProfileId, + TEST_CLASSROOM_ID_1, + RATIOS_TOPIC_ID, + RATIOS_STORY_ID_0 + ) + ).use { scenario -> + clickLessonTab() + testCoroutineDispatchers.runCurrent() + + scrollToPosition(position = 2) + clickStoryItem(position = 2, targetViewId = R.id.chapter_list_drop_down_icon) + + scenario.recreate() + + scrollToPosition(position = 2) + onView( + atPositionOnView( + recyclerViewId = R.id.story_summary_recycler_view, + position = 2, + targetViewId = R.id.chapter_recycler_view + ) + ).check(matches(isDisplayed())) + } + } + private fun markAllSpotlightsSeen() { spotlightStateController.markSpotlightViewed(profileId, TOPIC_LESSON_TAB) testCoroutineDispatchers.runCurrent() @@ -1359,7 +1436,7 @@ class TopicLessonsFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/topic/practice/TopicPracticeFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/topic/practice/TopicPracticeFragmentTest.kt index fd5c8f4117f..66e28ced35b 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/topic/practice/TopicPracticeFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/topic/practice/TopicPracticeFragmentTest.kt @@ -20,6 +20,8 @@ import androidx.test.espresso.matcher.ViewMatchers.isRoot import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.viewpager2.widget.ViewPager2 +import com.google.common.truth.Truth.assertThat import dagger.Component import org.hamcrest.Matchers.allOf import org.hamcrest.Matchers.not @@ -45,10 +47,12 @@ import org.oppia.android.app.model.QuestionPlayerActivityParams import org.oppia.android.app.model.Spotlight.FeatureCase.FIRST_CHAPTER import org.oppia.android.app.model.Spotlight.FeatureCase.TOPIC_LESSON_TAB import org.oppia.android.app.model.Spotlight.FeatureCase.TOPIC_REVISION_TAB +import org.oppia.android.app.model.TopicPracticeFragmentArguments import org.oppia.android.app.player.state.itemviewmodel.SplitScreenInteractionModule import org.oppia.android.app.recyclerview.RecyclerViewMatcher.Companion.atPositionOnView import org.oppia.android.app.shim.ViewBindingShimModule import org.oppia.android.app.topic.TopicActivity +import org.oppia.android.app.topic.TopicFragment import org.oppia.android.app.topic.TopicTab import org.oppia.android.app.topic.questionplayer.QuestionPlayerActivity import org.oppia.android.app.topic.questionplayer.QuestionPlayerActivity.Companion.QUESTION_PLAYER_ACTIVITY_PARAMS_KEY @@ -100,9 +104,9 @@ import org.oppia.android.testing.time.FakeOppiaClockModule import org.oppia.android.util.accessibility.AccessibilityTestModule import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule +import org.oppia.android.util.extensions.getProto import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -113,6 +117,7 @@ import org.oppia.android.util.parser.image.GlideImageLoaderModule import org.oppia.android.util.parser.image.ImageParsingModule import org.oppia.android.util.platformparameter.EnableExtraTopicTabsUi import org.oppia.android.util.platformparameter.PlatformParameterValue +import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject @@ -383,6 +388,72 @@ class TopicPracticeFragmentTest { } } + @Test + fun testFragmentArguments_afterCreation_areCorrect() { + launchTopicActivityIntent( + internalProfileId = internalProfileId, + classroomId = TEST_CLASSROOM_ID_1, + topicId = FRACTIONS_TOPIC_ID + ).use { scenario -> + clickPracticeTab() + testCoroutineDispatchers.runCurrent() + scenario.onActivity { activity -> + + val topicFragment = activity.supportFragmentManager + .findFragmentById(R.id.topic_fragment_placeholder) as TopicFragment + val viewPager = topicFragment.requireView() + .findViewById(R.id.topic_tabs_viewpager) + val topicPracticeFragment = topicFragment.childFragmentManager + .findFragmentByTag("f${viewPager.currentItem}") as TopicPracticeFragment + + val args = topicPracticeFragment.arguments?.getProto( + TopicPracticeFragment.TOPIC_PRACTICE_FRAGMENT_ARGUMENTS_KEY, + TopicPracticeFragmentArguments.getDefaultInstance() + ) + val receivedInternalProfileId = topicPracticeFragment + .arguments?.extractCurrentUserProfileId()?.internalId ?: -1 + val receivedTopicId = checkNotNull(args?.topicId) { + "Expected topic ID to be included in arguments for TopicPracticeFragment." + } + + assertThat(receivedInternalProfileId).isEqualTo(internalProfileId) + assertThat(receivedTopicId).isEqualTo(FRACTIONS_TOPIC_ID) + } + } + } + + @Test + fun testTopicPracticeFragment_saveInstanceState_verifyCorrectStateRestored() { + launchTopicActivityIntent( + internalProfileId = internalProfileId, + classroomId = TEST_CLASSROOM_ID_1, + topicId = FRACTIONS_TOPIC_ID + ).use { scenario -> + clickPracticeTab() + testCoroutineDispatchers.runCurrent() + + clickPracticeItem(position = 1, targetViewId = R.id.subtopic_check_box) + clickPracticeItem(position = 2, targetViewId = R.id.subtopic_check_box) + + scenario.recreate() + + onView( + atPositionOnView( + recyclerViewId = R.id.topic_practice_skill_list, + position = 1, + targetViewId = R.id.subtopic_check_box + ) + ).check(matches(isChecked())) + onView( + atPositionOnView( + recyclerViewId = R.id.topic_practice_skill_list, + position = 2, + targetViewId = R.id.subtopic_check_box + ) + ).check(matches(isChecked())) + } + } + private fun launchTopicActivityIntent( internalProfileId: Int, classroomId: String, @@ -466,7 +537,7 @@ class TopicPracticeFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivityTest.kt index e612dacc954..29cfd79e184 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivityTest.kt @@ -145,7 +145,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -880,7 +879,7 @@ class QuestionPlayerActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/topic/revision/TopicRevisionFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/topic/revision/TopicRevisionFragmentTest.kt index dec1050be90..85d1523cad3 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/topic/revision/TopicRevisionFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/topic/revision/TopicRevisionFragmentTest.kt @@ -22,6 +22,8 @@ import androidx.test.espresso.matcher.ViewMatchers.isRoot import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.viewpager2.widget.ViewPager2 +import com.google.common.truth.Truth.assertThat import dagger.Component import org.hamcrest.Matchers.allOf import org.junit.After @@ -45,11 +47,13 @@ import org.oppia.android.app.model.ProfileId import org.oppia.android.app.model.Spotlight.FeatureCase.FIRST_CHAPTER import org.oppia.android.app.model.Spotlight.FeatureCase.TOPIC_LESSON_TAB import org.oppia.android.app.model.Spotlight.FeatureCase.TOPIC_REVISION_TAB +import org.oppia.android.app.model.TopicRevisionFragmentArguments import org.oppia.android.app.player.state.itemviewmodel.SplitScreenInteractionModule import org.oppia.android.app.recyclerview.RecyclerViewMatcher.Companion.atPosition import org.oppia.android.app.recyclerview.RecyclerViewMatcher.Companion.atPositionOnView import org.oppia.android.app.shim.ViewBindingShimModule import org.oppia.android.app.topic.TopicActivity +import org.oppia.android.app.topic.TopicFragment import org.oppia.android.app.topic.TopicTab import org.oppia.android.app.topic.revisioncard.RevisionCardActivity import org.oppia.android.app.translation.testing.ActivityRecreatorTestModule @@ -102,9 +106,9 @@ import org.oppia.android.testing.time.FakeOppiaClockModule import org.oppia.android.util.accessibility.AccessibilityTestModule import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule +import org.oppia.android.util.extensions.getProto import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -114,6 +118,7 @@ import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule import org.oppia.android.util.parser.image.ImageParsingModule import org.oppia.android.util.platformparameter.EnableExtraTopicTabsUi import org.oppia.android.util.platformparameter.PlatformParameterValue +import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.extractCurrentUserProfileId import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode import javax.inject.Inject @@ -286,6 +291,37 @@ class TopicRevisionFragmentTest { } } + @Test + fun testFragmentArguments_afterCreation_areCorrect() { + launchTopicActivityIntent( + internalProfileId = internalProfileId, + classroomId = TEST_CLASSROOM_ID_1, + topicId = FRACTIONS_TOPIC_ID + ).use { scenario -> + clickRevisionTab() + testCoroutineDispatchers.runCurrent() + scenario.onActivity { activity -> + + val topicFragment = activity.supportFragmentManager + .findFragmentById(R.id.topic_fragment_placeholder) as TopicFragment + val viewPager = topicFragment.requireView() + .findViewById(R.id.topic_tabs_viewpager) + val topicRevisionFragment = topicFragment.childFragmentManager + .findFragmentByTag("f${viewPager.currentItem}") as TopicRevisionFragment + + val receivedInternalProfileId = topicRevisionFragment + .arguments?.extractCurrentUserProfileId()?.internalId ?: -1 + val args = topicRevisionFragment.arguments?.getProto( + TopicRevisionFragment.TOPIC_REVISION_FRAGMENT_ARGUMENTS_KEY, + TopicRevisionFragmentArguments.getDefaultInstance() + ) + + assertThat(receivedInternalProfileId).isEqualTo(internalProfileId) + assertThat(args?.topicId).isEqualTo(FRACTIONS_TOPIC_ID) + } + } + } + private fun markAllSpotlightsSeen() { val profileId = ProfileId.newBuilder().setInternalId(internalProfileId).build() spotlightStateController.markSpotlightViewed(profileId, TOPIC_LESSON_TAB) @@ -374,7 +410,7 @@ class TopicRevisionFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/topic/revisioncard/RevisionCardActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/topic/revisioncard/RevisionCardActivityTest.kt index c73b3c86579..15e47cbb2f2 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/topic/revisioncard/RevisionCardActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/topic/revisioncard/RevisionCardActivityTest.kt @@ -98,7 +98,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -480,7 +479,7 @@ class RevisionCardActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/topic/revisioncard/RevisionCardFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/topic/revisioncard/RevisionCardFragmentTest.kt index 8be20c6dc55..6e3e3a6729e 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/topic/revisioncard/RevisionCardFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/topic/revisioncard/RevisionCardFragmentTest.kt @@ -127,7 +127,6 @@ import org.oppia.android.util.caching.LoadLessonProtosFromAssets import org.oppia.android.util.extensions.getProto import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -943,7 +942,7 @@ class RevisionCardFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/utility/RatioExtensionsTest.kt b/app/src/sharedTest/java/org/oppia/android/app/utility/RatioExtensionsTest.kt index 7db790a6b1e..9e96546527f 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/utility/RatioExtensionsTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/utility/RatioExtensionsTest.kt @@ -70,7 +70,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -164,7 +163,7 @@ class RatioExtensionsTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughActivityTest.kt b/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughActivityTest.kt index 4f59324ee1f..5939e42ae93 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughActivityTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughActivityTest.kt @@ -85,7 +85,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.CurrentAppScreenNameIntentDecorator.extractCurrentAppScreenName -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -253,7 +252,7 @@ class WalkthroughActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughFinalFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughFinalFragmentTest.kt index 3bd1620da59..97a3dcbf506 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughFinalFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughFinalFragmentTest.kt @@ -18,6 +18,7 @@ import androidx.test.espresso.matcher.ViewMatchers.isRoot import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.ext.junit.runners.AndroidJUnit4 +import com.google.common.truth.Truth.assertThat import dagger.Component import org.hamcrest.CoreMatchers.containsString import org.junit.After @@ -37,12 +38,14 @@ import org.oppia.android.app.application.ApplicationStartupListenerModule import org.oppia.android.app.application.testing.TestingBuildFlavorModule import org.oppia.android.app.devoptions.DeveloperOptionsModule import org.oppia.android.app.devoptions.DeveloperOptionsStarterModule +import org.oppia.android.app.model.WalkthroughFinalFragmentArguments import org.oppia.android.app.player.state.itemviewmodel.SplitScreenInteractionModule import org.oppia.android.app.recyclerview.RecyclerViewMatcher.Companion.atPositionOnView import org.oppia.android.app.shim.ViewBindingShimModule import org.oppia.android.app.translation.testing.ActivityRecreatorTestModule import org.oppia.android.app.utility.OrientationChangeAction.Companion.orientationLandscape import org.oppia.android.app.utility.ProgressMatcher.Companion.withProgress +import org.oppia.android.app.walkthrough.end.WalkthroughFinalFragment import org.oppia.android.data.backends.gae.NetworkConfigProdModule import org.oppia.android.data.backends.gae.NetworkModule import org.oppia.android.domain.classify.InteractionsModule @@ -73,6 +76,7 @@ import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule import org.oppia.android.domain.question.QuestionModule +import org.oppia.android.domain.topic.FRACTIONS_TOPIC_ID import org.oppia.android.domain.workmanager.WorkManagerConfigurationModule import org.oppia.android.testing.OppiaTestRule import org.oppia.android.testing.TestLogReportingModule @@ -85,9 +89,9 @@ import org.oppia.android.testing.time.FakeOppiaClockModule import org.oppia.android.util.accessibility.AccessibilityTestModule import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule +import org.oppia.android.util.extensions.getProto import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -268,6 +272,33 @@ class WalkthroughFinalFragmentTest { } } + @Test + fun testFragmentArguments_afterCreation_areCorrect() { + launch(createWalkthroughActivityIntent(0)).use { scenario -> + testCoroutineDispatchers.runCurrent() + scenario.onActivity { activity -> + activity.pageWithTopicId(WalkthroughPages.FINAL.value, FRACTIONS_TOPIC_ID) + + val walkthroughFinalFragment = activity.supportFragmentManager + .findFragmentById(R.id.walkthrough_fragment_placeholder) as WalkthroughFinalFragment + + val arguments = + checkNotNull(walkthroughFinalFragment.arguments) { + "Expected arguments to be passed to WalkthroughFinalFragment" + } + val args = arguments.getProto( + WalkthroughFinalFragment.WALKTHROUGH_FINAL_FRAGMENT_ARGUMENTS_KEY, + WalkthroughFinalFragmentArguments.getDefaultInstance() + ) + val receivedTopicId = checkNotNull(args.topicId) { + "Expected topicId to be passed to WalkthroughFinalFragment" + } + + assertThat(receivedTopicId).isEqualTo(FRACTIONS_TOPIC_ID) + } + } + } + private fun setUpTestApplicationComponent() { ApplicationProvider.getApplicationContext().inject(this) } @@ -299,7 +330,7 @@ class WalkthroughFinalFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughTopicListFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughTopicListFragmentTest.kt index 831fb16faee..7bf8581cafe 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughTopicListFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughTopicListFragmentTest.kt @@ -92,7 +92,6 @@ import org.oppia.android.util.caching.LoadImagesFromAssets import org.oppia.android.util.caching.LoadLessonProtosFromAssets import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -315,7 +314,7 @@ class WalkthroughTopicListFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughWelcomeFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughWelcomeFragmentTest.kt index 34437e03bc7..97974f3a2d6 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughWelcomeFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/walkthrough/WalkthroughWelcomeFragmentTest.kt @@ -84,7 +84,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -222,7 +221,7 @@ class WalkthroughWelcomeFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/activity/ActivityIntentFactoriesTest.kt b/app/src/test/java/org/oppia/android/app/activity/ActivityIntentFactoriesTest.kt index 4a75e8d367a..554cbeff236 100644 --- a/app/src/test/java/org/oppia/android/app/activity/ActivityIntentFactoriesTest.kt +++ b/app/src/test/java/org/oppia/android/app/activity/ActivityIntentFactoriesTest.kt @@ -76,7 +76,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.extensions.getProtoExtra import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -206,7 +205,7 @@ class ActivityIntentFactoriesTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/activity/BUILD.bazel b/app/src/test/java/org/oppia/android/app/activity/BUILD.bazel index 48fed80cf67..9c2f2586933 100644 --- a/app/src/test/java/org/oppia/android/app/activity/BUILD.bazel +++ b/app/src/test/java/org/oppia/android/app/activity/BUILD.bazel @@ -37,7 +37,6 @@ oppia_android_test( "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", "//utility/src/main/java/org/oppia/android/util/data:data_providers", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", ], diff --git a/app/src/test/java/org/oppia/android/app/activity/route/ActivityRouterModuleTest.kt b/app/src/test/java/org/oppia/android/app/activity/route/ActivityRouterModuleTest.kt index b3caf939c6d..3aa92beb124 100644 --- a/app/src/test/java/org/oppia/android/app/activity/route/ActivityRouterModuleTest.kt +++ b/app/src/test/java/org/oppia/android/app/activity/route/ActivityRouterModuleTest.kt @@ -74,7 +74,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -160,7 +159,7 @@ class ActivityRouterModuleTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/activity/route/ActivityRouterTest.kt b/app/src/test/java/org/oppia/android/app/activity/route/ActivityRouterTest.kt index e493e5a6120..d1f06461035 100644 --- a/app/src/test/java/org/oppia/android/app/activity/route/ActivityRouterTest.kt +++ b/app/src/test/java/org/oppia/android/app/activity/route/ActivityRouterTest.kt @@ -80,7 +80,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -191,7 +190,7 @@ class ActivityRouterTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/activity/route/BUILD.bazel b/app/src/test/java/org/oppia/android/app/activity/route/BUILD.bazel index 250d3e8bf15..e44430238fc 100644 --- a/app/src/test/java/org/oppia/android/app/activity/route/BUILD.bazel +++ b/app/src/test/java/org/oppia/android/app/activity/route/BUILD.bazel @@ -41,7 +41,6 @@ oppia_android_test( "//utility/src/main/java/org/oppia/android/util/data:data_providers", "//utility/src/main/java/org/oppia/android/util/extensions:bundle_extensions", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", ], @@ -81,7 +80,6 @@ oppia_android_test( "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", "//utility/src/main/java/org/oppia/android/util/data:data_providers", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", ], diff --git a/app/src/test/java/org/oppia/android/app/home/HomeActivityLocalTest.kt b/app/src/test/java/org/oppia/android/app/home/HomeActivityLocalTest.kt index 3f69bfff0d6..9930513107a 100644 --- a/app/src/test/java/org/oppia/android/app/home/HomeActivityLocalTest.kt +++ b/app/src/test/java/org/oppia/android/app/home/HomeActivityLocalTest.kt @@ -27,7 +27,6 @@ import org.oppia.android.app.application.testing.TestingBuildFlavorModule import org.oppia.android.app.devoptions.DeveloperOptionsModule import org.oppia.android.app.devoptions.DeveloperOptionsStarterModule import org.oppia.android.app.model.EventLog -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.COMPLETE_APP_ONBOARDING import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.OPEN_HOME import org.oppia.android.app.model.ProfileId import org.oppia.android.app.player.state.itemviewmodel.SplitScreenInteractionModule @@ -80,7 +79,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -141,18 +139,6 @@ class HomeActivityLocalTest { } } - @Test - fun testHomeActivity_onFirstLaunch_logsCompletedOnboardingEvent() { - setUpTestApplicationComponent() - launch(createHomeActivityIntent(profileId)).use { - testCoroutineDispatchers.runCurrent() - val event = fakeAnalyticsEventLogger.getMostRecentEvent() - - assertThat(event.priority).isEqualTo(EventLog.Priority.OPTIONAL) - assertThat(event.context.activityContextCase).isEqualTo(COMPLETE_APP_ONBOARDING) - } - } - @Test fun testHomeActivity_onSubsequentLaunch_doesNotLogCompletedOnboardingEvent() { executeInPreviousAppInstance { testComponent -> @@ -228,7 +214,7 @@ class HomeActivityLocalTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/parser/FractionParsingUiErrorTest.kt b/app/src/test/java/org/oppia/android/app/parser/FractionParsingUiErrorTest.kt index 6a308f4ae91..df806df9225 100644 --- a/app/src/test/java/org/oppia/android/app/parser/FractionParsingUiErrorTest.kt +++ b/app/src/test/java/org/oppia/android/app/parser/FractionParsingUiErrorTest.kt @@ -68,7 +68,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -269,7 +268,7 @@ class FractionParsingUiErrorTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/parser/ListItemLeadingMarginSpanTest.kt b/app/src/test/java/org/oppia/android/app/parser/ListItemLeadingMarginSpanTest.kt index d007c30d687..e97850dc3a3 100644 --- a/app/src/test/java/org/oppia/android/app/parser/ListItemLeadingMarginSpanTest.kt +++ b/app/src/test/java/org/oppia/android/app/parser/ListItemLeadingMarginSpanTest.kt @@ -103,7 +103,6 @@ import org.oppia.android.util.locale.DisplayLocaleImpl import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.locale.OppiaBidiFormatter import org.oppia.android.util.locale.OppiaLocale -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -1078,7 +1077,7 @@ class ListItemLeadingMarginSpanTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/parser/StringToRatioParserTest.kt b/app/src/test/java/org/oppia/android/app/parser/StringToRatioParserTest.kt index e82fc1249e9..dbdffdca5db 100644 --- a/app/src/test/java/org/oppia/android/app/parser/StringToRatioParserTest.kt +++ b/app/src/test/java/org/oppia/android/app/parser/StringToRatioParserTest.kt @@ -70,7 +70,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -273,7 +272,7 @@ class StringToRatioParserTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/player/exploration/ExplorationActivityLocalTest.kt b/app/src/test/java/org/oppia/android/app/player/exploration/ExplorationActivityLocalTest.kt index c62ba27d2a0..b5059c0892e 100644 --- a/app/src/test/java/org/oppia/android/app/player/exploration/ExplorationActivityLocalTest.kt +++ b/app/src/test/java/org/oppia/android/app/player/exploration/ExplorationActivityLocalTest.kt @@ -94,7 +94,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -428,7 +427,7 @@ class ExplorationActivityLocalTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/player/state/StateFragmentLocalTest.kt b/app/src/test/java/org/oppia/android/app/player/state/StateFragmentLocalTest.kt index b40a46e7ce4..4af5ec06d22 100644 --- a/app/src/test/java/org/oppia/android/app/player/state/StateFragmentLocalTest.kt +++ b/app/src/test/java/org/oppia/android/app/player/state/StateFragmentLocalTest.kt @@ -162,7 +162,6 @@ import org.oppia.android.util.caching.LoadImagesFromAssets import org.oppia.android.util.caching.LoadLessonProtosFromAssets import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -2935,7 +2934,7 @@ class StateFragmentLocalTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/profile/ProfileChooserFragmentLocalTest.kt b/app/src/test/java/org/oppia/android/app/profile/ProfileChooserFragmentLocalTest.kt index 0295ea4eb15..128361f5d7b 100644 --- a/app/src/test/java/org/oppia/android/app/profile/ProfileChooserFragmentLocalTest.kt +++ b/app/src/test/java/org/oppia/android/app/profile/ProfileChooserFragmentLocalTest.kt @@ -72,7 +72,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -149,7 +148,7 @@ class ProfileChooserFragmentLocalTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/story/StoryActivityLocalTest.kt b/app/src/test/java/org/oppia/android/app/story/StoryActivityLocalTest.kt index 8cee1756370..b973bf5ef81 100644 --- a/app/src/test/java/org/oppia/android/app/story/StoryActivityLocalTest.kt +++ b/app/src/test/java/org/oppia/android/app/story/StoryActivityLocalTest.kt @@ -74,7 +74,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -177,7 +176,7 @@ class StoryActivityLocalTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/testing/CompletedStoryListSpanTest.kt b/app/src/test/java/org/oppia/android/app/testing/CompletedStoryListSpanTest.kt index e18e33c8df8..ea6b365c212 100644 --- a/app/src/test/java/org/oppia/android/app/testing/CompletedStoryListSpanTest.kt +++ b/app/src/test/java/org/oppia/android/app/testing/CompletedStoryListSpanTest.kt @@ -74,7 +74,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -182,7 +181,7 @@ class CompletedStoryListSpanTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/testing/HomeSpanTest.kt b/app/src/test/java/org/oppia/android/app/testing/HomeSpanTest.kt index f3dd5643520..84ff4b75285 100644 --- a/app/src/test/java/org/oppia/android/app/testing/HomeSpanTest.kt +++ b/app/src/test/java/org/oppia/android/app/testing/HomeSpanTest.kt @@ -75,7 +75,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -198,7 +197,7 @@ class HomeSpanTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/testing/OngoingTopicListSpanTest.kt b/app/src/test/java/org/oppia/android/app/testing/OngoingTopicListSpanTest.kt index e6f5fa12f34..3e8eba9a4a9 100644 --- a/app/src/test/java/org/oppia/android/app/testing/OngoingTopicListSpanTest.kt +++ b/app/src/test/java/org/oppia/android/app/testing/OngoingTopicListSpanTest.kt @@ -75,7 +75,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -193,7 +192,7 @@ class OngoingTopicListSpanTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/testing/PlatformParameterIntegrationTest.kt b/app/src/test/java/org/oppia/android/app/testing/PlatformParameterIntegrationTest.kt index ec2f7c75064..55923caadbc 100644 --- a/app/src/test/java/org/oppia/android/app/testing/PlatformParameterIntegrationTest.kt +++ b/app/src/test/java/org/oppia/android/app/testing/PlatformParameterIntegrationTest.kt @@ -94,7 +94,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -366,7 +365,7 @@ class PlatformParameterIntegrationTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/testing/ProfileChooserSpanTest.kt b/app/src/test/java/org/oppia/android/app/testing/ProfileChooserSpanTest.kt index 4518f4a30a8..e5e783cd8b3 100644 --- a/app/src/test/java/org/oppia/android/app/testing/ProfileChooserSpanTest.kt +++ b/app/src/test/java/org/oppia/android/app/testing/ProfileChooserSpanTest.kt @@ -74,7 +74,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -395,7 +394,7 @@ class ProfileChooserSpanTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/testing/ProfileProgressSpanCountTest.kt b/app/src/test/java/org/oppia/android/app/testing/ProfileProgressSpanCountTest.kt index 47ee98a7204..451e9aa249d 100644 --- a/app/src/test/java/org/oppia/android/app/testing/ProfileProgressSpanCountTest.kt +++ b/app/src/test/java/org/oppia/android/app/testing/ProfileProgressSpanCountTest.kt @@ -74,7 +74,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -179,7 +178,7 @@ class ProfileProgressSpanCountTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/testing/RecentlyPlayedSpanTest.kt b/app/src/test/java/org/oppia/android/app/testing/RecentlyPlayedSpanTest.kt index c348c55fe90..538f31e64b9 100644 --- a/app/src/test/java/org/oppia/android/app/testing/RecentlyPlayedSpanTest.kt +++ b/app/src/test/java/org/oppia/android/app/testing/RecentlyPlayedSpanTest.kt @@ -80,7 +80,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -320,7 +319,7 @@ class RecentlyPlayedSpanTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/testing/TopicRevisionSpanTest.kt b/app/src/test/java/org/oppia/android/app/testing/TopicRevisionSpanTest.kt index 6408a9b1e52..8fae80c1dcb 100644 --- a/app/src/test/java/org/oppia/android/app/testing/TopicRevisionSpanTest.kt +++ b/app/src/test/java/org/oppia/android/app/testing/TopicRevisionSpanTest.kt @@ -73,7 +73,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -179,7 +178,7 @@ class TopicRevisionSpanTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/testing/activity/BUILD.bazel b/app/src/test/java/org/oppia/android/app/testing/activity/BUILD.bazel index 6ee76e3e337..4adaac2d311 100644 --- a/app/src/test/java/org/oppia/android/app/testing/activity/BUILD.bazel +++ b/app/src/test/java/org/oppia/android/app/testing/activity/BUILD.bazel @@ -39,7 +39,6 @@ oppia_android_test( "//utility/src/main/java/org/oppia/android/util/locale:prod_module", "//utility/src/main/java/org/oppia/android/util/locale/testing:test_module", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_util_module", diff --git a/app/src/test/java/org/oppia/android/app/testing/activity/TestActivityTest.kt b/app/src/test/java/org/oppia/android/app/testing/activity/TestActivityTest.kt index c2a673eb4ea..bbb6dd15f15 100644 --- a/app/src/test/java/org/oppia/android/app/testing/activity/TestActivityTest.kt +++ b/app/src/test/java/org/oppia/android/app/testing/activity/TestActivityTest.kt @@ -70,7 +70,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -204,7 +203,7 @@ class TestActivityTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/testing/administratorcontrols/AdministratorControlsFragmentTest.kt b/app/src/test/java/org/oppia/android/app/testing/administratorcontrols/AdministratorControlsFragmentTest.kt index 2145dab63cb..2b2ee89f742 100644 --- a/app/src/test/java/org/oppia/android/app/testing/administratorcontrols/AdministratorControlsFragmentTest.kt +++ b/app/src/test/java/org/oppia/android/app/testing/administratorcontrols/AdministratorControlsFragmentTest.kt @@ -82,7 +82,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -205,7 +204,7 @@ class AdministratorControlsFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/testing/options/OptionsFragmentTest.kt b/app/src/test/java/org/oppia/android/app/testing/options/OptionsFragmentTest.kt index ee9b8cbbc5c..54178d81774 100644 --- a/app/src/test/java/org/oppia/android/app/testing/options/OptionsFragmentTest.kt +++ b/app/src/test/java/org/oppia/android/app/testing/options/OptionsFragmentTest.kt @@ -80,7 +80,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -241,7 +240,7 @@ class OptionsFragmentTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/testing/player/split/PlayerSplitScreenTest.kt b/app/src/test/java/org/oppia/android/app/testing/player/split/PlayerSplitScreenTest.kt index 9d38a8fabee..e0b55eb5de7 100644 --- a/app/src/test/java/org/oppia/android/app/testing/player/split/PlayerSplitScreenTest.kt +++ b/app/src/test/java/org/oppia/android/app/testing/player/split/PlayerSplitScreenTest.kt @@ -71,7 +71,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -212,7 +211,7 @@ class PlayerSplitScreenTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/testing/player/state/StateFragmentAccessibilityTest.kt b/app/src/test/java/org/oppia/android/app/testing/player/state/StateFragmentAccessibilityTest.kt index c36293a6e29..157dac70478 100644 --- a/app/src/test/java/org/oppia/android/app/testing/player/state/StateFragmentAccessibilityTest.kt +++ b/app/src/test/java/org/oppia/android/app/testing/player/state/StateFragmentAccessibilityTest.kt @@ -84,7 +84,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -221,7 +220,7 @@ class StateFragmentAccessibilityTest { SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/topic/info/TopicInfoFragmentLocalTest.kt b/app/src/test/java/org/oppia/android/app/topic/info/TopicInfoFragmentLocalTest.kt index 8c61974dcfe..b7a0a3dcabd 100644 --- a/app/src/test/java/org/oppia/android/app/topic/info/TopicInfoFragmentLocalTest.kt +++ b/app/src/test/java/org/oppia/android/app/topic/info/TopicInfoFragmentLocalTest.kt @@ -72,7 +72,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -166,7 +165,7 @@ class TopicInfoFragmentLocalTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/topic/lessons/TopicLessonsFragmentLocalTest.kt b/app/src/test/java/org/oppia/android/app/topic/lessons/TopicLessonsFragmentLocalTest.kt index 080512c02fb..0c0a47eba17 100644 --- a/app/src/test/java/org/oppia/android/app/topic/lessons/TopicLessonsFragmentLocalTest.kt +++ b/app/src/test/java/org/oppia/android/app/topic/lessons/TopicLessonsFragmentLocalTest.kt @@ -71,7 +71,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -170,7 +169,7 @@ class TopicLessonsFragmentLocalTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivityLocalTest.kt b/app/src/test/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivityLocalTest.kt index bde01024154..53794b37cce 100644 --- a/app/src/test/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivityLocalTest.kt +++ b/app/src/test/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivityLocalTest.kt @@ -102,7 +102,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -512,7 +511,7 @@ class QuestionPlayerActivityLocalTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/topic/revisioncard/RevisionCardActivityLocalTest.kt b/app/src/test/java/org/oppia/android/app/topic/revisioncard/RevisionCardActivityLocalTest.kt index 5db8eeb9491..88085b5959e 100644 --- a/app/src/test/java/org/oppia/android/app/topic/revisioncard/RevisionCardActivityLocalTest.kt +++ b/app/src/test/java/org/oppia/android/app/topic/revisioncard/RevisionCardActivityLocalTest.kt @@ -73,7 +73,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -156,7 +155,7 @@ class RevisionCardActivityLocalTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/translation/ActivityLanguageLocaleHandlerTest.kt b/app/src/test/java/org/oppia/android/app/translation/ActivityLanguageLocaleHandlerTest.kt index c60af9cf356..aa12b2be77a 100644 --- a/app/src/test/java/org/oppia/android/app/translation/ActivityLanguageLocaleHandlerTest.kt +++ b/app/src/test/java/org/oppia/android/app/translation/ActivityLanguageLocaleHandlerTest.kt @@ -86,7 +86,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.OppiaLocale import org.oppia.android.util.locale.testing.LocaleTestModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -329,7 +328,7 @@ class ActivityLanguageLocaleHandlerTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/translation/AppLanguageResourceHandlerTest.kt b/app/src/test/java/org/oppia/android/app/translation/AppLanguageResourceHandlerTest.kt index 9c6e56f953a..39c27aa8d92 100644 --- a/app/src/test/java/org/oppia/android/app/translation/AppLanguageResourceHandlerTest.kt +++ b/app/src/test/java/org/oppia/android/app/translation/AppLanguageResourceHandlerTest.kt @@ -84,7 +84,6 @@ import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.testing.LocaleTestModule import org.oppia.android.util.locale.testing.TestOppiaBidiFormatter -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -615,7 +614,7 @@ class AppLanguageResourceHandlerTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/translation/AppLanguageWatcherMixinTest.kt b/app/src/test/java/org/oppia/android/app/translation/AppLanguageWatcherMixinTest.kt index 2bb7f687b8c..49c522e6963 100644 --- a/app/src/test/java/org/oppia/android/app/translation/AppLanguageWatcherMixinTest.kt +++ b/app/src/test/java/org/oppia/android/app/translation/AppLanguageWatcherMixinTest.kt @@ -85,7 +85,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.testing.LocaleTestModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -311,7 +310,7 @@ class AppLanguageWatcherMixinTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/translation/BUILD.bazel b/app/src/test/java/org/oppia/android/app/translation/BUILD.bazel index faddd51f273..ed1db979001 100644 --- a/app/src/test/java/org/oppia/android/app/translation/BUILD.bazel +++ b/app/src/test/java/org/oppia/android/app/translation/BUILD.bazel @@ -81,7 +81,6 @@ oppia_android_test( "//utility/src/main/java/org/oppia/android/util/data:data_providers", "//utility/src/main/java/org/oppia/android/util/locale/testing:test_module", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_util_module", @@ -131,7 +130,6 @@ oppia_android_test( "//utility/src/main/java/org/oppia/android/util/locale/testing:test_module", "//utility/src/main/java/org/oppia/android/util/locale/testing:test_oppia_bidi_formatter", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_util_module", @@ -178,7 +176,6 @@ oppia_android_test( "//utility/src/main/java/org/oppia/android/util/data:data_providers", "//utility/src/main/java/org/oppia/android/util/locale/testing:test_module", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_util_module", diff --git a/app/src/test/java/org/oppia/android/app/utility/datetime/DateTimeUtilTest.kt b/app/src/test/java/org/oppia/android/app/utility/datetime/DateTimeUtilTest.kt index c709292fa29..e3ec6648bca 100644 --- a/app/src/test/java/org/oppia/android/app/utility/datetime/DateTimeUtilTest.kt +++ b/app/src/test/java/org/oppia/android/app/utility/datetime/DateTimeUtilTest.kt @@ -74,7 +74,6 @@ import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.EnableConsoleLog import org.oppia.android.util.logging.EnableFileLog -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.GlobalLogLevel import org.oppia.android.util.logging.LogLevel import org.oppia.android.util.logging.SyncStatusModule @@ -227,7 +226,7 @@ class DateTimeUtilTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, AnalyticsStartupListenerTestModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/app/src/test/java/org/oppia/android/app/utility/math/BUILD.bazel b/app/src/test/java/org/oppia/android/app/utility/math/BUILD.bazel index 672944d46ec..a7caa3b0995 100644 --- a/app/src/test/java/org/oppia/android/app/utility/math/BUILD.bazel +++ b/app/src/test/java/org/oppia/android/app/utility/math/BUILD.bazel @@ -43,7 +43,6 @@ oppia_android_test( "//utility/src/main/java/org/oppia/android/util/caching/testing:caching_test_module", "//utility/src/main/java/org/oppia/android/util/locale/testing:test_module", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/math:math_expression_parser", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", diff --git a/app/src/test/java/org/oppia/android/app/utility/math/MathExpressionAccessibilityUtilTest.kt b/app/src/test/java/org/oppia/android/app/utility/math/MathExpressionAccessibilityUtilTest.kt index 628b7cb8b75..2b286fc6a0b 100644 --- a/app/src/test/java/org/oppia/android/app/utility/math/MathExpressionAccessibilityUtilTest.kt +++ b/app/src/test/java/org/oppia/android/app/utility/math/MathExpressionAccessibilityUtilTest.kt @@ -97,7 +97,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.testing.LocaleTestModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -1272,7 +1271,7 @@ class MathExpressionAccessibilityUtilTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/build_flavors.bzl b/build_flavors.bzl index 68c4b6f469a..d9d6af2bf96 100644 --- a/build_flavors.bzl +++ b/build_flavors.bzl @@ -3,7 +3,7 @@ Macros & definitions corresponding to Oppia binary build flavors. """ load("//:oppia_android_application.bzl", "declare_deployable_application", "oppia_android_application") -load("//:version.bzl", "MAJOR_VERSION", "MINOR_VERSION", "OPPIA_ALPHA_KENYA_VERSION_CODE", "OPPIA_ALPHA_KITKAT_VERSION_CODE", "OPPIA_ALPHA_VERSION_CODE", "OPPIA_BETA_VERSION_CODE", "OPPIA_DEV_KITKAT_VERSION_CODE", "OPPIA_DEV_VERSION_CODE", "OPPIA_GA_VERSION_CODE") +load("//:version.bzl", "MAJOR_VERSION", "MINOR_VERSION", "OPPIA_ALPHA_KITKAT_VERSION_CODE", "OPPIA_ALPHA_VERSION_CODE", "OPPIA_BETA_VERSION_CODE", "OPPIA_DEV_KITKAT_VERSION_CODE", "OPPIA_DEV_VERSION_CODE", "OPPIA_GA_VERSION_CODE") # Defines the list of flavors available to build the Oppia app in. Note to developers: this list # should be ordered by the development pipeline (i.e. features go through dev first, then other @@ -13,7 +13,6 @@ AVAILABLE_FLAVORS = [ "dev_kitkat", "alpha", "alpha_kitkat", - "alpha_kenya", "beta", "ga", ] @@ -41,7 +40,6 @@ _PRODUCTION_PROGUARD_SPECS = [ ] # Note to developers: keys of this dict should follow the order of AVAILABLE_FLAVORS. -# TODO(#4419): Remove the Kenya-specific alpha flavor. _FLAVOR_METADATA = { "dev": { "manifest": "//app:src/main/AndroidManifest.xml", @@ -101,20 +99,6 @@ _FLAVOR_METADATA = { "version_code": OPPIA_ALPHA_KITKAT_VERSION_CODE, "application_class": ".app.application.alpha.AlphaOppiaApplication", }, - "alpha_kenya": { - "manifest": "//app:src/main/AndroidManifest.xml", - "min_sdk_version": 21, - "target_sdk_version": 33, - "multidex": "native", - "proguard_specs": _PRODUCTION_PROGUARD_SPECS, - "production_release": True, - "deps": [ - "//app/src/main/java/org/oppia/android/app/application/alphakenya:alpha_kenya_application", - "//config/src/java/org/oppia/android/config:all_languages_config", - ], - "version_code": OPPIA_ALPHA_KENYA_VERSION_CODE, - "application_class": ".app.application.alphakenya.AlphaKenyaOppiaApplication", - }, "beta": { "manifest": "//app:src/main/AndroidManifest.xml", "min_sdk_version": 21, diff --git a/domain/src/main/java/org/oppia/android/domain/hintsandsolution/HintsAndSolutionConfigAlphaKenyaModule.kt b/domain/src/main/java/org/oppia/android/domain/hintsandsolution/HintsAndSolutionConfigAlphaKenyaModule.kt deleted file mode 100644 index 5449e58af2b..00000000000 --- a/domain/src/main/java/org/oppia/android/domain/hintsandsolution/HintsAndSolutionConfigAlphaKenyaModule.kt +++ /dev/null @@ -1,21 +0,0 @@ -package org.oppia.android.domain.hintsandsolution - -import dagger.Module -import dagger.Provides -import java.util.concurrent.TimeUnit - -/** Production module for providing configurations for hints & solutions. */ -@Module -class HintsAndSolutionConfigAlphaKenyaModule { - @Provides - @DelayShowInitialHintMillis - fun provideInitialDelayForShowingHintsMillis(): Long = TimeUnit.SECONDS.toMillis(60) - - @Provides - @DelayShowAdditionalHintsMillis - fun provideDelayForShowingAdditionalHintsMillis(): Long = TimeUnit.MINUTES.toMillis(5) / 2 - - @Provides - @DelayShowAdditionalHintsFromWrongAnswerMillis - fun provideDelayForShowingHintsAfterOneWrongAnswerMillis(): Long = TimeUnit.SECONDS.toMillis(15) -} diff --git a/domain/src/main/java/org/oppia/android/domain/onboarding/AppStartupStateController.kt b/domain/src/main/java/org/oppia/android/domain/onboarding/AppStartupStateController.kt index ee30f69b061..43e959982c6 100644 --- a/domain/src/main/java/org/oppia/android/domain/onboarding/AppStartupStateController.kt +++ b/domain/src/main/java/org/oppia/android/domain/onboarding/AppStartupStateController.kt @@ -6,8 +6,10 @@ import org.oppia.android.app.model.AppStartupState.StartupMode import org.oppia.android.app.model.BuildFlavor import org.oppia.android.app.model.DeprecationResponseDatabase import org.oppia.android.app.model.OnboardingState +import org.oppia.android.app.model.ProfileId import org.oppia.android.data.persistence.PersistentCacheStore import org.oppia.android.domain.oppialogger.OppiaLogger +import org.oppia.android.domain.oppialogger.analytics.AnalyticsController import org.oppia.android.util.data.DataProvider import org.oppia.android.util.data.DataProviders.Companion.combineWith import org.oppia.android.util.extensions.getStringFromBundle @@ -31,6 +33,7 @@ class AppStartupStateController @Inject constructor( private val deprecationController: DeprecationController, @EnableAppAndOsDeprecation private val enableAppAndOsDeprecation: Provider>, + private val analyticsController: AnalyticsController, ) { private val onboardingFlowStore by lazy { cacheStoreFactory.create("on_boarding_flow", OnboardingState.getDefaultInstance()) @@ -65,8 +68,9 @@ class AppStartupStateController @Inject constructor( * Note that this does not notify existing subscribers of the changed state, nor can future * subscribers observe this state until the app restarts. */ - fun markOnboardingFlowCompleted() { + fun markOnboardingFlowCompleted(profileId: ProfileId? = null) { updateOnboardingState { alreadyOnboardedApp = true } + logAppOnboardedEvent(profileId) } /** @@ -190,4 +194,8 @@ class AppStartupStateController @Inject constructor( expirationDate?.isBeforeToday() ?: true } else false } + + private fun logAppOnboardedEvent(profileId: ProfileId?) { + analyticsController.logAppOnboardedEvent(profileId) + } } diff --git a/domain/src/main/java/org/oppia/android/domain/onboarding/BUILD.bazel b/domain/src/main/java/org/oppia/android/domain/onboarding/BUILD.bazel index 0c56bb8f283..34dc94addea 100644 --- a/domain/src/main/java/org/oppia/android/domain/onboarding/BUILD.bazel +++ b/domain/src/main/java/org/oppia/android/domain/onboarding/BUILD.bazel @@ -15,6 +15,7 @@ kt_android_library( ":exploration_meta_data_retriever", "//data/src/main/java/org/oppia/android/data/persistence:cache_store", "//domain/src/main/java/org/oppia/android/domain/oppialogger:oppia_logger", + "//domain/src/main/java/org/oppia/android/domain/oppialogger/analytics:controller", "//model/src/main/proto:deprecation_java_proto_lite", "//model/src/main/proto:onboarding_java_proto_lite", "//third_party:javax_inject_javax_inject", diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/BUILD.bazel b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/BUILD.bazel index 3a91ed280e8..b5c7b54bf0b 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/BUILD.bazel +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/analytics/BUILD.bazel @@ -20,7 +20,7 @@ kt_android_library( srcs = [ "AnalyticsController.kt", ], - visibility = ["//domain/src/main/java/org/oppia/android/domain/oppialogger:__subpackages__"], + visibility = ["//:oppia_api_visibility"], deps = [ "//:dagger", "//data/src/main/java/org/oppia/android/data/backends/gae:network_interceptors", @@ -49,6 +49,7 @@ kt_android_library( "//domain/src/main/java/org/oppia/android/domain/oppialogger:prod_module", "//model/src/main/proto:performance_metrics_event_logger_java_proto_lite", "//utility/src/main/java/org/oppia/android/util/data:data_provider", + "//utility/src/main/java/org/oppia/android/util/enumfilter:enum_filter_util", "//utility/src/main/java/org/oppia/android/util/logging:console_logger", "//utility/src/main/java/org/oppia/android/util/logging:exception_logger", "//utility/src/main/java/org/oppia/android/util/logging/performancemetrics:performance_metrics_assessor", 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 f518ff6121e..242eccbe1d3 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 @@ -7,6 +7,7 @@ import org.oppia.android.app.model.ScreenName import org.oppia.android.data.persistence.PersistentCacheStore import org.oppia.android.domain.oppialogger.PerformanceMetricsLogStorageCacheSize import org.oppia.android.util.data.DataProvider +import org.oppia.android.util.enumfilter.filterByEnumCondition import org.oppia.android.util.logging.ConsoleLogger import org.oppia.android.util.logging.ExceptionLogger import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsAssessor @@ -128,9 +129,11 @@ class PerformanceMetricsController @Inject constructor( * priority is returned. */ private fun getLeastRecentMetricLogIndex(oppiaMetricLogs: OppiaMetricLogs): Int? = - oppiaMetricLogs.oppiaMetricLogList.withIndex() - .filter { it.value.priority == Priority.LOW_PRIORITY } - .minByOrNull { it.value.timestampMillis }?.index + filterByEnumCondition( + oppiaMetricLogs.oppiaMetricLogList.withIndex().toList(), + { it.value.priority }, + { it == Priority.LOW_PRIORITY } + ).minByOrNull { it.value.timestampMillis }?.index ?: getLeastRecentMediumPriorityEventIndex(oppiaMetricLogs) /** @@ -142,9 +145,11 @@ class PerformanceMetricsController @Inject constructor( * priority is returned. */ private fun getLeastRecentMediumPriorityEventIndex(oppiaMetricLogs: OppiaMetricLogs): Int? = - oppiaMetricLogs.oppiaMetricLogList.withIndex() - .filter { it.value.priority == Priority.MEDIUM_PRIORITY } - .minByOrNull { it.value.timestampMillis }?.index + filterByEnumCondition( + oppiaMetricLogs.oppiaMetricLogList.withIndex().toList(), + { it.value.priority }, + { it == Priority.MEDIUM_PRIORITY } + ).minByOrNull { it.value.timestampMillis }?.index ?: getLeastRecentGeneralEventIndex(oppiaMetricLogs) /** Returns the index of the least recent event regardless of their priority. */ diff --git a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterAlphaKenyaModule.kt b/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterAlphaKenyaModule.kt deleted file mode 100644 index 657ed9f43d1..00000000000 --- a/domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterAlphaKenyaModule.kt +++ /dev/null @@ -1,352 +0,0 @@ -package org.oppia.android.domain.platformparameter - -import android.content.Context -import dagger.Module -import dagger.Provides -import org.oppia.android.util.extensions.getVersionCode -import org.oppia.android.util.platformparameter.APP_AND_OS_DEPRECATION -import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING -import org.oppia.android.util.platformparameter.CACHE_LATEX_RENDERING_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.CacheLatexRendering -import org.oppia.android.util.platformparameter.DOWNLOADS_SUPPORT -import org.oppia.android.util.platformparameter.EDIT_ACCOUNTS_OPTIONS_UI -import org.oppia.android.util.platformparameter.ENABLE_APP_AND_OS_DEPRECATION_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.ENABLE_EXTRA_TOPIC_TABS_UI_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.ENABLE_MULTIPLE_CLASSROOMS -import org.oppia.android.util.platformparameter.ENABLE_MULTIPLE_CLASSROOMS_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.ENABLE_NPS_SURVEY -import org.oppia.android.util.platformparameter.ENABLE_NPS_SURVEY_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.ENABLE_ONBOARDING_FLOW_V2 -import org.oppia.android.util.platformparameter.ENABLE_ONBOARDING_FLOW_V2_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.ENABLE_PERFORMANCE_METRICS_COLLECTION -import org.oppia.android.util.platformparameter.ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.ENABLE_SPOTLIGHT_UI_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.EXTRA_TOPIC_TABS_UI -import org.oppia.android.util.platformparameter.EnableAppAndOsDeprecation -import org.oppia.android.util.platformparameter.EnableDownloadsSupport -import org.oppia.android.util.platformparameter.EnableEditAccountsOptionsUi -import org.oppia.android.util.platformparameter.EnableExtraTopicTabsUi -import org.oppia.android.util.platformparameter.EnableFastLanguageSwitchingInLesson -import org.oppia.android.util.platformparameter.EnableInteractionConfigChangeStateRetention -import org.oppia.android.util.platformparameter.EnableLearnerStudyAnalytics -import org.oppia.android.util.platformparameter.EnableLoggingLearnerStudyIds -import org.oppia.android.util.platformparameter.EnableMultipleClassrooms -import org.oppia.android.util.platformparameter.EnableNpsSurvey -import org.oppia.android.util.platformparameter.EnableOnboardingFlowV2 -import org.oppia.android.util.platformparameter.EnablePerformanceMetricsCollection -import org.oppia.android.util.platformparameter.EnableSpotlightUi -import org.oppia.android.util.platformparameter.FAST_LANGUAGE_SWITCHING_IN_LESSON -import org.oppia.android.util.platformparameter.FORCED_APP_UPDATE_VERSION_CODE -import org.oppia.android.util.platformparameter.ForcedAppUpdateVersionCode -import org.oppia.android.util.platformparameter.INTERACTION_CONFIG_CHANGE_STATE_RETENTION -import org.oppia.android.util.platformparameter.LEARNER_STUDY_ANALYTICS -import org.oppia.android.util.platformparameter.LOGGING_LEARNER_STUDY_IDS -import org.oppia.android.util.platformparameter.LOWEST_SUPPORTED_API_LEVEL -import org.oppia.android.util.platformparameter.LOWEST_SUPPORTED_API_LEVEL_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.LowestSupportedApiLevel -import org.oppia.android.util.platformparameter.NPS_SURVEY_GRACE_PERIOD_IN_DAYS -import org.oppia.android.util.platformparameter.NPS_SURVEY_GRACE_PERIOD_IN_DAYS_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.NPS_SURVEY_MINIMUM_AGGREGATE_LEARNING_TIME_IN_A_TOPIC_IN_MINUTES -import org.oppia.android.util.platformparameter.NPS_SURVEY_MINIMUM_AGGREGATE_LEARNING_TIME_IN_A_TOPIC_IN_MINUTES_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.NpsSurveyGracePeriodInDays -import org.oppia.android.util.platformparameter.NpsSurveyMinimumAggregateLearningTimeInATopicInMinutes -import org.oppia.android.util.platformparameter.OPTIONAL_APP_UPDATE_VERSION_CODE -import org.oppia.android.util.platformparameter.OptionalAppUpdateVersionCode -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES -import org.oppia.android.util.platformparameter.PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes -import org.oppia.android.util.platformparameter.PerformanceMetricsCollectionUploadTimeIntervalInMinutes -import org.oppia.android.util.platformparameter.PlatformParameterSingleton -import org.oppia.android.util.platformparameter.PlatformParameterValue -import org.oppia.android.util.platformparameter.SPLASH_SCREEN_WELCOME_MSG -import org.oppia.android.util.platformparameter.SPLASH_SCREEN_WELCOME_MSG_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.SPOTLIGHT_UI -import org.oppia.android.util.platformparameter.SYNC_UP_WORKER_TIME_PERIOD_IN_HOURS -import org.oppia.android.util.platformparameter.SYNC_UP_WORKER_TIME_PERIOD_IN_HOURS_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.SplashScreenWelcomeMsg -import org.oppia.android.util.platformparameter.SyncUpWorkerTimePeriodHours - -// TODO(#4419): Remove this module. -/** - * Dagger module that provides bindings for platform parameters for the Kenya-specific alpha build - * of the app. - */ -@Module -class PlatformParameterAlphaKenyaModule { - @Provides - @EnableDownloadsSupport - fun provideEnableDownloadsSupport( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter(DOWNLOADS_SUPPORT) - ?: PlatformParameterValue.createDefaultParameter(ENABLE_DOWNLOADS_SUPPORT_DEFAULT_VALUE) - } - - @Provides - @SplashScreenWelcomeMsg - fun provideSplashScreenWelcomeMsgParam( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter(SPLASH_SCREEN_WELCOME_MSG) - ?: PlatformParameterValue.createDefaultParameter(SPLASH_SCREEN_WELCOME_MSG_DEFAULT_VALUE) - } - - @Provides - @SyncUpWorkerTimePeriodHours - fun provideSyncUpWorkerTimePeriod( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getIntegerPlatformParameter( - SYNC_UP_WORKER_TIME_PERIOD_IN_HOURS - ) ?: PlatformParameterValue.createDefaultParameter( - SYNC_UP_WORKER_TIME_PERIOD_IN_HOURS_DEFAULT_VALUE - ) - } - - @Provides - @EnableEditAccountsOptionsUi - fun provideEnableEditAccountsOptionsUi( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - EDIT_ACCOUNTS_OPTIONS_UI - ) ?: PlatformParameterValue.createDefaultParameter( - ENABLE_EDIT_ACCOUNTS_OPTIONS_UI_DEFAULT_VALUE - ) - } - - @Provides - @EnableLearnerStudyAnalytics - fun provideLearnerStudyAnalytics( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - // Turn on the learner study platform parameter by default. - return platformParameterSingleton.getBooleanPlatformParameter(LEARNER_STUDY_ANALYTICS) - ?: PlatformParameterValue.createDefaultParameter(true) - } - - @Provides - @EnableFastLanguageSwitchingInLesson - fun provideFastInLessonLanguageSwitching( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - // Turn on fast language switching functionality by default. - return platformParameterSingleton.getBooleanPlatformParameter(FAST_LANGUAGE_SWITCHING_IN_LESSON) - ?: PlatformParameterValue.createDefaultParameter(true) - } - - @Provides - @EnableLoggingLearnerStudyIds - fun provideLoggingLearnerStudyIds( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - // Turn on fast language switching functionality by default. - return platformParameterSingleton.getBooleanPlatformParameter(LOGGING_LEARNER_STUDY_IDS) - ?: PlatformParameterValue.createDefaultParameter(true) - } - - @Provides - @CacheLatexRendering - fun provideCacheLatexRendering( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter(CACHE_LATEX_RENDERING) - ?: PlatformParameterValue.createDefaultParameter(CACHE_LATEX_RENDERING_DEFAULT_VALUE) - } - - @Provides - @EnablePerformanceMetricsCollection - fun provideEnablePerformanceMetricCollection( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - ENABLE_PERFORMANCE_METRICS_COLLECTION - ) ?: PlatformParameterValue.createDefaultParameter( - ENABLE_PERFORMANCE_METRICS_COLLECTION_DEFAULT_VALUE - ) - } - - @Provides - @PerformanceMetricsCollectionUploadTimeIntervalInMinutes - fun providePerformanceMetricsCollectionUploadTimeIntervalInMinutes( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getIntegerPlatformParameter( - PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES - ) ?: PlatformParameterValue.createDefaultParameter( - PERFORMANCE_METRICS_COLLECTION_UPLOAD_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL - ) - } - - @Provides - @PerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes - fun providePerformanceMetricsCollectionHighFrequencyTimeIntervalInMinutes( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getIntegerPlatformParameter( - PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES - ) ?: PlatformParameterValue.createDefaultParameter( - PERFORMANCE_METRICS_COLLECTION_HIGH_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL - ) - } - - @Provides - @PerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes - fun providePerformanceMetricsCollectionLowFrequencyTimeIntervalInMinutes( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getIntegerPlatformParameter( - PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES - ) ?: PlatformParameterValue.createDefaultParameter( - PERFORMANCE_METRICS_COLLECTION_LOW_FREQUENCY_TIME_INTERVAL_IN_MINUTES_DEFAULT_VAL - ) - } - - @Provides - @EnableExtraTopicTabsUi - fun provideEnableExtraTopicTabsUi( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - EXTRA_TOPIC_TABS_UI - ) ?: PlatformParameterValue.createDefaultParameter( - ENABLE_EXTRA_TOPIC_TABS_UI_DEFAULT_VALUE - ) - } - - @Provides - @EnableInteractionConfigChangeStateRetention - fun provideEnableInteractionConfigChangeStateRetention( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - INTERACTION_CONFIG_CHANGE_STATE_RETENTION - ) ?: PlatformParameterValue.createDefaultParameter( - ENABLE_INTERACTION_CONFIG_CHANGE_STATE_RETENTION_DEFAULT_VALUE - ) - } - - @Provides - @EnableSpotlightUi - fun provideEnableSpotlightUi( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter(SPOTLIGHT_UI) - ?: PlatformParameterValue.createDefaultParameter(ENABLE_SPOTLIGHT_UI_DEFAULT_VALUE) - } - - @Provides - @EnableAppAndOsDeprecation - fun provideEnableAppAndOsDeprecation( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter( - APP_AND_OS_DEPRECATION - ) ?: PlatformParameterValue.createDefaultParameter( - ENABLE_APP_AND_OS_DEPRECATION_DEFAULT_VALUE - ) - } - - @Provides - @OptionalAppUpdateVersionCode - fun provideOptionalAppUpdateVersionCode( - platformParameterSingleton: PlatformParameterSingleton, - context: Context - ): PlatformParameterValue { - return platformParameterSingleton.getIntegerPlatformParameter( - OPTIONAL_APP_UPDATE_VERSION_CODE - ) ?: PlatformParameterValue.createDefaultParameter( - context.getVersionCode() - ) - } - - @Provides - @ForcedAppUpdateVersionCode - fun provideForcedAppUpdateVersionCode( - platformParameterSingleton: PlatformParameterSingleton, - context: Context - ): PlatformParameterValue { - return platformParameterSingleton.getIntegerPlatformParameter( - FORCED_APP_UPDATE_VERSION_CODE - ) ?: PlatformParameterValue.createDefaultParameter( - context.getVersionCode() - ) - } - - @Provides - @LowestSupportedApiLevel - fun provideLowestSupportedApiLevel( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getIntegerPlatformParameter( - LOWEST_SUPPORTED_API_LEVEL - ) ?: PlatformParameterValue.createDefaultParameter( - LOWEST_SUPPORTED_API_LEVEL_DEFAULT_VALUE - ) - } - - @Provides - @NpsSurveyGracePeriodInDays - fun provideNpsSurveyGracePeriodInDays( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getIntegerPlatformParameter( - NPS_SURVEY_GRACE_PERIOD_IN_DAYS - ) ?: PlatformParameterValue.createDefaultParameter( - NPS_SURVEY_GRACE_PERIOD_IN_DAYS_DEFAULT_VALUE - ) - } - - @Provides - @NpsSurveyMinimumAggregateLearningTimeInATopicInMinutes - fun provideNpsSurveyMinimumAggregateLearningTimeInATopicInMinutes( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getIntegerPlatformParameter( - NPS_SURVEY_MINIMUM_AGGREGATE_LEARNING_TIME_IN_A_TOPIC_IN_MINUTES - ) ?: PlatformParameterValue.createDefaultParameter( - NPS_SURVEY_MINIMUM_AGGREGATE_LEARNING_TIME_IN_A_TOPIC_IN_MINUTES_DEFAULT_VALUE - ) - } - - @Provides - @EnableNpsSurvey - fun provideEnableNpsSurvey( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter(ENABLE_NPS_SURVEY) - ?: PlatformParameterValue.createDefaultParameter( - ENABLE_NPS_SURVEY_DEFAULT_VALUE - ) - } - - @Provides - @EnableOnboardingFlowV2 - fun provideEnableOnboardingFlowV2( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter(ENABLE_ONBOARDING_FLOW_V2) - ?: PlatformParameterValue.createDefaultParameter( - ENABLE_ONBOARDING_FLOW_V2_DEFAULT_VALUE - ) - } - - @Provides - @EnableMultipleClassrooms - fun provideEnableMultipleClassrooms( - platformParameterSingleton: PlatformParameterSingleton - ): PlatformParameterValue { - return platformParameterSingleton.getBooleanPlatformParameter(ENABLE_MULTIPLE_CLASSROOMS) - ?: PlatformParameterValue.createDefaultParameter( - ENABLE_MULTIPLE_CLASSROOMS_DEFAULT_VALUE - ) - } -} diff --git a/domain/src/main/java/org/oppia/android/domain/profile/ProfileManagementController.kt b/domain/src/main/java/org/oppia/android/domain/profile/ProfileManagementController.kt index 983caebf6db..95438d0b9d0 100644 --- a/domain/src/main/java/org/oppia/android/domain/profile/ProfileManagementController.kt +++ b/domain/src/main/java/org/oppia/android/domain/profile/ProfileManagementController.kt @@ -16,6 +16,7 @@ import org.oppia.android.app.model.Profile import org.oppia.android.app.model.ProfileAvatar import org.oppia.android.app.model.ProfileDatabase import org.oppia.android.app.model.ProfileId +import org.oppia.android.app.model.ProfileType import org.oppia.android.app.model.ReadingTextSize import org.oppia.android.data.persistence.PersistentCacheStore import org.oppia.android.data.persistence.PersistentCacheStore.PublishMode @@ -78,6 +79,8 @@ private const val SET_LAST_SELECTED_CLASSROOM_ID_PROVIDER_ID = "set_last_selected_classroom_id_provider_id" private const val RETRIEVE_LAST_SELECTED_CLASSROOM_ID_PROVIDER_ID = "retrieve_last_selected_classroom_id_provider_id" +private const val UPDATE_PROFILE_DETAILS_PROVIDER_ID = "update_profile_details_data_provider_id" +private const val UPDATE_PROFILE_TYPE_PROVIDER_ID = "update_profile_type_data_provider_id" /** Controller for retrieving, adding, updating, and deleting profiles. */ @Singleton @@ -112,7 +115,7 @@ class ProfileManagementController @Inject constructor( /** Indicates that the selected image was not stored properly. */ class FailedToStoreImageException(msg: String) : Exception(msg) - /** Indicates that the profile's directory was not delete properly. */ + /** Indicates that the profile's directory was not deleted properly. */ class FailedToDeleteDirException(msg: String) : Exception(msg) /** Indicates that the given profileId is not associated with an existing profile. */ @@ -124,6 +127,9 @@ class ProfileManagementController @Inject constructor( /** Indicates that the Profile already has admin. */ class ProfileAlreadyHasAdminException(msg: String) : Exception(msg) + /** Indicates that the a ProfileType was not passed. */ + class UnknownProfileTypeException(msg: String) : Exception(msg) + /** Indicates that the there is not device settings currently. */ class DeviceSettingsNotFoundException(msg: String) : Exception(msg) @@ -169,7 +175,10 @@ class ProfileManagementController @Inject constructor( * Indicates that the operation failed due to an attempt to re-elevate an administrator to * administrator status (this should never happen in regular app operations). */ - PROFILE_ALREADY_HAS_ADMIN + PROFILE_ALREADY_HAS_ADMIN, + + /** Indicates that the operation failed due to the profileType property not supplied. */ + PROFILE_TYPE_UNKNOWN, } // TODO(#272): Remove init block when storeDataAsync is fixed @@ -365,7 +374,7 @@ class ProfileManagementController @Inject constructor( * Updates the name of an existing profile. * * @param profileId the ID corresponding to the profile being updated. - * @param newName New name for the profile being updated. + * @param newName new name for the profile being updated. * @return a [DataProvider] that indicates the success/failure of this update operation. */ fun updateName(profileId: ProfileId, newName: String): DataProvider { @@ -395,6 +404,47 @@ class ProfileManagementController @Inject constructor( } } + /** + * Updates the profile type field of an existing profile. + * + * @param profileId the ID of the profile to update + * @return a [DataProvider] that represents the result of the update operation + */ + fun updateProfileType( + profileId: ProfileId, + profileType: ProfileType + ): DataProvider { + val deferred = profileDataStore.storeDataWithCustomChannelAsync( + updateInMemoryCache = true + ) { + val profile = + it.profilesMap[profileId.internalId] ?: return@storeDataWithCustomChannelAsync Pair( + it, + ProfileActionStatus.PROFILE_NOT_FOUND + ) + + val updatedProfile = profile.toBuilder() + + if (profileType == ProfileType.PROFILE_TYPE_UNSPECIFIED) { + return@storeDataWithCustomChannelAsync Pair( + it, + ProfileActionStatus.PROFILE_TYPE_UNKNOWN + ) + } else { + updatedProfile.profileType = profileType + } + + val profileDatabaseBuilder = it.toBuilder().putProfiles( + profileId.internalId, + updatedProfile.build() + ) + Pair(profileDatabaseBuilder.build(), ProfileActionStatus.SUCCESS) + } + return dataProviders.createInMemoryDataProviderAsync(UPDATE_PROFILE_TYPE_PROVIDER_ID) { + return@createInMemoryDataProviderAsync getDeferredResult(profileId, null, deferred) + } + } + /** * Updates the PIN of an existing profile. * @@ -679,6 +729,77 @@ class ProfileManagementController @Inject constructor( ).transform(UPDATE_AUDIO_LANGUAGE_PROVIDER_ID) { value -> value } } + /** + * Updates the provided details of an newly created profile to migrate onboarding flow v2 support. + * + * @param profileId the ID of the profile to update + * @param avatarImagePath the path to the profile's avatar image, or null if unset + * @param colorRgb the randomly selected unique color to be used in place of a picture + * @param newName the nickname to identify the profile + * @param isAdmin whether the profile has administrator privileges + * @return [DataProvider] that represents the result of the update operation + */ + fun updateNewProfileDetails( + profileId: ProfileId, + profileType: ProfileType, + avatarImagePath: Uri?, + colorRgb: Int, + newName: String, + isAdmin: Boolean + ): DataProvider { + val deferred = profileDataStore.storeDataWithCustomChannelAsync( + updateInMemoryCache = true + ) { + if (!enableLearnerStudyAnalytics.value && !profileNameValidator.isNameValid(newName)) { + return@storeDataWithCustomChannelAsync Pair(it, ProfileActionStatus.INVALID_PROFILE_NAME) + } + val profile = + it.profilesMap[profileId.internalId] ?: return@storeDataWithCustomChannelAsync Pair( + it, + ProfileActionStatus.PROFILE_NOT_FOUND + ) + val profileDir = directoryManagementUtil.getOrCreateDir(profileId.toString()) + + val updatedProfile = profile.toBuilder() + + if (avatarImagePath != null) { + val imageUri = + saveImageToInternalStorage(avatarImagePath, profileDir) + ?: return@storeDataWithCustomChannelAsync Pair( + it, + ProfileActionStatus.FAILED_TO_STORE_IMAGE + ) + updatedProfile.avatar = + ProfileAvatar.newBuilder().setAvatarImageUri(imageUri).build() + } else { + updatedProfile.avatar = + ProfileAvatar.newBuilder().setAvatarColorRgb(colorRgb).build() + } + + if (profileType == ProfileType.PROFILE_TYPE_UNSPECIFIED) { + return@storeDataWithCustomChannelAsync Pair( + it, + ProfileActionStatus.PROFILE_TYPE_UNKNOWN + ) + } else { + updatedProfile.profileType = profileType + } + + updatedProfile.name = newName + + updatedProfile.isAdmin = isAdmin + + val profileDatabaseBuilder = it.toBuilder().putProfiles( + profileId.internalId, + updatedProfile.build() + ) + Pair(profileDatabaseBuilder.build(), ProfileActionStatus.SUCCESS) + } + return dataProviders.createInMemoryDataProviderAsync(UPDATE_PROFILE_DETAILS_PROVIDER_ID) { + return@createInMemoryDataProviderAsync getDeferredResult(profileId, newName, deferred) + } + } + /** * Log in to the user's Profile by setting the current profile Id, updating profile's last logged * in time and updating the total number of logins for the current profile Id. @@ -962,6 +1083,8 @@ class ProfileManagementController @Inject constructor( "Profile cannot be an admin" ) ) + ProfileActionStatus.PROFILE_TYPE_UNKNOWN -> + AsyncResult.Failure(UnknownProfileTypeException("ProfileType must be set.")) } } diff --git a/domain/src/test/java/org/oppia/android/domain/onboarding/AppStartupStateControllerTest.kt b/domain/src/test/java/org/oppia/android/domain/onboarding/AppStartupStateControllerTest.kt index 92c96177489..64aafa421d5 100644 --- a/domain/src/test/java/org/oppia/android/domain/onboarding/AppStartupStateControllerTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/onboarding/AppStartupStateControllerTest.kt @@ -26,6 +26,7 @@ import org.oppia.android.app.model.AppStartupState.StartupMode.USER_NOT_YET_ONBO import org.oppia.android.app.model.BuildFlavor import org.oppia.android.app.model.DeprecationNoticeType import org.oppia.android.app.model.DeprecationResponse +import org.oppia.android.app.model.EventLog import org.oppia.android.app.model.OnboardingState import org.oppia.android.app.model.PlatformParameter import org.oppia.android.data.persistence.PersistentCacheStore @@ -41,6 +42,7 @@ import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule import org.oppia.android.domain.platformparameter.PlatformParameterController import org.oppia.android.domain.platformparameter.PlatformParameterModule import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule +import org.oppia.android.testing.FakeAnalyticsEventLogger import org.oppia.android.testing.TestLogReportingModule import org.oppia.android.testing.data.DataProviderTestMonitor import org.oppia.android.testing.junit.OppiaParameterizedTestRunner @@ -51,6 +53,7 @@ import org.oppia.android.testing.junit.ParameterizedRobolectricTestRunner import org.oppia.android.testing.robolectric.RobolectricModule import org.oppia.android.testing.threading.TestCoroutineDispatchers import org.oppia.android.testing.threading.TestDispatcherModule +import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.data.DataProvidersInjector import org.oppia.android.util.data.DataProvidersInjectorProvider import org.oppia.android.util.locale.LocaleProdModule @@ -87,6 +90,7 @@ class AppStartupStateControllerTest { @Inject lateinit var platformParameterController: PlatformParameterController @Inject lateinit var testCoroutineDispatchers: TestCoroutineDispatchers @Inject lateinit var monitorFactory: DataProviderTestMonitor.Factory + @Inject lateinit var fakeAnalyticsEventLogger: FakeAnalyticsEventLogger @Parameter lateinit var initialFlavorName: String // TODO(#3792): Remove this usage of Locale (probably by introducing a test utility in the locale @@ -122,6 +126,18 @@ class AppStartupStateControllerTest { assertThat(mode.startupMode).isEqualTo(USER_NOT_YET_ONBOARDED) } + @Test + fun testController_afterSettingAppOnboarded_logsCompletedOnboardingEvent() { + setUpDefaultTestApplicationComponent() + appStartupStateController.markOnboardingFlowCompleted() + testCoroutineDispatchers.runCurrent() + + val event = fakeAnalyticsEventLogger.getMostRecentEvent() + assertThat(event.priority).isEqualTo(EventLog.Priority.OPTIONAL) + assertThat(event.context.activityContextCase) + .isEqualTo(EventLog.Context.ActivityContextCase.COMPLETE_APP_ONBOARDING) + } + @Test fun testController_settingAppOnboarded_observedNewController_userOnboardedApp() { // Simulate the previous app already having completed onboarding. @@ -1063,7 +1079,7 @@ class AppStartupStateControllerTest { ExpirationMetaDataRetrieverModule::class, // Use real implementation to test closer to prod. LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, PlatformParameterModule::class, - PlatformParameterSingletonModule::class + PlatformParameterSingletonModule::class, AssetModule::class ] ) interface TestApplicationComponent : DataProvidersInjector { diff --git a/domain/src/test/java/org/oppia/android/domain/onboarding/BUILD.bazel b/domain/src/test/java/org/oppia/android/domain/onboarding/BUILD.bazel index 16993f30a2c..7d59aa2021f 100644 --- a/domain/src/test/java/org/oppia/android/domain/onboarding/BUILD.bazel +++ b/domain/src/test/java/org/oppia/android/domain/onboarding/BUILD.bazel @@ -28,6 +28,7 @@ oppia_android_test( "//third_party:org_mockito_mockito-core", "//third_party:org_robolectric_robolectric", "//third_party:robolectric_android-all", + "//utility/src/main/java/org/oppia/android/util/caching:asset_prod_module", "//utility/src/main/java/org/oppia/android/util/locale:prod_module", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", diff --git a/domain/src/test/java/org/oppia/android/domain/profile/ProfileManagementControllerTest.kt b/domain/src/test/java/org/oppia/android/domain/profile/ProfileManagementControllerTest.kt index 91d58907646..287239d6e72 100644 --- a/domain/src/test/java/org/oppia/android/domain/profile/ProfileManagementControllerTest.kt +++ b/domain/src/test/java/org/oppia/android/domain/profile/ProfileManagementControllerTest.kt @@ -28,6 +28,7 @@ import org.oppia.android.app.model.AudioLanguage.NIGERIAN_PIDGIN_LANGUAGE import org.oppia.android.app.model.Profile import org.oppia.android.app.model.ProfileDatabase import org.oppia.android.app.model.ProfileId +import org.oppia.android.app.model.ProfileType import org.oppia.android.app.model.ReadingTextSize.MEDIUM_TEXT_SIZE import org.oppia.android.domain.classroom.TEST_CLASSROOM_ID_1 import org.oppia.android.domain.classroom.TEST_CLASSROOM_ID_2 @@ -141,7 +142,7 @@ class ProfileManagementControllerTest { assertThat(profile.isContinueButtonAnimationSeen).isEqualTo(false) assertThat(File(getAbsoluteDirPath("0")).isDirectory).isTrue() assertThat(profile.surveyLastShownTimestampMs).isEqualTo(0L) - assertThat(profile.lastSelectedClassroomId).isEqualTo("") + assertThat(profile.lastSelectedClassroomId).isEmpty() } @Test @@ -1434,6 +1435,190 @@ class ProfileManagementControllerTest { assertThat(lastSelectedClassroomId).isEmpty() } + @Test + fun testUpdateProfile_updateMultipleFields_checkUpdateIsSuccessful() { + setUpTestApplicationComponent() + profileTestHelper.createDefaultAdminProfile() + + val updateProvider = profileManagementController.updateNewProfileDetails( + PROFILE_ID_0, + ProfileType.SOLE_LEARNER, + null, + -1, + "John", + isAdmin = true + ) + monitorFactory.waitForNextSuccessfulResult(updateProvider) + + val profileProvider = profileManagementController.getProfile(PROFILE_ID_0) + val profile = monitorFactory.waitForNextSuccessfulResult(profileProvider) + + assertThat(profile.name).isEqualTo("John") + assertThat(profile.profileType).isEqualTo(ProfileType.SOLE_LEARNER) + assertThat(profile.isAdmin).isEqualTo(true) + assertThat(profile.avatar.avatarImageUri).isEmpty() + assertThat(profile.avatar.avatarColorRgb).isEqualTo(-1) + } + + @Test + fun testUpdateProfile_updateMultipleFields_invalidName_checkNameUpdateFailed() { + setUpTestApplicationComponent() + profileTestHelper.createDefaultAdminProfile() + + val updateProvider = profileManagementController.updateNewProfileDetails( + PROFILE_ID_0, + ProfileType.SOLE_LEARNER, + null, + -1, + "John123", + isAdmin = true + ) + val failure = monitorFactory.waitForNextFailureResult(updateProvider) + + assertThat(failure).hasMessageThat().contains("John123 does not contain only letters") + } + + @Test + fun testUpdateProfile_updateMultipleFields_nullAvatarUri_setsAvatarColorSuccessfully() { + setUpTestApplicationComponent() + profileTestHelper.createDefaultAdminProfile() + + val updateProvider = profileManagementController.updateNewProfileDetails( + PROFILE_ID_0, + ProfileType.SOLE_LEARNER, + null, + -11235672, + "John", + isAdmin = true + ) + monitorFactory.waitForNextSuccessfulResult(updateProvider) + + val profileProvider = profileManagementController.getProfile(PROFILE_ID_0) + val profile = monitorFactory.waitForNextSuccessfulResult(profileProvider) + + assertThat(profile.avatar.avatarImageUri).isEmpty() + assertThat(profile.avatar.avatarColorRgb).isEqualTo(-11235672) + assertThat(profile.name).isEqualTo("John") + assertThat(profile.profileType).isEqualTo(ProfileType.SOLE_LEARNER) + assertThat(profile.isAdmin).isEqualTo(true) + } + + @Test + fun testUpdateProfile_updateMultipleFields_unspecifiedProfileType_returnsProfileTypeError() { + setUpTestApplicationComponent() + profileTestHelper.createDefaultAdminProfile() + + val updateProvider = profileManagementController.updateNewProfileDetails( + PROFILE_ID_0, + ProfileType.PROFILE_TYPE_UNSPECIFIED, + null, + -11235672, + "John", + isAdmin = true + ) + + val failure = monitorFactory.waitForNextFailureResult(updateProvider) + assertThat(failure).hasMessageThat().isEqualTo("ProfileType must be set.") + } + + @Test + fun testUpdateProfile_updateMultipleFields_invalidProfileId_checkUpdateFailed() { + setUpTestApplicationComponent() + profileTestHelper.createDefaultAdminProfile() + + val updateProvider = profileManagementController.updateNewProfileDetails( + PROFILE_ID_3, + ProfileType.SOLE_LEARNER, + null, + -1, + "John", + isAdmin = true + ) + val failure = monitorFactory.waitForNextFailureResult(updateProvider) + + assertThat(failure).hasMessageThat() + .contains("ProfileId ${PROFILE_ID_3?.internalId} does not match an existing Profile") + } + + @Test + fun testUpdateExistingAdminProfile_updateProfileTypeToSupervisor_checkProfileTypeSupervisor() { + setUpTestApplicationComponent() + profileTestHelper.addOnlyAdminProfile() + + val updateProvider = profileManagementController.updateProfileType( + PROFILE_ID_0, + ProfileType.SUPERVISOR + ) + monitorFactory.waitForNextSuccessfulResult(updateProvider) + + val updatedProfileProvider = profileManagementController.getProfile(PROFILE_ID_0) + val updatedProfile = monitorFactory.waitForNextSuccessfulResult(updatedProfileProvider) + assertThat(updatedProfile.profileType).isEqualTo(ProfileType.SUPERVISOR) + } + + @Test + fun testUpdateExistingPinlessAdmin_updateProfileTypeToSoleLearner_checkProfileTypeSoleLearner() { + setUpTestApplicationComponent() + addAdminProfile(name = "Admin", pin = "") + + val updateProvider = profileManagementController.updateProfileType( + PROFILE_ID_0, + ProfileType.SOLE_LEARNER + ) + monitorFactory.waitForNextSuccessfulResult(updateProvider) + + val updatedProfileProvider = profileManagementController.getProfile(PROFILE_ID_0) + val updatedProfile = monitorFactory.waitForNextSuccessfulResult(updatedProfileProvider) + assertThat(updatedProfile.profileType).isEqualTo(ProfileType.SOLE_LEARNER) + } + + @Test + fun testUpdateExistingNonAdminProfile_updateProfileTypeToLearner_checkProfileTypeAddLearner() { + setUpTestApplicationComponent() + addAdminProfile("Admin") + addNonAdminProfileAndWait(name = "Rajat", pin = "01234") + + val updateProvider = profileManagementController.updateProfileType( + PROFILE_ID_1, + ProfileType.ADDITIONAL_LEARNER + ) + monitorFactory.waitForNextSuccessfulResult(updateProvider) + + val updatedProfileProvider = profileManagementController.getProfile(PROFILE_ID_1) + val updatedProfile = monitorFactory.waitForNextSuccessfulResult(updatedProfileProvider) + assertThat(updatedProfile.profileType).isEqualTo(ProfileType.ADDITIONAL_LEARNER) + } + + @Test + fun testUpdateDefaultProfile_profileTypeToSoleLearner_checkProfileTypeSoleLearner() { + setUpTestApplicationComponent() + profileTestHelper.createDefaultAdminProfile() + + val updateProvider = profileManagementController.updateProfileType( + PROFILE_ID_0, + ProfileType.SOLE_LEARNER + ) + monitorFactory.waitForNextSuccessfulResult(updateProvider) + + val updatedProfileProvider = profileManagementController.getProfile(PROFILE_ID_0) + val updatedProfile = monitorFactory.waitForNextSuccessfulResult(updatedProfileProvider) + assertThat(updatedProfile.profileType).isEqualTo(ProfileType.SOLE_LEARNER) + } + + @Test + fun testUpdateDefaultProfile_profileTypeUnspecified_returnsProfileTypeError() { + setUpTestApplicationComponent() + profileTestHelper.createDefaultAdminProfile() + + val updateProvider = profileManagementController.updateProfileType( + PROFILE_ID_0, + ProfileType.PROFILE_TYPE_UNSPECIFIED + ) + + val failure = monitorFactory.waitForNextFailureResult(updateProvider) + assertThat(failure).hasMessageThat().isEqualTo("ProfileType must be set.") + } + private fun addTestProfiles() { val profileAdditionProviders = PROFILES_LIST.map { addNonAdminProfile(it.name, pin = it.pin, allowDownloadAccess = it.allowDownloadAccess) diff --git a/instrumentation/src/java/org/oppia/android/instrumentation/application/BUILD.bazel b/instrumentation/src/java/org/oppia/android/instrumentation/application/BUILD.bazel index 7e7ab58686e..a42115f4021 100644 --- a/instrumentation/src/java/org/oppia/android/instrumentation/application/BUILD.bazel +++ b/instrumentation/src/java/org/oppia/android/instrumentation/application/BUILD.bazel @@ -26,7 +26,6 @@ kt_android_library( "//domain", "//testing/src/main/java/org/oppia/android/testing/firebase:test_authentication_module", "//utility", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", ], diff --git a/instrumentation/src/java/org/oppia/android/instrumentation/application/TestApplicationComponent.kt b/instrumentation/src/java/org/oppia/android/instrumentation/application/TestApplicationComponent.kt index da1c997fc18..65ead6fa8e7 100644 --- a/instrumentation/src/java/org/oppia/android/instrumentation/application/TestApplicationComponent.kt +++ b/instrumentation/src/java/org/oppia/android/instrumentation/application/TestApplicationComponent.kt @@ -49,7 +49,6 @@ import org.oppia.android.util.accessibility.AccessibilityProdModule import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.CachingModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.DebugLogReportingModule @@ -100,7 +99,7 @@ import javax.inject.Singleton SyncStatusModule::class, NetworkConnectionDebugUtilModule::class, MetricLogSchedulerModule::class, ActivityRouterModule::class, PerformanceMetricsAssessorModule::class, PerformanceMetricsConfigurationsModule::class, - TestingBuildFlavorModule::class, EventLoggingConfigurationModule::class, + TestingBuildFlavorModule::class, ExplorationProgressModule::class, CpuPerformanceSnapshotterModule::class, TestAuthenticationModule::class ] diff --git a/model/src/main/proto/arguments.proto b/model/src/main/proto/arguments.proto index 5b9e2c24af6..ac21f121a5d 100644 --- a/model/src/main/proto/arguments.proto +++ b/model/src/main/proto/arguments.proto @@ -281,6 +281,9 @@ message AudioLanguageFragmentArguments { message AudioLanguageFragmentStateBundle { // The default audio language selected by the user. AudioLanguage audio_language = 1; + + // The selected language display name. + OppiaLanguage selected_language = 2; } // Activity Parameters needed to create the policy page. @@ -886,3 +889,27 @@ message IntroActivityParams { // The nickname associated with a newly created profile. string profile_nickname = 1; } + +// Arguments required when creating a new IntroFragment. +message IntroFragmentArguments { + // The nickname associated with a newly created profile. + string profile_nickname = 1; +} + +// Params required when creating a new CreateProfileActivity. +message CreateProfileActivityParams { + // The ProfileType of the new profile as implied by the user's selection. + ProfileType profile_type = 1; +} + +// Arguments required when creating a new CreateProfileFragment. +message CreateProfileFragmentArguments { + // The ProfileType of the new profile as implied by the user's selection. + ProfileType profile_type = 1; +} + +// The bundle of properties that are saved on configuration change in OnboardingFragment. +message OnboardingFragmentStateBundle { + // The current selected language. + OppiaLanguage selected_language = 1; +} diff --git a/model/src/main/proto/profile.proto b/model/src/main/proto/profile.proto index bffdb1ec194..bb55c8b2b47 100644 --- a/model/src/main/proto/profile.proto +++ b/model/src/main/proto/profile.proto @@ -90,6 +90,24 @@ message Profile { // Represents the ID of the classroom that the user selected during their last login. string last_selected_classroom_id = 19; + + // Represents the type of user which informs the configuration options available to them. + ProfileType profile_type = 20; +} + +// Represents the type of user using the app. +enum ProfileType { + // The undefined ProfileType. + PROFILE_TYPE_UNSPECIFIED = 0; + + // Represents a single learner profile without an admin pin set. + SOLE_LEARNER = 1; + + // Represents an admin profile when there are more than one profiles. + SUPERVISOR = 2; + + // Represents a non-admin profile in a multiple profile setup. + ADDITIONAL_LEARNER = 3; } // Represents a profile avatar image. diff --git a/scripts/assets/accessibility_label_exemptions.textproto b/scripts/assets/accessibility_label_exemptions.textproto index a1993f3b4dd..206b77a0466 100644 --- a/scripts/assets/accessibility_label_exemptions.textproto +++ b/scripts/assets/accessibility_label_exemptions.textproto @@ -36,6 +36,7 @@ exempted_activity: "app/src/main/java/org/oppia/android/app/testing/SplashTestAc exempted_activity: "app/src/main/java/org/oppia/android/app/testing/StateAssemblerMarginBindingAdaptersTestActivity" exempted_activity: "app/src/main/java/org/oppia/android/app/testing/StateAssemblerPaddingBindingAdaptersTestActivity" exempted_activity: "app/src/main/java/org/oppia/android/app/testing/TestFontScaleConfigurationUtilActivity" +exempted_activity: "app/src/main/java/org/oppia/android/app/testing/TextInputLayoutBindingAdaptersTestActivity" exempted_activity: "app/src/main/java/org/oppia/android/app/testing/TextViewBindingAdaptersTestActivity" exempted_activity: "app/src/main/java/org/oppia/android/app/testing/TopicRevisionTestActivity" exempted_activity: "app/src/main/java/org/oppia/android/app/testing/TopicTestActivity" diff --git a/scripts/assets/file_content_validation_checks.textproto b/scripts/assets/file_content_validation_checks.textproto index d4e3597a664..fe0d7d9aba9 100644 --- a/scripts/assets/file_content_validation_checks.textproto +++ b/scripts/assets/file_content_validation_checks.textproto @@ -276,6 +276,7 @@ file_content_checks { exempted_file_name: "app/src/main/java/org/oppia/android/app/player/audio/LanguageDialogFragment.kt" exempted_file_name: "app/src/sharedTest/java/org/oppia/android/app/administratorcontrols/AppVersionActivityTest.kt" exempted_file_name: "app/src/sharedTest/java/org/oppia/android/app/home/HomeActivityTest.kt" + exempted_file_name: "app/src/sharedTest/java/org/oppia/android/app/onboarding/OnboardingFragmentTest.kt" exempted_file_name: "app/src/sharedTest/java/org/oppia/android/app/parser/HtmlParserTest.kt" exempted_file_name: "app/src/sharedTest/java/org/oppia/android/app/parser/ListItemLeadingMarginSpanTest.kt" exempted_file_name: "app/src/sharedTest/java/org/oppia/android/app/player/audio/AudioFragmentTest.kt" diff --git a/scripts/assets/test_file_exemptions.textproto b/scripts/assets/test_file_exemptions.textproto index bbc8a2fd872..1ea6be33967 100644 --- a/scripts/assets/test_file_exemptions.textproto +++ b/scripts/assets/test_file_exemptions.textproto @@ -238,18 +238,6 @@ test_file_exemption { exempted_file_path: "app/src/main/java/org/oppia/android/app/application/alpha/AlphaOppiaApplication.kt" test_file_not_required: true } -test_file_exemption { - exempted_file_path: "app/src/main/java/org/oppia/android/app/application/alphakenya/AlphaKenyaApplicationComponent.kt" - test_file_not_required: true -} -test_file_exemption { - exempted_file_path: "app/src/main/java/org/oppia/android/app/application/alphakenya/AlphaKenyaBuildFlavorModule.kt" - test_file_not_required: true -} -test_file_exemption { - exempted_file_path: "app/src/main/java/org/oppia/android/app/application/alphakenya/AlphaKenyaOppiaApplication.kt" - test_file_not_required: true -} test_file_exemption { exempted_file_path: "app/src/main/java/org/oppia/android/app/application/beta/BetaApplicationComponent.kt" test_file_not_required: true @@ -1342,6 +1330,10 @@ test_file_exemption { exempted_file_path: "app/src/main/java/org/oppia/android/app/onboarding/OnboardingViewModel.kt" test_file_not_required: true } +test_file_exemption { + exempted_file_path: "app/src/main/java/org/oppia/android/app/onboarding/OnboardingAppLanguageViewModel.kt" + test_file_not_required: true +} test_file_exemption { exempted_file_path: "app/src/main/java/org/oppia/android/app/onboarding/OnboardingViewPagerViewModel.kt" test_file_not_required: true @@ -2378,6 +2370,10 @@ test_file_exemption { exempted_file_path: "app/src/main/java/org/oppia/android/app/testing/BindableAdapterTestActivity.kt" test_file_not_required: true } +test_file_exemption { + exempted_file_path: "app/src/main/java/org/oppia/android/app/testing/TextInputLayoutBindingAdaptersTestActivity.kt" + test_file_not_required: true +} test_file_exemption { exempted_file_path: "app/src/main/java/org/oppia/android/app/testing/BindableAdapterTestDataModel.kt" test_file_not_required: true @@ -2410,6 +2406,10 @@ test_file_exemption { exempted_file_path: "app/src/main/java/org/oppia/android/app/testing/ColorBindingAdaptersTestFragment.kt" test_file_not_required: true } +test_file_exemption { + exempted_file_path: "app/src/main/java/org/oppia/android/app/testing/TextInputLayoutBindingAdaptersTestFragment.kt" + test_file_not_required: true +} test_file_exemption { exempted_file_path: "app/src/main/java/org/oppia/android/app/testing/ConceptCardFragmentTestActivity.kt" test_file_not_required: true @@ -3530,10 +3530,6 @@ test_file_exemption { exempted_file_path: "domain/src/main/java/org/oppia/android/domain/hintsandsolution/HintHandlerProdImpl.kt" source_file_is_incompatible_with_code_coverage: true } -test_file_exemption { - exempted_file_path: "domain/src/main/java/org/oppia/android/domain/hintsandsolution/HintsAndSolutionConfigAlphaKenyaModule.kt" - test_file_not_required: true -} test_file_exemption { exempted_file_path: "domain/src/main/java/org/oppia/android/domain/hintsandsolution/HintsAndSolutionConfigFastShowTestModule.kt" test_file_not_required: true @@ -3670,10 +3666,6 @@ test_file_exemption { exempted_file_path: "domain/src/main/java/org/oppia/android/domain/oppialogger/survey/SurveyEventsLogger.kt" source_file_is_incompatible_with_code_coverage: true } -test_file_exemption { - exempted_file_path: "domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterAlphaKenyaModule.kt" - test_file_not_required: true -} test_file_exemption { exempted_file_path: "domain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterAlphaModule.kt" test_file_not_required: true @@ -4318,6 +4310,10 @@ test_file_exemption { exempted_file_path: "utility/src/main/java/org/oppia/android/util/extensions/ContextExtensions.kt" test_file_not_required: true } +test_file_exemption { + exempted_file_path: "utility/src/main/java/org/oppia/android/util/enumfilter/EnumFilterUtil.kt" + test_file_not_required: true +} test_file_exemption { exempted_file_path: "utility/src/main/java/org/oppia/android/util/extensions/StringExtensions.kt" source_file_is_incompatible_with_code_coverage: true @@ -4362,26 +4358,10 @@ test_file_exemption { exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/ConsoleLoggerInjectorProvider.kt" test_file_not_required: true } -test_file_exemption { - exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/EventLoggingConfigurationModule.kt" - override_min_coverage_percent_required: 0 -} -test_file_exemption { - exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/EventTypeToHumanReadableNameConverter.kt" - test_file_not_required: true -} test_file_exemption { exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/ExceptionLogger.kt" test_file_not_required: true } -test_file_exemption { - exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/KenyaAlphaEventLoggingConfigurationModule.kt" - override_min_coverage_percent_required: 0 -} -test_file_exemption { - exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/KenyaAlphaEventTypeToHumanReadableNameConverterImpl.kt" - test_file_not_required: true -} test_file_exemption { exempted_file_path: "utility/src/main/java/org/oppia/android/util/logging/LogLevel.kt" test_file_not_required: true diff --git a/scripts/buf_lint_check.sh b/scripts/buf_lint_check.sh index c5cbfed35ec..b355f2af16b 100644 --- a/scripts/buf_lint_check.sh +++ b/scripts/buf_lint_check.sh @@ -1,5 +1,7 @@ #!/bin/bash +source scripts/formatting.sh + jar_file_path=$? config_file_path=$? os_type=$? @@ -15,11 +17,11 @@ lint_protobuf_files() { status=$? if [ "$status" = 0 ] ; then - echo "Protobuf lint check completed successfully" + echo_success "Protobuf lint check completed successfully" exit 0 else echo "********************************" - echo "Protobuf lint check issues found. Please fix them before pushing your code." + echo_error "Protobuf lint check issues found. Please fix them before pushing your code." echo "********************************" exit 1 fi @@ -57,7 +59,7 @@ check_os_type() { elif [[ "$OSTYPE" == "darwin"* ]]; then os_type="Darwin" else - echo "Protobuf lint check not available on $OSTYPE" + echo_error "Protobuf lint check not available on $OSTYPE" exit 0 fi } diff --git a/scripts/buildifier_lint_check.sh b/scripts/buildifier_lint_check.sh index 52e0857468e..b56487f6b2f 100644 --- a/scripts/buildifier_lint_check.sh +++ b/scripts/buildifier_lint_check.sh @@ -1,5 +1,7 @@ #!/bin/bash +source scripts/formatting.sh + echo "********************************" echo "Checking Bazel file formatting" echo "********************************" @@ -19,12 +21,12 @@ $buildifier_file_path --lint=warn --mode=check --warnings=-native-android,+out-o status=$? if [ "$status" = 0 ] ; then - echo "Buildifier lint check completed successfully" + echo_success "Buildifier lint check completed successfully" exit 0 else # Assume any lint output or non-zero exit code is a failure. echo "********************************" - echo "Buildifier issue found." + echo_error "Buildifier issue found." echo "Please fix the above issues." echo "********************************" exit 1 diff --git a/scripts/checkstyle_lint_check.sh b/scripts/checkstyle_lint_check.sh index 668be1ba670..1b682d8b615 100644 --- a/scripts/checkstyle_lint_check.sh +++ b/scripts/checkstyle_lint_check.sh @@ -1,5 +1,7 @@ #!/bin/bash +source scripts/formatting.sh + echo "********************************" echo "Checking Java file formatting" echo "********************************" @@ -23,11 +25,11 @@ echo $lint_results if [ "$lint_command_result" -ne 0 ] || [ -z "$lint_results" ] || [[ ${lint_results} == *"[WARN]"* ]]; then # Assume any lint output or non-zero exit code is a failure. echo "********************************" - echo "Checkstyle issue found." + echo_error "Checkstyle issue found." echo "Please fix the above issues." echo "********************************" exit 1 else - echo "Checkstyle lint check completed successfully" + echo_success "Checkstyle lint check completed successfully" exit 0 fi diff --git a/scripts/feature_flags_check.sh b/scripts/feature_flags_check.sh index 48e61153a70..92b0e07a10e 100644 --- a/scripts/feature_flags_check.sh +++ b/scripts/feature_flags_check.sh @@ -1,5 +1,7 @@ #!/bin/bash +source scripts/formatting.sh + echo "********************************" echo "Running feature flag checks" echo "********************************" @@ -120,7 +122,7 @@ function perform_checks_on_feature_flags() { in_array=$(item_in_array "$element" "${imported_classes[@]}") if [[ $in_array -ne 1 ]]; then failed_checks=$((failed_checks + 1)) - echo "$element is not imported in the constructor argument in $file_path at line $imports_line_number" + echo_error "$element is not imported in the constructor argument in $file_path at line $imports_line_number" fi done @@ -128,16 +130,16 @@ function perform_checks_on_feature_flags() { in_array=$(item_in_array "$element" "${flags_added_to_map[@]}") if [[ $in_array -ne 1 ]]; then failed_checks=$((failed_checks + 1)) - echo "$element is not added to the logging map in $file_path at line $flags_map_line_number" + echo_error "$element is not added to the logging map in $file_path at line $flags_map_line_number" fi done if [[ $failed_checks -eq 0 ]]; then - echo "Feature flag checks completed successfully" + echo_success "Feature flag checks completed successfully" exit 0 else echo "********************************" - echo "Feature flag issues found." + echo_error "Feature flag issues found." echo "Please fix the above issues." echo "********************************" exit 1 diff --git a/scripts/formatting.sh b/scripts/formatting.sh new file mode 100644 index 00000000000..0fd2c2dac94 --- /dev/null +++ b/scripts/formatting.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +#Defines color codes for output formatting + +# Red color for error messages +RED='\033[0;31m' + +# Green color for success messages +GREEN='\033[0;32m' + +# Yellow color for warnings messages +YELLOW='\033[0;33m' + +# No color, used to reset the color after each message +NC='\033[0m' + +# Function to print an error message in red +function echo_error() { + echo -e "${RED}$1${NC}" +} + +# Function to print a success message in green +function echo_success() { + echo -e "${GREEN}$1${NC}" +} + +# Function to print a warning message in yellow +function echo_warning() { + echo -e "${YELLOW}$1${NC}" +} diff --git a/scripts/ktlint_lint_check.sh b/scripts/ktlint_lint_check.sh index 2713b88d0e0..dab25e7bd64 100755 --- a/scripts/ktlint_lint_check.sh +++ b/scripts/ktlint_lint_check.sh @@ -1,5 +1,7 @@ #!/bin/bash +source scripts/formatting.sh + echo "********************************" echo "Checking code formatting" echo "********************************" @@ -19,15 +21,15 @@ java -jar $jar_file_path --android app/src/**/*.kt data/src/**/*.kt domain/src/* status=$? if [ "$status" = 0 ] ; then - echo "Lint completed successfully." + echo_success "Lint completed successfully." exit 0 else echo "********************************" - echo "Ktlint issue found." + echo_error "Ktlint issue found." echo "Please fix the above issues. You can also use the java -jar $jar_file_path -F --android domain/src/**/*.kt utility/src/**/*.kt data/src/**/*.kt app/src/**/*.kt testing/src/**/*.kt scripts/src/**/*.kt instrumentation/src/**/*.kt command to fix the most common issues." - echo "Please note, there might be a possibility where the above command will not fix the issue. + echo_warning "Please note, there might be a possibility where the above command will not fix the issue. In that case, you will have to fix it yourself." echo "********************************" exit 1 diff --git a/scripts/pre-push.sh b/scripts/pre-push.sh index 13d37eeb20e..ea2878926de 100755 --- a/scripts/pre-push.sh +++ b/scripts/pre-push.sh @@ -1,5 +1,7 @@ #!/bin/bash +source scripts/formatting.sh + # This script will run the pre-push checks in the given order # - ktlint # - checkstyle @@ -7,7 +9,7 @@ # - (others in the future) if bash scripts/ktlint_lint_check.sh && bash scripts/checkstyle_lint_check.sh && bash scripts/buf_lint_check.sh ; then - echo "All checks passed successfully" + echo_success "All checks passed successfully" exit 0 else exit 1 diff --git a/testing/src/main/java/org/oppia/android/testing/espresso/EditTextInputAction.kt b/testing/src/main/java/org/oppia/android/testing/espresso/EditTextInputAction.kt index 0f038c038e3..b65dd4f976b 100644 --- a/testing/src/main/java/org/oppia/android/testing/espresso/EditTextInputAction.kt +++ b/testing/src/main/java/org/oppia/android/testing/espresso/EditTextInputAction.kt @@ -50,7 +50,7 @@ class EditTextInputAction @Inject constructor( override fun perform(uiController: UiController?, view: View?) { // Appending text only works on Robolectric, whereas Espresso needs to use typeText(). if (Build.FINGERPRINT.contains("robolectric", ignoreCase = true)) { - (view as? EditText)?.append(text) + (view as? EditText)?.setText(text) testCoroutineDispatchers.runCurrent() } else baseAction.perform(uiController, view) } diff --git a/testing/src/main/java/org/oppia/android/testing/profile/ProfileTestHelper.kt b/testing/src/main/java/org/oppia/android/testing/profile/ProfileTestHelper.kt index 3dc71a049a1..a5e877fa705 100644 --- a/testing/src/main/java/org/oppia/android/testing/profile/ProfileTestHelper.kt +++ b/testing/src/main/java/org/oppia/android/testing/profile/ProfileTestHelper.kt @@ -76,6 +76,16 @@ class ProfileTestHelper @Inject constructor( } } + /** Creates one admin profile with default values for all fields. */ + fun createDefaultAdminProfile() { + addProfileAndWait( + name = "", + pin = "", + allowDownloadAccess = false, + isAdmin = true + ) + } + /** Log in to admin profile. */ fun logIntoAdmin() = logIntoProfile(internalProfileId = 0) diff --git a/testing/src/test/java/org/oppia/android/testing/junit/BUILD.bazel b/testing/src/test/java/org/oppia/android/testing/junit/BUILD.bazel index 69c6c6cbdca..e4b1a3de3ed 100644 --- a/testing/src/test/java/org/oppia/android/testing/junit/BUILD.bazel +++ b/testing/src/test/java/org/oppia/android/testing/junit/BUILD.bazel @@ -52,7 +52,6 @@ oppia_android_test( "//utility/src/main/java/org/oppia/android/util/locale:prod_module", "//utility/src/main/java/org/oppia/android/util/locale/testing:test_module", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_util_module", @@ -106,7 +105,6 @@ oppia_android_test( "//utility/src/main/java/org/oppia/android/util/locale:prod_module", "//utility/src/main/java/org/oppia/android/util/locale/testing:test_module", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_util_module", @@ -161,7 +159,6 @@ oppia_android_test( "//utility/src/main/java/org/oppia/android/util/locale:prod_module", "//utility/src/main/java/org/oppia/android/util/locale/testing:test_module", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_util_module", diff --git a/testing/src/test/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRuleCustomContextTest.kt b/testing/src/test/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRuleCustomContextTest.kt index 57a3bd0babf..ba70eadf910 100644 --- a/testing/src/test/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRuleCustomContextTest.kt +++ b/testing/src/test/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRuleCustomContextTest.kt @@ -69,7 +69,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -270,7 +269,7 @@ class InitializeDefaultLocaleRuleCustomContextTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/testing/src/test/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRuleOmissionTest.kt b/testing/src/test/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRuleOmissionTest.kt index c90ef4ab183..eaaf0521394 100644 --- a/testing/src/test/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRuleOmissionTest.kt +++ b/testing/src/test/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRuleOmissionTest.kt @@ -67,7 +67,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -146,7 +145,7 @@ class InitializeDefaultLocaleRuleOmissionTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/testing/src/test/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRuleTest.kt b/testing/src/test/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRuleTest.kt index a3518296ea9..cf6b0da998c 100644 --- a/testing/src/test/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRuleTest.kt +++ b/testing/src/test/java/org/oppia/android/testing/junit/InitializeDefaultLocaleRuleTest.kt @@ -70,7 +70,6 @@ import org.oppia.android.util.caching.AssetModule import org.oppia.android.util.caching.testing.CachingTestModule import org.oppia.android.util.gcsresource.GcsResourceModule import org.oppia.android.util.locale.LocaleProdModule -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.firebase.FirebaseLogUploaderModule @@ -150,7 +149,7 @@ class InitializeDefaultLocaleRuleTest { MathEquationInputModule::class, SplitScreenInteractionModule::class, LoggingIdentifierModule::class, ApplicationLifecycleModule::class, SyncStatusModule::class, MetricLogSchedulerModule::class, TestingBuildFlavorModule::class, - EventLoggingConfigurationModule::class, ActivityRouterModule::class, + ActivityRouterModule::class, CpuPerformanceSnapshotterModule::class, ExplorationProgressModule::class, TestAuthenticationModule::class ] diff --git a/testing/src/test/java/org/oppia/android/testing/profile/ProfileTestHelperTest.kt b/testing/src/test/java/org/oppia/android/testing/profile/ProfileTestHelperTest.kt index dcddadc11ab..74c9ab3846c 100644 --- a/testing/src/test/java/org/oppia/android/testing/profile/ProfileTestHelperTest.kt +++ b/testing/src/test/java/org/oppia/android/testing/profile/ProfileTestHelperTest.kt @@ -102,6 +102,18 @@ class ProfileTestHelperTest { assertThat(profiles).hasSize(10) } + @Test + fun testAddDefaultProfile_createDefaultProfile_checkProfileIsAdded() { + profileTestHelper.createDefaultAdminProfile() + testCoroutineDispatchers.runCurrent() + val profilesProvider = profileManagementController.getProfiles() + testCoroutineDispatchers.runCurrent() + + val profiles = monitorFactory.waitForNextSuccessfulResult(profilesProvider) + assertThat(profiles).hasSize(1) + assertThat(profiles.first().isAdmin).isTrue() + } + @Test fun testLogIntoAdmin_initializeProfiles_logIntoAdmin_checkIsSuccessful() { profileTestHelper.initializeProfiles() diff --git a/utility/src/main/java/org/oppia/android/util/enumfilter/BUILD.bazel b/utility/src/main/java/org/oppia/android/util/enumfilter/BUILD.bazel new file mode 100644 index 00000000000..876c262fe1a --- /dev/null +++ b/utility/src/main/java/org/oppia/android/util/enumfilter/BUILD.bazel @@ -0,0 +1,13 @@ +""" +General purpose utility for filtering enums. +""" + +load("@io_bazel_rules_kotlin//kotlin:android.bzl", "kt_android_library") + +kt_android_library( + name = "enum_filter_util", + srcs = [ + "EnumFilterUtil.kt", + ], + visibility = ["//:oppia_api_visibility"], +) diff --git a/utility/src/main/java/org/oppia/android/util/enumfilter/EnumFilterUtil.kt b/utility/src/main/java/org/oppia/android/util/enumfilter/EnumFilterUtil.kt new file mode 100644 index 00000000000..6c2aae441d6 --- /dev/null +++ b/utility/src/main/java/org/oppia/android/util/enumfilter/EnumFilterUtil.kt @@ -0,0 +1,20 @@ +package org.oppia.android.util.enumfilter + +/** + * Filters a collection based on a condition applied to an enum property of each element. + * + * @param E the type of enum values. + * @param T the type of elements in the collection. + * @param collection the collection of elements to filter. + * @param enumExtractor a function that extracts the enum value from each element. + * @param condition a predicate function that determines if an enum value should be included in the result. + * @return a list of elements from the collection that satisfy the condition when their enum property is evaluated. + */ + +inline fun , T> filterByEnumCondition( + collection: Collection, + enumExtractor: (T) -> E, + condition: (E) -> Boolean +): List { + return collection.filter { condition(enumExtractor(it)) } +} diff --git a/utility/src/main/java/org/oppia/android/util/logging/BUILD.bazel b/utility/src/main/java/org/oppia/android/util/logging/BUILD.bazel index 0b8fc767cb7..de80cc82f38 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/BUILD.bazel +++ b/utility/src/main/java/org/oppia/android/util/logging/BUILD.bazel @@ -117,6 +117,7 @@ kt_android_library( ], deps = [ "//model/src/main/proto:event_logger_java_proto_lite", + "//third_party:javax_inject_javax_inject", ], ) @@ -136,32 +137,6 @@ kt_android_library( ], ) -kt_android_library( - name = "standard_event_logging_configuration_module", - srcs = [ - "EventLoggingConfigurationModule.kt", - "StandardEventTypeToHumanReadableNameConverterImpl.kt", - ], - visibility = ["//:oppia_prod_module_visibility"], - deps = [ - ":event_type_to_human_readable_name_converter", - "//:dagger", - ], -) - -kt_android_library( - name = "kenya_alpha_event_logging_configuration_module", - srcs = [ - "KenyaAlphaEventLoggingConfigurationModule.kt", - "KenyaAlphaEventTypeToHumanReadableNameConverterImpl.kt", - ], - visibility = ["//:oppia_prod_module_visibility"], - deps = [ - ":event_type_to_human_readable_name_converter", - "//:dagger", - ], -) - kt_android_library( name = "log_uploader", srcs = [ diff --git a/utility/src/main/java/org/oppia/android/util/logging/ConsoleLogger.kt b/utility/src/main/java/org/oppia/android/util/logging/ConsoleLogger.kt index 2b1cd2637a1..3cd6f8707e1 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/ConsoleLogger.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/ConsoleLogger.kt @@ -11,6 +11,8 @@ import org.oppia.android.app.model.EventLog.ConsoleLoggerContext import org.oppia.android.util.locale.OppiaLocale import org.oppia.android.util.threading.BlockingDispatcher import java.io.File +import java.io.FileWriter +import java.io.PrintWriter import javax.inject.Inject import javax.inject.Singleton @@ -33,6 +35,8 @@ class ConsoleLogger @Inject constructor( */ val logErrorMessagesFlow: SharedFlow = _logErrorMessagesFlow + private var printWriter: PrintWriter? = null + /** Logs a verbose message with the specified tag. */ fun v(tag: String, msg: String) { writeLog(LogLevel.VERBOSE, tag, msg) @@ -73,12 +77,12 @@ class ConsoleLogger @Inject constructor( writeError(LogLevel.WARNING, tag, msg, tr) } - /** Logs a error message with the specified tag. */ + /** Logs an error message with the specified tag. */ fun e(tag: String, msg: String) { writeLog(LogLevel.ERROR, tag, msg) } - /** Logs a error message with the specified tag, message and exception. */ + /** Logs an error message with the specified tag, message and exception. */ fun e(tag: String, msg: String, tr: Throwable?) { writeError(LogLevel.ERROR, tag, msg, tr) } @@ -109,7 +113,7 @@ class ConsoleLogger @Inject constructor( } // Add the log to the error message flow so it can be logged to firebase. - CoroutineScope(blockingDispatcher).launch { + blockingScope.launch { // Only log error messages to firebase. if (logLevel == LogLevel.ERROR) { _logErrorMessagesFlow.emit( @@ -124,10 +128,17 @@ class ConsoleLogger @Inject constructor( } /** - * Writes the specified text line to file in a background thread to ensure that saving messages don't block the main - * thread. A blocking dispatcher is used to ensure messages are written in order. + * Writes the specified text line to file in a background thread to ensure that saving messages + * doesn't block the main thread. A blocking dispatcher is used to ensure messages are written + * in order. */ private fun logToFileInBackground(text: String) { - blockingScope.launch { logDirectory.printWriter().use { out -> out.println(text) } } + blockingScope.launch { + if (printWriter == null) { + printWriter = PrintWriter(FileWriter(logDirectory, true)) // Open in append mode. + } + printWriter?.println(text) + printWriter?.flush() + } } } diff --git a/utility/src/main/java/org/oppia/android/util/logging/EventLoggingConfigurationModule.kt b/utility/src/main/java/org/oppia/android/util/logging/EventLoggingConfigurationModule.kt deleted file mode 100644 index 57c88d8d2c9..00000000000 --- a/utility/src/main/java/org/oppia/android/util/logging/EventLoggingConfigurationModule.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.oppia.android.util.logging - -import dagger.Binds -import dagger.Module - -/** Module to provide standard configurations for the event logging infrastructure. */ -@Module -interface EventLoggingConfigurationModule { - @Binds - fun bindStandardEventTypeToHumanReadableNameConverter( - impl: StandardEventTypeToHumanReadableNameConverterImpl - ): EventTypeToHumanReadableNameConverter -} diff --git a/utility/src/main/java/org/oppia/android/util/logging/EventTypeToHumanReadableNameConverter.kt b/utility/src/main/java/org/oppia/android/util/logging/EventTypeToHumanReadableNameConverter.kt index c6c3c849e40..687e08dcc92 100644 --- a/utility/src/main/java/org/oppia/android/util/logging/EventTypeToHumanReadableNameConverter.kt +++ b/utility/src/main/java/org/oppia/android/util/logging/EventTypeToHumanReadableNameConverter.kt @@ -1,21 +1,87 @@ package org.oppia.android.util.logging -import org.oppia.android.app.model.EventLog +import org.oppia.android.app.model.EventLog.Context.ActivityContextCase +import javax.inject.Inject /** * Converter for event types into loggable, human-readable names. * - * Different builds of the app may leverage different implementations of this converter in order to - * customize the event names for querying purposes. + * The provided names may be changed over time as the broad standard for event names evolves with + * new and changed events. The general convention for event names is a second person singular + * conjugated action verb followed by the action, context, or both, that the user conducted that led + * to that event. Furthermore, efforts are taken to reduce referencing Android-specific terminology + * (e.g. 'screen' is used in place of 'activity'). + * + * Event names cannot exceed 40 characters, so care should be taken to ensure only the most + * important information is conveyed via the name. + * + * Finally, the provided event names are only meant to help simplify analyzing logged events. Since + * they can change, aggregation or dimensional slicing of events should occur by keying on the + * event's integral type rather than its name (as this type will remain fixed for the lifetime of a + * given event, unlike its name returned by this implementation). */ -interface EventTypeToHumanReadableNameConverter { +class EventTypeToHumanReadableNameConverter @Inject constructor() { /** - * Returns a human-readable event name for the specified [eventType]. + * Converts an event type to a human-readable name. * - * Note that the same name should always be returned for a given event type within the same - * version of the app (though the names can change across versions). The returned name should not - * contain any personal information nor any information tied to users; they should be constant - * regardless of the current logged in/created profile state of the app. + * @param eventType The type of event to convert. + * @return A human-readable string representation of the event type. */ - fun convertToHumanReadableName(eventType: EventLog.Context.ActivityContextCase): String + fun convertToHumanReadableName(eventType: ActivityContextCase): String { + return when (eventType) { + ActivityContextCase.OPEN_EXPLORATION_ACTIVITY -> "open_exploration_player_screen" + ActivityContextCase.OPEN_INFO_TAB -> "select_topic_info_tab" + ActivityContextCase.OPEN_LESSONS_TAB -> "select_topic_lessons_tab" + ActivityContextCase.OPEN_PRACTICE_TAB -> "select_topic_practice_tab" + ActivityContextCase.OPEN_REVISION_TAB -> "select_topic_revision_tab" + ActivityContextCase.OPEN_QUESTION_PLAYER -> "open_question_player_screen" + ActivityContextCase.OPEN_STORY_ACTIVITY -> "open_story_chapter_list_screen" + ActivityContextCase.OPEN_CONCEPT_CARD -> "open_concept_card" + ActivityContextCase.OPEN_REVISION_CARD -> "open_revision_card" + ActivityContextCase.CLOSE_REVISION_CARD -> "close_revision_card" + ActivityContextCase.START_CARD_CONTEXT -> "start_exploration_card" + ActivityContextCase.END_CARD_CONTEXT -> "end_exploration_card" + ActivityContextCase.HINT_UNLOCKED_CONTEXT -> "unlock_hint" + ActivityContextCase.REVEAL_HINT_CONTEXT -> "reveal_hint" + ActivityContextCase.VIEW_EXISTING_HINT_CONTEXT -> "view_existing_hint" + ActivityContextCase.SOLUTION_UNLOCKED_CONTEXT -> "unlock_solution" + ActivityContextCase.REVEAL_SOLUTION_CONTEXT -> "reveal_solution" + ActivityContextCase.VIEW_EXISTING_SOLUTION_CONTEXT -> "view_existing_solution" + ActivityContextCase.SUBMIT_ANSWER_CONTEXT -> "submit_answer" + ActivityContextCase.PLAY_VOICE_OVER_CONTEXT -> "click_play_voiceover_button" + ActivityContextCase.PAUSE_VOICE_OVER_CONTEXT -> "click_pause_voiceover_button" + ActivityContextCase.APP_IN_BACKGROUND_CONTEXT -> "send_app_to_background" + ActivityContextCase.APP_IN_FOREGROUND_CONTEXT -> "bring_app_to_foreground" + ActivityContextCase.START_EXPLORATION_CONTEXT -> "start_exploration_context" + ActivityContextCase.EXIT_EXPLORATION_CONTEXT -> "leave_exploration" + ActivityContextCase.FINISH_EXPLORATION_CONTEXT -> "complete_exploration" + ActivityContextCase.PROGRESS_SAVING_SUCCESS_CONTEXT -> "progress_saving_success" + ActivityContextCase.PROGRESS_SAVING_FAILURE_CONTEXT -> "progress_saving_failure" + ActivityContextCase.LESSON_SAVED_ADVERTENTLY_CONTEXT -> "lesson_saved_advertently" + ActivityContextCase.RESUME_LESSON_SUBMIT_CORRECT_ANSWER_CONTEXT -> + "submit_correct_ans_in_resumed_lesson" + ActivityContextCase.RESUME_LESSON_SUBMIT_INCORRECT_ANSWER_CONTEXT -> + "submit_incorrect_ans_in_resumed_lesson" + ActivityContextCase.RESUME_EXPLORATION_CONTEXT -> "resume_in_progress_exploration" + ActivityContextCase.START_OVER_EXPLORATION_CONTEXT -> "restart_in_progress_exploration" + ActivityContextCase.DELETE_PROFILE_CONTEXT -> "delete_profile" + ActivityContextCase.OPEN_HOME -> "open_home_screen" + ActivityContextCase.OPEN_PROFILE_CHOOSER -> "open_profile_chooser_screen" + ActivityContextCase.REACH_INVESTED_ENGAGEMENT -> "reach_invested_engagement" + ActivityContextCase.SWITCH_IN_LESSON_LANGUAGE -> "click_switch_language_in_lesson" + ActivityContextCase.SHOW_SURVEY_POPUP -> "show_survey_popup" + ActivityContextCase.BEGIN_SURVEY -> "begin_survey" + ActivityContextCase.ABANDON_SURVEY -> "abandon_survey" + ActivityContextCase.MANDATORY_RESPONSE -> "mandatory_response" + ActivityContextCase.OPTIONAL_RESPONSE -> "optional_response" + ActivityContextCase.FEATURE_FLAG_LIST_CONTEXT -> "feature_flag_list" + ActivityContextCase.INSTALL_ID_FOR_FAILED_ANALYTICS_LOG, + ActivityContextCase.ACTIVITYCONTEXT_NOT_SET -> "ERROR_internal_logging_failure" + ActivityContextCase.COMPLETE_APP_ONBOARDING -> "complete_app_onboarding" + ActivityContextCase.CONSOLE_LOG -> "console_log" + ActivityContextCase.RETROFIT_CALL_CONTEXT -> "retrofit_call_context" + ActivityContextCase.RETROFIT_CALL_FAILED_CONTEXT -> "retrofit_call_failed_context" + ActivityContextCase.APP_IN_FOREGROUND_TIME -> "app_in_foreground_time" + } + } } diff --git a/utility/src/main/java/org/oppia/android/util/logging/KenyaAlphaEventLoggingConfigurationModule.kt b/utility/src/main/java/org/oppia/android/util/logging/KenyaAlphaEventLoggingConfigurationModule.kt deleted file mode 100644 index 447525e5488..00000000000 --- a/utility/src/main/java/org/oppia/android/util/logging/KenyaAlphaEventLoggingConfigurationModule.kt +++ /dev/null @@ -1,16 +0,0 @@ -package org.oppia.android.util.logging - -import dagger.Binds -import dagger.Module - -/** - * Module to provide event logging infrastructure configurations specific to Kenya study alpha - * builds of the app. - */ -@Module -interface KenyaAlphaEventLoggingConfigurationModule { - @Binds - fun bindKenyaAlphaSpecificEventTypeToHumanReadableNameConverter( - impl: KenyaAlphaEventTypeToHumanReadableNameConverterImpl - ): EventTypeToHumanReadableNameConverter -} diff --git a/utility/src/main/java/org/oppia/android/util/logging/KenyaAlphaEventTypeToHumanReadableNameConverterImpl.kt b/utility/src/main/java/org/oppia/android/util/logging/KenyaAlphaEventTypeToHumanReadableNameConverterImpl.kt deleted file mode 100644 index bb7e96e643b..00000000000 --- a/utility/src/main/java/org/oppia/android/util/logging/KenyaAlphaEventTypeToHumanReadableNameConverterImpl.kt +++ /dev/null @@ -1,73 +0,0 @@ -package org.oppia.android.util.logging - -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase -import javax.inject.Inject - -// TODO(#4419): Remove this implementation and the extra piping for event name mapping. -/** - * Implementation of [EventTypeToHumanReadableNameConverter] which provides legacy event names for - * interoperability with previously logged data in the Kenya user study. - * - * The event names provided by this implementation are expected to never change as these names are - * the primary ways each corresponding event is identified in logged event queries. - */ -class KenyaAlphaEventTypeToHumanReadableNameConverterImpl @Inject constructor() : - EventTypeToHumanReadableNameConverter { - override fun convertToHumanReadableName(eventType: ActivityContextCase): String { - return when (eventType) { - ActivityContextCase.OPEN_EXPLORATION_ACTIVITY -> "open_exploration_activity" - ActivityContextCase.OPEN_INFO_TAB -> "open_info_tab" - ActivityContextCase.OPEN_LESSONS_TAB -> "open_lessons_tab" - ActivityContextCase.OPEN_PRACTICE_TAB -> "open_practice_tab" - ActivityContextCase.OPEN_REVISION_TAB -> "open_revision_tab" - ActivityContextCase.OPEN_QUESTION_PLAYER -> "open_question_player" - ActivityContextCase.OPEN_STORY_ACTIVITY -> "open_story_activity" - ActivityContextCase.OPEN_CONCEPT_CARD -> "open_concept_card" - ActivityContextCase.OPEN_REVISION_CARD -> "open_revision_card" - ActivityContextCase.CLOSE_REVISION_CARD -> "close_revision_card" - ActivityContextCase.START_CARD_CONTEXT -> "start_card_context" - ActivityContextCase.END_CARD_CONTEXT -> "end_card_context" - ActivityContextCase.HINT_UNLOCKED_CONTEXT -> "hint_offered_context" - ActivityContextCase.REVEAL_HINT_CONTEXT -> "reveal_hint_context" - ActivityContextCase.VIEW_EXISTING_HINT_CONTEXT -> "view_existing_hint_context" - ActivityContextCase.SOLUTION_UNLOCKED_CONTEXT -> "solution_offered_context" - ActivityContextCase.REVEAL_SOLUTION_CONTEXT -> "reveal_solution_context" - ActivityContextCase.VIEW_EXISTING_SOLUTION_CONTEXT -> "view_existing_solution_context" - ActivityContextCase.SUBMIT_ANSWER_CONTEXT -> "submit_answer_context" - ActivityContextCase.PLAY_VOICE_OVER_CONTEXT -> "play_voice_over_context" - ActivityContextCase.PAUSE_VOICE_OVER_CONTEXT -> "pause_voice_over_context" - ActivityContextCase.APP_IN_BACKGROUND_CONTEXT -> "app_in_background_context" - ActivityContextCase.APP_IN_FOREGROUND_CONTEXT -> "app_in_foreground_context" - ActivityContextCase.START_EXPLORATION_CONTEXT -> "start_exploration_context" - ActivityContextCase.EXIT_EXPLORATION_CONTEXT -> "exit_exploration_context" - ActivityContextCase.FINISH_EXPLORATION_CONTEXT -> "finish_exploration_context" - ActivityContextCase.PROGRESS_SAVING_SUCCESS_CONTEXT -> "progress_saving_success_context" - ActivityContextCase.PROGRESS_SAVING_FAILURE_CONTEXT -> "progress_saving_failure_context" - ActivityContextCase.LESSON_SAVED_ADVERTENTLY_CONTEXT -> "lesson_saved_advertently_context" - ActivityContextCase.RESUME_LESSON_SUBMIT_CORRECT_ANSWER_CONTEXT -> - "resume_lesson_submit_correct_answer_context" - ActivityContextCase.RESUME_LESSON_SUBMIT_INCORRECT_ANSWER_CONTEXT -> - "resume_lesson_submit_incorrect_answer_context" - ActivityContextCase.RESUME_EXPLORATION_CONTEXT -> "resume_exploration_context" - ActivityContextCase.START_OVER_EXPLORATION_CONTEXT -> "start_over_exploration_context" - ActivityContextCase.DELETE_PROFILE_CONTEXT -> "delete_profile_context" - ActivityContextCase.OPEN_HOME -> "open_home" - ActivityContextCase.OPEN_PROFILE_CHOOSER -> "open_profile_chooser" - ActivityContextCase.REACH_INVESTED_ENGAGEMENT -> "reached_invested_engagement" - ActivityContextCase.SWITCH_IN_LESSON_LANGUAGE -> "switch_in_lesson_language" - ActivityContextCase.SHOW_SURVEY_POPUP -> "show_survey_popup" - ActivityContextCase.BEGIN_SURVEY -> "begin_survey" - ActivityContextCase.ABANDON_SURVEY -> "abandon_survey" - ActivityContextCase.MANDATORY_RESPONSE -> "mandatory_response" - ActivityContextCase.OPTIONAL_RESPONSE -> "optional_response" - ActivityContextCase.FEATURE_FLAG_LIST_CONTEXT -> "feature_flag_list" - ActivityContextCase.INSTALL_ID_FOR_FAILED_ANALYTICS_LOG -> "failed_analytics_log" - ActivityContextCase.ACTIVITYCONTEXT_NOT_SET -> "unknown_activity_context" - ActivityContextCase.COMPLETE_APP_ONBOARDING -> "complete_app_onboarding" - ActivityContextCase.CONSOLE_LOG -> "console_log" - ActivityContextCase.RETROFIT_CALL_CONTEXT -> "retrofit_call_context" - ActivityContextCase.RETROFIT_CALL_FAILED_CONTEXT -> "retrofit_call_failed_context" - ActivityContextCase.APP_IN_FOREGROUND_TIME -> "app_in_foreground_time" - } - } -} diff --git a/utility/src/main/java/org/oppia/android/util/logging/StandardEventTypeToHumanReadableNameConverterImpl.kt b/utility/src/main/java/org/oppia/android/util/logging/StandardEventTypeToHumanReadableNameConverterImpl.kt deleted file mode 100644 index 315c28c5f3f..00000000000 --- a/utility/src/main/java/org/oppia/android/util/logging/StandardEventTypeToHumanReadableNameConverterImpl.kt +++ /dev/null @@ -1,83 +0,0 @@ -package org.oppia.android.util.logging - -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase -import javax.inject.Inject - -/** - * Implementation of [EventTypeToHumanReadableNameConverter] which provides well-named - * representations for each event type. - * - * The provided names may be changed over time as the broad standard for event names evolves with - * new and changed events. The general convention for event names is a second person singular - * conjugated action verb followed by the action, context, or both, that the user conducted that led - * to that event. Furthermore, efforts are taken to reduce referencing Android-specific terminology - * (e.g. 'screen' is used in place of 'activity'). - * - * Event names cannot exceed 40 characters, so care should be taken to ensure only the most - * important information is conveyed via the name. - * - * Finally, the provided event names are only meant to help simplify analyzing logged events. Since - * they can change, aggregation or dimensional slicing of events should occur by keying on the - * event's integral type rather than its name (as this type will remain fixed for the lifetime of a - * given event, unlike its name returned by this implementation). - */ -class StandardEventTypeToHumanReadableNameConverterImpl @Inject constructor() : - EventTypeToHumanReadableNameConverter { - override fun convertToHumanReadableName(eventType: ActivityContextCase): String { - return when (eventType) { - ActivityContextCase.OPEN_EXPLORATION_ACTIVITY -> "open_exploration_player_screen" - ActivityContextCase.OPEN_INFO_TAB -> "select_topic_info_tab" - ActivityContextCase.OPEN_LESSONS_TAB -> "select_topic_lessons_tab" - ActivityContextCase.OPEN_PRACTICE_TAB -> "select_topic_practice_tab" - ActivityContextCase.OPEN_REVISION_TAB -> "select_topic_revision_tab" - ActivityContextCase.OPEN_QUESTION_PLAYER -> "open_question_player_screen" - ActivityContextCase.OPEN_STORY_ACTIVITY -> "open_story_chapter_list_screen" - ActivityContextCase.OPEN_CONCEPT_CARD -> "open_concept_card" - ActivityContextCase.OPEN_REVISION_CARD -> "open_revision_card" - ActivityContextCase.CLOSE_REVISION_CARD -> "close_revision_card" - ActivityContextCase.START_CARD_CONTEXT -> "start_exploration_card" - ActivityContextCase.END_CARD_CONTEXT -> "end_exploration_card" - ActivityContextCase.HINT_UNLOCKED_CONTEXT -> "unlock_hint" - ActivityContextCase.REVEAL_HINT_CONTEXT -> "reveal_hint" - ActivityContextCase.VIEW_EXISTING_HINT_CONTEXT -> "view_existing_hint" - ActivityContextCase.SOLUTION_UNLOCKED_CONTEXT -> "unlock_solution" - ActivityContextCase.REVEAL_SOLUTION_CONTEXT -> "reveal_solution" - ActivityContextCase.VIEW_EXISTING_SOLUTION_CONTEXT -> "view_existing_solution" - ActivityContextCase.SUBMIT_ANSWER_CONTEXT -> "submit_answer" - ActivityContextCase.PLAY_VOICE_OVER_CONTEXT -> "click_play_voiceover_button" - ActivityContextCase.PAUSE_VOICE_OVER_CONTEXT -> "click_pause_voiceover_button" - ActivityContextCase.APP_IN_BACKGROUND_CONTEXT -> "send_app_to_background" - ActivityContextCase.APP_IN_FOREGROUND_CONTEXT -> "bring_app_to_foreground" - ActivityContextCase.START_EXPLORATION_CONTEXT -> "start_exploration_context" - ActivityContextCase.EXIT_EXPLORATION_CONTEXT -> "leave_exploration" - ActivityContextCase.FINISH_EXPLORATION_CONTEXT -> "complete_exploration" - ActivityContextCase.PROGRESS_SAVING_SUCCESS_CONTEXT -> "progress_saving_success" - ActivityContextCase.PROGRESS_SAVING_FAILURE_CONTEXT -> "progress_saving_failure" - ActivityContextCase.LESSON_SAVED_ADVERTENTLY_CONTEXT -> "lesson_saved_advertently" - ActivityContextCase.RESUME_LESSON_SUBMIT_CORRECT_ANSWER_CONTEXT -> - "submit_correct_ans_in_resumed_lesson" - ActivityContextCase.RESUME_LESSON_SUBMIT_INCORRECT_ANSWER_CONTEXT -> - "submit_incorrect_ans_in_resumed_lesson" - ActivityContextCase.RESUME_EXPLORATION_CONTEXT -> "resume_in_progress_exploration" - ActivityContextCase.START_OVER_EXPLORATION_CONTEXT -> "restart_in_progress_exploration" - ActivityContextCase.DELETE_PROFILE_CONTEXT -> "delete_profile" - ActivityContextCase.OPEN_HOME -> "open_home_screen" - ActivityContextCase.OPEN_PROFILE_CHOOSER -> "open_profile_chooser_screen" - ActivityContextCase.REACH_INVESTED_ENGAGEMENT -> "reach_invested_engagement" - ActivityContextCase.SWITCH_IN_LESSON_LANGUAGE -> "click_switch_language_in_lesson" - ActivityContextCase.SHOW_SURVEY_POPUP -> "show_survey_popup" - ActivityContextCase.BEGIN_SURVEY -> "begin_survey" - ActivityContextCase.ABANDON_SURVEY -> "abandon_survey" - ActivityContextCase.MANDATORY_RESPONSE -> "mandatory_response" - ActivityContextCase.OPTIONAL_RESPONSE -> "optional_response" - ActivityContextCase.FEATURE_FLAG_LIST_CONTEXT -> "feature_flag_list" - ActivityContextCase.INSTALL_ID_FOR_FAILED_ANALYTICS_LOG, - ActivityContextCase.ACTIVITYCONTEXT_NOT_SET -> "ERROR_internal_logging_failure" - ActivityContextCase.COMPLETE_APP_ONBOARDING -> "complete_app_onboarding" - ActivityContextCase.CONSOLE_LOG -> "console_log" - ActivityContextCase.RETROFIT_CALL_CONTEXT -> "retrofit_call_context" - ActivityContextCase.RETROFIT_CALL_FAILED_CONTEXT -> "retrofit_call_failed_context" - ActivityContextCase.APP_IN_FOREGROUND_TIME -> "app_in_foreground_time" - } - } -} diff --git a/utility/src/test/java/org/oppia/android/util/logging/BUILD.bazel b/utility/src/test/java/org/oppia/android/util/logging/BUILD.bazel index 32e765b11d4..d23fb656a4c 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/BUILD.bazel +++ b/utility/src/test/java/org/oppia/android/util/logging/BUILD.bazel @@ -56,79 +56,6 @@ oppia_android_test( "//third_party:org_robolectric_robolectric", "//third_party:robolectric_android-all", "//utility/src/main/java/org/oppia/android/util/logging:event_bundle_creator", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", - ], -) - -oppia_android_test( - name = "EventLoggingConfigurationModuleTest", - srcs = ["EventLoggingConfigurationModuleTest.kt"], - custom_package = "org.oppia.android.util.logging", - test_class = "org.oppia.android.util.logging.EventLoggingConfigurationModuleTest", - test_manifest = "//utility:test_manifest", - deps = [ - "//:dagger", - "//testing", - "//third_party:androidx_test_ext_junit", - "//third_party:androidx_test_ext_truth", - "//third_party:com_google_truth_truth", - "//third_party:org_robolectric_robolectric", - "//third_party:robolectric_android-all", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", - ], -) - -oppia_android_test( - name = "KenyaAlphaEventBundleCreatorTest", - srcs = ["KenyaAlphaEventBundleCreatorTest.kt"], - custom_package = "org.oppia.android.util.logging", - test_class = "org.oppia.android.util.logging.KenyaAlphaEventBundleCreatorTest", - test_manifest = "//utility:test_manifest", - deps = [ - "//:dagger", - "//testing", - "//third_party:androidx_test_ext_junit", - "//third_party:androidx_test_ext_truth", - "//third_party:com_google_truth_truth", - "//third_party:org_robolectric_robolectric", - "//third_party:robolectric_android-all", - "//utility/src/main/java/org/oppia/android/util/logging:event_bundle_creator", - "//utility/src/main/java/org/oppia/android/util/logging:kenya_alpha_event_logging_configuration_module", - ], -) - -oppia_android_test( - name = "KenyaAlphaEventLoggingConfigurationModuleTest", - srcs = ["KenyaAlphaEventLoggingConfigurationModuleTest.kt"], - custom_package = "org.oppia.android.util.logging", - test_class = "org.oppia.android.util.logging.KenyaAlphaEventLoggingConfigurationModuleTest", - test_manifest = "//utility:test_manifest", - deps = [ - "//:dagger", - "//testing", - "//third_party:androidx_test_ext_junit", - "//third_party:androidx_test_ext_truth", - "//third_party:com_google_truth_truth", - "//third_party:org_robolectric_robolectric", - "//third_party:robolectric_android-all", - "//utility/src/main/java/org/oppia/android/util/logging:kenya_alpha_event_logging_configuration_module", - ], -) - -oppia_android_test( - name = "StandardEventTypeToHumanReadableNameConverterImplTest", - srcs = ["StandardEventTypeToHumanReadableNameConverterImplTest.kt"], - custom_package = "org.oppia.android.util.logging", - test_class = "org.oppia.android.util.logging.StandardEventTypeToHumanReadableNameConverterImplTest", - test_manifest = "//utility:test_manifest", - deps = [ - "//:dagger", - "//testing", - "//third_party:androidx_test_ext_junit", - "//third_party:com_google_truth_truth", - "//third_party:org_robolectric_robolectric", - "//third_party:robolectric_android-all", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", ], ) @@ -182,7 +109,22 @@ oppia_android_test( "//utility/src/main/java/org/oppia/android/util/locale/testing:test_module", "//utility/src/main/java/org/oppia/android/util/logging:event_bundle_creator", "//utility/src/main/java/org/oppia/android/util/logging:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", ], ) + +oppia_android_test( + name = "EventTypeToHumanReadableNameConverterTest", + srcs = ["EventTypeToHumanReadableNameConverterTest.kt"], + custom_package = "org.oppia.android.util.logging", + test_class = "org.oppia.android.util.logging.EventTypeToHumanReadableNameConverterTest", + test_manifest = "//utility:test_manifest", + deps = [ + "//:dagger", + "//testing", + "//third_party:androidx_test_ext_junit", + "//third_party:com_google_truth_truth", + "//third_party:org_robolectric_robolectric", + "//third_party:robolectric_android-all", + ], +) diff --git a/utility/src/test/java/org/oppia/android/util/logging/ConsoleLoggerTest.kt b/utility/src/test/java/org/oppia/android/util/logging/ConsoleLoggerTest.kt index 6a314de75fe..05df6b8c3c7 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/ConsoleLoggerTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/ConsoleLoggerTest.kt @@ -13,6 +13,7 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.async import kotlinx.coroutines.flow.take import kotlinx.coroutines.flow.toList +import org.junit.After import org.junit.Before import org.junit.Test import org.junit.runner.RunWith @@ -31,6 +32,8 @@ import org.oppia.android.util.data.DataProvidersInjectorProvider import org.oppia.android.util.locale.testing.LocaleTestModule import org.robolectric.annotation.Config import org.robolectric.annotation.LooperMode +import java.io.File +import java.io.PrintWriter import javax.inject.Inject import javax.inject.Singleton @@ -54,9 +57,31 @@ class ConsoleLoggerTest { @field:[Inject BackgroundTestDispatcher] lateinit var backgroundTestDispatcher: TestCoroutineDispatcher + private lateinit var logFile: File + @Before fun setUp() { setUpTestApplicationComponent() + logFile = File(context.filesDir, "oppia_app.log") + logFile.delete() + } + + @After + fun tearDown() { + logFile.delete() + } + + @Test + fun testConsoleLogger_multipleLogCalls_appendsToFile() { + consoleLogger.e(testTag, testMessage) + consoleLogger.e(testTag, "$testMessage 2") + testCoroutineDispatchers.advanceUntilIdle() + + val logContent = logFile.readText() + assertThat(logContent).contains(testMessage) + assertThat(logContent).contains("$testMessage 2") + assertThat(logContent.indexOf(testMessage)) + .isLessThan(logContent.indexOf("$testMessage 2")) } @Test @@ -76,6 +101,26 @@ class ConsoleLoggerTest { assertThat(firstErrorContext.fullErrorLog).isEqualTo(testMessage) } + @Test + fun testConsoleLogger_closeAndReopen_continuesToAppend() { + consoleLogger.e(testTag, "first $testMessage") + testCoroutineDispatchers.advanceUntilIdle() + + // Force close the PrintWriter to simulate app restart + val printWriterField = ConsoleLogger::class.java.getDeclaredField("printWriter") + printWriterField.isAccessible = true + (printWriterField.get(consoleLogger) as? PrintWriter)?.close() + printWriterField.set(consoleLogger, null) + + consoleLogger.e(testTag, "first $testMessage") + consoleLogger.e(testTag, "second $testMessage") + testCoroutineDispatchers.advanceUntilIdle() + + val logContent = logFile.readText() + assertThat(logContent).contains("first $testMessage") + assertThat(logContent).contains("second $testMessage") + } + private fun setUpTestApplicationComponent() { ApplicationProvider.getApplicationContext().inject(this) } @@ -84,9 +129,7 @@ class ConsoleLoggerTest { class TestModule { @Provides @Singleton - fun provideContext(application: Application): Context { - return application - } + fun provideContext(application: Application): Context = application @Provides @Singleton @@ -96,7 +139,7 @@ class ConsoleLoggerTest { @Provides @Singleton @EnableFileLog - fun provideEnableFileLog(): Boolean = false + fun provideEnableFileLog(): Boolean = true @Provides @Singleton @@ -113,7 +156,6 @@ class ConsoleLoggerTest { FakeOppiaClockModule::class, ] ) - interface TestApplicationComponent : DataProvidersInjector { @Component.Builder interface Builder { diff --git a/utility/src/test/java/org/oppia/android/util/logging/EventBundleCreatorTest.kt b/utility/src/test/java/org/oppia/android/util/logging/EventBundleCreatorTest.kt index 7a285e8626c..e0b29f36d15 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/EventBundleCreatorTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/EventBundleCreatorTest.kt @@ -2557,7 +2557,7 @@ class EventBundleCreatorTest { // TODO(#89): Move this to a common test application component. @Singleton - @Component(modules = [TestModule::class, EventLoggingConfigurationModule::class]) + @Component(modules = [TestModule::class]) interface TestApplicationComponent { @Component.Builder interface Builder { diff --git a/utility/src/test/java/org/oppia/android/util/logging/EventLoggingConfigurationModuleTest.kt b/utility/src/test/java/org/oppia/android/util/logging/EventLoggingConfigurationModuleTest.kt deleted file mode 100644 index 4bd1ea8e445..00000000000 --- a/utility/src/test/java/org/oppia/android/util/logging/EventLoggingConfigurationModuleTest.kt +++ /dev/null @@ -1,70 +0,0 @@ -package org.oppia.android.util.logging - -import android.app.Application -import android.content.Context -import androidx.test.core.app.ApplicationProvider -import androidx.test.ext.junit.runners.AndroidJUnit4 -import com.google.common.truth.Truth.assertThat -import dagger.BindsInstance -import dagger.Component -import dagger.Module -import dagger.Provides -import org.junit.Before -import org.junit.Test -import org.junit.runner.RunWith -import org.robolectric.annotation.Config -import org.robolectric.annotation.LooperMode -import javax.inject.Inject -import javax.inject.Singleton - -/** Tests for [EventLoggingConfigurationModule]. */ -// FunctionName: test names are conventionally named with underscores. -@Suppress("FunctionName") -@RunWith(AndroidJUnit4::class) -@LooperMode(LooperMode.Mode.PAUSED) -@Config(manifest = Config.NONE) -class EventLoggingConfigurationModuleTest { - @Inject lateinit var eventTypeToHumanReadableNameConverter: EventTypeToHumanReadableNameConverter - - @Before - fun setUp() { - setUpTestApplicationComponent() - } - - @Test - fun testModule_injectedEventTypeToHumanReadableNameConverter_isStandardImplementation() { - assertThat(eventTypeToHumanReadableNameConverter) - .isInstanceOf(StandardEventTypeToHumanReadableNameConverterImpl::class.java) - } - - private fun setUpTestApplicationComponent() { - DaggerEventLoggingConfigurationModuleTest_TestApplicationComponent - .builder() - .setApplication(ApplicationProvider.getApplicationContext()).build().inject(this) - } - - // TODO(#89): Move this to a common test application component. - @Module - class TestModule { - @Provides - @Singleton - fun provideContext(application: Application): Context { - return application - } - } - - // TODO(#89): Move this to a common test application component. - @Singleton - @Component(modules = [EventLoggingConfigurationModule::class]) - interface TestApplicationComponent { - @Component.Builder - interface Builder { - @BindsInstance - fun setApplication(application: Application): Builder - - fun build(): TestApplicationComponent - } - - fun inject(test: EventLoggingConfigurationModuleTest) - } -} diff --git a/utility/src/test/java/org/oppia/android/util/logging/StandardEventTypeToHumanReadableNameConverterImplTest.kt b/utility/src/test/java/org/oppia/android/util/logging/EventTypeToHumanReadableNameConverterTest.kt similarity index 75% rename from utility/src/test/java/org/oppia/android/util/logging/StandardEventTypeToHumanReadableNameConverterImplTest.kt rename to utility/src/test/java/org/oppia/android/util/logging/EventTypeToHumanReadableNameConverterTest.kt index 82047919161..55bff1f748e 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/StandardEventTypeToHumanReadableNameConverterImplTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/EventTypeToHumanReadableNameConverterTest.kt @@ -17,7 +17,7 @@ import javax.inject.Inject import javax.inject.Singleton /** - * Tests for [StandardEventTypeToHumanReadableNameConverterImpl]. + * Tests for [EventTypeToHumanReadableNameConverter]. * * Note that this suite has special change detector tests to ensure that the converter conforms to * event logger restrictions (such as not having an event name longer than a certain number), which @@ -29,9 +29,9 @@ import javax.inject.Singleton @Suppress("FunctionName") @RunWith(AndroidJUnit4::class) @LooperMode(LooperMode.Mode.PAUSED) -@Config(application = StandardEventTypeToHumanReadableNameConverterImplTest.TestApplication::class) -class StandardEventTypeToHumanReadableNameConverterImplTest { - @Inject lateinit var converterImpl: StandardEventTypeToHumanReadableNameConverterImpl +@Config(application = EventTypeToHumanReadableNameConverterTest.TestApplication::class) +class EventTypeToHumanReadableNameConverterTest { + @Inject lateinit var converter: EventTypeToHumanReadableNameConverter private companion object { private val FAILURE_TYPES = setOf( @@ -49,7 +49,7 @@ class StandardEventTypeToHumanReadableNameConverterImplTest { fun testConvertToHumanReadableName_nonErrorTypes_returnsUniqueNameForEach() { val nonErrorContexts = ActivityContextCase.values().toSet() - FAILURE_TYPES - val nonErrorNames = nonErrorContexts.map(converterImpl::convertToHumanReadableName) + val nonErrorNames = nonErrorContexts.map(converter::convertToHumanReadableName) assertThat(nonErrorNames).containsNoDuplicates() } @@ -58,7 +58,7 @@ class StandardEventTypeToHumanReadableNameConverterImplTest { fun testConvertToHumanReadableName_errorTypes_shareTheSameName() { val errorContexts = FAILURE_TYPES - val errorNames = errorContexts.map(converterImpl::convertToHumanReadableName) + val errorNames = errorContexts.map(converter::convertToHumanReadableName) assertThat(errorNames.toSet()).hasSize(1) } @@ -68,8 +68,8 @@ class StandardEventTypeToHumanReadableNameConverterImplTest { val errorContexts = FAILURE_TYPES val nonErrorContexts = ActivityContextCase.values().toSet() - errorContexts - val nonErrorNames = nonErrorContexts.map(converterImpl::convertToHumanReadableName).toSet() - val errorNames = errorContexts.map(converterImpl::convertToHumanReadableName).toSet() + val nonErrorNames = nonErrorContexts.map(converter::convertToHumanReadableName).toSet() + val errorNames = errorContexts.map(converter::convertToHumanReadableName).toSet() assertThat(errorNames).containsNoneIn(nonErrorNames) } @@ -77,7 +77,7 @@ class StandardEventTypeToHumanReadableNameConverterImplTest { @Test fun testConvertToHumanReadableName_allNamesLessThan40Chars() { val allContexts = ActivityContextCase.values() - val allNames = allContexts.map(converterImpl::convertToHumanReadableName) + val allNames = allContexts.map(converter::convertToHumanReadableName) val namesLongerThan40 = allNames.filter { it.length > 40 } @@ -100,17 +100,17 @@ class StandardEventTypeToHumanReadableNameConverterImplTest { fun build(): TestApplicationComponent } - fun inject(test: StandardEventTypeToHumanReadableNameConverterImplTest) + fun inject(test: EventTypeToHumanReadableNameConverterTest) } class TestApplication : Application() { private val component: TestApplicationComponent by lazy { - DaggerStandardEventTypeToHumanReadableNameConverterImplTest_TestApplicationComponent.builder() + DaggerEventTypeToHumanReadableNameConverterTest_TestApplicationComponent.builder() .setApplication(this) .build() } - fun inject(test: StandardEventTypeToHumanReadableNameConverterImplTest) { + fun inject(test: EventTypeToHumanReadableNameConverterTest) { component.inject(test) } } diff --git a/utility/src/test/java/org/oppia/android/util/logging/KenyaAlphaEventBundleCreatorTest.kt b/utility/src/test/java/org/oppia/android/util/logging/KenyaAlphaEventBundleCreatorTest.kt deleted file mode 100644 index 517e4e1ffc1..00000000000 --- a/utility/src/test/java/org/oppia/android/util/logging/KenyaAlphaEventBundleCreatorTest.kt +++ /dev/null @@ -1,1760 +0,0 @@ -package org.oppia.android.util.logging - -import android.app.Application -import android.content.Context -import android.os.Bundle -import androidx.test.core.app.ApplicationProvider -import androidx.test.core.content.pm.ApplicationInfoBuilder -import androidx.test.core.content.pm.PackageInfoBuilder -import androidx.test.ext.junit.runners.AndroidJUnit4 -import androidx.test.ext.truth.os.BundleSubject.assertThat -import com.google.common.truth.Truth.assertThat -import dagger.BindsInstance -import dagger.Component -import dagger.Module -import dagger.Provides -import org.junit.After -import org.junit.Test -import org.junit.runner.RunWith -import org.oppia.android.app.model.EventLog -import org.oppia.android.app.model.EventLog.CardContext -import org.oppia.android.app.model.EventLog.ConceptCardContext -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.ACTIVITYCONTEXT_NOT_SET -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.APP_IN_BACKGROUND_CONTEXT -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.APP_IN_FOREGROUND_CONTEXT -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.CLOSE_REVISION_CARD -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.DELETE_PROFILE_CONTEXT -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.END_CARD_CONTEXT -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.EXIT_EXPLORATION_CONTEXT -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.FINISH_EXPLORATION_CONTEXT -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.HINT_UNLOCKED_CONTEXT -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.INSTALL_ID_FOR_FAILED_ANALYTICS_LOG -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.OPEN_CONCEPT_CARD -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.OPEN_EXPLORATION_ACTIVITY -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.OPEN_HOME -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.OPEN_INFO_TAB -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.OPEN_LESSONS_TAB -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.OPEN_PRACTICE_TAB -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.OPEN_PROFILE_CHOOSER -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.OPEN_QUESTION_PLAYER -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.OPEN_REVISION_CARD -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.OPEN_REVISION_TAB -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.OPEN_STORY_ACTIVITY -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.PAUSE_VOICE_OVER_CONTEXT -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.PLAY_VOICE_OVER_CONTEXT -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.RESUME_EXPLORATION_CONTEXT -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.REVEAL_HINT_CONTEXT -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.REVEAL_SOLUTION_CONTEXT -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.SOLUTION_UNLOCKED_CONTEXT -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.START_CARD_CONTEXT -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.START_OVER_EXPLORATION_CONTEXT -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.SUBMIT_ANSWER_CONTEXT -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.SWITCH_IN_LESSON_LANGUAGE -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.VIEW_EXISTING_HINT_CONTEXT -import org.oppia.android.app.model.EventLog.Context.ActivityContextCase.VIEW_EXISTING_SOLUTION_CONTEXT -import org.oppia.android.app.model.EventLog.ExplorationContext -import org.oppia.android.app.model.EventLog.HintContext -import org.oppia.android.app.model.EventLog.LearnerDetailsContext -import org.oppia.android.app.model.EventLog.Priority.ESSENTIAL -import org.oppia.android.app.model.EventLog.Priority.OPTIONAL -import org.oppia.android.app.model.EventLog.QuestionContext -import org.oppia.android.app.model.EventLog.RevisionCardContext -import org.oppia.android.app.model.EventLog.StoryContext -import org.oppia.android.app.model.EventLog.SubmitAnswerContext -import org.oppia.android.app.model.EventLog.SwitchInLessonLanguageEventContext -import org.oppia.android.app.model.EventLog.TopicContext -import org.oppia.android.app.model.EventLog.VoiceoverActionContext -import org.oppia.android.app.model.OppiaLanguage -import org.oppia.android.util.platformparameter.EnableLoggingLearnerStudyIds -import org.oppia.android.util.platformparameter.LOGGING_LEARNER_STUDY_IDS_DEFAULT_VALUE -import org.oppia.android.util.platformparameter.PlatformParameterValue -import org.robolectric.Shadows -import org.robolectric.annotation.Config -import org.robolectric.annotation.LooperMode -import javax.inject.Inject -import javax.inject.Singleton -import org.oppia.android.app.model.EventLog.Context.Builder as EventContextBuilder - -private const val TEST_ANDROID_SDK_VERSION = 30 - -// TODO(#4419): Remove this test suite post-Kenya user study. -/** - * Variant of [EventBundleCreatorTest] but for testing behaviors specific to alpha builds of the app - * intended for users in the Kenya user study. - */ -// FunctionName: test names are conventionally named with underscores. -@Suppress("FunctionName") -@RunWith(AndroidJUnit4::class) -@LooperMode(LooperMode.Mode.PAUSED) -@Config( - application = KenyaAlphaEventBundleCreatorTest.TestApplication::class, - sdk = [TEST_ANDROID_SDK_VERSION] -) -class KenyaAlphaEventBundleCreatorTest { - private companion object { - private const val TEST_TIMESTAMP_1 = 1556094120000 - private const val TEST_TIMESTAMP_2 = 1234567898765 - private const val TEST_CLASSROOM_ID = "test_classroom_id" - private const val TEST_TOPIC_ID = "test_topic_id" - private const val TEST_STORY_ID = "test_story_id" - private const val TEST_EXPLORATION_ID = "test_exploration_id" - private const val TEST_QUESTION_ID = "test_question_id" - private const val TEST_SKILL_ID_1 = "test_skill_id_1" - private const val TEST_SKILL_ID_2 = "test_skill_id_2" - private const val TEST_SUB_TOPIC_INDEX = 1 - private const val TEST_SUB_TOPIC_INDEX_STR = "1" - private const val TEST_LEARNER_ID = "test_ed_ld_learner_id" - private const val TEST_INSTALLATION_ID = "test_installation_id" - private const val TEST_LEARNER_SESSION_ID = "test_session_id" - private const val TEST_EXPLORATION_VERSION = 5 - private const val TEST_EXPLORATION_VERSION_STR = "5" - private const val TEST_STATE_NAME = "test_state_name" - private const val TEST_HINT_INDEX = 1 - private const val TEST_HINT_INDEX_STR = "1" - private const val TEST_IS_ANSWER_CORRECT = true - private const val TEST_IS_ANSWER_CORRECT_STR = "true" - private const val TEST_CONTENT_ID = "test_content_id" - private const val TEST_LANGUAGE_CODE = "en" - private const val TEST_APP_VERSION_NAME = "oppia-android-test-0123456789" - private const val TEST_APP_VERSION_CODE = 125L - } - - @Inject lateinit var context: Context - @Inject lateinit var eventBundleCreator: EventBundleCreator - - @After - fun tearDown() { - TestModule.enableLoggingLearnerStudyIds = LOGGING_LEARNER_STUDY_IDS_DEFAULT_VALUE - } - - @Test - fun testFillEventBundle_defaultEvent_defaultsBundleAndReturnsUnknownActivityContext() { - setUpTestApplicationComponent() - val bundle = Bundle() - - val typeName = eventBundleCreator.fillEventBundle(EventLog.getDefaultInstance(), bundle) - - assertThat(typeName).isEqualTo("unknown_activity_context") - assertThat(bundle).hasSize(11) - assertThat(bundle).longInt("timestamp").isEqualTo(0) - assertThat(bundle).string("priority").isEqualTo("unspecified_priority") - assertThat(bundle).integer("event_type").isEqualTo(ACTIVITYCONTEXT_NOT_SET.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - } - - @Test - fun testFillEventBundle_eventWithDefaultedContext_fillsPriorityAndTimeAndRetsUnknownContext() { - setUpTestApplicationComponent() - val bundle = Bundle() - val eventLog = createEventLog(timestamp = TEST_TIMESTAMP_1, priority = ESSENTIAL) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - - assertThat(typeName).isEqualTo("unknown_activity_context") - assertThat(bundle).hasSize(11) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(ACTIVITYCONTEXT_NOT_SET.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - } - - @Test - fun testFillEventBundle_eventWithDifferentTimestamp_savesDifferentTimestampInBundle() { - setUpTestApplicationComponent() - val bundle = Bundle() - val eventLog = createEventLog(timestamp = TEST_TIMESTAMP_2) - - eventBundleCreator.fillEventBundle(eventLog, bundle) - - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_2) - } - - @Test - fun testFillEventBundle_eventWithDifferentPriority_savesDifferentPriorityInBundle() { - setUpTestApplicationComponent() - val bundle = Bundle() - val eventLog = createEventLog(priority = OPTIONAL) - - eventBundleCreator.fillEventBundle(eventLog, bundle) - - assertThat(bundle).string("priority").isEqualTo("optional") - } - - @Test - fun testFillEventBundle_openExpActivityEvent_studyOff_fillsOnlyNonSensitiveFieldsAndRetsName() { - setUpTestApplicationComponentWithoutLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createOpenExplorationActivity()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("open_exploration_activity") - assertThat(bundle).hasSize(18) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(OPEN_EXPLORATION_ACTIVITY.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("state_name").isEqualTo(TEST_STATE_NAME) - } - - @Test - fun testFillEventBundle_openExpActivityEvent_studyOn_fillsAllFieldsAndReturnsName() { - setUpTestApplicationComponentWithLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createOpenExplorationActivity()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("open_exploration_activity") - assertThat(bundle).hasSize(20) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(OPEN_EXPLORATION_ACTIVITY.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("state_name").isEqualTo(TEST_STATE_NAME) - assertThat(bundle).string("ld_learner_id").isEqualTo(TEST_LEARNER_ID) - assertThat(bundle).string("ld_install_id").isEqualTo(TEST_INSTALLATION_ID) - } - - @Test - fun testFillEventBundle_openInfoTabContextEvent_fillsAllFieldsInBundleAndReturnsName() { - setUpTestApplicationComponent() - val bundle = Bundle() - - val eventLog = createEventLog(context = createOpenInfoTab()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("open_info_tab") - assertThat(bundle).hasSize(12) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(OPEN_INFO_TAB.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("topic_id").isEqualTo(TEST_TOPIC_ID) - } - - @Test - fun testFillEventBundle_openLessonsTabContextEvent_fillsAllFieldsInBundleAndReturnsName() { - setUpTestApplicationComponent() - val bundle = Bundle() - - val eventLog = createEventLog(context = createOpenLessonsTab()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("open_lessons_tab") - assertThat(bundle).hasSize(12) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(OPEN_LESSONS_TAB.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("topic_id").isEqualTo(TEST_TOPIC_ID) - } - - @Test - fun testFillEventBundle_openPracticeTabContextEvent_fillsAllFieldsInBundleAndReturnsName() { - setUpTestApplicationComponent() - val bundle = Bundle() - - val eventLog = createEventLog(context = createOpenPracticeTab()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("open_practice_tab") - assertThat(bundle).hasSize(12) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(OPEN_PRACTICE_TAB.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("topic_id").isEqualTo(TEST_TOPIC_ID) - } - - @Test - fun testFillEventBundle_openRevisionTabContextEvent_fillsAllFieldsInBundleAndReturnsName() { - setUpTestApplicationComponent() - val bundle = Bundle() - - val eventLog = createEventLog(context = createOpenRevisionTab()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("open_revision_tab") - assertThat(bundle).hasSize(12) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(OPEN_REVISION_TAB.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("topic_id").isEqualTo(TEST_TOPIC_ID) - } - - @Test - fun testFillEventBundle_openQuestionPlayerContextEvent_fillsAllFieldsInBundleAndReturnsName() { - setUpTestApplicationComponent() - val bundle = Bundle() - - val eventLog = createEventLog(context = createOpenQuestionPlayer()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("open_question_player") - assertThat(bundle).hasSize(13) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(OPEN_QUESTION_PLAYER.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("question_id").isEqualTo(TEST_QUESTION_ID) - assertThat(bundle).string("skill_ids").isEqualTo("$TEST_SKILL_ID_1,$TEST_SKILL_ID_2") - } - - @Test - fun testFillEventBundle_openStoryActivityContextEvent_fillsAllFieldsInBundleAndReturnsName() { - setUpTestApplicationComponent() - val bundle = Bundle() - - val eventLog = createEventLog(context = createOpenStoryActivity()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("open_story_activity") - assertThat(bundle).hasSize(13) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(OPEN_STORY_ACTIVITY.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("story_id").isEqualTo(TEST_STORY_ID) - } - - @Test - fun testFillEventBundle_openConceptCardContextEvent_fillsAllFieldsInBundleAndReturnsName() { - setUpTestApplicationComponent() - val bundle = Bundle() - - val eventLog = createEventLog(context = createOpenConceptCard()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("open_concept_card") - assertThat(bundle).hasSize(12) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(OPEN_CONCEPT_CARD.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("skill_id").isEqualTo(TEST_SKILL_ID_1) - } - - @Test - fun testFillEventBundle_openRevisionCardContextEvent_fillsAllFieldsInBundleAndReturnsName() { - setUpTestApplicationComponent() - val bundle = Bundle() - - val eventLog = createEventLog(context = createOpenRevisionCard()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("open_revision_card") - assertThat(bundle).hasSize(13) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(OPEN_REVISION_CARD.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("subtopic_index").isEqualTo(TEST_SUB_TOPIC_INDEX_STR) - } - - @Test - fun testFillEventBundle_closeRevisionCardContextEvent_fillsAllFieldsInBundleAndReturnsName() { - setUpTestApplicationComponent() - val bundle = Bundle() - - val eventLog = createEventLog(context = createCloseRevisionCard()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("close_revision_card") - assertThat(bundle).hasSize(13) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(CLOSE_REVISION_CARD.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("subtopic_index").isEqualTo(TEST_SUB_TOPIC_INDEX_STR) - } - - @Test - fun testFillEventBundle_startCardContextEvent_studyOff_fillsOnlyNonSensitiveFieldsAndRetsName() { - setUpTestApplicationComponentWithoutLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createStartCardContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("start_card_context") - assertThat(bundle).hasSize(19) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(START_CARD_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("ed_classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("ed_topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("ed_story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("ed_exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("ed_session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("ed_exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("ed_state_name").isEqualTo(TEST_STATE_NAME) - assertThat(bundle).string("skill_id").isEqualTo(TEST_SKILL_ID_1) - } - - @Test - fun testFillEventBundle_startCardContextEvent_studyOn_fillsAllFieldsAndReturnsName() { - setUpTestApplicationComponentWithLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createStartCardContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("start_card_context") - assertThat(bundle).hasSize(21) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(START_CARD_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("ed_classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("ed_topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("ed_story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("ed_exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("ed_session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("ed_exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("ed_state_name").isEqualTo(TEST_STATE_NAME) - assertThat(bundle).string("skill_id").isEqualTo(TEST_SKILL_ID_1) - assertThat(bundle).string("ed_ld_learner_id").isEqualTo(TEST_LEARNER_ID) - assertThat(bundle).string("ed_ld_install_id").isEqualTo(TEST_INSTALLATION_ID) - } - - @Test - fun testFillEventBundle_endCardContextEvent_studyOff_fillsOnlyNonSensitiveFieldsAndRetsName() { - setUpTestApplicationComponentWithoutLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createEndCardContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("end_card_context") - assertThat(bundle).hasSize(19) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(END_CARD_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("ed_classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("ed_topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("ed_story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("ed_exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("ed_session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("ed_exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("ed_state_name").isEqualTo(TEST_STATE_NAME) - assertThat(bundle).string("skill_id").isEqualTo(TEST_SKILL_ID_1) - } - - @Test - fun testFillEventBundle_endCardContextEvent_studyOn_fillsAllFieldsAndReturnsName() { - setUpTestApplicationComponentWithLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createEndCardContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("end_card_context") - assertThat(bundle).hasSize(21) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(END_CARD_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("ed_classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("ed_topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("ed_story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("ed_exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("ed_session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("ed_exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("ed_state_name").isEqualTo(TEST_STATE_NAME) - assertThat(bundle).string("skill_id").isEqualTo(TEST_SKILL_ID_1) - assertThat(bundle).string("ed_ld_learner_id").isEqualTo(TEST_LEARNER_ID) - assertThat(bundle).string("ed_ld_install_id").isEqualTo(TEST_INSTALLATION_ID) - } - - @Test - fun testFillEventBundle_hintUnlockedEvent_studyOff_fillsOnlyNonSensitiveFieldsAndRetsName() { - setUpTestApplicationComponentWithoutLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createHintUnlockedContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("hint_offered_context") - assertThat(bundle).hasSize(19) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(HINT_UNLOCKED_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("ed_classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("ed_topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("ed_story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("ed_exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("ed_session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("ed_exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("ed_state_name").isEqualTo(TEST_STATE_NAME) - assertThat(bundle).string("hint_index").isEqualTo(TEST_HINT_INDEX_STR) - } - - @Test - fun testFillEventBundle_hintUnlockedEvent_studyOn_fillsAllFieldsAndReturnsName() { - setUpTestApplicationComponentWithLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createHintUnlockedContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("hint_offered_context") - assertThat(bundle).hasSize(21) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(HINT_UNLOCKED_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("ed_classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("ed_topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("ed_story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("ed_exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("ed_session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("ed_exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("ed_state_name").isEqualTo(TEST_STATE_NAME) - assertThat(bundle).string("hint_index").isEqualTo(TEST_HINT_INDEX_STR) - assertThat(bundle).string("ed_ld_learner_id").isEqualTo(TEST_LEARNER_ID) - assertThat(bundle).string("ed_ld_install_id").isEqualTo(TEST_INSTALLATION_ID) - } - - @Test - fun testFillEventBundle_revealHintContextEvent_studyOff_fillsOnlyNonSensitiveFieldsAndRetsName() { - setUpTestApplicationComponentWithoutLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createRevealHintContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("reveal_hint_context") - assertThat(bundle).hasSize(19) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(REVEAL_HINT_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("ed_classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("ed_topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("ed_story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("ed_exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("ed_session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("ed_exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("ed_state_name").isEqualTo(TEST_STATE_NAME) - assertThat(bundle).string("hint_index").isEqualTo(TEST_HINT_INDEX_STR) - } - - @Test - fun testFillEventBundle_revealHintContextEvent_studyOn_fillsAllFieldsAndReturnsName() { - setUpTestApplicationComponentWithLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createRevealHintContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("reveal_hint_context") - assertThat(bundle).hasSize(21) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(REVEAL_HINT_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("ed_classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("ed_topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("ed_story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("ed_exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("ed_session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("ed_exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("ed_state_name").isEqualTo(TEST_STATE_NAME) - assertThat(bundle).string("hint_index").isEqualTo(TEST_HINT_INDEX_STR) - assertThat(bundle).string("ed_ld_learner_id").isEqualTo(TEST_LEARNER_ID) - assertThat(bundle).string("ed_ld_install_id").isEqualTo(TEST_INSTALLATION_ID) - } - - @Test - fun testFillEventBundle_viewExistingHintEvent_studyOff_fillsOnlyNonSensitiveFieldsAndRetsName() { - setUpTestApplicationComponentWithoutLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createViewExistingHintContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("view_existing_hint_context") - assertThat(bundle).hasSize(19) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(VIEW_EXISTING_HINT_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("ed_classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("ed_topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("ed_story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("ed_exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("ed_session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("ed_exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("ed_state_name").isEqualTo(TEST_STATE_NAME) - assertThat(bundle).string("hint_index").isEqualTo(TEST_HINT_INDEX_STR) - } - - @Test - fun testFillEventBundle_viewExistingHintEvent_studyOn_fillsAllFieldsAndReturnsName() { - setUpTestApplicationComponentWithLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createViewExistingHintContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("view_existing_hint_context") - assertThat(bundle).hasSize(21) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(VIEW_EXISTING_HINT_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("ed_classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("ed_topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("ed_story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("ed_exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("ed_session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("ed_exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("ed_state_name").isEqualTo(TEST_STATE_NAME) - assertThat(bundle).string("hint_index").isEqualTo(TEST_HINT_INDEX_STR) - assertThat(bundle).string("ed_ld_learner_id").isEqualTo(TEST_LEARNER_ID) - assertThat(bundle).string("ed_ld_install_id").isEqualTo(TEST_INSTALLATION_ID) - } - - @Test - fun testFillEventBundle_solutionUnlockedEvent_studyOff_fillsOnlyNonSensitiveFieldsAndRetsName() { - setUpTestApplicationComponentWithoutLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createSolutionUnlockedContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("solution_offered_context") - assertThat(bundle).hasSize(18) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(SOLUTION_UNLOCKED_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("state_name").isEqualTo(TEST_STATE_NAME) - } - - @Test - fun testFillEventBundle_solutionUnlockedEvent_studyOn_fillsAllFieldsAndReturnsName() { - setUpTestApplicationComponentWithLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createSolutionUnlockedContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("solution_offered_context") - assertThat(bundle).hasSize(20) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(SOLUTION_UNLOCKED_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("state_name").isEqualTo(TEST_STATE_NAME) - assertThat(bundle).string("ld_learner_id").isEqualTo(TEST_LEARNER_ID) - assertThat(bundle).string("ld_install_id").isEqualTo(TEST_INSTALLATION_ID) - } - - @Test - fun testFillEventBundle_revealSolutionEvent_studyOff_fillsOnlyNonSensitiveFieldsAndRetsName() { - setUpTestApplicationComponentWithoutLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createRevealSolutionContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("reveal_solution_context") - assertThat(bundle).hasSize(18) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(REVEAL_SOLUTION_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("state_name").isEqualTo(TEST_STATE_NAME) - } - - @Test - fun testFillEventBundle_revealSolutionEvent_studyOn_fillsAllFieldsAndReturnsName() { - setUpTestApplicationComponentWithLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createRevealSolutionContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("reveal_solution_context") - assertThat(bundle).hasSize(20) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(REVEAL_SOLUTION_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("state_name").isEqualTo(TEST_STATE_NAME) - assertThat(bundle).string("ld_learner_id").isEqualTo(TEST_LEARNER_ID) - assertThat(bundle).string("ld_install_id").isEqualTo(TEST_INSTALLATION_ID) - } - - @Test - fun testFillEventBundle_viewExistingSolutionEvent_studyOff_fillsNonSensitiveFieldsAndRetsName() { - setUpTestApplicationComponentWithoutLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createViewExistingSolutionContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("view_existing_solution_context") - assertThat(bundle).hasSize(18) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(VIEW_EXISTING_SOLUTION_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("state_name").isEqualTo(TEST_STATE_NAME) - } - - @Test - fun testFillEventBundle_viewExistingSolutionEvent_studyOn_fillsAllFieldsAndReturnsName() { - setUpTestApplicationComponentWithLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createViewExistingSolutionContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("view_existing_solution_context") - assertThat(bundle).hasSize(20) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(VIEW_EXISTING_SOLUTION_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("state_name").isEqualTo(TEST_STATE_NAME) - assertThat(bundle).string("ld_learner_id").isEqualTo(TEST_LEARNER_ID) - assertThat(bundle).string("ld_install_id").isEqualTo(TEST_INSTALLATION_ID) - } - - @Test - fun testFillEventBundle_submitAnswerEvent_studyOff_fillsOnlyNonSensitiveFieldsAndRetsName() { - setUpTestApplicationComponentWithoutLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createSubmitAnswerContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("submit_answer_context") - assertThat(bundle).hasSize(20) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(SUBMIT_ANSWER_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("ed_classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("ed_topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("ed_story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("ed_exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("ed_session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("ed_exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("ed_state_name").isEqualTo(TEST_STATE_NAME) - assertThat(bundle).string("submitted_answer").isEmpty() - assertThat(bundle).string("is_answer_correct").isEqualTo(TEST_IS_ANSWER_CORRECT_STR) - } - - @Test - fun testFillEventBundle_submitAnswerEvent_studyOn_fillsAllFieldsAndReturnsName() { - setUpTestApplicationComponentWithLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createSubmitAnswerContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("submit_answer_context") - assertThat(bundle).hasSize(22) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(SUBMIT_ANSWER_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("ed_classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("ed_topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("ed_story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("ed_exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("ed_session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("ed_exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("ed_state_name").isEqualTo(TEST_STATE_NAME) - assertThat(bundle).string("submitted_answer").isEmpty() - assertThat(bundle).string("is_answer_correct").isEqualTo(TEST_IS_ANSWER_CORRECT_STR) - assertThat(bundle).string("ed_ld_learner_id").isEqualTo(TEST_LEARNER_ID) - assertThat(bundle).string("ed_ld_install_id").isEqualTo(TEST_INSTALLATION_ID) - } - - @Test - fun testFillEventBundle_playVoiceOverEvent_studyOff_fillsOnlyNonSensitiveFieldsAndRetsName() { - setUpTestApplicationComponentWithoutLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createPlayVoiceOverContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("play_voice_over_context") - assertThat(bundle).hasSize(20) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(PLAY_VOICE_OVER_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("ed_classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("ed_topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("ed_story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("ed_exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("ed_session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("ed_exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("ed_state_name").isEqualTo(TEST_STATE_NAME) - assertThat(bundle).string("content_id").isEqualTo(TEST_CONTENT_ID) - assertThat(bundle).string("language_code").isEqualTo(TEST_LANGUAGE_CODE) - } - - @Test - fun testFillEventBundle_playVoiceOverEvent_studyOn_fillsAllFieldsAndReturnsName() { - setUpTestApplicationComponentWithLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createPlayVoiceOverContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("play_voice_over_context") - assertThat(bundle).hasSize(22) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(PLAY_VOICE_OVER_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("ed_classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("ed_topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("ed_story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("ed_exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("ed_session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("ed_exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("ed_state_name").isEqualTo(TEST_STATE_NAME) - assertThat(bundle).string("content_id").isEqualTo(TEST_CONTENT_ID) - assertThat(bundle).string("language_code").isEqualTo(TEST_LANGUAGE_CODE) - assertThat(bundle).string("ed_ld_learner_id").isEqualTo(TEST_LEARNER_ID) - assertThat(bundle).string("ed_ld_install_id").isEqualTo(TEST_INSTALLATION_ID) - } - - @Test - fun testFillEventBundle_pauseVoiceOverEvent_studyOff_fillsOnlyNonSensitiveFieldsAndRetsName() { - setUpTestApplicationComponentWithoutLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createPauseVoiceOverContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("pause_voice_over_context") - assertThat(bundle).hasSize(20) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(PAUSE_VOICE_OVER_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("ed_classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("ed_topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("ed_story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("ed_exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("ed_session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("ed_exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("ed_state_name").isEqualTo(TEST_STATE_NAME) - assertThat(bundle).string("content_id").isEqualTo(TEST_CONTENT_ID) - assertThat(bundle).string("language_code").isEqualTo(TEST_LANGUAGE_CODE) - } - - @Test - fun testFillEventBundle_pauseVoiceOverEvent_studyOn_fillsAllFieldsAndReturnsName() { - setUpTestApplicationComponentWithLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createPauseVoiceOverContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("pause_voice_over_context") - assertThat(bundle).hasSize(22) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(PAUSE_VOICE_OVER_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("ed_classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("ed_topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("ed_story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("ed_exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("ed_session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("ed_exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("ed_state_name").isEqualTo(TEST_STATE_NAME) - assertThat(bundle).string("content_id").isEqualTo(TEST_CONTENT_ID) - assertThat(bundle).string("language_code").isEqualTo(TEST_LANGUAGE_CODE) - assertThat(bundle).string("ed_ld_learner_id").isEqualTo(TEST_LEARNER_ID) - assertThat(bundle).string("ed_ld_install_id").isEqualTo(TEST_INSTALLATION_ID) - } - - @Test - fun testFillEventBundle_appInBackgroundEvent_studyOff_fillsOnlyNonSensitiveFieldsAndRetsName() { - setUpTestApplicationComponentWithoutLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createAppInBackgroundContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("app_in_background_context") - assertThat(bundle).hasSize(11) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(APP_IN_BACKGROUND_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - } - - @Test - fun testFillEventBundle_appInBackgroundEvent_studyOn_fillsAllFieldsAndReturnsName() { - setUpTestApplicationComponentWithLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createAppInBackgroundContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("app_in_background_context") - assertThat(bundle).hasSize(13) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(APP_IN_BACKGROUND_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("learner_id").isEqualTo(TEST_LEARNER_ID) - assertThat(bundle).string("install_id").isEqualTo(TEST_INSTALLATION_ID) - } - - @Test - fun testFillEventBundle_appInForegroundEvent_studyOff_fillsOnlyNonSensitiveFieldsAndRetsName() { - setUpTestApplicationComponentWithoutLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createAppInForegroundContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("app_in_foreground_context") - assertThat(bundle).hasSize(11) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(APP_IN_FOREGROUND_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - } - - @Test - fun testFillEventBundle_appInForegroundEvent_studyOn_fillsAllFieldsAndReturnsName() { - setUpTestApplicationComponentWithLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createAppInForegroundContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("app_in_foreground_context") - assertThat(bundle).hasSize(13) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(APP_IN_FOREGROUND_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("learner_id").isEqualTo(TEST_LEARNER_ID) - assertThat(bundle).string("install_id").isEqualTo(TEST_INSTALLATION_ID) - } - - @Test - fun testFillEventBundle_exitExplorationEvent_studyOff_fillsOnlyNonSensitiveFieldsAndRetsName() { - setUpTestApplicationComponentWithoutLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createExitExplorationContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("exit_exploration_context") - assertThat(bundle).hasSize(18) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(EXIT_EXPLORATION_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("state_name").isEqualTo(TEST_STATE_NAME) - } - - @Test - fun testFillEventBundle_exitExplorationEvent_studyOn_fillsAllFieldsAndReturnsName() { - setUpTestApplicationComponentWithLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createExitExplorationContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("exit_exploration_context") - assertThat(bundle).hasSize(20) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(EXIT_EXPLORATION_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("state_name").isEqualTo(TEST_STATE_NAME) - assertThat(bundle).string("ld_learner_id").isEqualTo(TEST_LEARNER_ID) - assertThat(bundle).string("ld_install_id").isEqualTo(TEST_INSTALLATION_ID) - } - - @Test - fun testFillEventBundle_finishExplorationEvent_studyOff_fillsOnlyNonSensitiveFieldsAndRetsName() { - setUpTestApplicationComponentWithoutLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createFinishExplorationContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("finish_exploration_context") - assertThat(bundle).hasSize(18) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(FINISH_EXPLORATION_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("state_name").isEqualTo(TEST_STATE_NAME) - } - - @Test - fun testFillEventBundle_finishExplorationEvent_studyOn_fillsAllFieldsAndReturnsName() { - setUpTestApplicationComponentWithLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createFinishExplorationContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("finish_exploration_context") - assertThat(bundle).hasSize(20) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(FINISH_EXPLORATION_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("state_name").isEqualTo(TEST_STATE_NAME) - assertThat(bundle).string("ld_learner_id").isEqualTo(TEST_LEARNER_ID) - assertThat(bundle).string("ld_install_id").isEqualTo(TEST_INSTALLATION_ID) - } - - @Test - fun testFillEventBundle_resumeExplorationEvent_studyOff_fillsOnlyNonSensitiveFieldsAndRetsName() { - setUpTestApplicationComponentWithoutLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createResumeExplorationContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("resume_exploration_context") - assertThat(bundle).hasSize(11) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(RESUME_EXPLORATION_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - } - - @Test - fun testFillEventBundle_resumeExplorationEvent_studyOn_fillsAllFieldsAndReturnsName() { - setUpTestApplicationComponentWithLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createResumeExplorationContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("resume_exploration_context") - assertThat(bundle).hasSize(13) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(RESUME_EXPLORATION_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("learner_id").isEqualTo(TEST_LEARNER_ID) - assertThat(bundle).string("install_id").isEqualTo(TEST_INSTALLATION_ID) - } - - @Test - fun testFillEventBundle_startOverExpEvent_studyOff_fillsOnlyNonSensitiveFieldsAndRetsName() { - setUpTestApplicationComponentWithoutLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createStartOverExplorationContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("start_over_exploration_context") - assertThat(bundle).hasSize(11) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(START_OVER_EXPLORATION_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - } - - @Test - fun testFillEventBundle_startOverExpEvent_studyOn_fillsAllFieldsAndReturnsName() { - setUpTestApplicationComponentWithLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createStartOverExplorationContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("start_over_exploration_context") - assertThat(bundle).hasSize(13) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(START_OVER_EXPLORATION_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("learner_id").isEqualTo(TEST_LEARNER_ID) - assertThat(bundle).string("install_id").isEqualTo(TEST_INSTALLATION_ID) - } - - @Test - fun testFillEventBundle_deleteProfileEvent_studyOff_fillsOnlyNonSensitiveFieldsAndRetsName() { - setUpTestApplicationComponentWithoutLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createDeleteProfileContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("delete_profile_context") - assertThat(bundle).hasSize(11) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(DELETE_PROFILE_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - } - - @Test - fun testFillEventBundle_deleteProfileEvent_studyOn_fillsAllFieldsAndReturnsName() { - setUpTestApplicationComponentWithLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createDeleteProfileContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("delete_profile_context") - assertThat(bundle).hasSize(13) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(DELETE_PROFILE_CONTEXT.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("learner_id").isEqualTo(TEST_LEARNER_ID) - assertThat(bundle).string("install_id").isEqualTo(TEST_INSTALLATION_ID) - } - - @Test - fun testFillEventBundle_openHomeContextEvent_fillsAllFieldsInBundleAndReturnsName() { - setUpTestApplicationComponent() - val bundle = Bundle() - - val eventLog = createEventLog(context = createOpenHomeContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("open_home") - assertThat(bundle).hasSize(11) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(OPEN_HOME.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - } - - @Test - fun testFillEventBundle_openProfileChooserContextEvent_fillsAllFieldsInBundleAndReturnsName() { - setUpTestApplicationComponent() - val bundle = Bundle() - - val eventLog = createEventLog(context = createOpenProfileChooserContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("open_profile_chooser") - assertThat(bundle).hasSize(11) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(OPEN_PROFILE_CHOOSER.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - } - - @Test - fun testFillEventBundle_switchInLessonLanguageEvent_studyOff_fillsAllFieldsAndReturnsName() { - setUpTestApplicationComponent() - val bundle = Bundle() - - val eventLog = createEventLog(context = createSwitchInLessonLanguageContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("switch_in_lesson_language") - assertThat(bundle).hasSize(20) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(SWITCH_IN_LESSON_LANGUAGE.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("ed_classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("ed_topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("ed_story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("ed_exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("ed_session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("ed_exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("ed_state_name").isEqualTo(TEST_STATE_NAME) - assertThat(bundle).string("from_language").isEqualTo("English") - assertThat(bundle).string("to_language").isEqualTo("Swahili") - } - - @Test - fun testFillEventBundle_switchInLessonLanguageEvent_studyOn_fillsNonSensitiveDataAndRetsName() { - setUpTestApplicationComponentWithLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createSwitchInLessonLanguageContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("switch_in_lesson_language") - assertThat(bundle).hasSize(22) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(SWITCH_IN_LESSON_LANGUAGE.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("ed_classroom_id").isEqualTo(TEST_CLASSROOM_ID) - assertThat(bundle).string("ed_topic_id").isEqualTo(TEST_TOPIC_ID) - assertThat(bundle).string("ed_story_id").isEqualTo(TEST_STORY_ID) - assertThat(bundle).string("ed_exploration_id").isEqualTo(TEST_EXPLORATION_ID) - assertThat(bundle).string("ed_session_id").isEqualTo(TEST_LEARNER_SESSION_ID) - assertThat(bundle).string("ed_exploration_version").isEqualTo(TEST_EXPLORATION_VERSION_STR) - assertThat(bundle).string("ed_state_name").isEqualTo(TEST_STATE_NAME) - assertThat(bundle).string("ed_ld_learner_id").isEqualTo(TEST_LEARNER_ID) - assertThat(bundle).string("ed_ld_install_id").isEqualTo(TEST_INSTALLATION_ID) - assertThat(bundle).string("from_language").isEqualTo("English") - assertThat(bundle).string("to_language").isEqualTo("Swahili") - } - - @Test - fun testFillEventBundle_failedEventInstallId_studyOff_fillsOnlyNonSensitiveFieldsAndRetsName() { - setUpTestApplicationComponentWithoutLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createInstallationIdForFailedAnalyticsLogContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("failed_analytics_log") - assertThat(bundle).hasSize(11) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(INSTALL_ID_FOR_FAILED_ANALYTICS_LOG.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - } - - @Test - fun testFillEventBundle_failedEventInstallId_studyOn_fillsAllFieldsAndReturnsName() { - setUpTestApplicationComponentWithLearnerAnalyticsStudy() - val bundle = Bundle() - - val eventLog = createEventLog(context = createInstallationIdForFailedAnalyticsLogContext()) - - val typeName = eventBundleCreator.fillEventBundle(eventLog, bundle) - assertThat(typeName).isEqualTo("failed_analytics_log") - assertThat(bundle).hasSize(12) - assertThat(bundle).longInt("timestamp").isEqualTo(TEST_TIMESTAMP_1) - assertThat(bundle).string("priority").isEqualTo("essential") - assertThat(bundle).integer("event_type").isEqualTo(INSTALL_ID_FOR_FAILED_ANALYTICS_LOG.number) - assertThat(bundle).integer("android_sdk").isEqualTo(TEST_ANDROID_SDK_VERSION) - assertThat(bundle).string("app_version_name").isEqualTo(TEST_APP_VERSION_NAME) - assertThat(bundle).integer("app_version_code").isEqualTo(TEST_APP_VERSION_CODE) - assertThat(bundle).string("install_id").isEqualTo(TEST_INSTALLATION_ID) - } - - private fun createEventLog( - timestamp: Long = TEST_TIMESTAMP_1, - priority: EventLog.Priority = ESSENTIAL, - context: EventLog.Context = EventLog.Context.getDefaultInstance() - ) = EventLog.newBuilder().apply { - this.timestamp = timestamp - this.priority = priority - this.context = context - }.build() - - private fun createOpenExplorationActivity( - explorationContext: ExplorationContext = createExplorationContext() - ) = createEventContext(explorationContext, EventContextBuilder::setOpenExplorationActivity) - - private fun createOpenInfoTab(topicContext: TopicContext = createTopicContext()) = - createEventContext(topicContext, EventContextBuilder::setOpenInfoTab) - - private fun createOpenLessonsTab(topicContext: TopicContext = createTopicContext()) = - createEventContext(topicContext, EventContextBuilder::setOpenLessonsTab) - - private fun createOpenPracticeTab(topicContext: TopicContext = createTopicContext()) = - createEventContext(topicContext, EventContextBuilder::setOpenPracticeTab) - - private fun createOpenRevisionTab(topicContext: TopicContext = createTopicContext()) = - createEventContext(topicContext, EventContextBuilder::setOpenRevisionTab) - - private fun createOpenQuestionPlayer(questionContext: QuestionContext = createQuestionContext()) = - createEventContext(questionContext, EventContextBuilder::setOpenQuestionPlayer) - - private fun createOpenStoryActivity(storyContext: StoryContext = createStoryContext()) = - createEventContext(storyContext, EventContextBuilder::setOpenStoryActivity) - - private fun createOpenConceptCard( - conceptCardContext: ConceptCardContext = createConceptCardContext() - ) = createEventContext(conceptCardContext, EventContextBuilder::setOpenConceptCard) - - private fun createOpenRevisionCard( - revisionCardContext: RevisionCardContext = createRevisionCardContext() - ) = createEventContext(revisionCardContext, EventContextBuilder::setOpenRevisionCard) - - private fun createCloseRevisionCard( - revisionCardContext: RevisionCardContext = createRevisionCardContext() - ) = createEventContext(revisionCardContext, EventContextBuilder::setCloseRevisionCard) - - private fun createStartCardContext(cardContext: CardContext = createCardContext()) = - createEventContext(cardContext, EventContextBuilder::setStartCardContext) - - private fun createEndCardContext(cardContext: CardContext = createCardContext()) = - createEventContext(cardContext, EventContextBuilder::setEndCardContext) - - private fun createHintUnlockedContext(hintContext: HintContext = createHintContext()) = - createEventContext(hintContext, EventContextBuilder::setHintUnlockedContext) - - private fun createRevealHintContext(hintContext: HintContext = createHintContext()) = - createEventContext(hintContext, EventContextBuilder::setRevealHintContext) - - private fun createViewExistingHintContext(hintContext: HintContext = createHintContext()) = - createEventContext(hintContext, EventContextBuilder::setViewExistingHintContext) - - private fun createSolutionUnlockedContext( - explorationContext: ExplorationContext = createExplorationContext() - ) = createEventContext(explorationContext, EventContextBuilder::setSolutionUnlockedContext) - - private fun createRevealSolutionContext( - explorationContext: ExplorationContext = createExplorationContext() - ) = createEventContext(explorationContext, EventContextBuilder::setRevealSolutionContext) - - private fun createViewExistingSolutionContext( - explorationContext: ExplorationContext = createExplorationContext() - ) = createEventContext(explorationContext, EventContextBuilder::setViewExistingSolutionContext) - - private fun createSubmitAnswerContext( - submitAnswerContext: SubmitAnswerContext = createSubmitAnswerContextDetails() - ) = createEventContext(submitAnswerContext, EventContextBuilder::setSubmitAnswerContext) - - private fun createPlayVoiceOverContext( - playVoiceOverContext: VoiceoverActionContext = createPlayVoiceOverContextDetails() - ) = createEventContext(playVoiceOverContext, EventContextBuilder::setPlayVoiceOverContext) - - private fun createPauseVoiceOverContext( - pauseVoiceOverContext: VoiceoverActionContext = createPauseVoiceOverContextDetails() - ) = createEventContext(pauseVoiceOverContext, EventContextBuilder::setPauseVoiceOverContext) - - private fun createAppInBackgroundContext( - learnerDetails: LearnerDetailsContext = createLearnerDetailsContext() - ) = createEventContext(learnerDetails, EventContextBuilder::setAppInBackgroundContext) - - private fun createAppInForegroundContext( - learnerDetails: LearnerDetailsContext = createLearnerDetailsContext() - ) = createEventContext(learnerDetails, EventContextBuilder::setAppInForegroundContext) - - private fun createExitExplorationContext( - explorationContext: ExplorationContext = createExplorationContext() - ) = createEventContext(explorationContext, EventContextBuilder::setExitExplorationContext) - - private fun createFinishExplorationContext( - explorationContext: ExplorationContext = createExplorationContext() - ) = createEventContext(explorationContext, EventContextBuilder::setFinishExplorationContext) - - private fun createResumeExplorationContext( - learnerDetails: LearnerDetailsContext = createLearnerDetailsContext() - ) = createEventContext(learnerDetails, EventContextBuilder::setResumeExplorationContext) - - private fun createStartOverExplorationContext( - learnerDetails: LearnerDetailsContext = createLearnerDetailsContext() - ) = createEventContext(learnerDetails, EventContextBuilder::setStartOverExplorationContext) - - private fun createDeleteProfileContext( - learnerDetails: LearnerDetailsContext = createLearnerDetailsContext() - ) = createEventContext(learnerDetails, EventContextBuilder::setDeleteProfileContext) - - private fun createOpenHomeContext() = - createEventContext(value = true, EventContextBuilder::setOpenHome) - - private fun createOpenProfileChooserContext() = - createEventContext(value = true, EventContextBuilder::setOpenProfileChooser) - - private fun createSwitchInLessonLanguageContext( - switchLanguageContext: SwitchInLessonLanguageEventContext = - createSwitchInLessonLanguageEventContext(), - ) = createEventContext(switchLanguageContext, EventContextBuilder::setSwitchInLessonLanguage) - - private fun createInstallationIdForFailedAnalyticsLogContext( - installationId: String = TEST_INSTALLATION_ID - ) = createEventContext(installationId, EventContextBuilder::setInstallIdForFailedAnalyticsLog) - - private fun createEventContext( - value: T, - setter: EventContextBuilder.(T) -> EventContextBuilder - ) = EventLog.Context.newBuilder().setter(value).build() - - private fun createExplorationContext( - classroomId: String = TEST_CLASSROOM_ID, - topicId: String = TEST_TOPIC_ID, - storyId: String = TEST_STORY_ID, - explorationId: String = TEST_EXPLORATION_ID, - sessionId: String = TEST_LEARNER_SESSION_ID, - explorationVersion: Int = TEST_EXPLORATION_VERSION, - stateName: String = TEST_STATE_NAME, - learnerDetails: LearnerDetailsContext = createLearnerDetailsContext() - ) = ExplorationContext.newBuilder().apply { - this.classroomId = classroomId - this.topicId = topicId - this.storyId = storyId - this.explorationId = explorationId - this.sessionId = sessionId - this.explorationVersion = explorationVersion - this.stateName = stateName - this.learnerDetails = learnerDetails - }.build() - - private fun createLearnerDetailsContext( - learnerId: String = TEST_LEARNER_ID, - installId: String = TEST_INSTALLATION_ID - ) = LearnerDetailsContext.newBuilder().apply { - this.learnerId = learnerId - this.installId = installId - }.build() - - private fun createTopicContext(topicId: String = TEST_TOPIC_ID) = - TopicContext.newBuilder().apply { this.topicId = topicId }.build() - - private fun createQuestionContext( - questionId: String = TEST_QUESTION_ID, - skillIds: List = listOf(TEST_SKILL_ID_1, TEST_SKILL_ID_2) - ) = QuestionContext.newBuilder().apply { - this.questionId = questionId - addAllSkillId(skillIds) - }.build() - - private fun createStoryContext( - topicId: String = TEST_TOPIC_ID, - storyId: String = TEST_STORY_ID - ) = StoryContext.newBuilder().apply { - this.topicId = topicId - this.storyId = storyId - }.build() - - private fun createConceptCardContext(skillId: String = TEST_SKILL_ID_1) = - ConceptCardContext.newBuilder().apply { this.skillId = skillId }.build() - - private fun createRevisionCardContext( - topicId: String = TEST_TOPIC_ID, - subTopicIndex: Int = TEST_SUB_TOPIC_INDEX - ) = RevisionCardContext.newBuilder().apply { - this.topicId = topicId - subTopicId = subTopicIndex - }.build() - - private fun createCardContext( - explorationDetails: ExplorationContext = createExplorationContext(), - skillId: String = TEST_SKILL_ID_1 - ) = CardContext.newBuilder().apply { - this.explorationDetails = explorationDetails - this.skillId = skillId - }.build() - - private fun createHintContext( - explorationDetails: ExplorationContext = createExplorationContext(), - hintIndex: Int = TEST_HINT_INDEX - ) = HintContext.newBuilder().apply { - this.explorationDetails = explorationDetails - this.hintIndex = hintIndex - }.build() - - private fun createSubmitAnswerContextDetails( - explorationDetails: ExplorationContext = createExplorationContext(), - isAnswerCorrect: Boolean = TEST_IS_ANSWER_CORRECT - ) = SubmitAnswerContext.newBuilder().apply { - this.explorationDetails = explorationDetails - this.isAnswerCorrect = isAnswerCorrect - }.build() - - private fun createPlayVoiceOverContextDetails( - explorationDetails: ExplorationContext = createExplorationContext(), - contentId: String = TEST_CONTENT_ID, - languageCode: String = TEST_LANGUAGE_CODE - ) = VoiceoverActionContext.newBuilder().apply { - this.explorationDetails = explorationDetails - this.contentId = contentId - this.languageCode = languageCode - }.build() - - private fun createPauseVoiceOverContextDetails( - explorationDetails: ExplorationContext = createExplorationContext(), - contentId: String = TEST_CONTENT_ID, - languageCode: String = TEST_LANGUAGE_CODE - ) = VoiceoverActionContext.newBuilder().apply { - this.explorationDetails = explorationDetails - this.contentId = contentId - this.languageCode = languageCode - }.build() - - private fun createSwitchInLessonLanguageEventContext( - explorationDetails: ExplorationContext = createExplorationContext(), - switchFromLanguage: OppiaLanguage = OppiaLanguage.ENGLISH, - switchToLanguage: OppiaLanguage = OppiaLanguage.SWAHILI - ) = SwitchInLessonLanguageEventContext.newBuilder().apply { - this.explorationDetails = explorationDetails - this.switchFromLanguage = switchFromLanguage - this.switchToLanguage = switchToLanguage - }.build() - - private fun registerTestApplication() { - val packageManager = Shadows.shadowOf(context.packageManager) - val applicationInfo = - ApplicationInfoBuilder.newBuilder() - .setPackageName(context.packageName) - .build() - val packageInfo = - PackageInfoBuilder.newBuilder() - .setPackageName(context.packageName) - .setApplicationInfo(applicationInfo) - .build() - packageInfo.versionName = TEST_APP_VERSION_NAME - packageInfo.longVersionCode = TEST_APP_VERSION_CODE - packageManager.installPackage(packageInfo) - } - - private fun setUpTestApplicationComponentWithoutLearnerAnalyticsStudy() { - TestModule.enableLoggingLearnerStudyIds = false - setUpTestApplicationComponent() - } - - private fun setUpTestApplicationComponentWithLearnerAnalyticsStudy() { - TestModule.enableLoggingLearnerStudyIds = true - setUpTestApplicationComponent() - } - - private fun setUpTestApplicationComponent() { - ApplicationProvider.getApplicationContext().inject(this) - registerTestApplication() - } - - // TODO(#89): Move this to a common test application component. - @Module - class TestModule { - internal companion object { - // This is expected to be off by default, so this helps the tests above confirm that the - // feature's default value is, indeed, off. - var enableLoggingLearnerStudyIds = LOGGING_LEARNER_STUDY_IDS_DEFAULT_VALUE - } - - @Provides - @Singleton - fun provideContext(application: Application): Context { - return application - } - - // The scoping here is to ensure changes to the module value above don't change the parameter - // within the same application instance. - @Provides - @Singleton - @EnableLoggingLearnerStudyIds - fun provideLoggingLearnerStudyIds(): PlatformParameterValue { - // Snapshot the value so that it doesn't change between injection and use. - val enableFeature = enableLoggingLearnerStudyIds - return PlatformParameterValue.createDefaultParameter( - defaultValue = enableFeature - ) - } - } - - // TODO(#89): Move this to a common test application component. - @Singleton - @Component(modules = [TestModule::class, KenyaAlphaEventLoggingConfigurationModule::class]) - interface TestApplicationComponent { - @Component.Builder - interface Builder { - @BindsInstance - fun setApplication(application: Application): Builder - - fun build(): TestApplicationComponent - } - - fun inject(test: KenyaAlphaEventBundleCreatorTest) - } - - class TestApplication : Application() { - private val component: TestApplicationComponent by lazy { - DaggerKenyaAlphaEventBundleCreatorTest_TestApplicationComponent.builder() - .setApplication(this) - .build() - } - - fun inject(test: KenyaAlphaEventBundleCreatorTest) { - component.inject(test) - } - } -} diff --git a/utility/src/test/java/org/oppia/android/util/logging/KenyaAlphaEventLoggingConfigurationModuleTest.kt b/utility/src/test/java/org/oppia/android/util/logging/KenyaAlphaEventLoggingConfigurationModuleTest.kt deleted file mode 100644 index 31d1130c3d0..00000000000 --- a/utility/src/test/java/org/oppia/android/util/logging/KenyaAlphaEventLoggingConfigurationModuleTest.kt +++ /dev/null @@ -1,70 +0,0 @@ -package org.oppia.android.util.logging - -import android.app.Application -import android.content.Context -import androidx.test.core.app.ApplicationProvider -import androidx.test.ext.junit.runners.AndroidJUnit4 -import com.google.common.truth.Truth.assertThat -import dagger.BindsInstance -import dagger.Component -import dagger.Module -import dagger.Provides -import org.junit.Before -import org.junit.Test -import org.junit.runner.RunWith -import org.robolectric.annotation.Config -import org.robolectric.annotation.LooperMode -import javax.inject.Inject -import javax.inject.Singleton - -/** Tests for [KenyaAlphaEventLoggingConfigurationModule]. */ -// FunctionName: test names are conventionally named with underscores. -@Suppress("FunctionName") -@RunWith(AndroidJUnit4::class) -@LooperMode(LooperMode.Mode.PAUSED) -@Config(manifest = Config.NONE) -class KenyaAlphaEventLoggingConfigurationModuleTest { - @Inject lateinit var eventTypeToHumanReadableNameConverter: EventTypeToHumanReadableNameConverter - - @Before - fun setUp() { - setUpTestApplicationComponent() - } - - @Test - fun testModule_injectedEventTypeToHumanReadableNameConverter_isStudySpecificImplementation() { - assertThat(eventTypeToHumanReadableNameConverter) - .isInstanceOf(KenyaAlphaEventTypeToHumanReadableNameConverterImpl::class.java) - } - - private fun setUpTestApplicationComponent() { - DaggerKenyaAlphaEventLoggingConfigurationModuleTest_TestApplicationComponent - .builder() - .setApplication(ApplicationProvider.getApplicationContext()).build().inject(this) - } - - // TODO(#89): Move this to a common test application component. - @Module - class TestModule { - @Provides - @Singleton - fun provideContext(application: Application): Context { - return application - } - } - - // TODO(#89): Move this to a common test application component. - @Singleton - @Component(modules = [KenyaAlphaEventLoggingConfigurationModule::class]) - interface TestApplicationComponent { - @Component.Builder - interface Builder { - @BindsInstance - fun setApplication(application: Application): Builder - - fun build(): TestApplicationComponent - } - - fun inject(test: KenyaAlphaEventLoggingConfigurationModuleTest) - } -} diff --git a/utility/src/test/java/org/oppia/android/util/logging/firebase/BUILD.bazel b/utility/src/test/java/org/oppia/android/util/logging/firebase/BUILD.bazel index 8980bedd68c..841f115ae69 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/firebase/BUILD.bazel +++ b/utility/src/test/java/org/oppia/android/util/logging/firebase/BUILD.bazel @@ -22,7 +22,6 @@ oppia_android_test( "//third_party:org_robolectric_robolectric", "//third_party:robolectric_android-all", "//utility/src/main/java/org/oppia/android/util/locale:prod_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:prod_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", ], @@ -46,7 +45,6 @@ oppia_android_test( "//third_party:org_robolectric_robolectric", "//third_party:robolectric_android-all", "//utility/src/main/java/org/oppia/android/util/locale/testing:test_module", - "//utility/src/main/java/org/oppia/android/util/logging:standard_event_logging_configuration_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:debug_module", "//utility/src/main/java/org/oppia/android/util/logging/firebase:prod_module", "//utility/src/main/java/org/oppia/android/util/networking:debug_module", diff --git a/utility/src/test/java/org/oppia/android/util/logging/firebase/LogReportingModuleTest.kt b/utility/src/test/java/org/oppia/android/util/logging/firebase/LogReportingModuleTest.kt index 30992f7132c..40c20ad719c 100644 --- a/utility/src/test/java/org/oppia/android/util/logging/firebase/LogReportingModuleTest.kt +++ b/utility/src/test/java/org/oppia/android/util/logging/firebase/LogReportingModuleTest.kt @@ -20,7 +20,6 @@ import org.oppia.android.util.data.DataProvidersInjector import org.oppia.android.util.data.DataProvidersInjectorProvider import org.oppia.android.util.locale.LocaleProdModule import org.oppia.android.util.logging.AnalyticsEventLogger -import org.oppia.android.util.logging.EventLoggingConfigurationModule import org.oppia.android.util.logging.LoggerModule import org.oppia.android.util.logging.SyncStatusModule import org.oppia.android.util.logging.performancemetrics.PerformanceMetricsEventLogger @@ -112,7 +111,6 @@ class LogReportingModuleTest { RobolectricModule::class, FakeOppiaClockModule::class, NetworkConnectionUtilDebugModule::class, LocaleProdModule::class, TestPlatformParameterModule::class, LoggerModule::class, SyncStatusModule::class, - EventLoggingConfigurationModule::class ] ) interface TestApplicationComponent : DataProvidersInjector { diff --git a/version.bzl b/version.bzl index 792b4e48c31..cd5a9094511 100644 --- a/version.bzl +++ b/version.bzl @@ -12,11 +12,9 @@ the app (that are potentially not broadly released yet). MAJOR_VERSION = 0 MINOR_VERSION = 13 -# TODO(#4419): Remove the Kenya-specific alpha version code. -OPPIA_DEV_VERSION_CODE = 166 -OPPIA_DEV_KITKAT_VERSION_CODE = 165 -OPPIA_ALPHA_KENYA_VERSION_CODE = 164 -OPPIA_ALPHA_VERSION_CODE = 163 -OPPIA_ALPHA_KITKAT_VERSION_CODE = 162 -OPPIA_BETA_VERSION_CODE = 161 -OPPIA_GA_VERSION_CODE = 160 +OPPIA_DEV_VERSION_CODE = 172 +OPPIA_DEV_KITKAT_VERSION_CODE = 171 +OPPIA_ALPHA_VERSION_CODE = 170 +OPPIA_ALPHA_KITKAT_VERSION_CODE = 169 +OPPIA_BETA_VERSION_CODE = 168 +OPPIA_GA_VERSION_CODE = 167 diff --git a/wiki/Upgrading-Target-Sdk-Guide.md b/wiki/Upgrading-Target-Sdk-Guide.md new file mode 100644 index 00000000000..bc5ce02e032 --- /dev/null +++ b/wiki/Upgrading-Target-Sdk-Guide.md @@ -0,0 +1,156 @@ +## Overview + +Updating Oppia Android's [target SDK](https://developer.android.com/guide/topics/manifest/uses-sdk-element#target) provides an explicit signal to Android OS versions at or above the new target SDK level that the app should work correctly for that platform. + +The target SDK version, unlike the compile SDK version, is specifically a runtime behavior signal. That means it enables functionality only observable by opening and running the app on the corresponding, or newer, versions of the OS. When Android makes changes that could break compatibility with older apps, they will usually gate this behind the target SDK level so that apps can have time to upgrade without users being unable to use them after they themselves upgrade to the newer Android version. Not every version of Android introduces these compatibility breakages, and not every potential breakage will affect Oppia Android. + +This guide describes the high-level process for upgrading the app to a newer version of Android, and how to do it in a way that should reduce the risk of introducing breakages to users. + +## Upgrade Process + +```mermaid +flowchart TD + classDef textWrap text-wrap: wrap; + A(Step 1: Identifying the need to upgrade):::textWrap -->|Tracking issue exists| B + B(Step 2: Auditing the Android OS changelog):::textWrap -->|Audit complete| C + C(Step 3: Testing the app & filing problems):::textWrap -->|Testing finished & issues filed| D + D(Step 4: Fixing and stabilizing support):::textWrap -->|All issues fixed| E + E(Step 5: Submitting the upgrade):::textWrap -->|Compile/target SDK PR submitted| F + F(Step 6: Future work items and upgrading Robolectric):::textWrap -->|Future issues filed| G + G(Finished) +``` + +### Step 1: Identifying the need to upgrade + +There are generally three signals that may indicate the team should consider upgrading to a newer Android SDK target: +1. https://developer.android.com/google/play/requirements/target-sdk indicates an upgrade mandate and deadline. We also get this reminder via the Google Play Console. +2. A new version of Android has released to users and we perform a periodic check for compatibility (usually around July/August). We may decide to upgrade even if there isn't a mandate. +3. A feature requires a newer version of Android (note this is unlikely since we generally want to design features to work for all of our users). + +If it's deemed that there's a new SDK version to target and the app isn't yet targeting it, a new feature request should be filed (similar to [#5535](https://github.com/oppia/oppia-android/pull/5535)) as long as there isn't an existing tracking issue for this work. + +### Step 2: Auditing the Android OS changelog + +All new Android OS functionality changes (both those tied to ``targetSdkVersion`` and those not) should be analyzed for potential areas of testing. These can be found on the Android developers site, for example for SDK 34: +- Changes affecting all apps: https://developer.android.com/about/versions/14/behavior-changes-all. +- Changes tied to changing target SDK version: https://developer.android.com/about/versions/14/behavior-changes-14. + +Any concerning changes or functionality that could be beneficial to Oppia Android should be noted in the tracking issue for the SDK upgrade (see https://github.com/oppia/oppia-android/issues/5137#issuecomment-1815241974 for a good example of this). + +#### Step 2.1: Tips for auditing +Note that narrowing down these categories isn't a process that can be easily described as a set of steps since new OS features may not even be predictable ahead of time. However, here are some tips that might help: +- Look for changes in permissions. This could either be an old permission that's now more restricted, or existing SDK functionality that's now blocked by a new permission (both have occurred in past Android OS updates). If the functionality and/or permission relates to Oppia Android, it should be noted. Note that some things may be tied to permissions and access control that's not obvious such as: + - Filesystem management + - Content providers (such as for photo selection which we use for users selecting their avatar) + - Clipboard management (which we support for a specific user study feature) +- Look for changes in service/worker management, especially background processing (note that Oppia Android does not use a foreground service) and wakelocks. These areas receive updates in almost every OS version and Oppia Android relies in them indirectly (via Firebase and ``WorkManager``). +- Changes in SQLite database support _could_ affect the app, so it's worth noting. +- API deprecations should always be checked against the latest Oppia Android ``develop`` code and, in cases where we are using those APIs, be noted as this is likely to become a compiler error. +- Changes in media handling, especially for ``MediaPlayer``. +- Changes in UI lifecycle management (such as in a past OS version when Android introduced the support for multiple apps to be started, but not resumed, at the same time, e.g. for split screen). +- Generic changes that may affect any of the ~100 third-party dependencies the app uses. A good example of this: https://developer.android.com/about/versions/13/changes/non-sdk-13. + +For anything else, if you're unsure whether it affects Oppia Android then err on the side of noting it rather than ignoring it. The expectation is that whoever goes through this step of the process will read _every_ listed change in the new target version of Android and note **everything** of interest. + +#### Step 2.2: Reporting findings + +Post the findings as a new comment in the tracking issue using three different lists: +1. One list for areas with known problems (e.g. API deprecations). Note that each of these problems should be filed as separate bugs in the Oppia Android issue tracker and their issue numbers noted as part of this list. +2. One list for areas that require additional verification to ensure compatibility. +3. One list for areas that could be of interest for future work. + +The new comment should include an explicit indication of whether the audit was completed, or if additional analysis on Android SDK documentation is needed. + +### Step 3: Testing the app & filing problems + +Compatibility with the new target SDK should be done by: +1. Building a local production [Bazel build](https://github.com/oppia/oppia-android/wiki/Oppia-Bazel-Setup-Instructions#building-the-app) of the app (``//:oppia_beta``) and deployed to a local emulator or device running the **same** version of Android as the new target SDK version. + - Note that this requires the local app's target SDK to be temporarily upgraded (see step (5) below) but not checked in. + - In some cases, a real device may need to be used instead of an emulator since certain features change behavior on an emulator (such as the drag and drop interaction). + - If the app isn't already using the new version of Android as its compile SDK version, then it may fail to build. Any build failures should be filed as issues on the issue tracker and fixed before this step of the process can continue. +2. Testing the app using the local production build of the app to ensure compatibility (see the following sub-sections for specifics). + +#### Step 3.1: Testing potential problem areas + +The list of focus areas to specifically test (per the audit completed in step (2) above) should be explicity tested to ensure that corresponding user features behave correctly and don't have new issues due to the SDK change. +- Note that in some cases this may require using both a handset and tablet emulator configuration if there are tablet-specific or layout-specific areas identified. +- Note that [#5137](https://github.com/oppia/oppia-android/issues/5137) may provide some good context on how to test certain types of changes that may not be as simple as manually performing a certain user action and may instead require a clever code change. + +#### Step 3.2: Testing broad app behaviors + +A general analysis should be peformed by testing the following scenarios: +- Profile creation/deletion and login. +- Playing, pausing, resuming, and finishing a lesson. +- Ensuring all interactions work (play through every test topic prototype exploration). +- Ensuring LaTeX and in-lesson images load correctly. +- Ensuring that lesson progress correctly saves per profile. +- Ensuring that profile avatars can be correctly set. +- Ensuring that hints and solutions work correctly. +- Ensuring that wrong answers are handled correctly. +- Checking that concept and revision cards work correctly. +- Verifying that events are logged (either per Firebase analytics if you have access, or the developer options menu using a build of ``//:oppia_dev``--note that ``oppia_dev`` should only be used for this specific verification and not any of the others). + +#### Step 3.3: Cataloging findings + +Any breakages should be noted, and then checked against a version of the app without the target SDK. From there: +- If the breakage still occurs, file a new bug noting the problem and mention in the 'additional context' section that it was found during target SDK testing but was determined as unrelated. +- If the breakage does not occur on the non-upgraded version of the app, file a new bug in the issue tracker and mention that it's specific to the new target SDK version and is a blocking issue. + +Please note all found blocking issues with their issue numbers in a follow-up reply to the tracking issue. Any other thoughts or findings during testing can also be noted in the tracking issue (similar to the comments in [#5137](https://github.com/oppia/oppia-android/issues/5137)). Please also note in the tracking issue when testing has concluded. + +### Step 4: Fixing and stabilizing support + +Work on fixing all identified problems from steps (3) and (4) (either by directly fixing the problems via code changes, or via coordination with other members of the team). + +Once all issues are fixed, verify each problem is correctly addressed using a temporary local build of the app (see step (3) above). If any problems are still occurring, reopen the corresponding tracking issue and leave a follow-up comment detailing the ongoing problem and steps to reproduce it. + +Once all fixed issues are verified, leave a follow-up comment on the upgrade target SDK tracking issue mentioning that verification has concluded and there are no remaining issues found. + +### Step 5: Submitting the upgrade + +The actual code change to upgrade the app comes in two parts: +1. Upgrading the compile version (which may already be done as the team sometimes needs to update this for other reasons). +2. Upgrading the runtime target SDK version. + +The sub-sections below detail each of the code changes needed to perform these upgrades. + +**Important caveats and notes**: +- Both version upgrades can be done together in the same PR, but if they are split up the compile-time change (step (5.1) below) must happen first. +- [#5222](https://github.com/oppia/oppia-android/issues/5222) is an example of a PR that performs both steps in one, though it includes a few additional code changes that were needed as a result of the compile SDK change. +- Please note the CI results for this upgrade change. Any failures are likely problems that will need to be fixed within the upgrade PR (if small, e.g. the change in [#5222](https://github.com/oppia/oppia-android/issues/5222)) or filed as a separate bug that will need to be fixed before the upgrade can be submitted (see step (4) above). +- Updating the compile-time SDK version may require updating the build tools version. This is **not** a simple change and may cause difficult-to-fix breakages due to subtle compatibility issues between third-party dependencies and the build system configurations. If you suspect a build tools version upgrade is needed, please file an issue to track it and contact the developer workflow team lead to discuss next steps. +- Updating tests to use a newer version of Android can be exceptionally complicated, and thus this is considered a completely separate exercise from upgrading production code. See step (6) below for more specifics. + +#### Step 5.1: Updating the compiled SDK version + +This code change essentially requires replacing the old SDK version number (e.g. 31) with the new one (e.g. 33), but only for compile-time behaviors. All needed changes are detailed below: +1. [``.github/actions/set-up-android-bazel-build-environment/action.yml``](https://github.com/oppia/oppia-android/blob/dfb9a301280b9a46526cb2f5ca6329532fec6bf0/.github/actions/set-up-android-bazel-build-environment/action.yml#L75-L78) needs to be updated to install the correct SDK version (via the ``sdkmanager --install`` command). +2. Bazel [``build_vars.bzl``](https://github.com/oppia/oppia-android/blob/dfb9a301280b9a46526cb2f5ca6329532fec6bf0/build_vars.bzl#L1) changes to ``BUILD_SDK_VERSION``. +3. Gradle ``compileSdkVersion`` changes (e.g. for [``app/build.gradle``](https://github.com/oppia/oppia-android/blob/dfb9a301280b9a46526cb2f5ca6329532fec6bf0/app/build.gradle#L8)). Note that all module ``.gradle`` files will need to be updated in this way. + +#### Step 5.2: Updating the target SDK version + +This code change requires changing Bazel, Gradle, and ``AndroidManifest.xml`` files. All needed changes are detailed below: +1. The top-level [``BUILD.bazel``](https://github.com/oppia/oppia-android/blob/dfb9a301280b9a46526cb2f5ca6329532fec6bf0/BUILD.bazel#L118-L130)'s APK targets need to be upgraded to target the correct SDK. +2. All Bazel AAB targets need to be updated in [``build_flavors.bzl``](https://github.com/oppia/oppia-android/blob/dfb9a301280b9a46526cb2f5ca6329532fec6bf0/build_flavors.bzl#L45-L146)'s ``_FLAVOR_METADATA`` dict to point to the correct target SDK version (each flavor has its own target SDK declared). +3. All manifest XML files (e.g. [``app/src/main/AppAndroidManifest.xml``](https://github.com/oppia/oppia-android/blob/dfb9a301280b9a46526cb2f5ca6329532fec6bf0/app/src/main/AppAndroidManifest.xml#L4)) that _have_ an ``android:targetSdkVersion`` attribute need to be updated to use the correct version. If a manifest file is missing this attribute, it doesn't need to be changed. +4. All module ``.gradle`` files must be updated to use the correct target SDK version, e.g. [``app/build.gradle``](https://github.com/oppia/oppia-android/blob/dfb9a301280b9a46526cb2f5ca6329532fec6bf0/app/build.gradle#L13). + +After the four areas above are completed, the old SDK version is unlikely to be present anywhere in the codebase. This can be verified using a quick "find all" or ``grep`` search. One likely exception is tests (see the caveats list in the main section of step (5) above). + +The PR that updates the target SDK version can be marked as fixing and closing the corresponding tracking issue. + +### Step 6: Future work items and upgrading Robolectric + +Findings from the analysis in step (2) should be considered as potential future work items. Anything that either the CLaM or developer workflow team leads think might be worth pursuing in the future should be filed as feature requests in the issue tracker and mentioned in a follow-up comment in the SDK upgrade tracking issue. + +Ideally, Robolectric tests would also be upgraded with the target SDK version. However, there are a few problems with this currently: +1. Robolectric's version is tightly coupled with the SDKs it supports (since Robolectric itself needs to be updated to support each version of Android). +2. Robolectric usually lags far behind (sometimes more than a year) mainline Android for SDK support. +3. Upgrading Robolectric can have significant downstream effects. One such case that's been observed in the past: + - Upgrading Robolectric required upgrading Espresso (since Robolectric depends on Espresso libraries to implement part of its API). + - Upgrading Espresso required upgrading AndroidX libraries (which actually impact production behaviors). + - Upgrading the AndroidX libraries led to many other version upgrades that actually eventually led to a Kotlin version upgrade and an upgrade to the version of Bazel used. +4. Robolectric does not have strong behavior consistency between SDK versions so tests have a relatively higher chance of regressing when changing the SDK version Robolectric is using by default than production code. + +For now, the best course of action is to either file a new feature request to upgrade Robolectric tests to use the same target SDK as the app by default, or update the existing issue if there's one already tracking an upgrade (which is likely since the upgrade can be both difficult and time consuming, so it's usually not a team priority). diff --git a/wiki/_Sidebar.md b/wiki/_Sidebar.md index c1f9834bc49..c6639f04b52 100644 --- a/wiki/_Sidebar.md +++ b/wiki/_Sidebar.md @@ -29,14 +29,14 @@ * [Writing Tests with Good Behavioral Coverage](https://github.com/oppia/oppia-android/wiki/Writing-Tests-With-Good-Behavioral-Coverage) * [Developing Skills](https://github.com/oppia/oppia-android/wiki/Developing-skills) * [Frequent Errors and Solutions](https://github.com/oppia/oppia-android/wiki/Frequent-Errors-and-Solutions) - * [RTL Guidelines](https://github.com/oppia/oppia-android/wiki/RTL-Guidelines) + * [RTL Guidelines](https://github.com/oppia/oppia-android/wiki/RTL-Guidelines) * [Working on UI](https://github.com/oppia/oppia-android/wiki/Working-on-UI) * [Writing Design Docs](https://github.com/oppia/oppia-android/wiki/Writing-design-docs) --- **Developer Reference** * Code style * [Coding style guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide) - * [Ktlint Guide](https://github.com/oppia/oppia-android/wiki/Ktlint-Guide) + * [Ktlint Guide](https://github.com/oppia/oppia-android/wiki/Ktlint-Guide) * [Static Analysis Checks](https://github.com/oppia/oppia-android/wiki/Static-Analysis-Checks) * [Accessibility Guide](https://github.com/oppia/oppia-android/wiki/Accessibility-A11y-Guide) * [Debugging](https://github.com/oppia/oppia-android/wiki/Debugging) @@ -45,7 +45,7 @@ * [Background Processing](https://github.com/oppia/oppia-android/wiki/Background-Processing) * [Kotlin Coroutines](https://github.com/oppia/oppia-android/wiki/Kotlin-Coroutines) * [DataProvider & LiveData](https://github.com/oppia/oppia-android/wiki/DataProvider-&-LiveData) - * [PersistentCacheStore & In Memory Blocking Cache](https://github.com/oppia/oppia-android/wiki/PersistentCacheStore-&-In-Memory-Blocking-Cache) + * [PersistentCacheStore & In Memory Blocking Cache](https://github.com/oppia/oppia-android/wiki/PersistentCacheStore-&-In-Memory-Blocking-Cache) * [Dark mode](https://github.com/oppia/oppia-android/wiki/Dark-Mode) * [Buf Guide](https://github.com/oppia/oppia-android/wiki/Buf-Guide) * [Firebase Console Guide](https://github.com/oppia/oppia-android/wiki/Firebase-Console-Guide) @@ -53,10 +53,11 @@ * [Work Manager](https://github.com/oppia/oppia-android/wiki/Work-Manager) * [Dependency Injection](https://github.com/oppia/oppia-android/wiki/Dependency-Injection) with [Dagger](https://github.com/oppia/oppia-android/wiki/Dagger) * [Revert & regression policy](https://github.com/oppia/oppia-android/wiki/Revert-&-regression-policy) + * [Upgrading target SDK version](https://github.com/oppia/oppia-android/wiki/Upgrading-Target-Sdk-Guide) * [Spotlight Guide](https://github.com/oppia/oppia-android/wiki/Spotlight-Guide) * [Triaging Process](https://github.com/oppia/oppia-android/wiki/Triaging-process) * Bazel - * [Gradle Bazel Migration Best Practices and FAQ](https://github.com/oppia/oppia-android/wiki/Gradle--Bazel-Migration-Best-Practices-and-FAQ) + * [Gradle Bazel Migration Best Practices and FAQ](https://github.com/oppia/oppia-android/wiki/Gradle--Bazel-Migration-Best-Practices-and-FAQ) * [Updating Maven Dependencies](https://github.com/oppia/oppia-android/wiki/Updating-Maven-Dependencies) * [Internationalization](https://github.com/oppia/oppia-android/wiki/Internationalization) * [Terminology in Oppia](https://github.com/oppia/oppia-android/wiki/Terminology-in-Oppia)