-
Notifications
You must be signed in to change notification settings - Fork 1
[FEAT/#673] 홈 온보딩 구현 #685
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
Merged
Merged
[FEAT/#673] 홈 온보딩 구현 #685
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
3a43af7
add: 이미지 추가
Hyobeen-Park bce11aa
feat: onboarding bottomSheet 구현
Hyobeen-Park 1be5252
feat: indicator 구현
Hyobeen-Park 0f0533e
feat: onboarding content 구현
Hyobeen-Park a79f3b2
feat: local storage 구현
Hyobeen-Park 66ffb50
Merge remote-tracking branch 'origin/develop' into feat/#673-home-onb…
Hyobeen-Park c6fac3b
feat: 온보딩 노출 구현
Hyobeen-Park 6d86bf7
feat: onboarding repository
Hyobeen-Park 79b72c1
feat: onboarding repository
Hyobeen-Park 5a0daba
mod: 인디케이터 네이밍 수정
Hyobeen-Park 5f29ef3
mod: 인디케이터 modifier 수정 및 방어코드 추가
Hyobeen-Park ab8362c
mod: homeState 사용
Hyobeen-Park ef7e671
Merge remote-tracking branch 'origin/develop' into feat/#673-home-onb…
Hyobeen-Park b7a6010
chore: 코드 가독성 개선 및 불필요한 import 제거
Hyobeen-Park 674262f
chore: 온보딩 데이터 위치 수정
Hyobeen-Park 4890ef8
mod: bottomsheet 수정
Hyobeen-Park 5531e8a
chore: 코드 가독성 개선
Hyobeen-Park File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
.../main/java/com/hilingual/core/designsystem/component/indicator/HilingualPagerIndicator.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| package com.hilingual.core.designsystem.component.indicator | ||
|
|
||
| import androidx.compose.animation.core.FastOutSlowInEasing | ||
| import androidx.compose.animation.core.animateDpAsState | ||
| import androidx.compose.animation.core.tween | ||
| import androidx.compose.foundation.background | ||
| import androidx.compose.foundation.layout.Arrangement | ||
| import androidx.compose.foundation.layout.Box | ||
| import androidx.compose.foundation.layout.Row | ||
| import androidx.compose.foundation.layout.height | ||
| import androidx.compose.foundation.layout.width | ||
| import androidx.compose.foundation.shape.CircleShape | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.runtime.LaunchedEffect | ||
| import androidx.compose.runtime.getValue | ||
| import androidx.compose.runtime.mutableIntStateOf | ||
| import androidx.compose.runtime.remember | ||
| import androidx.compose.runtime.setValue | ||
| import androidx.compose.ui.Alignment | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.draw.clip | ||
| import androidx.compose.ui.graphics.Color | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.compose.ui.unit.Dp | ||
| import androidx.compose.ui.unit.dp | ||
| import com.hilingual.core.designsystem.theme.HilingualTheme | ||
| import kotlinx.coroutines.delay | ||
|
|
||
| @Composable | ||
| fun HilingualPagerIndicator( | ||
| pageCount: Int, | ||
| currentPage: Int, | ||
| modifier: Modifier = Modifier, | ||
| indicatorHeight: Dp = 8.dp, | ||
| indicatorSpacing: Dp = 8.dp, | ||
| activeIndicatorWidth: Dp = 20.dp, | ||
| inactiveIndicatorWidth: Dp = 8.dp, | ||
| activeIndicatorColor: Color = HilingualTheme.colors.hilingualOrange, | ||
| inactiveIndicatorColor: Color = HilingualTheme.colors.gray200 | ||
| ) { | ||
| if (pageCount <= 0) return | ||
| val selectedPage = currentPage.coerceIn(0, pageCount - 1) | ||
|
|
||
| val indicatorModifier = Modifier | ||
| .height(indicatorHeight) | ||
| .clip(CircleShape) | ||
|
|
||
| Row( | ||
| modifier = modifier, | ||
| horizontalArrangement = Arrangement.spacedBy(indicatorSpacing), | ||
| verticalAlignment = Alignment.CenterVertically | ||
| ) { | ||
| repeat(pageCount) { index -> | ||
| val isSelected = index == selectedPage | ||
|
|
||
| val animatedWidth by animateDpAsState( | ||
| targetValue = if (isSelected) activeIndicatorWidth else inactiveIndicatorWidth, | ||
| animationSpec = tween( | ||
| durationMillis = 300, | ||
| easing = FastOutSlowInEasing | ||
| ), | ||
| label = "indicatorWidth" | ||
| ) | ||
|
|
||
| Box( | ||
angryPodo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| modifier = indicatorModifier | ||
| .width(animatedWidth) | ||
| .background( | ||
| color = if (isSelected) activeIndicatorColor else inactiveIndicatorColor | ||
| ) | ||
| ) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Preview | ||
| @Composable | ||
| private fun HilingualPagerIndicatorPreview() { | ||
| val pageCount = 4 | ||
| var currentPage by remember { mutableIntStateOf(0) } | ||
|
|
||
| LaunchedEffect(Unit) { | ||
| while (true) { | ||
| delay(1_000L) | ||
| currentPage = (currentPage + 1) % pageCount | ||
| } | ||
| } | ||
|
|
||
| HilingualTheme { | ||
| HilingualPagerIndicator( | ||
| pageCount = pageCount, | ||
| currentPage = currentPage | ||
| ) | ||
| } | ||
| } | ||
7 changes: 7 additions & 0 deletions
7
core/localstorage/src/main/java/com/hilingual/core/localstorage/OnboardingStateManager.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package com.hilingual.core.localstorage | ||
|
|
||
| interface OnboardingStateManager { | ||
| suspend fun getIsHomeOnboardingCompleted(): Boolean | ||
|
|
||
| suspend fun updateIsHomeOnboardingCompleted(isCompleted: Boolean) | ||
| } |
25 changes: 25 additions & 0 deletions
25
.../localstorage/src/main/java/com/hilingual/core/localstorage/OnboardingStateManagerImpl.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package com.hilingual.core.localstorage | ||
|
|
||
| import androidx.datastore.core.DataStore | ||
| import androidx.datastore.preferences.core.Preferences | ||
| import androidx.datastore.preferences.core.booleanPreferencesKey | ||
| import androidx.datastore.preferences.core.edit | ||
| import javax.inject.Inject | ||
| import kotlinx.coroutines.flow.first | ||
|
|
||
| class OnboardingStateManagerImpl @Inject constructor( | ||
| private val dataStore: DataStore<Preferences> | ||
| ) : OnboardingStateManager { | ||
| private object PreferencesKeys { | ||
| val IS_HOME_ONBOARDING_COMPLETED = booleanPreferencesKey("is_home_onboarding_completed") | ||
| } | ||
|
|
||
| override suspend fun getIsHomeOnboardingCompleted(): Boolean = | ||
| dataStore.data.first()[PreferencesKeys.IS_HOME_ONBOARDING_COMPLETED] ?: true | ||
|
|
||
angryPodo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| override suspend fun updateIsHomeOnboardingCompleted(isCompleted: Boolean) { | ||
| dataStore.edit { preferences -> | ||
| preferences[PreferencesKeys.IS_HOME_ONBOARDING_COMPLETED] = isCompleted | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| /build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import com.hilingual.buildlogic.setNamespace | ||
|
|
||
| plugins { | ||
| alias(libs.plugins.hilingual.android.data) | ||
| } | ||
|
|
||
| android { | ||
| setNamespace("data.onboarding") | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
|
||
| </manifest> |
17 changes: 17 additions & 0 deletions
17
data/onboarding/src/main/java/com/hilingual/data/onboarding/di/RepositoryModule.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| package com.hilingual.data.onboarding.di | ||
|
|
||
| import com.hilingual.data.onboarding.repository.OnboardingRepository | ||
| import com.hilingual.data.onboarding.repositoryimpl.OnboardingRepositoryImpl | ||
| import dagger.Binds | ||
| import dagger.Module | ||
| import dagger.hilt.InstallIn | ||
| import dagger.hilt.components.SingletonComponent | ||
| import jakarta.inject.Singleton | ||
|
|
||
| @Module | ||
| @InstallIn(SingletonComponent::class) | ||
| internal abstract class RepositoryModule { | ||
| @Binds | ||
| @Singleton | ||
| abstract fun bindOnboardingRepository(impl: OnboardingRepositoryImpl): OnboardingRepository | ||
| } |
7 changes: 7 additions & 0 deletions
7
...onboarding/src/main/java/com/hilingual/data/onboarding/repository/OnboardingRepository.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package com.hilingual.data.onboarding.repository | ||
|
|
||
| interface OnboardingRepository { | ||
| suspend fun getIsHomeOnboardingCompleted(): Result<Boolean> | ||
|
|
||
| suspend fun updateIsHomeOnboardingCompleted(isCompleted: Boolean): Result<Unit> | ||
| } |
20 changes: 20 additions & 0 deletions
20
...ng/src/main/java/com/hilingual/data/onboarding/repositoryimpl/OnboardingRepositoryImpl.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| package com.hilingual.data.onboarding.repositoryimpl | ||
|
|
||
| import com.hilingual.core.common.util.suspendRunCatching | ||
| import com.hilingual.core.localstorage.OnboardingStateManager | ||
| import com.hilingual.data.onboarding.repository.OnboardingRepository | ||
| import javax.inject.Inject | ||
|
|
||
| class OnboardingRepositoryImpl @Inject constructor( | ||
| private val onboardingStateManager: OnboardingStateManager | ||
| ) : OnboardingRepository { | ||
| override suspend fun getIsHomeOnboardingCompleted(): Result<Boolean> = | ||
| suspendRunCatching { | ||
| onboardingStateManager.getIsHomeOnboardingCompleted() | ||
| } | ||
|
|
||
| override suspend fun updateIsHomeOnboardingCompleted(isCompleted: Boolean): Result<Unit> = | ||
| suspendRunCatching { | ||
| onboardingStateManager.updateIsHomeOnboardingCompleted(isCompleted = isCompleted) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이거 정식 도입 됐구나ㅋㅋ