Skip to content

Commit

Permalink
Merge pull request #116 from YAPP-Github/release/TNT-244
Browse files Browse the repository at this point in the history
[TNT-244] 0.0.1 버전 배포 πŸ’£πŸ’£πŸ’£
  • Loading branch information
hoyahozz authored Feb 15, 2025
2 parents 473d49f + 41e49e5 commit 18c6a29
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 12 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ android {
applicationId = "co.kr.tnt"
minSdk = 27
targetSdk = 35
versionCode = 1
versionName = "1.0"
versionCode = 2
versionName = "0.0.1"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

Expand Down
29 changes: 28 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,31 @@

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile

## ------------------------ firebase-crashlytics ------------------------
-keepattributes SourceFile,LineNumberTable # Keep file names and line numbers.
-keep public class * extends java.lang.Exception # Optional: Keep custom exceptions.
## ------------------------ firebase-crashlytics ------------------------

## ------------------------ firebase-analytics ------------------------
-keep public class com.google.firebase.analytics.FirebaseAnalytics {
public *;
}
-keep public class com.google.android.gms.measurement.AppMeasurement {
public *;
}
## ------------------------ firebase-analytics ------------------------

## ------------------ kakao -------------------
-keep class com.kakao.sdk.**.model.* { <fields>; }
-keep class * extends com.google.gson.TypeAdapter

# https://github.com/square/okhttp/pull/6792
-dontwarn org.bouncycastle.jsse.**
-dontwarn org.conscrypt.*
-dontwarn org.openjsse.**
## ------------------ kakao -------------------

-keep enum co.kr.tnt.navigation.model.ScreenMode { *; }

32 changes: 25 additions & 7 deletions app/src/main/java/co/kr/tnt/service/MessagingService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,42 @@ import androidx.core.app.NotificationCompat
import androidx.core.content.ContextCompat
import androidx.core.net.toUri
import co.kr.tnt.R
import co.kr.tnt.domain.repository.SettingRepository
import co.kr.tnt.main.MainActivity
import com.google.firebase.messaging.Constants.MessageNotificationKeys
import com.google.firebase.messaging.FirebaseMessagingService
import com.google.firebase.messaging.RemoteMessage
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.launch
import javax.inject.Inject

@AndroidEntryPoint
class MessagingService : FirebaseMessagingService() {
class MessagingService: FirebaseMessagingService() {
@Inject
lateinit var settingRepository: SettingRepository

private val job = SupervisorJob()
private val scope = CoroutineScope(Dispatchers.IO + job)

override fun onMessageReceived(message: RemoteMessage) {
super.onMessageReceived(message)

// TODO message.data ν˜•νƒœλ‘œ μ˜€λ„λ‘ μš”μ²­
launchNotification(
title = message.data["title"] ?: "νŠΈλ ˆμ΄λ„ˆ μ—°κ²° μ•Œλ¦Ό",
content = message.data["content"] ?: "νŠΈλ ˆμ΄λ‹ˆλ‹˜κ³Ό μ—°κ²°λ˜μ—ˆμ–΄μš”!",
pendingIntent = createPendingIntent(message.data)
)
scope.launch {
// TODO message.data ν˜•νƒœλ‘œ μ˜€λ„λ‘ μš”μ²­
val isEnabled = settingRepository.isEnablePushNotification().first()

if (isEnabled) {
launchNotification(
title = message.data["title"] ?: "νŠΈλ ˆμ΄λ„ˆ μ—°κ²° μ•Œλ¦Ό",
content = message.data["content"] ?: "νŠΈλ ˆμ΄λ‹ˆλ‹˜κ³Ό μ—°κ²°λ˜μ—ˆμ–΄μš”!",
pendingIntent = createPendingIntent(message.data)
)
}
}
}

private fun createPendingIntent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ internal class TraineeMyPageContract {
val user: User.Trainee = User.Trainee.EMPTY,
val trainerName: String = "",
val isEnablePushNotification: Boolean = true,
val isLoading: Boolean = false,
val dialogState: DialogState = DialogState.NONE,
) : UiState {
enum class DialogState {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import co.kr.tnt.trainee.mypage.TraineeMyPageContract.TraineeMyPageEffect
import co.kr.tnt.trainee.mypage.TraineeMyPageContract.TraineeMyPageUiEvent
import co.kr.tnt.trainee.mypage.TraineeMyPageContract.TraineeMyPageUiState
import co.kr.tnt.trainee.mypage.TraineeMyPageContract.TraineeMyPageUiState.DialogState
import co.kr.tnt.ui.component.TnTLoadingScreen
import co.kr.tnt.ui.component.TnTMyPageButton
import co.kr.tnt.ui.extensions.getAppVersion
import co.kr.tnt.ui.extensions.moveToAppSetting
Expand Down Expand Up @@ -96,6 +97,10 @@ internal fun TraineeMyPageRoute(
onDismissDialog = { viewModel.setEvent(TraineeMyPageUiEvent.OnDismissDialog) },
)

if (uiState.isLoading) {
TnTLoadingScreen()
}

LaunchedEffect(viewModel.effect) {
viewModel.effect.collect { effect ->
when (effect) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,26 +135,32 @@ internal class TraineeMyPageViewModel @Inject constructor(

private fun logout() {
viewModelScope.launch {
updateState { copy(isLoading = true) }
runCatching {
loginRepository.logout()
kakaoLoginSdk.logout()
}.onSuccess {
updateState { copy(dialogState = DialogState.LOGOUT) }
}.onFailure {
sendEffect(TraineeMyPageEffect.ShowToast("λ‘œκ·Έμ•„μ›ƒμ— μ‹€νŒ¨ν•˜μ˜€μŠ΅λ‹ˆλ‹€."))
}.also {
updateState { copy(isLoading = false) }
}
}
}

private fun withdraw() {
viewModelScope.launch {
updateState { copy(isLoading = true) }
runCatching {
loginRepository.withdraw()
kakaoLoginSdk.unlink()
}.onSuccess {
updateState { copy(dialogState = DialogState.DELETE_ACCOUNT) }
}.onFailure {
sendEffect(TraineeMyPageEffect.ShowToast("νƒˆν‡΄μ— μ‹€νŒ¨ν•˜μ˜€μŠ΅λ‹ˆλ‹€."))
}.also {
updateState { copy(isLoading = false) }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import co.kr.tnt.trainer.home.TrainerHomeContract.TrainerHomeUiEvent
import co.kr.tnt.trainer.home.TrainerHomeContract.TrainerHomeUiState
import co.kr.tnt.ui.component.TnTCheckToggleDialog
import co.kr.tnt.ui.component.TnTHomeTopBar
import co.kr.tnt.ui.utils.throttled
import coil.compose.rememberAsyncImagePainter
import coil.request.ImageRequest
import com.kizitonwose.calendar.compose.CalendarState
Expand Down Expand Up @@ -355,7 +356,7 @@ private fun PtSessionCard(
.clip(RoundedCornerShape(8.dp))
.then(
if (ptSession.isCompleted.not()) {
Modifier.clickable { onClickComplete(ptSession) }
Modifier.clickable(onClick = throttled { onClickComplete(ptSession) })
} else {
Modifier
},
Expand All @@ -374,6 +375,7 @@ private fun PtSessionCard(
Spacer(modifier = Modifier.width(20.dp))
ptSession.run {
// TODO μ»΄ν¬λ„ŒνŠΈ κ°œμ„ 
// TODO 정식 μΆœμ‹œ ν›„ PT μˆ˜μ—… 기둝 남기기 ν™œμ„±ν™”
TnTSessionRecordCard(
isTrainer = true,
name = traineeName,
Expand All @@ -383,7 +385,7 @@ private fun PtSessionCard(
defaultImage = painterResource(R.drawable.img_default),
profileImage = painter,
leadingEmoji = "\uD83D\uDCAA",
showSessionRecordCreation = ptSession.isCompleted,
showSessionRecordCreation = false,
onClick = {},
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ internal class TrainerMyPageContract {
data class TrainerMyPageUiState(
val user: User.Trainer = User.Trainer.EMPTY,
val isEnablePushNotification: Boolean = true,
val isLoading: Boolean = false,
val dialogState: DialogState = DialogState.NONE,
) : UiState {
enum class DialogState {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import co.kr.tnt.trainer.mypage.TrainerMyPageContract.TrainerMyPageSideEffect
import co.kr.tnt.trainer.mypage.TrainerMyPageContract.TrainerMyPageUiEvent
import co.kr.tnt.trainer.mypage.TrainerMyPageContract.TrainerMyPageUiState
import co.kr.tnt.trainer.mypage.TrainerMyPageContract.TrainerMyPageUiState.DialogState
import co.kr.tnt.ui.component.TnTLoadingScreen
import co.kr.tnt.ui.component.TnTMyPageButton
import co.kr.tnt.ui.extensions.getAppVersion
import co.kr.tnt.ui.extensions.moveToAppSetting
Expand Down Expand Up @@ -98,6 +99,10 @@ internal fun TrainerMyPageRoute(
onDismissDialog = { viewModel.setEvent(TrainerMyPageUiEvent.OnDismissDialog) },
)

if (state.isLoading) {
TnTLoadingScreen()
}

LaunchedEffect(viewModel.effect) {
viewModel.effect.collect { effect ->
when (effect) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,26 +121,32 @@ internal class TrainerMyPageViewModel @Inject constructor(

private fun logout() {
viewModelScope.launch {
updateState { copy(isLoading = true) }
runCatching {
loginRepository.logout()
kakaoLoginSdk.logout()
}.onSuccess {
updateState { copy(dialogState = DialogState.LOGOUT) }
}.onFailure {
sendEffect(TrainerMyPageSideEffect.ShowToast("λ‘œκ·Έμ•„μ›ƒμ— μ‹€νŒ¨ν•˜μ˜€μŠ΅λ‹ˆλ‹€."))
}.also {
updateState { copy(isLoading = false) }
}
}
}

private fun withdraw() {
viewModelScope.launch {
updateState { copy(isLoading = true) }
runCatching {
loginRepository.withdraw()
kakaoLoginSdk.unlink()
}.onSuccess {
updateState { copy(dialogState = DialogState.DELETE_ACCOUNT) }
}.onFailure {
sendEffect(TrainerMyPageSideEffect.ShowToast("νƒˆν‡΄μ— μ‹€νŒ¨ν•˜μ˜€μŠ΅λ‹ˆλ‹€."))
}.also {
updateState { copy(isLoading = false) }
}
}
}
Expand Down

0 comments on commit 18c6a29

Please sign in to comment.