-
Notifications
You must be signed in to change notification settings - Fork 0
[Feature] 스플래시 화면 구성 및 자동 로그인 구현 #26
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
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
146331b
feat: 스플래쉬 화면 구현
stopstone c3f5233
feat: 로그인 상태 확인 로직 구현
stopstone fa77703
feat: 앱 아이콘 변경
stopstone c25aa6b
refactor: img_bg.png 이미지 dpi별 drawable 분리
stopstone 1ee5d34
refactor: 스플래시 화면 ViewModel 로직 수정
stopstone 32c70d8
Merge branch 'dev' into feat/splash-auto-login
stopstone 83e9aba
feat: 스플래시 화면 관련 파일 삭제
stopstone 90e1696
feat: 스플래시 화면 라이브러리 추가
stopstone d291865
feat: themes.xml에서 스플래시 화면 구현
stopstone 8fb3bfc
feat: 스플래시 로고 이미지 추가
stopstone a669663
feat: 스플래시 화면 API 적용 및 로그인 상태에 따른 화면 분기 처리
stopstone 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
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
58 changes: 58 additions & 0 deletions
58
Near/app/src/main/java/com/alarmy/near/presentation/feature/splash/SplashScreen.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,58 @@ | ||
| package com.alarmy.near.presentation.feature.splash | ||
|
|
||
| import androidx.compose.foundation.Image | ||
| import androidx.compose.foundation.layout.Box | ||
| import androidx.compose.foundation.layout.fillMaxSize | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.runtime.LaunchedEffect | ||
| import androidx.compose.ui.Alignment | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.layout.ContentScale | ||
| import androidx.compose.ui.res.painterResource | ||
| import androidx.compose.ui.res.stringResource | ||
| import androidx.compose.ui.tooling.preview.Preview | ||
| import androidx.hilt.navigation.compose.hiltViewModel | ||
| import com.alarmy.near.R | ||
|
|
||
| @Composable | ||
| fun SplashScreen( | ||
| onNavigateToLogin: () -> Unit, | ||
| onNavigateToHome: () -> Unit, | ||
| viewModel: SplashViewModel = hiltViewModel(), | ||
| ) { | ||
| LaunchedEffect(Unit) { | ||
| viewModel.checkLoginStatusAndNavigate( | ||
| onNavigateToLogin = onNavigateToLogin, | ||
| onNavigateToHome = onNavigateToHome, | ||
| ) | ||
| } | ||
|
|
||
| SplashContent() | ||
| } | ||
|
|
||
| @Composable | ||
| private fun SplashContent() { | ||
| Box( | ||
| modifier = Modifier.fillMaxSize(), | ||
| contentAlignment = Alignment.Center, | ||
| ) { | ||
| Image( | ||
| modifier = Modifier.fillMaxSize(), | ||
| painter = painterResource(id = R.drawable.img_bg), | ||
| contentDescription = stringResource(R.string.near_splash_background), | ||
| contentScale = ContentScale.Crop, | ||
| ) | ||
|
|
||
| Image( | ||
| painter = painterResource(id = R.drawable.ic_near_logo_title_white), | ||
| contentDescription = stringResource(R.string.near_logo_title), | ||
| ) | ||
| } | ||
| } | ||
|
|
||
|
|
||
| @Preview | ||
| @Composable | ||
| fun SplashScreenPreview() { | ||
| SplashContent() | ||
| } |
39 changes: 39 additions & 0 deletions
39
Near/app/src/main/java/com/alarmy/near/presentation/feature/splash/SplashViewModel.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,39 @@ | ||
| package com.alarmy.near.presentation.feature.splash | ||
|
|
||
| import androidx.lifecycle.ViewModel | ||
| import androidx.lifecycle.viewModelScope | ||
| import com.alarmy.near.data.repository.AuthRepository | ||
| import dagger.hilt.android.lifecycle.HiltViewModel | ||
| import kotlinx.coroutines.delay | ||
| import kotlinx.coroutines.launch | ||
| import javax.inject.Inject | ||
|
|
||
| @HiltViewModel | ||
| class SplashViewModel @Inject constructor( | ||
| private val authRepository: AuthRepository, | ||
| ): ViewModel() { | ||
|
|
||
| // 로그인 상태 확인 및 화면 전환 | ||
| fun checkLoginStatusAndNavigate( | ||
| onNavigateToLogin: () -> Unit, | ||
| onNavigateToHome: () -> Unit, | ||
| ) { | ||
| viewModelScope.launch { | ||
| runCatching { | ||
| delay(SPLASH_DELAY_MILLIS) | ||
| authRepository.isLoggedIn() | ||
| }.onSuccess { isLoggedIn -> | ||
| when(isLoggedIn) { | ||
| true -> { onNavigateToHome() } | ||
| false -> { onNavigateToLogin() } | ||
| } | ||
| }.onFailure { exception -> | ||
| onNavigateToLogin() | ||
| } | ||
| } | ||
| } | ||
|
|
||
| companion object { | ||
| const val SPLASH_DELAY_MILLIS = 1000L | ||
| } | ||
|
||
| } | ||
21 changes: 21 additions & 0 deletions
21
.../src/main/java/com/alarmy/near/presentation/feature/splash/navigation/SplashNavigation.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,21 @@ | ||
| package com.alarmy.near.presentation.feature.splash.navigation | ||
|
|
||
| import androidx.navigation.NavGraphBuilder | ||
| import androidx.navigation.compose.composable | ||
| import com.alarmy.near.presentation.feature.splash.SplashScreen | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| object RouteSplash | ||
|
|
||
| fun NavGraphBuilder.splashNavGraph( | ||
| onNavigateToLogin: () -> Unit, | ||
| onNavigateToHome: () -> Unit, | ||
| ) { | ||
| composable<RouteSplash> { | ||
| SplashScreen( | ||
| onNavigateToLogin = onNavigateToLogin, | ||
| onNavigateToHome = onNavigateToHome, | ||
| ) | ||
| } | ||
| } |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 31 additions & 28 deletions
59
Near/app/src/main/res/drawable/ic_launcher_foreground.xml
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 |
|---|---|---|
| @@ -1,30 +1,33 @@ | ||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
| xmlns:aapt="http://schemas.android.com/aapt" | ||
| android:width="108dp" | ||
| android:height="108dp" | ||
| android:viewportWidth="108" | ||
| android:viewportHeight="108"> | ||
| <path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z"> | ||
| <aapt:attr name="android:fillColor"> | ||
| <gradient | ||
| android:endX="85.84757" | ||
| android:endY="92.4963" | ||
| android:startX="42.9492" | ||
| android:startY="49.59793" | ||
| android:type="linear"> | ||
| <item | ||
| android:color="#44000000" | ||
| android:offset="0.0" /> | ||
| <item | ||
| android:color="#00000000" | ||
| android:offset="1.0" /> | ||
| </gradient> | ||
| </aapt:attr> | ||
| </path> | ||
| <path | ||
| android:fillColor="#FFFFFF" | ||
| android:fillType="nonZero" | ||
| android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z" | ||
| android:strokeWidth="1" | ||
| android:strokeColor="#00000000" /> | ||
| </vector> | ||
| android:width="100dp" | ||
| android:height="101dp" | ||
| android:viewportWidth="100" | ||
| android:viewportHeight="101"> | ||
| <path | ||
| android:pathData="M49.68,12C66.06,12 79.88,22.94 84.24,37.9C88.31,36.32 93.04,37.89 95.29,41.79C97.78,46.1 96.3,51.6 92,54.09L86.8,57.09C85.98,57.56 85.12,57.89 84.25,58.08C79.88,73.06 66.06,84 49.68,84C33.25,84 19.4,73 15.08,57.96C14.36,57.77 13.66,57.48 12.99,57.09L7.8,54.09C3.49,51.6 2.02,46.1 4.5,41.79C6.68,38.02 11.18,36.42 15.16,37.76C19.57,22.87 33.35,12 49.68,12Z"> | ||
| <aapt:attr name="android:fillColor"> | ||
| <gradient | ||
| android:centerX="59.58" | ||
| android:centerY="55.13" | ||
| android:gradientRadius="54.35" | ||
| android:type="radial"> | ||
| <item android:offset="0.17" android:color="#FF8ACCFF"/> | ||
| <item android:offset="1" android:color="#FFD9EEFF"/> | ||
| </gradient> | ||
| </aapt:attr> | ||
| </path> | ||
| <path | ||
| android:pathData="M43.25,40.25m-2.25,0a2.25,2.25 0,1 1,4.5 0a2.25,2.25 0,1 1,-4.5 0" | ||
| android:fillColor="#1A1A1A"/> | ||
| <path | ||
| android:pathData="M52.47,44.38C52.76,44.38 53.01,44.61 52.95,44.9C52.91,45.06 52.86,45.23 52.8,45.38C52.67,45.7 52.47,45.99 52.23,46.23C51.99,46.48 51.7,46.67 51.38,46.8C51.06,46.93 50.72,47 50.38,47C50.03,47 49.69,46.93 49.37,46.8C49.05,46.67 48.76,46.48 48.52,46.23C48.28,45.99 48.08,45.7 47.95,45.38C47.89,45.23 47.84,45.06 47.8,44.9C47.74,44.61 47.99,44.38 48.28,44.38L50.38,44.38H52.47Z" | ||
| android:fillColor="#1A1A1A"/> | ||
| <path | ||
| android:pathData="M56.75,40.25m-2.25,0a2.25,2.25 0,1 1,4.5 0a2.25,2.25 0,1 1,-4.5 0" | ||
| android:fillColor="#1A1A1A"/> | ||
| <path | ||
| android:pathData="M33,92a16,3 0,1 0,32 0a16,3 0,1 0,-32 0z" | ||
| android:fillColor="#8ACCFF" | ||
| android:fillAlpha="0.17"/> | ||
| </vector> |
File renamed without changes.
18 changes: 18 additions & 0 deletions
18
Near/app/src/main/res/drawable/ic_near_logo_title_white.xml
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,18 @@ | ||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:width="100dp" | ||
| android:height="27dp" | ||
| android:viewportWidth="100" | ||
| android:viewportHeight="27"> | ||
| <path | ||
| android:pathData="M85.89,26V1H89.64V7.15C89.77,6.72 90.02,6.15 90.39,5.45C90.79,4.72 91.36,3.98 92.09,3.25C92.82,2.52 93.74,1.9 94.84,1.4C95.97,0.87 97.31,0.6 98.84,0.6H99.09V4.35H98.64C96.77,4.35 95.16,4.87 93.79,5.9C92.46,6.9 91.42,8.22 90.69,9.85C89.99,11.45 89.64,13.17 89.64,15V26H85.89Z" | ||
| android:fillColor="#ffffff"/> | ||
| <path | ||
| android:pathData="M66.83,26.4C64.39,26.4 62.26,25.83 60.43,24.7C58.63,23.53 57.23,21.97 56.23,20C55.23,18.03 54.73,15.87 54.73,13.5C54.73,11.1 55.23,8.93 56.23,7C57.23,5.03 58.63,3.48 60.43,2.35C62.26,1.18 64.39,0.6 66.83,0.6C68.89,0.6 70.66,1 72.13,1.8C73.63,2.6 74.84,3.68 75.78,5.05V1H79.53V26H75.78V22C74.84,23.33 73.63,24.4 72.13,25.2C70.66,26 68.89,26.4 66.83,26.4ZM67.33,23C69.19,23 70.76,22.57 72.03,21.7C73.33,20.83 74.31,19.68 74.98,18.25C75.64,16.78 75.98,15.2 75.98,13.5C75.98,11.77 75.64,10.18 74.98,8.75C74.31,7.32 73.33,6.17 72.03,5.3C70.76,4.43 69.19,4 67.33,4C65.49,4 63.91,4.43 62.58,5.3C61.24,6.17 60.23,7.32 59.53,8.75C58.83,10.18 58.48,11.77 58.48,13.5C58.48,15.2 58.83,16.78 59.53,18.25C60.23,19.68 61.24,20.83 62.58,21.7C63.91,22.57 65.49,23 67.33,23Z" | ||
| android:fillColor="#ffffff"/> | ||
| <path | ||
| android:pathData="M39.67,26.4C37.14,26.4 34.92,25.83 33.02,24.7C31.12,23.53 29.64,21.97 28.57,20C27.54,18.03 27.02,15.87 27.02,13.5C27.02,11.1 27.52,8.93 28.52,7C29.52,5.03 30.96,3.48 32.82,2.35C34.69,1.18 36.89,0.6 39.42,0.6C41.99,0.6 44.19,1.18 46.02,2.35C47.89,3.48 49.32,5.03 50.32,7C51.32,8.93 51.82,11.1 51.82,13.5V15H30.87C31.07,16.47 31.54,17.82 32.27,19.05C33.04,20.25 34.06,21.22 35.32,21.95C36.59,22.65 38.06,23 39.72,23C41.49,23 42.97,22.62 44.17,21.85C45.37,21.05 46.31,20.03 46.97,18.8H51.07C50.21,21.03 48.82,22.87 46.92,24.3C45.06,25.7 42.64,26.4 39.67,26.4ZM30.92,11.5H47.92C47.59,9.37 46.69,7.58 45.22,6.15C43.76,4.72 41.82,4 39.42,4C37.02,4 35.09,4.72 33.62,6.15C32.19,7.58 31.29,9.37 30.92,11.5Z" | ||
| android:fillColor="#ffffff"/> | ||
| <path | ||
| android:pathData="M0.38,26V1H4.13V4.9C5.03,3.7 6.13,2.68 7.43,1.85C8.73,1.02 10.39,0.6 12.43,0.6C14.16,0.6 15.77,1.02 17.27,1.85C18.81,2.65 20.04,3.87 20.98,5.5C21.94,7.1 22.42,9.08 22.42,11.45V26H18.67V11.55C18.67,9.28 18.02,7.47 16.73,6.1C15.43,4.7 13.74,4 11.68,4C10.27,4 9.01,4.32 7.88,4.95C6.74,5.58 5.82,6.48 5.13,7.65C4.46,8.78 4.13,10.1 4.13,11.6V26H0.38Z" | ||
| android:fillColor="#ffffff"/> | ||
| </vector> |
This file was deleted.
Oops, something went wrong.
6 changes: 2 additions & 4 deletions
6
Near/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
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 |
|---|---|---|
| @@ -1,6 +1,4 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| <background android:drawable="@drawable/ic_launcher_background" /> | ||
| <foreground android:drawable="@drawable/ic_launcher_foreground" /> | ||
| <monochrome android:drawable="@drawable/ic_launcher_foreground" /> | ||
| </adaptive-icon> | ||
| <foreground android:drawable="@mipmap/ic_launcher"/> | ||
| </adaptive-icon> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
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
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.
현재
checkLoginStatusAndNavigate함수는delay를 먼저 실행한 후 로그인 상태를 확인하고 있어, 앱 시작 시간이 불필요하게 길어질 수 있습니다. 예를 들어, 로그인 상태 확인에 200ms가 걸린다면, 총 스플래시 시간은 1000ms + 200ms = 1200ms가 됩니다.로그인 상태 확인과 최소 스플래시 시간 보장을 병렬로 처리하여 사용자 경험을 개선하는 것이 좋습니다. 아래와 같이 수정하면 로그인 상태를 확인하는 동안 최소 스플래시 시간을 보장할 수 있어, 전체 대기 시간을 줄일 수 있습니다.