-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from Team-ReMind/feat/setting_architecture
Feat/setting architecture
- Loading branch information
Showing
48 changed files
with
1,236 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...in/java/com/example/remind/core/di/App.kt → ...c/main/java/com/example/remind/app/App.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
.../example/remind/FirebaseMessageService.kt → ...mple/remind/app/FirebaseMessageService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.example.remind.app | ||
|
||
import android.os.Bundle | ||
import android.util.Log | ||
import androidx.activity.ComponentActivity | ||
import androidx.activity.compose.setContent | ||
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen | ||
import com.example.remind.core.designsystem.theme.RemindTheme | ||
import com.google.firebase.Firebase | ||
import dagger.hilt.android.AndroidEntryPoint | ||
import com.google.firebase.messaging.messaging | ||
|
||
@AndroidEntryPoint | ||
class MainActivity : ComponentActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
installSplashScreen() | ||
setContent { | ||
RemindTheme { | ||
RemindNavHost() | ||
} | ||
} | ||
//곧 지워질 코드 | ||
Firebase.messaging.token.addOnCompleteListener { task -> | ||
if(!task.isSuccessful) { | ||
Log.e("tagg", "failed") | ||
} else { | ||
val token = task.result | ||
Log.d("taag", "$token") | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.example.remind.app | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.navigation.compose.NavHost | ||
import androidx.navigation.compose.composable | ||
import androidx.navigation.compose.navigation | ||
import androidx.navigation.compose.rememberNavController | ||
import com.example.remind.feature.screens.patience.FirstScreen | ||
import com.example.remind.feature.screens.patience.FourthScreen | ||
import com.example.remind.feature.screens.patience.PatienceScreen | ||
import com.example.remind.feature.screens.patience.SecondScreen | ||
import com.example.remind.feature.screens.patience.ThirdScreen | ||
import com.example.remind.feature.screens.register.RegisterGraph | ||
|
||
@Composable | ||
fun RemindNavHost() { | ||
val navHostController = rememberNavController() | ||
NavHost( | ||
navController = navHostController, | ||
startDestination = Screens.Register.route | ||
) { | ||
RegisterGraph(navHostController) | ||
|
||
|
||
composable(route = Screens.Patience.route) { | ||
PatienceScreen() | ||
} | ||
|
||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.example.remind.app | ||
|
||
sealed class Screens(val route: String) { | ||
object Register: Screens("register") { | ||
object Login: Screens("login") | ||
object SelectType: Screens("selecttype") | ||
} | ||
|
||
object Doctor: Screens("doctor") { | ||
object PatienceRegister: Screens("PatienceRegister") | ||
} | ||
object Center: Screens("center") { | ||
object PatienceRegister: Screens("PatienceRegister") | ||
} | ||
object Patience: Screens("patience") { | ||
object Fitst: Screens("FirstScreen") | ||
object Second: Screens("SecondScreen") | ||
object Third: Screens("ThirdScreen") | ||
object Fourth: Screens("FourthScreen") | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
app/src/main/java/com/example/remind/core/base/BaseViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package com.example.remind.core.base | ||
|
||
import androidx.lifecycle.ViewModel | ||
import androidx.lifecycle.viewModelScope | ||
import kotlinx.coroutines.channels.Channel | ||
import kotlinx.coroutines.flow.MutableSharedFlow | ||
import kotlinx.coroutines.flow.MutableStateFlow | ||
import kotlinx.coroutines.flow.asSharedFlow | ||
import kotlinx.coroutines.flow.asStateFlow | ||
import kotlinx.coroutines.flow.receiveAsFlow | ||
import kotlinx.coroutines.launch | ||
|
||
|
||
interface UiState | ||
interface UiEvent | ||
interface UiEffect | ||
abstract class BaseViewModel<Event: UiEvent, State: UiState, Effect: UiEffect>( | ||
initialState: State | ||
): ViewModel() { | ||
private val _uiState: MutableStateFlow<State> = MutableStateFlow(initialState) | ||
val currentState: State | ||
get() = _uiState.value | ||
val uiState = _uiState.asStateFlow() | ||
|
||
private val _event: MutableSharedFlow<Event> = MutableSharedFlow() | ||
val event = _event.asSharedFlow() | ||
|
||
private val _effect: Channel<Effect> = Channel() | ||
val effect = _effect.receiveAsFlow() | ||
|
||
fun setEvent(event: Event) { | ||
val newEvent = event | ||
viewModelScope.launch { | ||
_event.emit(newEvent) | ||
} | ||
} | ||
|
||
fun setEffect(builder: () -> Effect) { | ||
val effectValue = builder() | ||
viewModelScope.launch { | ||
_effect.send(effectValue) | ||
} | ||
} | ||
|
||
protected fun setState(reduce: State.() -> State) { | ||
val newState = currentState.reduce() | ||
_uiState.value = newState | ||
} | ||
|
||
init { | ||
subscribeEvents() | ||
} | ||
|
||
private fun subscribeEvents() { | ||
viewModelScope.launch { | ||
event.collect { | ||
handleEvent(it) | ||
} | ||
} | ||
} | ||
|
||
abstract fun handleEvent(event: Event) | ||
|
||
} |
65 changes: 65 additions & 0 deletions
65
app/src/main/java/com/example/remind/core/common/component/BasicListItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package com.example.remind.core.common.component | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.graphicsLayer | ||
import androidx.compose.ui.graphics.painter.Painter | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.text.TextStyle | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import com.example.remind.R | ||
import com.example.remind.core.designsystem.theme.RemindColors | ||
import com.example.remind.core.designsystem.theme.RemindTheme | ||
import com.example.remind.data.model.response.ListData | ||
|
||
@Composable | ||
fun BasicListItem(name: String, index: String) { | ||
Row( | ||
modifier = Modifier | ||
.background(Color.White) | ||
.fillMaxWidth() | ||
.padding(start = 11.dp, end = 9.dp, top = 10.dp, bottom = 9.dp), | ||
verticalAlignment = Alignment.CenterVertically | ||
) { | ||
Text( | ||
text = index, | ||
color = RemindTheme.colors.text, | ||
style = RemindTheme.typography.b3Medium | ||
) | ||
Text( | ||
modifier = Modifier | ||
.padding(start = 30.dp), | ||
text = name, | ||
color = RemindTheme.colors.text, | ||
style = RemindTheme.typography.b3Medium | ||
) | ||
Spacer(Modifier.weight(1f)) | ||
Text( | ||
text = "관리", | ||
color = Color.Black, | ||
style = RemindTheme.typography.b3Medium | ||
) | ||
Image( | ||
painter = painterResource(id = R.drawable.ic_listitem), | ||
contentDescription = null | ||
) | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun ListItemPreview() { | ||
BasicListItem("송승희", "01") | ||
} |
Oops, something went wrong.