Skip to content

Conversation

@kareem-01
Copy link
Collaborator

add main view model and with localization support


import java.util.Locale

data class MainState(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name of this data class shouble be MainActivityScreenState
or MainActivityUiState

but MainState is inConsistent and not the convention for naming screen state

import kotlinx.coroutines.launch
import java.util.Locale

class MainViewModel(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i suggest to rename this to MainActivityViewModel

import kotlinx.coroutines.flow.map
import java.util.Locale

class AppPreferencesServiceImpl(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where isDarkModelEnabled function ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it exists in this file down below


init {
getIsDarkTheme()
getOnBoardingState()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as the above method

Copy link
Collaborator

@mahmoudkhai mahmoudkhai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good work but some little things need refactoring

}

viewModel { (taskId:Int , onCancel: () -> Unit , onActionResult: (success: Boolean, message: String) -> Unit) ->
viewModel { (taskId: Int, onCancel: () -> Unit, onActionResult: (success: Boolean, message: String) -> Unit) ->
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we changed type of task id to be TaskId alise name not int

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check domain layer

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this concerns the EditTask feature which is out of scope for this pr so I will not be modifying it, as to not affect other's work

package com.washingtondcsquad.tudee.domain.services

import kotlinx.coroutines.flow.Flow
import java.util.Locale
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try to search for kotlin version . it's not recommended to use java libraries in domain layer.

Copy link
Collaborator

@mahmoudkhai mahmoudkhai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good work

import kotlinx.coroutines.flow.Flow
import java.util.Locale

interface AppPreferencesService {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment on multiple lines

Copy link
Collaborator

@omer1998 omer1998 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great work kareem

appPreferencesService.isDarkModeEnabled()
},
onSuccess = ::onDarkThemeEnabled,
onError = {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it always a good practice to handle error state, help in debugging and improve user experience

import kotlinx.coroutines.flow.map
import java.util.Locale

class AppPreferencesServiceImpl(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it exists in this file down below


data class MainState(
val isDarkTheme: Boolean = false,
val hasOnBoardingShown: Boolean? = null,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't see any need of nullable value for hasOnBoardingShow, because it must be initialize when the app start

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i agree

@karrar-abbas
Copy link
Collaborator

Good job, @mahmoudkhai mentioned a good points. Solve it, and I will give you approve.

# Conflicts:
#	app/src/main/java/com/washingtondcsquad/tudee/MainActivity.kt
#	app/src/main/java/com/washingtondcsquad/tudee/di/viewModelModule.kt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add main view model

6 participants