Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -45,17 +45,18 @@ import com.alarmy.near.model.Friend
import com.alarmy.near.model.Relation
import com.alarmy.near.model.ReminderInterval
import com.alarmy.near.presentation.feature.friendprofileedittor.component.NearDatePicker
import com.alarmy.near.presentation.ui.component.bottomsheet.CycleSettingBottomSheet
import com.alarmy.near.presentation.feature.friendprofileedittor.dialog.EditorExitDialog
import com.alarmy.near.presentation.feature.friendprofileedittor.uistate.FriendProfileEditorUIEvent
import com.alarmy.near.presentation.feature.friendprofileedittor.uistate.FriendProfileEditorUIState
import com.alarmy.near.presentation.ui.component.NearFrame
import com.alarmy.near.presentation.ui.component.appbar.NearTopAppbar
import com.alarmy.near.presentation.ui.component.bottomsheet.CycleSettingBottomSheet
import com.alarmy.near.presentation.ui.component.radiobutton.NearSmallRadioButton
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
}
if (suffix == null) {
return intervalText
}
return "$intervalText ${stringResource(
R.string.friend_profile_editor_contact_period_format,
suffix,
)}"
}
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 @@ -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,21 @@ fun NearTheme(
darkTheme -> lightColor // TODO DarkTheme 추가시 수정
else -> lightColor
}

/*
* TODO
* 하단 부분으로 Typography의 크기를 고정합니다.
* 시스템에서 텍스트 크기를 조정해도 앱 내부에서는 변경되지 않기에 접근성을 해칠 수 있습니다.
* 추후 다른 방법으로 텍스트 크기를 조정하도록 합니다.
* */
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