Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
8e520b1
✨ Feat: 프로필 업데이트 API 통신 로직 구현
dogmania May 19, 2026
a255383
🍱 Chore: String 리소스 추가
dogmania May 20, 2026
a4c21ac
✨ Feat: 공용 텍스트 필드 컴포넌트 구현
dogmania May 20, 2026
732dd73
♻️ Refactor: GoalTextField -> ValidateUnderlineTextField로 변경
dogmania May 20, 2026
362b5da
✨ Feat: 닉네임 변경 비즈니스 로직 연결 및 상태 처리
dogmania May 20, 2026
1378854
✨ Feat: 닉네임 수정 기능 구현
dogmania May 20, 2026
f3a9b6a
🍱 Chore: 리소스 추가
dogmania May 28, 2026
fe8d485
✨ Feat: SettingMenuUiModel 정의
dogmania May 28, 2026
66461da
✨ Feat: SettingsLanguage 정의
dogmania May 28, 2026
5f73901
♻️ Refactor: ProfileInfo 컴포넌트로 분리
dogmania May 28, 2026
0fad5cb
🍱 Chore: 문자열 리소스 추가
dogmania May 28, 2026
6c54243
♻️ Refactor: lint 적용
dogmania May 28, 2026
5d08585
✨ Feat: 언어 설정 다이얼로그 렌더링 로직 구현
dogmania May 28, 2026
a6c3349
✨ Feat: openExternalUrl 확장 메서드 구현
dogmania May 28, 2026
791223c
🍱 Chore: string 리소스 추가
dogmania May 28, 2026
10d054b
✨ Feat: 오픈 채팅 url 설정
dogmania May 28, 2026
91e0ac8
✨ Feat: 문의하기 오픈채팅방 이동 기능 구현
dogmania May 28, 2026
68199b8
🍱 Chore: String 리소스 추가
dogmania May 28, 2026
bd835df
✨ Feat: 알림 설정 Intent 정의
dogmania May 28, 2026
ac959a2
✨ Feat: 알림 설정 상태 변수 정의
dogmania May 28, 2026
7805530
✨ Feat: 알림 설정 화면 구현
dogmania May 28, 2026
942e937
✨ Feat: 설정 화면 -> 알림 설정 화면 네비게이션 구현
dogmania May 28, 2026
590ffda
✨ Feat: 알림 설정 도메인 모델 정의
dogmania May 29, 2026
680fb58
✨ Feat: 알림 설정 응답 DTO 구현
dogmania May 29, 2026
4186846
✨ Feat: 알림 설정 변경 요청 DTO 구현
dogmania May 29, 2026
43c83f3
✨ Feat: 알림 설정 응답 Mapper 구현
dogmania May 29, 2026
3446748
🍱 Chore: string 리소스 추가
dogmania May 29, 2026
a56a85a
✨ Feat: 알림 설정 조회, 변경 api 통신 로직 구현
dogmania May 29, 2026
9489f9c
♻️ Refactor: 상태 변수 초기값 변경
dogmania May 29, 2026
079178e
✨ Feat: 알림 설정 조회, 변경 비즈니스 로직 연결 및 상태 처리
dogmania May 29, 2026
ca3f2f3
♻️ Refactor: enabled 옵션 추가
dogmania May 29, 2026
f7efbcd
♻️ Refactor: 유효 길이 검증 조건 추가
dogmania May 29, 2026
2c40bb6
✨ Feat: 알림 설정 업데이트중 방어 로직 구현
dogmania May 29, 2026
21fb17b
✨ Feat: SideEffect 처리 로직 구현
dogmania May 29, 2026
8f6df7e
🍱 Chore: String 리소스 추가
dogmania Jun 1, 2026
624a532
✨ Feat: inviteCode 상태 추가 및 처리 로직 구현
dogmania Jun 1, 2026
d5e3178
✨ Feat: 커플 끊기, 커플코드 구현
dogmania Jun 1, 2026
5a2f4f0
🐛 Fix: conflict 해결
dogmania Jun 1, 2026
9929d23
♻️ Refactor: isLoading 초기값 true로 변경
dogmania Jun 1, 2026
fdda525
♻️ Refactor: GraphRoute를 사용하도록 변경
dogmania Jun 1, 2026
c7acb3f
♻️ Refactor: SettingsGraphHost 분리 및 사이드 이펙트 처리 통합
dogmania Jun 1, 2026
c537745
🔥 Remove: 사이드 이펙트 처리 코드 제거
dogmania Jun 1, 2026
0408f6d
⬆️ Upgrade: 버전 업데이트
dogmania Jun 1, 2026
bbd7b03
♻️ Refactor: non Activity Context인 경우 예외 처리
dogmania Jun 1, 2026
b667d49
♻️ Refactor: 길이 제약 명시 및 중복 Modifier 제거
dogmania Jun 1, 2026
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
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ android {

defaultConfig {
applicationId = "com.yapp.twix"
versionCode = 9
versionName = "1.0.1"
versionCode = 10
versionName = "1.0.2"

val kakaoKey = properties["kakao_dev_native_app_key"].toString()
manifestPlaceholders["KAKAO_NATIVE_APP_KEY"] = kakaoKey.trim('"')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import kotlin.math.roundToInt
fun CommonSwitch(
modifier: Modifier = Modifier,
checked: Boolean,
enabled: Boolean = true,
onClick: (Boolean) -> Unit,
) {
val density = LocalDensity.current
Expand All @@ -45,7 +46,10 @@ fun CommonSwitch(
.clip(RoundedCornerShape(999.dp))
.background(if (checked) GrayColor.C500 else CommonColor.White)
.border(1.dp, GrayColor.C500, RoundedCornerShape(999.dp))
.clickable(onClick = { onClick(!checked) }),
.clickable(
enabled = enabled,
onClick = { onClick(!checked) },
),
contentAlignment = Alignment.CenterStart,
) {
Box(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.twix.goal_editor.component
package com.twix.designsystem.components.text_field

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
Expand Down Expand Up @@ -27,72 +27,81 @@ import androidx.compose.ui.focus.onFocusChanged
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.unit.dp
import com.twix.designsystem.R
import com.twix.designsystem.components.text.AppText
import com.twix.designsystem.components.text_field.UnderlineTextField
import com.twix.designsystem.theme.SystemColor
import com.twix.domain.model.enums.AppTextStyle
import com.twix.ui.extension.noRippleClickable

@OptIn(ExperimentalLayoutApi::class)
@Composable
fun GoalTextField(
fun ValidateUnderlineTextField(
value: String,
onCommitTitle: (String) -> Unit,
modifier: Modifier = Modifier,
textFieldModifier: Modifier = Modifier,
placeholder: String,
guideText: String,
validLengthRange: IntRange = 2..14,
maxLength: Int = validLengthRange.last,
showGuideWhenValid: Boolean = true,
onCommit: (String) -> Unit,
) {
val focusManager = LocalFocusManager.current
val density = LocalDensity.current

var internalValue by rememberSaveable(value) { mutableStateOf(value) }
var isFocused by remember { mutableStateOf(false) }
var lastCommitted by remember(value) { mutableStateOf(value.trim()) }

fun commitIfChanged() {
val trimmed = internalValue.trim()
if (trimmed != lastCommitted) {

if (trimmed.length in validLengthRange && trimmed != lastCommitted) {
lastCommitted = trimmed
onCommitTitle(trimmed)
onCommit(trimmed)
}
}

val imeVisibleState =
remember {
mutableStateOf(false)
}

val imeVisibleState = remember { mutableStateOf(false) }
imeVisibleState.value = WindowInsets.ime.getBottom(density) > 0

LaunchedEffect(isFocused) {
var prev = imeVisibleState.value

snapshotFlow { imeVisibleState.value }
.collect { now ->
if (prev && !now && isFocused) {
commitIfChanged()
focusManager.clearFocus(force = true)
}

prev = now
}
}

val isValidLength = internalValue.length in validLengthRange
Comment thread
dogmania marked this conversation as resolved.

Column(
modifier =
Modifier
.height(96.dp),
modifier = modifier.height(96.dp),
verticalArrangement = Arrangement.Top,
) {
UnderlineTextField(
modifier =
Modifier
textFieldModifier
.padding(horizontal = 20.dp)
.fillMaxWidth()
.onFocusChanged { state ->
isFocused = state.isFocused
if (!state.isFocused) commitIfChanged()

if (!state.isFocused) {
commitIfChanged()
}
},
value = internalValue,
placeHolder = stringResource(R.string.goal_editor_text_field_placeholder),
maxLength = 14,
placeHolder = placeholder,
maxLength = maxLength,
showTrailing = internalValue.isNotBlank(),
onValueChange = { internalValue = it },
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done),
Expand All @@ -107,12 +116,15 @@ fun GoalTextField(
Image(
painter = painterResource(R.drawable.ic_clear_text),
contentDescription = null,
modifier = Modifier.noRippleClickable { internalValue = "" },
modifier =
Modifier.noRippleClickable {
internalValue = ""
},
Comment thread
dogmania marked this conversation as resolved.
)
},
)

if (internalValue.length in 2..14) {
if (showGuideWhenValid && isValidLength) {
Row(
modifier =
Modifier
Expand All @@ -124,13 +136,11 @@ fun GoalTextField(
Image(
painter = painterResource(R.drawable.ic_check_success),
contentDescription = null,
modifier =
Modifier
.size(16.dp),
modifier = Modifier.size(16.dp),
)

AppText(
text = stringResource(R.string.goal_editor_text_filed_guide),
text = guideText,
style = AppTextStyle.C2,
color = SystemColor.Success,
)
Expand Down
16 changes: 16 additions & 0 deletions core/design-system/src/main/res/drawable/ic_arrow_down_circle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M3,12C3,7.029 7.029,3 12,3C16.971,3 21,7.029 21,12C21,16.971 16.971,21 12,21C7.029,21 3,16.971 3,12Z"
android:fillColor="#171717"/>
<path
android:strokeWidth="1"
android:pathData="M9.111,11.002L12.057,13.948L15.004,11.002"
android:strokeLineJoin="round"
android:fillColor="#00000000"
android:strokeColor="#ffffff"
android:strokeLineCap="round"/>
</vector>
9 changes: 9 additions & 0 deletions core/design-system/src/main/res/drawable/ic_language.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12,21C10.761,21 9.595,20.763 8.5,20.29C7.405,19.817 6.452,19.173 5.64,18.36C4.827,17.549 4.183,16.595 3.71,15.5C3.237,14.405 3,13.239 3,12C3,10.758 3.237,9.59 3.71,8.497C4.184,7.404 4.827,6.451 5.64,5.639C6.451,4.827 7.405,4.184 8.5,3.711C9.595,3.237 10.761,3 12,3C13.242,3 14.41,3.237 15.503,3.71C16.596,4.184 17.549,4.827 18.361,5.64C19.173,6.452 19.816,7.404 20.289,8.497C20.763,9.59 21,10.758 21,12C21,13.239 20.763,14.405 20.29,15.5C19.817,16.595 19.173,17.548 18.36,18.36C17.548,19.173 16.596,19.816 15.503,20.29C14.41,20.763 13.242,21 12,21ZM12,20.008C12.587,19.254 13.071,18.514 13.452,17.787C13.833,17.06 14.142,16.247 14.381,15.347H9.619C9.883,16.298 10.199,17.136 10.567,17.863C10.935,18.59 11.413,19.305 12,20.008ZM10.727,19.858C10.26,19.308 9.834,18.628 9.449,17.818C9.064,17.009 8.777,16.185 8.589,15.346H4.753C5.326,16.59 6.139,17.61 7.19,18.406C8.242,19.202 9.421,19.686 10.726,19.858H10.727ZM13.273,19.858C14.578,19.686 15.757,19.202 16.809,18.406C17.861,17.61 18.673,16.59 19.246,15.346H15.412C15.159,16.197 14.84,17.028 14.455,17.838C14.07,18.647 13.676,19.321 13.273,19.858ZM4.346,14.346H8.381C8.305,13.936 8.252,13.536 8.221,13.147C8.189,12.758 8.173,12.375 8.173,12C8.173,11.625 8.189,11.242 8.22,10.853C8.251,10.464 8.305,10.064 8.38,9.653H4.347C4.238,10 4.153,10.377 4.092,10.786C4.031,11.195 4,11.599 4,12C4,12.401 4.03,12.806 4.091,13.214C4.152,13.623 4.237,14 4.346,14.346ZM9.381,14.346H14.619C14.695,13.936 14.748,13.543 14.779,13.166C14.811,12.79 14.827,12.401 14.827,12C14.827,11.599 14.811,11.21 14.78,10.834C14.749,10.457 14.695,10.064 14.62,9.654H9.38C9.305,10.064 9.251,10.457 9.22,10.834C9.189,11.21 9.173,11.599 9.173,12C9.173,12.401 9.189,12.79 9.22,13.166C9.251,13.543 9.306,13.936 9.381,14.346ZM15.619,14.346H19.654C19.763,13.999 19.848,13.622 19.909,13.214C19.97,12.806 20.001,12.401 20,12C20,11.599 19.97,11.194 19.909,10.786C19.848,10.377 19.763,10 19.654,9.654H15.619C15.695,10.064 15.748,10.464 15.779,10.853C15.811,11.242 15.827,11.625 15.827,12C15.827,12.375 15.811,12.758 15.78,13.147C15.749,13.536 15.695,13.936 15.62,14.347L15.619,14.346ZM15.412,8.654H19.246C18.66,7.385 17.857,6.365 16.838,5.594C15.818,4.823 14.63,4.333 13.273,4.124C13.74,4.737 14.159,5.439 14.532,6.23C14.904,7.02 15.197,7.828 15.412,8.654ZM9.619,8.654H14.381C14.117,7.715 13.791,6.867 13.404,6.108C13.017,5.349 12.549,4.643 12,3.992C11.451,4.643 10.983,5.349 10.596,6.108C10.209,6.867 9.884,7.715 9.619,8.654ZM4.754,8.654H8.588C8.803,7.828 9.096,7.02 9.468,6.23C9.841,5.439 10.26,4.737 10.727,4.123C9.358,4.333 8.166,4.826 7.153,5.603C6.14,6.38 5.34,7.397 4.753,8.653L4.754,8.654Z"
android:fillColor="#171717"/>
</vector>
12 changes: 12 additions & 0 deletions core/design-system/src/main/res/drawable/ic_notification.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M9.049,19.593C9.23,20.282 9.64,20.892 10.214,21.328C10.788,21.764 11.493,22 12.219,22C12.944,22 13.65,21.764 14.223,21.328C14.797,20.892 15.207,20.282 15.389,19.593M12,3C10.047,3 8.174,3.761 6.793,5.115C5.412,6.469 4.636,8.306 4.636,10.221V14.074L3.058,17.948C3.009,18.07 2.99,18.201 3.005,18.331C3.019,18.462 3.066,18.586 3.141,18.695C3.216,18.803 3.316,18.892 3.434,18.953C3.552,19.015 3.684,19.047 3.817,19.047H20.183C20.316,19.047 20.448,19.015 20.566,18.953C20.684,18.892 20.784,18.803 20.859,18.695C20.934,18.586 20.981,18.462 20.995,18.331C21.01,18.201 20.991,18.07 20.942,17.948L19.364,14.073V10.221C19.364,8.306 18.588,6.469 17.207,5.115C15.826,3.761 13.953,3 12,3Z"
android:strokeWidth="1.2"
android:fillColor="#00000000"
android:strokeColor="#171717"
android:strokeLineCap="round"/>
</vector>
9 changes: 9 additions & 0 deletions core/design-system/src/main/res/drawable/ic_question.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M13.73,19.805H12C9.494,19.805 7.368,18.931 5.621,17.185C3.874,15.439 3,13.314 3,10.809C3,8.305 3.873,6.179 5.62,4.429C7.366,2.679 9.492,1.805 11.998,1.805C13.25,1.805 14.422,2.039 15.514,2.508C16.605,2.976 17.558,3.617 18.373,4.431C19.188,5.247 19.829,6.199 20.297,7.287C20.766,8.375 21,9.547 21,10.805C21,13.101 20.41,15.206 19.231,17.12C18.052,19.036 16.551,20.629 14.728,21.897C14.62,21.959 14.512,21.993 14.404,22C14.296,22.006 14.194,21.982 14.095,21.927C13.997,21.874 13.918,21.806 13.86,21.723C13.802,21.639 13.77,21.534 13.765,21.407L13.73,19.805ZM15,20.225C16.42,19.025 17.575,17.619 18.466,16.009C19.356,14.399 19.801,12.664 19.8,10.805C19.8,8.625 19.045,6.78 17.534,5.27C16.024,3.761 14.179,3.005 12,3.005C9.82,3.005 7.975,3.76 6.466,5.27C4.956,6.781 4.201,8.625 4.2,10.805C4.2,12.985 4.955,14.83 6.466,16.339C7.976,17.849 9.821,18.604 12,18.605H15V20.225ZM12.043,16.89C12.288,16.89 12.496,16.803 12.667,16.631C12.838,16.457 12.923,16.248 12.923,16.003C12.923,15.757 12.836,15.55 12.664,15.379C12.49,15.208 12.281,15.122 12.036,15.122C11.79,15.122 11.582,15.209 11.412,15.383C11.241,15.556 11.155,15.765 11.155,16.01C11.155,16.255 11.242,16.463 11.416,16.634C11.588,16.805 11.798,16.89 12.043,16.89ZM9.551,8.046C9.69,8.1 9.829,8.097 9.967,8.036C10.105,7.975 10.218,7.877 10.306,7.742C10.47,7.472 10.704,7.256 11.005,7.094C11.307,6.934 11.654,6.854 12.046,6.854C12.635,6.854 13.114,7.008 13.483,7.316C13.851,7.625 14.035,8.042 14.035,8.567C14.035,8.891 13.956,9.195 13.799,9.479C13.641,9.761 13.372,10.092 12.992,10.472C12.477,10.974 12.107,11.404 11.882,11.764C11.658,12.123 11.546,12.472 11.546,12.81C11.546,12.967 11.598,13.102 11.7,13.213C11.803,13.325 11.927,13.381 12.072,13.381C12.217,13.381 12.339,13.325 12.438,13.213C12.536,13.103 12.595,12.966 12.614,12.803C12.653,12.555 12.786,12.28 13.015,11.977C13.245,11.674 13.523,11.358 13.85,11.03C14.302,10.58 14.624,10.155 14.819,9.756C15.013,9.356 15.11,8.956 15.11,8.556C15.11,7.733 14.826,7.072 14.258,6.571C13.69,6.07 12.968,5.82 12.092,5.82C11.504,5.82 10.961,5.963 10.465,6.251C9.968,6.537 9.596,6.879 9.347,7.278C9.259,7.439 9.233,7.595 9.269,7.743C9.305,7.892 9.399,7.992 9.551,8.046Z"
android:fillColor="#171717"/>
</vector>
17 changes: 17 additions & 0 deletions core/design-system/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<string name="word_sting">찌르기</string>
<string name="word_notification">알림</string>
<string name="word_new">NEW</string>
<string name="word_couple_code">커플코드</string>

<string name="word_daily">매일</string>
<string name="word_weekly">매주</string>
Expand Down Expand Up @@ -56,6 +57,8 @@
<string name="action_withdraw_account">탈퇴하기</string>
<string name="action_poke">찌르기</string>
<string name="action_poke_emphasized">찌르기!</string>
<string name="action_unlink_couple">커플 끊기</string>
<string name="action_confirm_unlink_couple">연결 끊기</string>

<!-- 홈 화면 -->
<string name="home_today_goal">오늘 우리 목표</string>
Expand Down Expand Up @@ -100,6 +103,16 @@
<string name="settings_privacy_policy">개인정보 처리방침</string>
<string name="settings_my_app_version">나의 버전</string>
<string name="settings_notification">알림 설정</string>
<string name="settings_language">언어 설정</string>
<string name="settings_inquiry">문의하기</string>
<string name="settings_inquiry_time">평일 오전 9시 - 오후 6시 운영</string>
<string name="settings_nickname_placeholder">닉네임을 입력해 주세요.</string>
<string name="settings_nickname_text_filed_guide">닉네임 2-8자</string>
<string name="settings_language_description">이미 앱 내에 저장된 언어는 변경되지 않아요</string>
<string name="settings_inquiry_open_failed">문의하기 화면을 열 수 없어요. 잠시 후 다시 시도해 주세요.</string>
<string name="settings_poke_push_notification">찌르기 푸쉬알림</string>
<string name="settings_marketing_push_notification">마케팅 정보 푸쉬알림</string>
<string name="settings_night_marketing_push_notification">야간 마케팅 정보 푸쉬알림</string>
Comment thread
dogmania marked this conversation as resolved.

<!-- 통계 화면 -->
<string name="stats_top_bar_title">스탬프 통계</string>
Expand Down Expand Up @@ -133,6 +146,8 @@
<string name="toast_already_certificated">이미 인증되었어요.</string>
<string name="toast_camera_permission_request">인증샷 촬영을 위해서 카메라 권한이 필요해요.</string>
<string name="toast_fetch_notification_failed">알림 목록 조회에 실패했습니다.</string>
<string name="toast_notification_setting_load_failed">알림 설정 조회에 실패했습니다.</string>
<string name="toast_notification_setting_update_failed">알림 설정 변경에 실패했습니다.</string>
<string name="toast_poke_goal_success">상대방을 찔렀어요!</string>
<string name="toast_poke_goal_failed">찌르기에 실패했습니다.</string>
<string name="toast_poke_cooldown">%1$s 뒤에 다시 찌를 수 있어요</string>
Expand All @@ -157,6 +172,8 @@
<string name="dialog_delete_goal_content">저장된 인증샷은 모두 삭제됩니다.</string>
<string name="dialog_withdraw_account_title">정말 탈퇴하시겠어요?</string>
<string name="dialog_withdraw_account_content">커플 연결이 끊어집니다.\n데이터는 전부 삭제되며 복구가 불가능합니다.</string>
<string name="dialog_unlink_couple_title">정말 커플을 끊으시겠어요?</string>
<string name="dialog_unlink_couple_content">오늘부로 30일 후, 모든 데이터가 삭제됩니다.\n복구 가능 기간은 30일 이내입니다.\n복구 희망시 ttwixteamm@gmail.com로 문의해 주시기 바랍니다.</string>

<!-- 마케팅 다이얼로그 -->
<string name="marketing_dialog_title">도움이 되는 정보를\n알림으로 받아보시겠어요?</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ sealed class NavRoutes(

object SettingsAboutRoute : NavRoutes("settings/about")

object SettingsNotificationRoute : NavRoutes("settings/notification")

/**
* StatsGraph
* */
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.twix.network.model.request.notification

import kotlinx.serialization.Serializable

@Serializable
data class UpdateNotificationSettingRequest(
val enabled: Boolean,
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ package com.twix.network.model.response.notification.mapper
import com.twix.domain.model.enums.NotificationType
import com.twix.domain.model.notification.Notification
import com.twix.domain.model.notification.NotificationPage
import com.twix.domain.model.notification.NotificationSettings
import com.twix.network.model.response.notification.model.NotificationListResponse
import com.twix.network.model.response.notification.model.NotificationResponse
import com.twix.network.model.response.notification.model.NotificationSettingsResponse
import java.time.LocalDateTime
import java.time.OffsetDateTime

Expand All @@ -25,4 +27,11 @@ fun NotificationResponse.toDomain(): Notification =
createdAt = createdAt.toLocalDateTimeOrNull(),
)

fun NotificationSettingsResponse.toDomain(): NotificationSettings =
NotificationSettings(
isPushEnabled = isPushEnabled,
isMarketingPushEnabled = isMarketingPushEnabled,
isNightPushEnabled = isNightPushEnabled,
)

private fun String.toLocalDateTimeOrNull(): LocalDateTime? = runCatching { OffsetDateTime.parse(this).toLocalDateTime() }.getOrNull()
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.twix.network.model.response.notification.model

import kotlinx.serialization.Serializable

@Serializable
data class NotificationSettingsResponse(
val isPushEnabled: Boolean,
val isMarketingPushEnabled: Boolean,
val isNightPushEnabled: Boolean,
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package com.twix.network.service
import com.twix.network.model.request.notification.InitNotificationSettingsRequest
import com.twix.network.model.request.notification.RegisterFcmTokenRequest
import com.twix.network.model.request.notification.TokenRequest
import com.twix.network.model.request.notification.UpdateNotificationSettingRequest
import com.twix.network.model.response.notification.model.NotificationListResponse
import com.twix.network.model.response.notification.model.NotificationSettingsResponse
import de.jensklingenberg.ktorfit.http.Body
import de.jensklingenberg.ktorfit.http.DELETE
import de.jensklingenberg.ktorfit.http.GET
Expand Down Expand Up @@ -33,6 +35,24 @@ interface NotificationService {
@Body request: InitNotificationSettingsRequest,
)

@GET("api/v1/notifications/settings")
suspend fun fetchNotificationSettings(): NotificationSettingsResponse

@PATCH("api/v1/notifications/settings/poke")
suspend fun updatePokeNotificationSetting(
@Body request: UpdateNotificationSettingRequest,
): NotificationSettingsResponse

@PATCH("api/v1/notifications/settings/marketing")
suspend fun updateMarketingNotificationSetting(
@Body request: UpdateNotificationSettingRequest,
): NotificationSettingsResponse

@PATCH("api/v1/notifications/settings/night")
suspend fun updateNightNotificationSetting(
@Body request: UpdateNotificationSettingRequest,
): NotificationSettingsResponse

@GET("api/v1/notifications")
suspend fun fetchNotifications(
@Query("lastId") lastId: Long? = null,
Expand Down
Loading
Loading