Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fun FriendSummaryEntity.toModel(): FriendSummary =
id = friendId,
name = name,
profileImageUrl = imageUrl,
lastContactedAt = lastContactAt,
lastContactedAt = lastContactAt?.replace("-", "."),
isContacted = true,
contactFrequencyLevel =
when (checkRate) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import com.alarmy.near.presentation.ui.component.textfield.NearLimitedTextField
import com.alarmy.near.presentation.ui.component.textfield.NearTextField
import com.alarmy.near.presentation.ui.extension.onNoRippleClick
import com.alarmy.near.presentation.ui.theme.NearTheme
import com.alarmy.near.utils.extensions.DateExtension
import kotlinx.coroutines.launch

@Composable
Expand Down Expand Up @@ -333,12 +334,7 @@ fun FriendProfileEditorScreen(
horizontalArrangement = Arrangement.SpaceBetween,
) {
Text(
text =
stringResource(friendProfileEditorUIState.contactFrequency.reminderInterval.labelRes) +
stringResource(
R.string.friend_profile_editor_contact_period_format,
stringResource(friendProfileEditorUIState.contactFrequency.dayOfWeek.resId),
),
text = buildContactFrequencyText(friendProfileEditorUIState.contactFrequency),
style = NearTheme.typography.B2_14_MEDIUM,
color = NearTheme.colors.BLACK_1A1A1A,
)
Expand Down Expand Up @@ -613,3 +609,29 @@ fun FriendProfileEditorScreenPreview() {
)
}
}

@Composable
private fun buildContactFrequencyText(contactFrequency: ContactFrequency): String {
val intervalText = stringResource(contactFrequency.reminderInterval.labelRes)
val suffix =
when (contactFrequency.reminderInterval) {
ReminderInterval.EVERY_WEEK,
ReminderInterval.EVERY_TWO_WEEK -> DateExtension.getTodayDayOfWeekInKorean()
ReminderInterval.EVERY_MONTH,
ReminderInterval.EVERY_SIX_MONTH ->
stringResource(
R.string.friend_profile_editor_contact_period_day_of_month,
DateExtension.getTodayDayOfMonth(),
)
else -> null
}
Comment on lines 616 to 629

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

주간/격주 반복 설정 시, 설정된 요일(contactFrequency.dayOfWeek) 대신 현재 요일을 표시하고 있어 의도와 다르게 동작할 수 있습니다. 예를 들어, '매주 수요일'로 설정했더라도 목요일에 보면 '매주 목요일'로 표시됩니다. contactFrequency.dayOfWeek를 사용하여 설정된 요일을 표시하도록 수정해야 합니다.

또한, 월간/반년 주기 설정 시 현재 날짜의 '일'을 가져와 사용하고 있는데, 이 또한 주간 주기 문제와 마찬가지로 조회하는 날짜에 따라 표시가 달라지는 문제가 있습니다. 이 설정값은 ContactFrequency 모델에 저장되고 사용되어야 할 것으로 보입니다.

    val suffix =
        when (contactFrequency.reminderInterval) {
            ReminderInterval.EVERY_WEEK,
            ReminderInterval.EVERY_TWO_WEEK -> when (contactFrequency.dayOfWeek) {
                DayOfWeek.MONDAY -> stringResource(R.string.day_of_week_monday)
                DayOfWeek.TUESDAY -> stringResource(R.string.day_of_week_tuesday)
                DayOfWeek.WEDNESDAY -> stringResource(R.string.day_of_week_wednesday)
                DayOfWeek.THURSDAY -> stringResource(R.string.day_of_week_thursday)
                DayOfWeek.FRIDAY -> stringResource(R.string.day_of_week_friday)
                DayOfWeek.SATURDAY -> stringResource(R.string.day_of_week_saturday)
                DayOfWeek.SUNDAY -> stringResource(R.string.day_of_week_sunday)
            }
            ReminderInterval.EVERY_MONTH,
            ReminderInterval.EVERY_SIX_MONTH ->
                stringResource(
                    R.string.friend_profile_editor_contact_period_day_of_month,
                    DateExtension.getTodayDayOfMonth(), // TODO: 이 값은 상태로부터 읽어와야 합니다.
                )
            else -> null
        }

if (suffix == null) {
return intervalText
}
return intervalText +
" " +
stringResource(
R.string.friend_profile_editor_contact_period_format,
suffix,
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이것도 사소한 거지만 아래와 같은 문법은 어떠실까요?

return "$intervalText ${stringResource(
        R.string.friend_profile_editor_contact_period_format,
        suffix,
    )}" 
``

반영은 안하셔도 됩니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

앗.... 스트링 템플릿을 잘 활용해야겠군요..!
너무 간결하게 되어서 반영안 할 수 없을 것 같습니다 감사합니다!

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.alarmy.near.presentation.feature.friendprofileedittor.component

