Skip to content

Commit

Permalink
Fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
adhiamboperes committed Jul 23, 2024
1 parent eb64975 commit e7ee78a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 23 deletions.
16 changes: 0 additions & 16 deletions app/src/main/java/org/oppia/android/app/home/HomeActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -80,22 +80,6 @@ class HomeActivity :
)
}

override fun onBackPressed() {
val previousFragment =
supportFragmentManager.findFragmentByTag(TAG_SWITCH_PROFILE_DIALOG)
if (previousFragment != null) {
supportFragmentManager.beginTransaction().remove(previousFragment).commitNow()
}
val exitProfileDialogArguments =
ExitProfileDialogArguments
.newBuilder()
.setHighlightItem(HighlightItem.NONE)
.build()
val dialogFragment = ExitProfileDialogFragment
.newInstance(exitProfileDialogArguments = exitProfileDialogArguments)
dialogFragment.showNow(supportFragmentManager, TAG_SWITCH_PROFILE_DIALOG)
}

override fun routeToTopicPlayStory(
internalProfileId: Int,
classroomId: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.oppia.android.app.onboarding

import android.os.Bundle
import android.view.Gravity.apply
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import org.oppia.android.R
Expand All @@ -13,8 +12,10 @@ import org.oppia.android.util.extensions.putProto
import org.oppia.android.util.profile.CurrentUserProfileIdIntentDecorator.decorateWithUserProfileId
import javax.inject.Inject

private const val TAG_CREATE_PROFILE_ACTIVITY_FRAGMENT = "TAG_CREATE_PROFILE_ACTIVITY_FRAGMENT"
private const val CREATE_PROFILE_FRAGMENT_ARGS = "CreateProfileFragment.args"
private const val TAG_CREATE_PROFILE_FRAGMENT = "TAG_CREATE_PROFILE_FRAGMENT"

/** Arguments key for [CreateProfileFragment] args. */
const val CREATE_PROFILE_FRAGMENT_ARGS = "CreateProfileFragment.args"

/** Presenter for [CreateProfileActivity]. */
class CreateProfileActivityPresenter @Inject constructor(
Expand Down Expand Up @@ -44,14 +45,14 @@ class CreateProfileActivityPresenter @Inject constructor(
activity.supportFragmentManager.beginTransaction().add(
R.id.profile_fragment_placeholder,
createLearnerProfileFragment,
TAG_CREATE_PROFILE_ACTIVITY_FRAGMENT
TAG_CREATE_PROFILE_FRAGMENT
).commitNow()
}
}

private fun getNewLearnerProfileFragment(): CreateProfileFragment? {
return activity.supportFragmentManager.findFragmentByTag(
TAG_CREATE_PROFILE_ACTIVITY_FRAGMENT
TAG_CREATE_PROFILE_FRAGMENT
) as? CreateProfileFragment
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ 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.CreateProfileActivityParams
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
Expand Down Expand Up @@ -42,7 +42,7 @@ class CreateProfileFragment : InjectableFragment() {
}
val profileType = checkNotNull(
arguments?.getProto(
CREATE_PROFILE_PARAMS_KEY, CreateProfileActivityParams.getDefaultInstance()
CREATE_PROFILE_FRAGMENT_ARGS, CreateProfileFragmentArguments.getDefaultInstance()
)?.profileType
) {
"Expected CreateProfileFragment to have a profileType argument."
Expand Down

0 comments on commit e7ee78a

Please sign in to comment.