Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TNT-184] 트레이너 마이페이지 구현 #73

Merged
merged 26 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b794880
[TNT-183] refactor: TnTMyPageButton 내 후행 컴포넌트를 추가할 수 있도록 개선
hoyahozz Feb 8, 2025
ed4d772
[TNT-183] feat: 트레이너 마이페이지 UI 구현
hoyahozz Feb 8, 2025
b2d20bf
[TNT-184] feat: 트레이너 마이페이지 Contract 정의
hoyahozz Feb 8, 2025
581468f
[TNT-184] move: 로그아웃 관련 스트링 리소스 이동
hoyahozz Feb 8, 2025
1cc2e42
[TNT-184] feat: 마이페이지 화면 내 상태 연동 처리
hoyahozz Feb 9, 2025
bb885b5
[TNT-184] feat: 다이얼로그 cancel 여부를 사용처에서 결정할 수 있도록 구현
hoyahozz Feb 9, 2025
9364d80
[TNT-184] feat: 로그아웃 API 호출 구현
hoyahozz Feb 9, 2025
0605cf6
[TNT-184] feat: 로그아웃 기능 구현
hoyahozz Feb 9, 2025
ea13e5d
[TNT-184] feat: 회원 탈퇴 API 호출 구현
hoyahozz Feb 9, 2025
80684e7
[TNT-184] feat: 회원 탈퇴 기능 구현
hoyahozz Feb 9, 2025
c224869
[TNT-184] fix: 트레이니 정보 도메인 모델 내 나이 프로퍼티 제거
hoyahozz Feb 9, 2025
74e544c
[TNT-184] feat: 내 정보 조회 API 호출 구현
hoyahozz Feb 9, 2025
866c53d
[TNT-184] feat: 내 정보 출력 구현
hoyahozz Feb 9, 2025
b08a8bf
[TNT-184] feat: 서비스 이용약관, 개인정보 처리방침 이동 구현
hoyahozz Feb 9, 2025
12d29c1
[TNT-184] feat: 오픈소스 라이선스 자동 표기 라이브러리 종속성 추가
hoyahozz Feb 9, 2025
e1e0b04
[TNT-184] feat: 오픈소스 라이선스 이동 구현
hoyahozz Feb 9, 2025
61bffe3
[TNT-184] feat: 앱 설정 Preferences 구현
hoyahozz Feb 9, 2025
12c4e16
[TNT-184] feat: 앱 푸시 알림 토글 기능 구현
hoyahozz Feb 9, 2025
eb8451b
[TNT-184] feat: 알림 설정 권한 사용 정의
hoyahozz Feb 9, 2025
6fff6bd
[TNT-184] feat: 알림 토글 시 권한에 따른 대응 로직 구현
hoyahozz Feb 9, 2025
48c0eea
[TNT-184] feat: 알람 권한을 명시적으로 거부하지 않은 경우, 앱 진입 시 알람 권한을 요청하도록 구현
hoyahozz Feb 9, 2025
48fdaf7
[TNT-184] feat: 앱 진입 시 알람 권한이 거부된 경우, 앱 푸시 알림 비활성화 처리
hoyahozz Feb 9, 2025
0968894
[TNT-184] fix: apply ktlint
hoyahozz Feb 9, 2025
26784e8
[TNT-184] fix: apply ktlint
hoyahozz Feb 9, 2025
4bf4d09
[TNT-184] Merge branch 'develop' into feature/TNT-184
hoyahozz Feb 10, 2025
7fe8109
[TNT-184] fix: 스트링 리소스 수정
hoyahozz Feb 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ private val kakaoNativeAppKey: String =
plugins {
id("tnt.android.application")
id("tnt.android.compose")
id("com.google.android.gms.oss-licenses-plugin")
}

android {
Expand Down Expand Up @@ -59,4 +60,5 @@ dependencies {

implementation(libs.androidx.activity.compose)
implementation(libs.kakao.user)
implementation(libs.play.services.oss.licenses)
}
7 changes: 7 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>

<application
android:name=".TnTApplication"
Expand All @@ -16,6 +17,12 @@
android:theme="@style/Theme.TnT"
tools:targetApi="31" >

<activity
android:name="com.google.android.gms.oss.licenses.OssLicensesMenuActivity"
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity
android:name="com.google.android.gms.oss.licenses.OssLicensesActivity"
android:theme="@style/Theme.AppCompat.NoActionBar" />
</application>

</manifest>
3 changes: 3 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ buildscript {
google()
mavenCentral()
}
dependencies {
classpath(libs.oss.licenses.plugin)
}
}

