Skip to content

Commit 5fcdf20

Browse files
committed
[BOOK-354] feat: 알림 가이드 눌렀을 때 설정 화면 이동
1 parent 38e6a27 commit 5fcdf20

3 files changed

Lines changed: 60 additions & 35 deletions

File tree

feature/settings/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,7 @@ ksp {
1717
dependencies {
1818
implementations(
1919
libs.logger,
20+
21+
libs.androidx.activity.compose,
2022
)
2123
}

feature/settings/src/main/kotlin/com/ninecraft/booket/feature/settings/notification/NotificationUi.kt

Lines changed: 56 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package com.ninecraft.booket.feature.settings.notification
22

3+
import android.content.Intent
4+
import android.net.Uri
5+
import android.provider.Settings
6+
import androidx.activity.result.contract.ActivityResultContracts
7+
import androidx.activity.compose.rememberLauncherForActivityResult
38
import androidx.compose.foundation.background
49
import androidx.compose.foundation.layout.Arrangement
510
import androidx.compose.foundation.layout.Column
@@ -16,8 +21,10 @@ import androidx.compose.runtime.Composable
1621
import androidx.compose.ui.Alignment
1722
import androidx.compose.ui.Modifier
1823
import androidx.compose.ui.graphics.vector.ImageVector
24+
import androidx.compose.ui.platform.LocalContext
1925
import androidx.compose.ui.res.stringResource
2026
import androidx.compose.ui.res.vectorResource
27+
import com.ninecraft.booket.core.common.extensions.noRippleClickable
2128
import com.ninecraft.booket.core.designsystem.DevicePreview
2229
import com.ninecraft.booket.core.designsystem.theme.ReedTheme
2330
import com.ninecraft.booket.core.designsystem.theme.White
@@ -53,39 +60,7 @@ internal fun NotificationUi(
5360
},
5461
)
5562
Spacer(modifier = Modifier.height(ReedTheme.spacing.spacing2))
56-
Row(
57-
modifier = modifier
58-
.padding(horizontal = ReedTheme.spacing.spacing5)
59-
.fillMaxWidth()
60-
.background(
61-
color = ReedTheme.colors.baseSecondary,
62-
shape = RoundedCornerShape(ReedTheme.radius.md),
63-
)
64-
.padding(
65-
vertical = ReedTheme.spacing.spacing6,
66-
horizontal = ReedTheme.spacing.spacing5,
67-
),
68-
verticalAlignment = Alignment.CenterVertically,
69-
horizontalArrangement = Arrangement.SpaceBetween,
70-
) {
71-
Column {
72-
Text(
73-
text = stringResource(R.string.notification_enable_title),
74-
color = ReedTheme.colors.contentBrand,
75-
style = ReedTheme.typography.body1SemiBold,
76-
)
77-
Text(
78-
text = stringResource(R.string.notification_enable_description),
79-
color = ReedTheme.colors.contentTertiary,
80-
style = ReedTheme.typography.label2Regular,
81-
)
82-
}
83-
Icon(
84-
imageVector = ImageVector.vectorResource(designR.drawable.ic_chevron_right),
85-
contentDescription = "Chevron Right Icon",
86-
tint = ReedTheme.colors.contentBrand,
87-
)
88-
}
63+
NotificationGuideItem()
8964
Spacer(modifier = Modifier.height(ReedTheme.spacing.spacing4))
9065
Row(
9166
modifier = modifier
@@ -120,6 +95,54 @@ internal fun NotificationUi(
12095
}
12196
}
12297

98+
@Composable
99+
internal fun NotificationGuideItem() {
100+
val context = LocalContext.current
101+
val settingsLauncher = rememberLauncherForActivityResult(
102+
contract = ActivityResultContracts.StartActivityForResult(),
103+
) { _ -> }
104+
105+
Row(
106+
modifier = Modifier
107+
.padding(horizontal = ReedTheme.spacing.spacing5)
108+
.fillMaxWidth()
109+
.background(
110+
color = ReedTheme.colors.baseSecondary,
111+
shape = RoundedCornerShape(ReedTheme.radius.md),
112+
)
113+
.noRippleClickable {
114+
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply {
115+
data = Uri.fromParts("package", context.packageName, null)
116+
}
117+
settingsLauncher.launch(intent)
118+
}
119+
.padding(
120+
vertical = ReedTheme.spacing.spacing6,
121+
horizontal = ReedTheme.spacing.spacing5,
122+
),
123+
verticalAlignment = Alignment.CenterVertically,
124+
horizontalArrangement = Arrangement.SpaceBetween,
125+
) {
126+
Column {
127+
Text(
128+
text = stringResource(R.string.notification_guide_title),
129+
color = ReedTheme.colors.contentBrand,
130+
style = ReedTheme.typography.body1SemiBold,
131+
)
132+
Text(
133+
text = stringResource(R.string.notification_guide_description),
134+
color = ReedTheme.colors.contentTertiary,
135+
style = ReedTheme.typography.label2Regular,
136+
)
137+
}
138+
Icon(
139+
imageVector = ImageVector.vectorResource(designR.drawable.ic_chevron_right),
140+
contentDescription = "Chevron Right Icon",
141+
tint = ReedTheme.colors.contentBrand,
142+
)
143+
}
144+
}
145+
123146
@DevicePreview
124147
@Composable
125148
private fun NotificationUiPreview() {

feature/settings/src/main/res/values/strings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
<string name="settings_optional_update_button_text">업데이트하기</string>
2121
<string name="settings_login">로그인</string>
2222
<string name="settings_notification">알림</string>
23-
<string name="notification_enable_title">알림을 켜주세요.</string>
24-
<string name="notification_enable_description">기기 설정에서 Reed 알림을 설정하세요.\n독서 기록에 도움되는 알림을 받을 수 있어요.</string>
23+
<string name="notification_guide_title">알림을 켜주세요.</string>
24+
<string name="notification_guide_description">기기 설정에서 Reed 알림을 설정하세요.\n독서 기록에 도움되는 알림을 받을 수 있어요.</string>
2525
<string name="notification_toggle_title">알림 받기</string>
2626
<string name="notification_toggle_description">리드에서 알림을 보내드려요.</string>
2727
</resources>

0 commit comments

Comments
 (0)