Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
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
2 changes: 2 additions & 0 deletions apps/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ include ':rceditor'
include ':recyclerview'
include ':pandares'
include ':horizon'
include ':ngc'

project(':annotations').projectDir = new File(rootProject.projectDir, '/../libs/annotations')
project(':canvas-api-2').projectDir = new File(rootProject.projectDir, '/../libs/canvas-api-2')
Expand All @@ -43,3 +44,4 @@ project(':rceditor').projectDir = new File(rootProject.projectDir, '/../libs/rce
project(':recyclerview').projectDir = new File(rootProject.projectDir, '/../libs/recyclerview')
project(':pandares').projectDir = new File(rootProject.projectDir, '/../libs/pandares')
project(':horizon').projectDir = new File(rootProject.projectDir, '/../libs/horizon')
project(':ngc').projectDir = new File(rootProject.projectDir, '/../libs/ngc')
1 change: 1 addition & 0 deletions apps/student/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ dependencies {
implementation project(path: ':rceditor')
implementation project(path: ':interactions')
implementation project(path: ':horizon')
implementation project(path: ':ngc')

/* Android Test Dependencies */
androidTestImplementation project(path: ':espresso')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.instructure.canvasapi2.models.CanvasContext
import com.instructure.pandautils.features.dashboard.notifications.DashboardRouter
import com.instructure.pandautils.features.dashboard.DashboardNavigationEvent
import com.instructure.pandautils.features.dashboard.DashboardNavigationHandler
import com.instructure.pandautils.features.dashboard.compose.DashboardUiState
import com.instructure.pandautils.features.dashboard.widget.WidgetMetadata
import com.instructure.student.features.dashboard.compose.DashboardScreenContent
import com.instructure.student.features.dashboard.compose.DashboardUiState
import kotlinx.coroutines.flow.MutableSharedFlow
import org.junit.Assert.assertTrue
import org.junit.Rule
Expand All @@ -40,14 +40,13 @@ class DashboardScreenTest {
@get:Rule
val composeTestRule = createComposeRule()

private val mockRouter = object : DashboardRouter {
override fun routeToGlobalAnnouncement(subject: String, message: String) {}
override fun routeToSubmissionDetails(canvasContext: CanvasContext, assignmentId: Long, attemptId: Long) {}
override fun routeToMyFiles(canvasContext: CanvasContext, folderId: Long) {}
override fun routeToSyncProgress() {}
override fun routeToManageOfflineContent() {}
override fun routeToCustomizeDashboard() {}
override fun restartApp() {}
private val mockNavigationHandler = object : DashboardNavigationHandler {
override fun handleCoursesNavigation(event: DashboardNavigationEvent.Courses) {}
override fun handleTodoNavigation(event: DashboardNavigationEvent.Todo) {}
override fun handleForecastNavigation(event: DashboardNavigationEvent.Forecast) {}
override fun handleProgressNavigation(event: DashboardNavigationEvent.Progress) {}
override fun handleConferencesNavigation(event: DashboardNavigationEvent.Conferences) {}
override fun handleDashboardNavigation(event: DashboardNavigationEvent.Dashboard) {}
}

@Test
Expand All @@ -66,7 +65,7 @@ class DashboardScreenTest {
refreshSignal = MutableSharedFlow(),
snackbarMessageFlow = MutableSharedFlow(),
onShowSnackbar = { _, _, _ -> },
router = mockRouter
navigationHandler = mockNavigationHandler
)
}

Expand All @@ -90,7 +89,7 @@ class DashboardScreenTest {
refreshSignal = MutableSharedFlow(),
snackbarMessageFlow = MutableSharedFlow(),
onShowSnackbar = { _, _, _ -> },
router = mockRouter
navigationHandler = mockNavigationHandler
)
}

Expand All @@ -114,7 +113,7 @@ class DashboardScreenTest {
refreshSignal = MutableSharedFlow(),
snackbarMessageFlow = MutableSharedFlow(),
onShowSnackbar = { _, _, _ -> },
router = mockRouter
navigationHandler = mockNavigationHandler
)
}

Expand All @@ -138,7 +137,7 @@ class DashboardScreenTest {
refreshSignal = MutableSharedFlow(),
snackbarMessageFlow = MutableSharedFlow(),
onShowSnackbar = { _, _, _ -> },
router = mockRouter
navigationHandler = mockNavigationHandler
)
}