plugins {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,18 @@ fun TnTPopupDialog(
content: String,
leftButtonText: String,
rightButtonText: String,
modifier: Modifier = Modifier,
cancelable: Boolean = true,
onLeftButtonClick: () -> Unit,
onRightButtonClick: () -> Unit,
onDismiss: () -> Unit,
modifier: Modifier = Modifier,
) {
Dialog(
onDismissRequest = { onDismiss() },
onDismissRequest = {
if (cancelable) {
onDismiss()
}
},
properties = DialogProperties(usePlatformDefaultWidth = false),
) {
Card(
Expand Down Expand Up @@ -100,12 +105,17 @@ fun TnTSingleButtonPopupDialog(
title: String,
content: String,
buttonText: String,
modifier: Modifier = Modifier,
cancelable: Boolean = true,
onButtonClick: () -> Unit,
onDismiss: () -> Unit,
modifier: Modifier = Modifier,
) {
Dialog(
onDismissRequest = { onDismiss() },
onDismissRequest = {
if (cancelable) {
onDismiss()
}
},
properties = DialogProperties(usePlatformDefaultWidth = false),
) {
Card(
Expand Down Expand Up @@ -159,13 +169,18 @@ fun TnTIconPopupDialog(
topIcon: Painter = painterResource(R.drawable.ic_round_warning),
leftButtonText: String,
rightButtonText: String,
modifier: Modifier = Modifier,
cancelable: Boolean = true,
onLeftButtonClick: () -> Unit,
onRightButtonClick: () -> Unit,
onDismiss: () -> Unit,
modifier: Modifier = Modifier,
) {
Dialog(
onDismissRequest = { onDismiss() },
onDismissRequest = {
if (cancelable) {
onDismiss()
}
},
properties = DialogProperties(usePlatformDefaultWidth = false),
) {
Card(
Expand Down Expand Up @@ -229,13 +244,18 @@ fun TnTIconSingleButtonPopupDialog(
content: String,
topIcon: Painter,
buttonText: String,
modifier: Modifier = Modifier,
type: ButtonType = ButtonType.Gray,
cancelable: Boolean = true,
onButtonClick: () -> Unit,
onDismiss: () -> Unit,
modifier: Modifier = Modifier,
type: ButtonType = ButtonType.Gray,
) {
Dialog(
onDismissRequest = { onDismiss() },
onDismissRequest = {
if (cancelable) {
onDismiss()
}
},
properties = DialogProperties(usePlatformDefaultWidth = false),
) {
Card(
Expand Down
22 changes: 22 additions & 0 deletions core/designsystem/src/main/res/drawable/ic_bomb.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="36dp"
android:height="36dp"
android:viewportWidth="36"
android:viewportHeight="36">
<path
android:pathData="M21.931,10.824L22.565,9.725C23.118,8.769 24.341,8.441 25.297,8.993L26.396,9.628"
android:strokeLineJoin="round"
android:strokeWidth="0.5"
android:fillColor="#00000000"
android:strokeColor="#E5E5E5"
android:strokeLineCap="round"/>
<path
android:pathData="M31.114,7.602C31.259,7.451 31.51,7.595 31.451,7.797L30.862,9.802C30.824,9.932 30.924,10.062 31.059,10.059L33.149,10.009C33.359,10.004 33.434,10.284 33.25,10.385L31.415,11.387C31.296,11.452 31.275,11.614 31.373,11.707L32.886,13.15C33.037,13.295 32.892,13.546 32.691,13.487L30.685,12.898C30.555,12.86 30.426,12.959 30.429,13.095L30.478,15.185C30.483,15.394 30.204,15.469 30.103,15.285L29.101,13.451C29.036,13.332 28.874,13.311 28.781,13.408L27.338,14.921C27.193,15.073 26.942,14.928 27.001,14.727L27.59,12.721C27.628,12.591 27.528,12.462 27.393,12.465L25.303,12.514C25.094,12.519 25.019,12.239 25.203,12.139L27.037,11.136C27.156,11.071 27.177,10.91 27.079,10.816L25.567,9.373C25.415,9.229 25.56,8.978 25.761,9.037L27.767,9.625C27.897,9.663 28.026,9.564 28.023,9.429L27.974,7.339C27.969,7.129 28.249,7.054 28.349,7.238L29.351,9.073C29.416,9.192 29.578,9.213 29.672,9.115L31.114,7.602Z"
android:fillColor="#FF472F"/>
<path
android:pathData="M20.69,8.535C20.966,8.057 21.577,7.893 22.056,8.169L24.287,9.457C24.765,9.733 24.929,10.345 24.653,10.823L22.538,14.487L18.575,12.198L20.69,8.535Z"
android:fillColor="#525252"/>
<path
android:pathData="M16.351,19.973m-9.059,-5.23a10.46,10.46 75,1 1,18.118 10.46a10.46,10.46 75,1 1,-18.118 -10.46"
android:fillColor="#262626"/>
</vector>
48 changes: 41 additions & 7 deletions core/ui/src/main/java/co/kr/tnt/ui/component/TnTMyPageButton.kt
Original file line number Diff line number Diff line change
@@ -1,33 +1,42 @@
package co.kr.tnt.ui.component

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.defaultMinSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonColors
import androidx.compose.material3.LocalMinimumInteractiveComponentSize
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import co.kr.tnt.designsystem.component.TnTSwitch
import co.kr.tnt.designsystem.theme.TnTTheme

@Composable
fun TnTMyPageButton(
text: String,
verticalPadding: Dp,
onClick: () -> Unit = { },
modifier: Modifier = Modifier,
onClick: () -> Unit,
enabled: Boolean = true,
trailingComponent: (@Composable () -> Unit)? = null,
) {
CompositionLocalProvider(LocalMinimumInteractiveComponentSize provides 39.dp) {
Button(
onClick = onClick,
shape = RoundedCornerShape(12.dp),
enabled = enabled,
colors = ButtonColors(
containerColor = TnTTheme.colors.commonColors.Common0,
contentColor = TnTTheme.colors.neutralColors.Neutral700,
Expand All @@ -40,13 +49,23 @@ fun TnTMyPageButton(
.fillMaxWidth()
.defaultMinSize(Dp.Hairline),
) {
Text(
text = text,
style = TnTTheme.typography.body2Medium,
Row(
modifier = Modifier.fillMaxWidth(),
overflow = TextOverflow.Ellipsis,
maxLines = 1,
)
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
) {
Text(
modifier = Modifier.weight(1f),
text = text,
style = TnTTheme.typography.body2Medium,
overflow = TextOverflow.Ellipsis,
maxLines = 1,
)
trailingComponent?.let { trailingComponent ->
Spacer(modifier = Modifier.width(4.dp))
trailingComponent()
}
}
}
}
}
Expand All @@ -63,3 +82,18 @@ private fun TnTMyPageButtonPreview() {
)
}
}

@Preview
@Composable
private fun TnTMyPageButtonWithTrailingComponentPreview() {
TnTTheme {
TnTMyPageButton(
text = "앱 푸시 알림",
onClick = {},
verticalPadding = 8.dp,
trailingComponent = {
TnTSwitch(checked = true, onClick = { })
},
)
}
}
12 changes: 12 additions & 0 deletions core/ui/src/main/java/co/kr/tnt/ui/extensions/Context.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package co.kr.tnt.ui.extensions

import android.content.Context
import android.content.Intent
import android.content.res.Resources.NotFoundException
import android.net.Uri
import android.provider.Settings
import android.util.Log

fun Context.moveToAppSetting() {
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).also {
Expand All @@ -12,3 +14,13 @@ fun Context.moveToAppSetting() {
}
startActivity(intent)
}

fun Context.getAppVersion(): String {
try {
val packageInfo = packageManager.getPackageInfo(packageName, 0)
return packageInfo.versionName ?: throw NotFoundException()
} catch (e: Exception) {
Log.e("Version not found", "버전 확인에 실패하였습니다.")
return "0.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import co.kr.tnt.designsystem.theme.TnTTheme
fun PermissionRequestDialog(
permission: TnTPermission,
isPermanentlyDenied: Boolean,
onOkButtonClick: (isPermanentlyDenied: Boolean) -> Unit,
onDismissRequest: () -> Unit,
onClickConfirm: () -> Unit,
onDismiss: () -> Unit,
modifier: Modifier = Modifier,
) {
TnTPopupDialog(
Expand All @@ -33,10 +33,16 @@ fun PermissionRequestDialog(
},
),
leftButtonText = stringResource(R.string.close),
rightButtonText = stringResource(R.string.ok),
onLeftButtonClick = onDismissRequest,
onRightButtonClick = { onOkButtonClick(isPermanentlyDenied) },
onDismiss = onDismissRequest,
rightButtonText = stringResource(
if (isPermanentlyDenied) {
R.string.move_to_setting
} else {
R.string.ok
},
),
onLeftButtonClick = onDismiss,
onRightButtonClick = onClickConfirm,
onDismiss = onDismiss,
)
}

Expand All @@ -46,9 +52,9 @@ private fun PermissionRequestDialogPreview() {
TnTTheme {
PermissionRequestDialog(
permission = TnTPermission.NOTIFICATION,
isPermanentlyDenied = false,
onOkButtonClick = { },
onDismissRequest = { },
isPermanentlyDenied = true,
onClickConfirm = { },
onDismiss = { },
)
}
}
9 changes: 6 additions & 3 deletions core/ui/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
permanentlyTitle
<string name="alarm_permission_title">TnT에서 알림을 보내고자 합니다.</string>
<string name="alarm_permission_description">해당 기기로 수업 일정 등 서비스 이용에 도움이 되는 안내 사항을 푸시 알림으로 보내드리겠습니다.
\n앱 푸시 알림에 수신 동의 하시겠습니까?</string>

<string name="alarm_permission_permanently_title">알림 설정 권한 명시 거부</string>
<string name="alarm_permission_permanently_description">권한 설정을 위해 설정창으로 이동해주세요.</string>
<string name="alarm_permission_permanently_title">TnT에서 알림 권한이 필요합니다.</string>
<string name="alarm_permission_permanently_description">수업 일정 및 중요한 공지 알림을 받기 위해 알림 권한이 필요합니다.\n설정에서 알림 권한을 활성화해주세요.</string>

<string name="media_permission_title">프로필 사진 설정을 위해 사진 접근 권한이 필요해요</string>
<string name="media_permission_description">사진 추가는 프로필 말고도 운동과 식단 기록에도 사용돼요</string>
Expand All @@ -15,6 +14,7 @@
<string name="media_permission_permanently_description">권한 설정을 위해 설정창으로 이동해주세요.</string>
<string name="close">닫기</string>
<string name="ok">확인</string>
<string name="move_to_setting">설정으로 이동</string>

<string name="error_server_request_failed">서버 요청에 실패했어요</string>
<string name="entered_wrong_text">잘못된 수치를 입력했어요</string>
Expand Down Expand Up @@ -65,4 +65,7 @@
<string name="logout">로그아웃</string>
<string name="delete_account">계정 탈퇴</string>

<string name="logout_title">현재 계정을 로그아웃 할까요?</string>
<string name="logout_content">언제든지 다시 로그인 할 수 있어요!</string>
<string name="logout_complete_title">로그아웃이 완료되었어요</string>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package co.kr.data.network.model

import co.kr.data.network.model.enum.MemberType
import co.kr.tnt.domain.model.User
import co.kr.tnt.domain.utils.DateFormatter
import kotlinx.serialization.Serializable

@Serializable
data class UserResponse(
val name: String,
val email: String,
val profileImageUrl: String,
val birthday: String?,
val memberType: MemberType,
val socialType: String,
val invitationCode: String,
val height: Double?,
val weight: Double?,
val cautionNote: String?,
val goalContents: List<String>,
)

fun UserResponse.toDomain(dateFormatter: DateFormatter): User {
return when (memberType) {
MemberType.TRAINER -> User.Trainer(
id = "TODO",
name = name,
image = profileImageUrl,
)

MemberType.TRAINEE -> User.Trainee(
id = "TODO",
name = name,
image = profileImageUrl,
birthday = birthday?.let(dateFormatter::parse),
weight = requireNotNull(weight),
height = requireNotNull(height?.toInt()),
ptPurpose = goalContents,
caution = cautionNote,
)

MemberType.UNREGISTERED -> error("등록되지 않은 유저입니다.")
}
}
Loading