Skip to content

Commit

Permalink
Merge pull request #103 from YAPP-Github/feature/flash159483/#94
Browse files Browse the repository at this point in the history
#94: 문제가 있는 로직 수정
  • Loading branch information
flash159483 authored Aug 16, 2024
2 parents d4a7112 + a68e439 commit c2378e2
Show file tree
Hide file tree
Showing 18 changed files with 279 additions and 38 deletions.
8 changes: 8 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>

<service
android:name=".PushNotificationService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
</application>

</manifest>
2 changes: 2 additions & 0 deletions app/src/main/kotlin/com/bff/wespot/PushNotificationService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ import com.bff.wespot.domain.repository.DataStoreRepository
import com.bff.wespot.domain.util.DataStoreKey.PUSH_TOKEN
import com.google.firebase.messaging.FirebaseMessagingService
import com.google.firebase.messaging.RemoteMessage
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.cancel
import kotlinx.coroutines.launch
import javax.inject.Inject

@AndroidEntryPoint
class PushNotificationService : FirebaseMessagingService() {

@Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ import kotlinx.serialization.Serializable
data class KakaoAuthTokenDto(
val socialType: String,
val identityToken: String,
val fcmToken: String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import com.bff.wespot.model.auth.request.KakaoAuthToken
import com.bff.wespot.model.auth.request.SignUp
import com.bff.wespot.model.auth.response.Consents

internal fun KakaoAuthToken.toDto() =
internal fun KakaoAuthToken.toDto(fcmToken: String) =
KakaoAuthTokenDto(
socialType = socialType,
identityToken = accessToken,
fcmToken = fcmToken,
)

internal fun Consents.toDto() =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class AuthRepositoryImpl @Inject constructor(

override suspend fun sendKakaoToken(token: KakaoAuthToken): Result<Any> =
authDataSource
.sendKakaoToken(token.toDto())
.sendKakaoToken(token.toDto(dataStore.getString(DataStoreKey.PUSH_TOKEN).first()))
.mapCatching {
when (it) {
is AuthTokenDto -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ fun EditScreen(

EditField(
title = stringResource(id = R.string.gender),
value = if (state.gender == "male") {
value = if (state.gender == "MALE") {
stringResource(id = R.string.male_student)
} else {
stringResource(id = R.string.female_student)
Expand Down Expand Up @@ -230,7 +230,7 @@ private fun ConfirmBottomSheetContent(
Column {
Text(
text = "$name (${
if (gender == "male") {
if (gender == "MALE") {
stringResource(id = R.string.male_student)
} else {
stringResource(id = R.string.female_student)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ fun GenderScreen(
icon = painterResource(
id = com.bff.wespot.ui.R.drawable.male_student,
),
selected = "male" == state.gender,
selected = "MALE" == state.gender,
onClicked = {
action(AuthAction.OnGenderChanged("male"))
action(AuthAction.OnGenderChanged("MALE"))
if (edit) {
action(AuthAction.Navigation(NavigationAction.PopBackStack))
return@GenderBox
Expand All @@ -96,9 +96,9 @@ fun GenderScreen(
icon = painterResource(
id = com.bff.wespot.ui.R.drawable.female_student,
),
selected = "female" == state.gender,
selected = "FEMALE" == state.gender,
onClicked = {
action(AuthAction.OnGenderChanged("female"))
action(AuthAction.OnGenderChanged("FEMALE"))
if (edit) {
action(AuthAction.Navigation(NavigationAction.PopBackStack))
return@GenderBox
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,7 @@ fun GradeScreen(

Box(
modifier = Modifier
.fillMaxWidth()
.clickable {
action(AuthAction.OnGradeBottomSheetChanged(true))
},
.fillMaxWidth(),
) {
WSOutlineButton(
text = "",
Expand Down Expand Up @@ -132,12 +129,13 @@ fun GradeScreen(
BottomSheetContent(
currentGrade = state.grade,
onGradeSelected = { grade ->
if (grade == 1) {
if (grade == 1 && state.selectedSchool?.type != "HIGH") {
toast = true
return@BottomSheetContent
}

action(AuthAction.OnGradeChanged(grade))
action(AuthAction.OnGradeBottomSheetChanged(false))
if (edit) {
action(AuthAction.Navigation(NavigationAction.PopBackStack))
return@BottomSheetContent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ fun NameScreen(
R.string.next
},
),
enabled = error.not(),
enabled = state.name.length > 1 && error.not(),
) {
it.invoke()
}
Expand Down
Loading

0 comments on commit c2378e2

Please sign in to comment.