Skip to content

Commit 115a9c8

Browse files
fix: Fixes according to PR feedback
1 parent 9454c60 commit 115a9c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+457
-495
lines changed

app/src/main/java/org/openedx/app/AppRouter.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,16 +160,16 @@ class AppRouter : AuthRouter, DiscoveryRouter, DashboardRouter, CourseRouter, Di
160160
courseTitle: String,
161161
enrollmentMode: String,
162162
openDates: Boolean,
163-
openBlock: String
163+
resumeBlockId: String
164164
) {
165165
replaceFragmentWithBackStack(
166166
fm,
167-
CourseContainerFragment.newInstance(courseId, courseTitle, enrollmentMode, openDates, openBlock)
167+
CourseContainerFragment.newInstance(courseId, courseTitle, enrollmentMode, openDates, resumeBlockId)
168168
)
169169
}
170170

171171
override fun navigateToEnrolledProgramInfo(fm: FragmentManager, pathId: String) {
172-
replaceFragmentWithBackStack(fm, ProgramFragment(true))
172+
replaceFragmentWithBackStack(fm, ProgramFragment.newInstance(pathId))
173173
}
174174

175175
override fun navigateToNoAccess(

app/src/main/java/org/openedx/app/MainFragment.kt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import org.koin.android.ext.android.inject
1313
import org.koin.androidx.viewmodel.ext.android.viewModel
1414
import org.openedx.app.databinding.FragmentMainBinding
1515
import org.openedx.core.adapter.NavigationFragmentAdapter
16-
import org.openedx.core.config.Config
1716
import org.openedx.core.config.DashboardConfig
1817
import org.openedx.core.presentation.global.app_upgrade.UpgradeRequiredFragment
1918
import org.openedx.core.presentation.global.viewBinding
@@ -28,7 +27,6 @@ class MainFragment : Fragment(R.layout.fragment_main) {
2827
private val binding by viewBinding(FragmentMainBinding::bind)
2928
private val viewModel by viewModel<MainViewModel>()
3029
private val router by inject<DiscoveryRouter>()
31-
private val config by inject<Config>()
3230

3331
private lateinit var adapter: NavigationFragmentAdapter
3432

@@ -53,7 +51,7 @@ class MainFragment : Fragment(R.layout.fragment_main) {
5351
binding.viewPager.setCurrentItem(0, false)
5452
}
5553

56-
R.id.fragmentHome -> {
54+
R.id.fragmentDiscover -> {
5755
viewModel.logDiscoveryTabClickedEvent()
5856
binding.viewPager.setCurrentItem(1, false)
5957
}
@@ -75,7 +73,7 @@ class MainFragment : Fragment(R.layout.fragment_main) {
7573
viewLifecycleOwner.lifecycleScope.launch {
7674
viewModel.navigateToDiscovery.collect { shouldNavigateToDiscovery ->
7775
if (shouldNavigateToDiscovery) {
78-
binding.bottomNavView.selectedItemId = R.id.fragmentHome
76+
binding.bottomNavView.selectedItemId = R.id.fragmentDiscover
7977
}
8078
}
8179
}
@@ -84,7 +82,7 @@ class MainFragment : Fragment(R.layout.fragment_main) {
8482
getString(ARG_COURSE_ID).takeIf { it.isNullOrBlank().not() }?.let { courseId ->
8583
val infoType = getString(ARG_INFO_TYPE)
8684

87-
if (config.getDiscoveryConfig().isViewTypeWebView() && infoType != null) {
85+
if (viewModel.isDiscoveryTypeWebView && infoType != null) {
8886
router.navigateToCourseInfo(parentFragmentManager, courseId, infoType)
8987
} else {
9088
router.navigateToCourseDetail(parentFragmentManager, courseId)
@@ -102,7 +100,7 @@ class MainFragment : Fragment(R.layout.fragment_main) {
102100
binding.viewPager.offscreenPageLimit = 4
103101

104102
val discoveryFragment = DiscoveryNavigator(viewModel.isDiscoveryTypeWebView).getDiscoveryFragment()
105-
val dashboardFragment = when (config.getDashboardConfig().getType()) {
103+
val dashboardFragment = when (viewModel.dashboardType) {
106104
DashboardConfig.DashboardType.LIST -> ListDashboardFragment()
107105
DashboardConfig.DashboardType.PRIMARY_COURSE -> LearnFragment()
108106
}

app/src/main/java/org/openedx/app/MainViewModel.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import androidx.lifecycle.LifecycleOwner
44
import androidx.lifecycle.LiveData
55
import androidx.lifecycle.MutableLiveData
66
import androidx.lifecycle.viewModelScope
7-
import kotlinx.coroutines.FlowPreview
87
import kotlinx.coroutines.flow.MutableSharedFlow
98
import kotlinx.coroutines.flow.SharedFlow
109
import kotlinx.coroutines.flow.asSharedFlow
@@ -31,8 +30,8 @@ class MainViewModel(
3130
get() = _navigateToDiscovery.asSharedFlow()
3231

3332
val isDiscoveryTypeWebView get() = config.getDiscoveryConfig().isViewTypeWebView()
33+
val dashboardType get() = config.getDashboardConfig().getType()
3434

35-
@OptIn(FlowPreview::class)
3635
override fun onCreate(owner: LifecycleOwner) {
3736
super.onCreate(owner)
3837
notifier.notifier
@@ -57,10 +56,6 @@ class MainViewModel(
5756
logEvent(AppAnalyticsEvent.MY_COURSES)
5857
}
5958

60-
fun logMyProgramsTabClickedEvent() {
61-
logEvent(AppAnalyticsEvent.MY_PROGRAMS)
62-
}
63-
6459
fun logProfileTabClickedEvent() {
6560
logEvent(AppAnalyticsEvent.PROFILE)
6661
}

app/src/main/java/org/openedx/app/di/ScreenModule.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import org.openedx.courses.presentation.AllEnrolledCoursesViewModel
3333
import org.openedx.courses.presentation.PrimaryCourseViewModel
3434
import org.openedx.dashboard.data.repository.DashboardRepository
3535
import org.openedx.dashboard.domain.interactor.DashboardInteractor
36-
import org.openedx.dashboard.presentation.ListDashboardViewModel
36+
import org.openedx.dashboard.presentation.DashboardListViewModel
3737
import org.openedx.discovery.data.repository.DiscoveryRepository
3838
import org.openedx.discovery.domain.interactor.DiscoveryInteractor
3939
import org.openedx.discovery.presentation.NativeDiscoveryViewModel
@@ -119,7 +119,7 @@ val screenModule = module {
119119

120120
factory { DashboardRepository(get(), get(), get(), get()) }
121121
factory { DashboardInteractor(get()) }
122-
viewModel { ListDashboardViewModel(get(), get(), get(), get(), get(), get(), get()) }
122+
viewModel { DashboardListViewModel(get(), get(), get(), get(), get(), get(), get()) }
123123
viewModel { PrimaryCourseViewModel(get(), get(), get(), get(), get(), get(), get()) }
124124
viewModel { AllEnrolledCoursesViewModel(get(), get(), get(), get(), get(), get(), get()) }
125125
viewModel { LearnViewModel(get(), get()) }
@@ -198,11 +198,11 @@ val screenModule = module {
198198
get()
199199
)
200200
}
201-
viewModel { (courseId: String, courseTitle: String, enrollmentMode: String, openBlock: String) ->
201+
viewModel { (courseId: String, courseTitle: String, enrollmentMode: String, resumeBlockId: String) ->
202202
CourseContainerViewModel(
203203
courseId,
204204
courseTitle,
205-
openBlock,
205+
resumeBlockId,
206206
enrollmentMode,
207207
get(),
208208
get(),
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<selector xmlns:android="http://schemas.android.com/apk/res/android">
3-
<item android:state_checked="true" android:color="@color/checked_tab_item" />
4-
<item android:state_checked="false" android:color="@color/unchecked_tab_item" />
5-
</selector>
3+
<item android:color="@color/checked_tab_item" android:state_checked="true" />
4+
<item android:color="@color/unchecked_tab_item" android:state_checked="false" />
5+
</selector>

app/src/main/res/drawable/app_ic_rows.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
android:height="17dp"
44
android:viewportWidth="20"
55
android:viewportHeight="17">
6-
<path
7-
android:pathData="M19.81,2.71C19.83,2.77 19.85,2.83 19.85,2.89C19.85,2.93 19.87,3 19.87,3V15.99C19.87,16 19.867,16.007 19.865,16.015C19.862,16.022 19.86,16.03 19.86,16.04C19.86,16.1 19.85,16.15 19.83,16.21C19.824,16.228 19.818,16.247 19.813,16.264C19.802,16.306 19.791,16.345 19.77,16.38C19.75,16.4 19.75,16.41 19.75,16.43L19.75,16.43C19.71,16.49 19.67,16.55 19.62,16.6L19.61,16.61C19.53,16.69 19.45,16.74 19.36,16.78C19.355,16.782 19.35,16.785 19.344,16.788C19.326,16.798 19.305,16.81 19.29,16.81C19.19,16.85 19.09,16.87 18.99,16.87C18.89,16.87 18.79,16.85 18.69,16.81C18.68,16.805 18.667,16.8 18.655,16.795C18.642,16.79 18.63,16.785 18.62,16.78L18.56,16.75C16.1,15.33 12.91,15.33 10.44,16.75C10.426,16.763 10.413,16.768 10.4,16.772C10.393,16.774 10.386,16.777 10.38,16.78C10.374,16.783 10.369,16.786 10.363,16.79C10.348,16.799 10.331,16.81 10.31,16.81C10.12,16.88 9.91,16.88 9.71,16.81C9.7,16.805 9.687,16.8 9.675,16.795C9.662,16.79 9.65,16.785 9.64,16.78L9.58,16.75C7.12,15.33 3.93,15.33 1.46,16.75C1.44,16.77 1.43,16.77 1.41,16.77C1.375,16.791 1.335,16.802 1.294,16.814C1.276,16.819 1.258,16.824 1.24,16.83C1.218,16.834 1.198,16.838 1.178,16.843C1.143,16.852 1.108,16.86 1.07,16.86C1.06,16.87 1.04,16.87 1.02,16.87C1,16.87 0.982,16.865 0.965,16.86C0.947,16.855 0.93,16.85 0.91,16.85C0.85,16.85 0.79,16.84 0.74,16.82C0.68,16.8 0.63,16.77 0.58,16.74L0.58,16.74C0.564,16.729 0.548,16.719 0.531,16.708C0.503,16.692 0.474,16.675 0.45,16.65C0.413,16.621 0.387,16.586 0.36,16.55C0.35,16.537 0.34,16.523 0.33,16.51C0.32,16.495 0.307,16.483 0.295,16.47C0.282,16.458 0.27,16.445 0.26,16.43C0.24,16.41 0.24,16.4 0.24,16.38C0.217,16.343 0.206,16.306 0.194,16.265C0.189,16.25 0.185,16.236 0.18,16.22C0.176,16.199 0.171,16.178 0.167,16.159C0.158,16.123 0.15,16.089 0.15,16.05C0.14,16.03 0.14,16 0.14,16V3C0.14,2.98 0.145,2.962 0.15,2.945C0.155,2.927 0.16,2.91 0.16,2.89C0.17,2.83 0.18,2.77 0.2,2.71C0.22,2.66 0.24,2.61 0.27,2.56C0.278,2.546 0.286,2.532 0.293,2.518C0.313,2.483 0.331,2.449 0.36,2.42C0.402,2.377 0.438,2.349 0.478,2.317C0.485,2.311 0.492,2.306 0.5,2.3C0.515,2.29 0.527,2.277 0.54,2.265C0.552,2.252 0.565,2.24 0.58,2.23C0.595,2.22 0.61,2.212 0.625,2.205C0.64,2.197 0.655,2.19 0.67,2.18C3.51,0.59 7.12,0.51 10.01,1.99C12.91,0.51 16.51,0.59 19.35,2.18C19.365,2.19 19.38,2.197 19.395,2.205C19.41,2.212 19.425,2.22 19.44,2.23C19.455,2.24 19.467,2.252 19.48,2.265C19.492,2.277 19.505,2.29 19.52,2.3C19.535,2.316 19.553,2.33 19.57,2.344C19.597,2.367 19.625,2.39 19.65,2.42C19.665,2.445 19.68,2.467 19.695,2.49C19.71,2.512 19.725,2.535 19.74,2.56C19.77,2.61 19.79,2.66 19.81,2.71L19.81,2.71ZM9.5,4.12C9.5,3.84 9.72,3.62 10,3.62C10.28,3.62 10.5,3.84 10.5,4.12V14.4C10.5,14.68 10.28,14.9 10,14.9C9.72,14.9 9.5,14.68 9.5,14.4V4.12Z"
8-
android:fillColor="#3F68F8"
9-
android:fillType="evenOdd"/>
6+
<path
7+
android:fillColor="#3F68F8"
8+
android:fillType="evenOdd"
9+
android:pathData="M19.81,2.71C19.83,2.77 19.85,2.83 19.85,2.89C19.85,2.93 19.87,3 19.87,3V15.99C19.87,16 19.867,16.007 19.865,16.015C19.862,16.022 19.86,16.03 19.86,16.04C19.86,16.1 19.85,16.15 19.83,16.21C19.824,16.228 19.818,16.247 19.813,16.264C19.802,16.306 19.791,16.345 19.77,16.38C19.75,16.4 19.75,16.41 19.75,16.43L19.75,16.43C19.71,16.49 19.67,16.55 19.62,16.6L19.61,16.61C19.53,16.69 19.45,16.74 19.36,16.78C19.355,16.782 19.35,16.785 19.344,16.788C19.326,16.798 19.305,16.81 19.29,16.81C19.19,16.85 19.09,16.87 18.99,16.87C18.89,16.87 18.79,16.85 18.69,16.81C18.68,16.805 18.667,16.8 18.655,16.795C18.642,16.79 18.63,16.785 18.62,16.78L18.56,16.75C16.1,15.33 12.91,15.33 10.44,16.75C10.426,16.763 10.413,16.768 10.4,16.772C10.393,16.774 10.386,16.777 10.38,16.78C10.374,16.783 10.369,16.786 10.363,16.79C10.348,16.799 10.331,16.81 10.31,16.81C10.12,16.88 9.91,16.88 9.71,16.81C9.7,16.805 9.687,16.8 9.675,16.795C9.662,16.79 9.65,16.785 9.64,16.78L9.58,16.75C7.12,15.33 3.93,15.33 1.46,16.75C1.44,16.77 1.43,16.77 1.41,16.77C1.375,16.791 1.335,16.802 1.294,16.814C1.276,16.819 1.258,16.824 1.24,16.83C1.218,16.834 1.198,16.838 1.178,16.843C1.143,16.852 1.108,16.86 1.07,16.86C1.06,16.87 1.04,16.87 1.02,16.87C1,16.87 0.982,16.865 0.965,16.86C0.947,16.855 0.93,16.85 0.91,16.85C0.85,16.85 0.79,16.84 0.74,16.82C0.68,16.8 0.63,16.77 0.58,16.74L0.58,16.74C0.564,16.729 0.548,16.719 0.531,16.708C0.503,16.692 0.474,16.675 0.45,16.65C0.413,16.621 0.387,16.586 0.36,16.55C0.35,16.537 0.34,16.523 0.33,16.51C0.32,16.495 0.307,16.483 0.295,16.47C0.282,16.458 0.27,16.445 0.26,16.43C0.24,16.41 0.24,16.4 0.24,16.38C0.217,16.343 0.206,16.306 0.194,16.265C0.189,16.25 0.185,16.236 0.18,16.22C0.176,16.199 0.171,16.178 0.167,16.159C0.158,16.123 0.15,16.089 0.15,16.05C0.14,16.03 0.14,16 0.14,16V3C0.14,2.98 0.145,2.962 0.15,2.945C0.155,2.927 0.16,2.91 0.16,2.89C0.17,2.83 0.18,2.77 0.2,2.71C0.22,2.66 0.24,2.61 0.27,2.56C0.278,2.546 0.286,2.532 0.293,2.518C0.313,2.483 0.331,2.449 0.36,2.42C0.402,2.377 0.438,2.349 0.478,2.317C0.485,2.311 0.492,2.306 0.5,2.3C0.515,2.29 0.527,2.277 0.54,2.265C0.552,2.252 0.565,2.24 0.58,2.23C0.595,2.22 0.61,2.212 0.625,2.205C0.64,2.197 0.655,2.19 0.67,2.18C3.51,0.59 7.12,0.51 10.01,1.99C12.91,0.51 16.51,0.59 19.35,2.18C19.365,2.19 19.38,2.197 19.395,2.205C19.41,2.212 19.425,2.22 19.44,2.23C19.455,2.24 19.467,2.252 19.48,2.265C19.492,2.277 19.505,2.29 19.52,2.3C19.535,2.316 19.553,2.33 19.57,2.344C19.597,2.367 19.625,2.39 19.65,2.42C19.665,2.445 19.68,2.467 19.695,2.49C19.71,2.512 19.725,2.535 19.74,2.56C19.77,2.61 19.79,2.66 19.81,2.71L19.81,2.71ZM9.5,4.12C9.5,3.84 9.72,3.62 10,3.62C10.28,3.62 10.5,3.84 10.5,4.12V14.4C10.5,14.68 10.28,14.9 10,14.9C9.72,14.9 9.5,14.68 9.5,14.4V4.12Z" />
1010
</vector>

app/src/main/res/layout/fragment_main.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@
2727
app:layout_constraintStart_toStartOf="parent"
2828
app:menu="@menu/bottom_view_menu" />
2929

30-
</androidx.constraintlayout.widget.ConstraintLayout>
30+
</androidx.constraintlayout.widget.ConstraintLayout>

app/src/main/res/menu/bottom_view_menu.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33

44
<item
55
android:id="@+id/fragmentLearn"
6-
android:title="@string/app_navigation_learn"
76
android:enabled="true"
8-
android:icon="@drawable/app_ic_rows"/>
7+
android:icon="@drawable/app_ic_rows"
8+
android:title="@string/app_navigation_learn" />
99

1010
<item
11-
android:id="@+id/fragmentHome"
12-
android:title="@string/app_navigation_discovery"
11+
android:id="@+id/fragmentDiscover"
1312
android:enabled="true"
14-
android:icon="@drawable/app_ic_home"/>
13+
android:icon="@drawable/app_ic_home"
14+
android:title="@string/app_navigation_discovery" />
1515

1616
<item
1717
android:id="@+id/fragmentProfile"
18-
android:title="@string/app_navigation_profile"
1918
android:enabled="true"
20-
android:icon="@drawable/app_ic_profile"/>
19+
android:icon="@drawable/app_ic_profile"
20+
android:title="@string/app_navigation_profile" />
2121

22-
</menu>
22+
</menu>

app/src/main/res/values-uk/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
<string name="app_navigation_learn">Мої курси</string>
99
<string name="app_navigation_programs">Програми</string>
1010
<string name="app_navigation_profile">Профіль</string>
11-
</resources>
11+
</resources>

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
<string name="app_navigation_learn">Learn</string>
88
<string name="app_navigation_programs">Programs</string>
99
<string name="app_navigation_profile">Profile</string>
10-
</resources>
10+
</resources>

0 commit comments

Comments
 (0)