-
Notifications
You must be signed in to change notification settings - Fork 1
SplashActivity Handler 제거, SplashScreen API + ViewModel + 테스트로 교체 #400
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 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
96fc9cf
feat: SplashActivity Handler 제거, SplashScreen API + ViewModel + 테스트로 교체
unam98 138f71d
fix: SplashViewModel navigateEvent replay=1로 변경 (lifecycle 전환 시 이벤트 유…
unam98 9d01dd8
fix: SplashActivity Compose 전체화면 구현으로 기존 비주얼 복원
unam98 f147715
test: SplashScreen Compose UI 테스트 추가 (렌더링 안전망)
unam98 820aa9f
ci: PR 변경 패키지 기반 선택적 테스트 실행
unam98 cd48d3d
fix: CI 패키지 감지를 git diff → GitHub API로 교체 (shallow clone 호환)
unam98 4c8be96
fix: emulator-runner script를 외부 파일로 분리 (sh 멀티라인 파싱 에러 수정)
unam98 47689c8
fix: connectedDebugAndroidTest 패키지 필터 인자 수정
unam98 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
Some comments aren't visible on the classic Files Changed page.
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
36 changes: 36 additions & 0 deletions
36
app/src/main/java/com/runnect/runnect/presentation/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,36 @@ | ||
| package com.runnect.runnect.presentation.splash | ||
|
|
||
| import androidx.lifecycle.ViewModel | ||
| import androidx.lifecycle.viewModelScope | ||
| import dagger.hilt.android.lifecycle.HiltViewModel | ||
| import kotlinx.coroutines.delay | ||
| import kotlinx.coroutines.flow.MutableSharedFlow | ||
| import kotlinx.coroutines.flow.MutableStateFlow | ||
| import kotlinx.coroutines.flow.SharedFlow | ||
| import kotlinx.coroutines.flow.StateFlow | ||
| import kotlinx.coroutines.flow.asSharedFlow | ||
| import kotlinx.coroutines.flow.asStateFlow | ||
| import kotlinx.coroutines.launch | ||
| import javax.inject.Inject | ||
|
|
||
| @HiltViewModel | ||
| class SplashViewModel @Inject constructor() : ViewModel() { | ||
|
|
||
| private val _isReady = MutableStateFlow(false) | ||
| val isReady: StateFlow<Boolean> = _isReady.asStateFlow() | ||
|
|
||
| private val _navigateEvent = MutableSharedFlow<Unit>(extraBufferCapacity = 1) | ||
| val navigateEvent: SharedFlow<Unit> = _navigateEvent.asSharedFlow() | ||
|
|
||
| init { | ||
| viewModelScope.launch { | ||
| delay(SPLASH_DELAY) | ||
| _isReady.value = true | ||
| _navigateEvent.emit(Unit) | ||
| } | ||
| } | ||
|
|
||
| companion object { | ||
| const val SPLASH_DELAY = 1000L | ||
| } | ||
| } | ||
This file was deleted.
Oops, something went wrong.
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
61 changes: 61 additions & 0 deletions
61
app/src/test/java/com/runnect/runnect/presentation/splash/SplashViewModelTest.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,61 @@ | ||
| package com.runnect.runnect.presentation.splash | ||
|
|
||
| import app.cash.turbine.test | ||
| import kotlinx.coroutines.Dispatchers | ||
| import kotlinx.coroutines.ExperimentalCoroutinesApi | ||
| import kotlinx.coroutines.test.StandardTestDispatcher | ||
| import kotlinx.coroutines.test.advanceTimeBy | ||
| import kotlinx.coroutines.test.advanceUntilIdle | ||
| import kotlinx.coroutines.test.resetMain | ||
| import kotlinx.coroutines.test.runTest | ||
| import kotlinx.coroutines.test.setMain | ||
| import org.junit.After | ||
| import org.junit.Assert.assertFalse | ||
| import org.junit.Assert.assertTrue | ||
| import org.junit.Before | ||
| import org.junit.Test | ||
|
|
||
| @OptIn(ExperimentalCoroutinesApi::class) | ||
| class SplashViewModelTest { | ||
| private val testDispatcher = StandardTestDispatcher() | ||
|
|
||
| @Before | ||
| fun setUp() { | ||
| Dispatchers.setMain(testDispatcher) | ||
| } | ||
|
|
||
| @After | ||
| fun tearDown() { | ||
| Dispatchers.resetMain() | ||
| } | ||
|
|
||
| @Test | ||
| fun `초기 상태에서 isReady는 false다`() { | ||
| val viewModel = SplashViewModel() | ||
| assertFalse(viewModel.isReady.value) | ||
| } | ||
|
|
||
| @Test | ||
| fun `1초 경과 전에는 isReady가 false다`() = runTest(testDispatcher) { | ||
| val viewModel = SplashViewModel() | ||
| advanceTimeBy(SplashViewModel.SPLASH_DELAY - 1) | ||
| assertFalse(viewModel.isReady.value) | ||
| } | ||
|
|
||
| @Test | ||
| fun `1초 경과 후 isReady가 true가 된다`() = runTest(testDispatcher) { | ||
| val viewModel = SplashViewModel() | ||
| advanceUntilIdle() | ||
| assertTrue(viewModel.isReady.value) | ||
| } | ||
|
|
||
| @Test | ||
| fun `1초 후 navigateEvent가 emit된다`() = runTest(testDispatcher) { | ||
| val viewModel = SplashViewModel() | ||
| viewModel.navigateEvent.test { | ||
| advanceTimeBy(SplashViewModel.SPLASH_DELAY) | ||
| awaitItem() | ||
| cancelAndIgnoreRemainingEvents() | ||
| } | ||
| } | ||
| } |
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.
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.
Uh oh!
There was an error while loading. Please reload this page.