import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.DatePicker
import androidx.compose.material3.DatePickerColors
import androidx.compose.material3.DatePickerDefaults
import androidx.compose.material3.DatePickerDialog
import androidx.compose.material3.DatePickerState
Expand All @@ -12,11 +12,7 @@ import androidx.compose.material3.rememberDatePickerState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.tooling.preview.Preview
import com.alarmy.near.presentation.ui.theme.NearColor
import com.alarmy.near.presentation.ui.theme.NearTheme
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale

@OptIn(ExperimentalMaterial3Api::class)
@Composable
Expand All @@ -33,15 +29,27 @@ fun NearDatePicker(
),
onDismissRequest = onDismiss,
confirmButton = {
TextButton(onClick = {
onDateSelected(datePickerState.selectedDateMillis)
onDismiss()
}) {
TextButton(
onClick = {
onDateSelected(datePickerState.selectedDateMillis)
onDismiss()
},
colors =
ButtonDefaults.textButtonColors(
contentColor = NearTheme.colors.BLUE01_5AA2E9,
),
) {
Text("확인")
}
},
dismissButton = {
TextButton(onClick = onDismiss) {
TextButton(
onClick = onDismiss,
colors =
ButtonDefaults.textButtonColors(
contentColor = NearTheme.colors.BLUE01_5AA2E9,
),
) {
Text("닫기")
}
},
Expand All @@ -57,6 +65,13 @@ fun NearDatePicker(
colors =
DatePickerDefaults.colors().copy(
containerColor = NearTheme.colors.WHITE_FFFFFF,
selectedDayContainerColor = NearTheme.colors.BLUE01_5AA2E9,
selectedDayContentColor = NearTheme.colors.WHITE_FFFFFF,
todayDateBorderColor = NearTheme.colors.BLUE01_5AA2E9,
todayContentColor = NearTheme.colors.BLUE01_5AA2E9,
currentYearContentColor = NearTheme.colors.BLUE01_5AA2E9,
selectedYearContentColor = NearTheme.colors.WHITE_FFFFFF,
selectedYearContainerColor = NearTheme.colors.BLUE01_5AA2E9,
),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ fun CycleSettingBottomSheet(

Text(
text =
stringResource(R.string.friend_contact_cycle_next_cycle_prefix) +
stringResource(R.string.friend_contact_cycle_next_cycle_prefix) + " " +
(
selectedInterval?.let { DateExtension.getNextCycleDate(it) }
?: DateExtension.getNextWeekSameDay()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.unit.Density
import androidx.core.view.WindowCompat

val LocalCustomColors =
Expand All @@ -29,7 +31,14 @@ fun NearTheme(
darkTheme -> lightColor // TODO DarkTheme 추가시 수정
else -> lightColor
}
val currentDensity = LocalDensity.current
val themeDensity =
Density(
density = currentDensity.density,
fontScale = 1f,
)
Comment on lines +41 to +46
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 코드는 시스템 폰트 사이즈를 고정시키는 것이 맞을까요?
만약 그렇다면 접근성과 트레이드 오프긴 해서 고민이 되네요🤔

현재로서는 좋아보입니다! TODO로 접근성 관련 수정을 기록해주시면 향후 대응에 좋아보여요!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

기념일 수정 부분(FriendProfileEditorScreen)에서
연락 주기 -[패딩]- 텍스트필드 의 유동적인 패딩을 통일하는 방법이 떠오르지 않아 이렇게 구성하였습니다.
접근성 부분에서 아쉬운 부분이 많이 있을 것 같네요 😭

다른 방법으로는 텍스트필드를 고정값으로 해야 될 것 같아 이 부분은 다른 분들과 논의해보면 좋을 것 같습니다!
말씀주신대로 TODO 작성 해두겠습니다!

CompositionLocalProvider(
LocalDensity provides themeDensity,
LocalCustomColors provides colorScheme,
LocalCustomTypography provides Typography,
content = content,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ object DateExtension {
// ReminderInterval을 contactWeek 문자열로 변환
fun toContactWeekString(reminderInterval: ReminderInterval): String = reminderInterval.name

// 오늘 날짜의 일(day)을 반환해서 반복 주기 표기에 사용한다.
fun getTodayDayOfMonth(): Int {
val calendar = Calendar.getInstance()
return calendar.get(Calendar.DAY_OF_MONTH)
}

// 오늘 요일을 DayOfWeek enum으로 반환
fun getTodayDayOfWeek(): DayOfWeek {
val calendar = Calendar.getInstance()
Expand Down
1 change: 1 addition & 0 deletions Near/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
<string name="friend_profile_editor_anniversary_add">추가하기</string>
<string name="friend_profile_editor_anniversary">기념일</string>
<string name="friend_profile_editor_contact_period_format">(%1$s 마다)</string>
<string name="friend_profile_editor_contact_period_day_of_month">%1$d일</string>
<string name="friend_profile_info_contact_success_text">더 가까워졌어요!</string>
<string name="friend_profile_info_edit">수정</string>
<string name="friend_profile_info_delete">삭제</string>
Expand Down