Expand Down Expand Up @@ -167,7 +166,7 @@ class DashboardScreenTest {
refreshSignal = MutableSharedFlow(),
snackbarMessageFlow = MutableSharedFlow(),
onShowSnackbar = { _, _, _ -> },
router = mockRouter
navigationHandler = mockNavigationHandler
)
}

Expand All @@ -176,18 +175,19 @@ class DashboardScreenTest {
}

@Test
fun testCustomizeDashboardButtonCallsRouter() {
var routerCalled = false
val testRouter = object : DashboardRouter {
override fun routeToGlobalAnnouncement(subject: String, message: String) {}
override fun routeToSubmissionDetails(canvasContext: CanvasContext, assignmentId: Long, attemptId: Long) {}
override fun routeToMyFiles(canvasContext: CanvasContext, folderId: Long) {}
override fun routeToSyncProgress() {}
override fun routeToManageOfflineContent() {}
override fun routeToCustomizeDashboard() {
routerCalled = true
fun testCustomizeDashboardButtonCallsNavigationHandler() {
var navigationCalled = false
val testNavigationHandler = object : DashboardNavigationHandler {
override fun handleCoursesNavigation(event: DashboardNavigationEvent.Courses) {}
override fun handleTodoNavigation(event: DashboardNavigationEvent.Todo) {}
override fun handleForecastNavigation(event: DashboardNavigationEvent.Forecast) {}
override fun handleProgressNavigation(event: DashboardNavigationEvent.Progress) {}
override fun handleConferencesNavigation(event: DashboardNavigationEvent.Conferences) {}
override fun handleDashboardNavigation(event: DashboardNavigationEvent.Dashboard) {
if (event is DashboardNavigationEvent.Dashboard.NavigateToCustomizeDashboard) {
navigationCalled = true
}
}
override fun restartApp() {}
}

val mockWidgets = listOf(
Expand All @@ -208,13 +208,13 @@ class DashboardScreenTest {
refreshSignal = MutableSharedFlow(),
snackbarMessageFlow = MutableSharedFlow(),
onShowSnackbar = { _, _, _ -> },
router = testRouter
navigationHandler = testNavigationHandler
)
}

composeTestRule.waitForIdle()
composeTestRule.onNodeWithText("Customize Dashboard").performClick()

assertTrue("Router's routeToCustomizeDashboard should be called", routerCalled)
assertTrue("NavigationHandler's handleDashboardNavigation should be called", navigationCalled)
}
}
}
8 changes: 8 additions & 0 deletions apps/student/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,14 @@
</activity>
<activity android:name=".activity.StudentLoginWithQRActivity" />

<activity
android:name="com.instructure.ngc.NGCActivity"
android:windowSoftInputMode="adjustResize"
android:exported="false"
android:label="@string/student_app_name"
android:launchMode="singleTask"
android:theme="@style/CanvasMaterialTheme_Default" />

<activity
android:name=".activity.StudentViewStarterActivity"
android:launchMode="singleTask"
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@

package com.instructure.student.di.feature

import com.instructure.pandautils.features.dashboard.widget.todo.TodoWidgetBehavior
import com.instructure.pandautils.features.dashboard.widget.todo.TodoWidgetRouter
import com.instructure.student.features.dashboard.widget.todo.StudentTodoWidgetBehavior
import com.instructure.student.features.dashboard.widget.todo.StudentTodoWidgetRouter
import com.instructure.pandautils.features.dashboard.widget.todo.TodoHomeScreenWidgetUpdater
import com.instructure.student.features.dashboard.widget.todo.StudentTodoHomeScreenWidgetUpdater
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
Expand All @@ -30,14 +28,9 @@ import dagger.hilt.android.components.ViewModelComponent
class TodoWidgetModule {

@Provides
fun provideTodoWidgetRouter(): TodoWidgetRouter {
return StudentTodoWidgetRouter()
fun provideTodoHomeScreenWidgetUpdater(
studentTodoHomeScreenWidgetUpdater: StudentTodoHomeScreenWidgetUpdater
): TodoHomeScreenWidgetUpdater {
return studentTodoHomeScreenWidgetUpdater
}

@Provides
fun provideTodoWidgetBehavior(
studentTodoWidgetBehavior: StudentTodoWidgetBehavior
): TodoWidgetBehavior {
return studentTodoWidgetBehavior
}
}
}
Loading
Loading