Skip to content

Commit

Permalink
chore(DynamicDashboard): Apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianDevel committed Feb 24, 2025
1 parent 73d4953 commit 78c1fd0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import com.infomaniak.lib.core.models.ApiResponse
import com.infomaniak.lib.core.models.ApiResponseStatus
import com.infomaniak.lib.core.networking.HttpClient
import okhttp3.OkHttpClient
import com.infomaniak.core.myksuite.ui.network.ApiRoutes as MyKSuiteApiRoutes

object ApiRepository : ApiRepositoryCore() {

Expand Down Expand Up @@ -512,7 +513,7 @@ object ApiRepository : ApiRepositoryCore() {

fun getMyKSuiteData(okHttpClient: OkHttpClient): ApiResponse<MyKSuiteData> {
return callApi(
url = com.infomaniak.core.myksuite.ui.network.ApiRoutes.myKSuiteData(),
url = MyKSuiteApiRoutes.myKSuiteData(),
method = ApiController.ApiMethod.GET,
okHttpClient = okHttpClient,
useKotlinxSerialization = true,
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/com/infomaniak/drive/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ import com.infomaniak.lib.stores.updatemanagers.InAppUpdateManager
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import com.infomaniak.core.myksuite.R as RMyKSuite

class MainActivity : BaseActivity() {

Expand Down Expand Up @@ -441,7 +442,7 @@ class MainActivity : BaseActivity() {
}

when (destination.id) {
R.id.fileDetailsFragment, com.infomaniak.core.myksuite.R.id.myKSuiteDashboardFragment -> {
R.id.fileDetailsFragment, RMyKSuite.id.myKSuiteDashboardFragment -> {
setColorNavigationBar(true)
}
R.id.fileShareLinkSettingsFragment -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import kotlinx.coroutines.launch

class MyKSuiteViewModel : ViewModel() {

val myKSuiteDataResult = SingleLiveEvent<MyKSuiteData?>()
val myKSuiteDataResult = SingleLiveEvent<MyKSuiteData>()

fun refreshMyKSuite() = viewModelScope.launch(Dispatchers.IO) {
myKSuiteDataResult.postValue(MyKSuiteDataUtils.fetchData())
MyKSuiteDataUtils.fetchData()?.let(myKSuiteDataResult::postValue)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ class KSuiteDashboardFragment : MyKSuiteDashboardFragment() {

myKSuiteViewModel.refreshMyKSuite()
myKSuiteViewModel.myKSuiteDataResult.observe(viewLifecycleOwner) { myKSuiteData ->
if (myKSuiteData == null) return@observe

resetContent(
dashboardData = MyKSuiteUiUtils.getDashboardData(
context = requireContext(),
Expand Down

0 comments on commit 78c1fd0

Please sign in to comment.