Skip to content

Commit

Permalink
Merge pull request #6 from Team-ReMind/feat/doctor_main
Browse files Browse the repository at this point in the history
Feat/doctor main
  • Loading branch information
seunghee17 authored May 14, 2024
2 parents e67de00 + 3b12bab commit 9bf0eb1
Show file tree
Hide file tree
Showing 84 changed files with 2,393 additions and 392 deletions.
17 changes: 0 additions & 17 deletions .idea/deploymentTargetDropDown.xml

This file was deleted.

5 changes: 4 additions & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 27 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ android {
viewBinding = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.4.3"
kotlinCompilerExtensionVersion = "1.5.13"
}
packaging {
resources {
Expand Down Expand Up @@ -89,6 +89,7 @@ dependencies {
//hilt
implementation("com.google.dagger:hilt-android:2.48")
kapt("com.google.dagger:hilt-android-compiler:2.48")
implementation ("androidx.hilt:hilt-navigation-compose:1.1.0")

//Retrofit, okhttp
implementation("com.squareup.retrofit2:retrofit:2.9.0")
Expand Down Expand Up @@ -117,5 +118,30 @@ dependencies {
//splash screen api
implementation( "androidx.core:core-splashscreen:1.0.1")

//vico module
implementation("com.patrykandpatrick.vico:compose:1.12.0")
implementation("com.patrykandpatrick.vico:compose-m3:1.12.0")
implementation("com.patrykandpatrick.vico:core:1.12.0")
implementation("com.patrykandpatrick.vico:views:1.12.0")

//serialization
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0")

//timber
implementation ("com.jakewharton.timber:timber:5.0.1")

//lifecycle
implementation ("androidx.lifecycle:lifecycle-runtime-compose:2.6.0-alpha01")

//chucker
debugImplementation("com.github.chuckerteam.chucker:library:4.0.0")
releaseImplementation("com.github.chuckerteam.chucker:library-no-op:4.0.0")

//landscapist - glide
implementation("com.github.skydoves:landscapist-glide:2.3.3")
implementation ("com.github.bumptech.glide:compose:1.0.0-alpha.1")

//tabrow
implementation("com.google.accompanist:accompanist-pager:0.28.0")
implementation("com.google.accompanist:accompanist-pager-indicators:0.28.0")
}
19 changes: 14 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,29 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:windowSoftInputMode="adjustResize"
android:theme="@style/AppTheme"
android:supportsRtl="true"
android:theme="@style/Theme.SplashScreenAPI"
tools:targetApi="31" >

<activity
android:name=".app.MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.SplashScreen.SplashScreen" >
android:theme="@style/AppTheme"
android:windowSoftInputMode="adjustResize"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<action android:name="android.intent.category.DEFAULT"/>
<action android:name="android.intent.category.BROWSABLE"/>
<data
android:host="kakaolink"
android:scheme="${kakaoKey}" />
</intent-filter>
</activity>
<activity
android:name="com.kakao.sdk.auth.AuthCodeHandlerActivity"
Expand All @@ -46,7 +55,7 @@
<service
android:name="com.example.remind.app.FirebaseMessageService"
android:enabled="true"
android:exported="true">
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ class FirebaseMessageService : FirebaseMessagingService() {
.setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle(message.data["body"].toString())
.setContentText(message.data["title"].toString())
.setAutoCancel(true)//알림클릭시 삭제 여부
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setCategory(NotificationCompat.CATEGORY_MESSAGE)
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
.setFullScreenIntent(pendingIntent, true)
.setContentIntent(pendingIntent)
.setAutoCancel(true)
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val channel = NotificationChannel(channelId, "Notice", NotificationManager.IMPORTANCE_DEFAULT)
Expand Down
19 changes: 17 additions & 2 deletions app/src/main/java/com/example/remind/app/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
package com.example.remind.app

import android.graphics.Color
import android.os.Bundle
import android.util.Log
import android.view.View
import androidx.activity.ComponentActivity
import androidx.activity.SystemBarStyle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.Surface
import androidx.compose.material.TopAppBar
import androidx.compose.ui.Modifier
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.WindowCompat
import com.example.remind.core.designsystem.theme.RemindTheme
import com.google.firebase.Firebase
import dagger.hilt.android.AndroidEntryPoint
Expand All @@ -14,10 +23,16 @@ import com.google.firebase.messaging.messaging
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
installSplashScreen()

setContent {
RemindTheme {
RemindNavHost()

Surface(
modifier = Modifier.fillMaxSize(),
color = RemindTheme.colors.white
) {
RemindNavHost()
}
}
}
//곧 지워질 코드
Expand Down
18 changes: 8 additions & 10 deletions app/src/main/java/com/example/remind/app/RemindNavHost.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,27 @@ 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.center.CenterGraph
import com.example.remind.feature.screens.doctor.DoctorGraph
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
import com.example.remind.feature.screens.auth.RegisterGraph
import com.example.remind.feature.screens.auth.splash.SplashGraph

@Composable
fun RemindNavHost() {
val navHostController = rememberNavController()
NavHost(
navController = navHostController,
startDestination = Screens.Register.route
startDestination = Screens.Splash.route
) {
SplashGraph(navHostController)
RegisterGraph(navHostController)


composable(route = Screens.Patience.route) {
PatienceScreen()
}

DoctorGraph(navHostController)
CenterGraph(navHostController)
}
}

17 changes: 11 additions & 6 deletions app/src/main/java/com/example/remind/app/Screens.kt
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
package com.example.remind.app

sealed class Screens(val route: String) {
object Splash: Screens("splash") {
object SplashScreen: Screens("splash_screen")
}
object Register: Screens("register") {
object Login: Screens("login")
object SelectType: Screens("selecttype")
}

object Doctor: Screens("doctor") {
object PatienceRegister: Screens("PatienceRegister")
object DoctorMain: Screens("DoctorMain")
object DoctorPatienceRegister: Screens("PatienceRegister_doctor")
}
object Center: Screens("center") {
object PatienceRegister: Screens("PatienceRegister")
object CenterMain: Screens("CenterMain")
object CenterPatienceRegister: Screens("PatienceRegister_center")
}
object Patience: Screens("patience") {
object Fitst: Screens("FirstScreen")
object Second: Screens("SecondScreen")
object Third: Screens("ThirdScreen")
object Fourth: Screens("FourthScreen")
object Home: Screens("HomeScreen")
object MoodChart: Screens("MoodChart")
object Medicine: Screens("Medicine")
object MyPage: Screens("MyPage")
}
}
19 changes: 12 additions & 7 deletions app/src/main/java/com/example/remind/core/base/BaseViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ abstract class BaseViewModel<Event: UiEvent, State: UiState, Effect: UiEffect>(
val effect = _effect.receiveAsFlow()

fun setEvent(event: Event) {
val newEvent = event
//val newEvent = event
viewModelScope.launch {
_event.emit(newEvent)
_event.emit(event)
}
}

Expand All @@ -42,9 +42,14 @@ abstract class BaseViewModel<Event: UiEvent, State: UiState, Effect: UiEffect>(
}
}

protected fun setState(reduce: State.() -> State) {
val newState = currentState.reduce()
_uiState.value = newState
protected fun updateState(currentState: State) {
_uiState.value = currentState
}

protected fun postEffect(effect: Effect) {
viewModelScope.launch {
_effect.send(effect)
}
}

init {
Expand All @@ -54,11 +59,11 @@ abstract class BaseViewModel<Event: UiEvent, State: UiState, Effect: UiEffect>(
private fun subscribeEvents() {
viewModelScope.launch {
event.collect {
handleEvent(it)
reduceState(it)
}
}
}

abstract fun handleEvent(event: Event)
abstract fun reduceState(event: Event)

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.example.remind.core.common.component

import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.example.remind.core.designsystem.theme.RemindTheme

@Composable
fun BasicButton(
modifier: Modifier = Modifier,
text: String,
backgroundColor: Color,
textColor: Color,
verticalPadding: Dp,
onClick: () -> Unit
) {
Button(
modifier = modifier.fillMaxWidth(),
onClick = onClick,
shape = RoundedCornerShape(20.dp),
colors = ButtonDefaults.buttonColors(
containerColor = backgroundColor,
contentColor = textColor
),
contentPadding = PaddingValues(vertical = verticalPadding),
) {
Text(
text = text,
style = RemindTheme.typography.c1Medium
)
}
}

@Composable
@Preview
fun BasicButtonPreview() {
BasicButton(
text = "삭제",
backgroundColor = RemindTheme.colors.main_6,
onClick = {},
verticalPadding = 0.dp,
textColor = RemindTheme.colors.text
)
}
Loading

0 comments on commit 9bf0eb1

Please sign in to comment.