Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #3095, #2824: Use protos with intent extras in RecentlyPlayedActivity #4511

Merged
merged 78 commits into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
771778e
RecentlyPlayedActivityParams proto created with ActivityRouter
vrajdesai78 Aug 19, 2022
dcdbe50
Nit changes
vrajdesai78 Aug 19, 2022
39558cd
Optimize imports
vrajdesai78 Aug 19, 2022
4ad3c4c
Merge branch 'develop' into Proto-for-Intent-extras
vrajdesai78 Aug 19, 2022
4c5b5af
Shifted applicationComponent to developerApplicationComponent
vrajdesai78 Aug 19, 2022
a7339b3
Optimized import
vrajdesai78 Aug 19, 2022
519a555
ActivityRouterModule updated
vrajdesai78 Aug 19, 2022
54fb3c1
Updated RECENTLY_PLAYED_ACTIVITY_INTENT_EXTRAS_KEY in ProfileProgress…
vrajdesai78 Aug 19, 2022
dfe1fa0
Static checks fixed
vrajdesai78 Aug 19, 2022
f8b933f
setTitle added in ReceltyPlayedActivityPresenter
vrajdesai78 Aug 19, 2022
c4fd457
bazel added and set title to toolbar
vrajdesai78 Aug 19, 2022
fe671c8
removed unused import
vrajdesai78 Aug 19, 2022
f0c7f49
nit changes
vrajdesai78 Aug 19, 2022
bb29773
test updated and made changes in bazel
vrajdesai78 Aug 20, 2022
ca129fe
dependencies added BUILD.bazel
vrajdesai78 Aug 20, 2022
bba42b7
static and lint checks fixed
vrajdesai78 Aug 20, 2022
8b0c707
protobuf lint issue fixed
vrajdesai78 Aug 20, 2022
2e06677
Revert "protobuf lint issue fixed"
vrajdesai78 Aug 20, 2022
9cbc1a4
protofub lint test fixed
vrajdesai78 Aug 20, 2022
5e03f3c
UNSPECIFIED enum renamed
vrajdesai78 Aug 20, 2022
6202e80
order changed in bazel
vrajdesai78 Aug 20, 2022
d3bd439
src of bazel fixed
vrajdesai78 Aug 21, 2022
8c3979a
dagger deps added in bazel
vrajdesai78 Aug 21, 2022
9675442
KDoc updated for bazel
vrajdesai78 Aug 21, 2022
4d868c3
Merge branch 'develop' into Proto-for-Intent-extras
vrajdesai78 Aug 27, 2022
00c426a
nit changes
vrajdesai78 Aug 27, 2022
6bdc969
Merge branch 'Proto-for-Intent-extras' of https://github.com/vrajdesa…
vrajdesai78 Aug 27, 2022
e6c9559
Revert "nit changes"
vrajdesai78 Aug 27, 2022
e1f3f6c
Merge branch 'new-branch-for-merge' into Proto-for-Intent-extras
vrajdesai78 Aug 27, 2022
cf3e56f
Updated kdoc and optimized code
vrajdesai78 Sep 1, 2022
d4d8c41
Merge to develop
vrajdesai78 Sep 12, 2022
0ccc77f
klint issue fixed
vrajdesai78 Sep 12, 2022
387d3b8
reformated route/BUILD.bazel
vrajdesai78 Sep 12, 2022
bfcb908
regex pattern checks fixed
vrajdesai78 Sep 12, 2022
3ef88c1
optimized import
vrajdesai78 Sep 12, 2022
158f9bd
Nit changes
vrajdesai78 Sep 12, 2022
839080a
Test updated and RecentlyPlayedActivityTitle used
vrajdesai78 Sep 17, 2022
ee1a545
Optimized import
vrajdesai78 Sep 17, 2022
0ccf9a6
Added newline EOF
vrajdesai78 Sep 17, 2022
06634ef
ActivityRouter added to bazel
vrajdesai78 Sep 17, 2022
b7a0b3b
reformat bazel
vrajdesai78 Sep 17, 2022
3384611
corrected path
vrajdesai78 Sep 17, 2022
6193973
made nit changes
vrajdesai78 Sep 22, 2022
c4bee7f
Merged with develop and done nit changes
vrajdesai78 Sep 22, 2022
062c29a
Nit changes
vrajdesai78 Sep 22, 2022
d1ed34e
added new line
vrajdesai78 Sep 22, 2022
151292f
New approach implemented for dagger
vrajdesai78 Sep 27, 2022
891cc90
code optimized
vrajdesai78 Sep 27, 2022
ccab9b4
Fix broken builds for #4511.
BenHenning Sep 29, 2022
2ef5e87
Fixed intentname failing tests
vrajdesai78 Sep 30, 2022
75d9eb0
Imports optimized
vrajdesai78 Sep 30, 2022
cb475ac
Added tests for ActivityRouter and ActivityRouterModule
vrajdesai78 Oct 1, 2022
f451213
optimized code
vrajdesai78 Oct 1, 2022
5f7e2a2
Merge branch 'develop' into Proto-for-Intent-extras
vrajdesai78 Oct 1, 2022
53203f8
Added KDoc and ActivityRouter in bazel
vrajdesai78 Oct 1, 2022
5bd3cfb
Merge branch 'Proto-for-Intent-extras' of https://github.com/vrajdesa…
vrajdesai78 Oct 1, 2022
0ab0840
fixed typo
vrajdesai78 Oct 1, 2022
8cf6c60
removed practicetab
vrajdesai78 Oct 1, 2022
56a191c
ActivityRouterModule added in BottomSheetOptionsMenu
vrajdesai78 Oct 1, 2022
5f10a78
Optimized imports
vrajdesai78 Oct 1, 2022
0e0c2de
Updated failing tests
vrajdesai78 Oct 1, 2022
fa33c5c
Added activityRouterModule in Intrumentation
vrajdesai78 Oct 1, 2022
c241e14
removed activity_router_module from bazel in Instrumentation
vrajdesai78 Oct 1, 2022
ed56d9f
removed activityRouterModule from LogReportingModuleTest
vrajdesai78 Oct 1, 2022
926b761
removed activity_component_factory from bazel in route/BUILD.bazel
vrajdesai78 Oct 1, 2022
da393f1
Nit changes
vrajdesai78 Oct 1, 2022
2fe5926
Optimized import
vrajdesai78 Oct 1, 2022
4fffe58
Tests for ActivityRouter and ActivityRouterModule updated
vrajdesai78 Oct 4, 2022
2792a39
Optimized code for null safety in ProfileProgressHeaderViewModel
vrajdesai78 Oct 4, 2022
211f6ad
Optimized code
vrajdesai78 Oct 4, 2022
5a72a21
Updated KDoc
vrajdesai78 Oct 4, 2022
451500f
Updated kDoc
vrajdesai78 Oct 4, 2022
9c06752
Nit changes
vrajdesai78 Oct 5, 2022
6c8221c
Added new tests and updated ActivityRouter to fix failing CI
vrajdesai78 Oct 5, 2022
3c141fb
Update app/src/sharedTest/java/org/oppia/android/app/profileprogress/…
vrajdesai78 Oct 5, 2022
19b8fa3
Revert "Update app/src/sharedTest/java/org/oppia/android/app/profilep…
vrajdesai78 Oct 5, 2022
13cb226
Updated testname
vrajdesai78 Oct 5, 2022
b59c5f1
Updated logic in ActivityRouter
vrajdesai78 Oct 5, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ class ActivityRouter @Inject constructor(
) {
/** Opens the activity corresponding to the specified [destinationScreen]. */
fun routeToScreen(destinationScreen: DestinationScreen) {
destinationRoutes[destinationScreen.destinationScreenCase].let { route ->
destinationRoutes[destinationScreen.destinationScreenCase]?.let { route ->
when (destinationScreen.destinationScreenCase) {
DestinationScreenCase.RECENTLY_PLAYED_ACTIVITY_PARAMS -> {
activity.startActivity(
route?.createIntent(
route.createIntent(
activity,
destinationScreen
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package org.oppia.android.app.activity.route

import android.app.Application
import android.content.Context
import androidx.appcompat.app.AppCompatActivity
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.ext.truth.content.IntentSubject.assertThat
import com.google.common.truth.Truth.assertThat
import dagger.BindsInstance
import dagger.Component
import org.junit.Before
Expand All @@ -25,6 +27,7 @@ import org.oppia.android.app.devoptions.DeveloperOptionsModule
import org.oppia.android.app.devoptions.DeveloperOptionsStarterModule
import org.oppia.android.app.home.recentlyplayed.RecentlyPlayedActivity
import org.oppia.android.app.model.DestinationScreen
import org.oppia.android.app.model.DestinationScreen.DestinationScreenCase
import org.oppia.android.app.player.state.itemviewmodel.SplitScreenInteractionModule
import org.oppia.android.app.shim.ViewBindingShimModule
import org.oppia.android.app.testing.activity.TestActivity
Expand Down Expand Up @@ -97,6 +100,9 @@ class ActivityRouterModuleTest {
lateinit var destinationRoutes:
Map<DestinationScreen.DestinationScreenCase, @JvmSuppressWildcards Route>

@Inject
lateinit var context: Context

@get:Rule
var activityRule =
ActivityScenarioRule<TestActivity>(
Expand All @@ -109,36 +115,19 @@ class ActivityRouterModuleTest {
}

@Test
fun testInjectActivityRouterModule_routeToRecentlyPlayedActivity() {
activityRule.scenario.onActivity { activity ->
assert(
destinationRoutes.containsKey(
DestinationScreen.DestinationScreenCase.RECENTLY_PLAYED_ACTIVITY_PARAMS
)
)
destinationRoutes[DestinationScreen.DestinationScreenCase.RECENTLY_PLAYED_ACTIVITY_PARAMS]
.let { route ->
val intent = route?.createIntent(
activity,
DestinationScreen.getDefaultInstance()
)
assertThat(intent).hasComponentClass(RecentlyPlayedActivity::class.java)
}
}
fun testInjectDestinationRoutes_hasRouteForRecentlyPlayedActivity() {
assertThat(
destinationRoutes.containsKey(DestinationScreenCase.RECENTLY_PLAYED_ACTIVITY_PARAMS)
).isTrue()
BenHenning marked this conversation as resolved.
Show resolved Hide resolved
val route = destinationRoutes[DestinationScreenCase.RECENTLY_PLAYED_ACTIVITY_PARAMS]
val intent = route?.createIntent(context, DestinationScreen.getDefaultInstance())
assertThat(intent).hasComponentClass(RecentlyPlayedActivity::class.java)
}

@Test
fun testInjectActivityRouterModule_routeToDestinationScreenNotSet_showsError() {
activityRule.scenario.onActivity { activity ->
destinationRoutes[DestinationScreen.DestinationScreenCase.DESTINATIONSCREEN_NOT_SET]
.let { route ->
val intent = route?.createIntent(
activity,
DestinationScreen.getDefaultInstance()
)
assertThat(intent).isNull()
}
}
fun testInjectDestinationRoutes_doesNotHaveRouteForDestinationScreenNotSet() {
assertThat(destinationRoutes)
.doesNotContainKey(DestinationScreenCase.DESTINATIONSCREEN_NOT_SET)
}

private fun setUpTestApplicationComponent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.test.core.app.ApplicationProvider
import androidx.test.espresso.intent.Intents
import androidx.test.espresso.intent.Intents.intended
import androidx.test.espresso.intent.matcher.IntentMatchers
import androidx.test.espresso.intent.matcher.IntentMatchers.hasComponent
import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.google.common.truth.Truth.assertThat
Expand Down Expand Up @@ -127,7 +127,7 @@ class ActivityRouterTest {
}

@Test
fun testActivityRouter_routeToRecentlyPlayedActivity() {
fun testActivityRouter_canRouteToRecentlyPlayedActivity() {
activityRule.scenario.onActivity { activity ->
val activityRouter = activity.activityRouter
val recentlyPlayedActivityParams =
Expand All @@ -147,7 +147,7 @@ class ActivityRouterTest {
RecentlyPlayedActivity.RECENTLY_PLAYED_ACTIVITY_INTENT_EXTRAS_KEY,
recentlyPlayedActivityParams
),
IntentMatchers.hasComponent(RecentlyPlayedActivity::class.java.name)
hasComponent(RecentlyPlayedActivity::class.java.name)
)
)
}
Expand Down