-
Notifications
You must be signed in to change notification settings - Fork 0
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
[1.1.0-AN_FEAT] 스플래시 때 포켓몬 front 이미지 캐시 #319
Conversation
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.
고생하셨습니다!
궁금한 점 남겨두었는데 제가 직접 말로도 물어볼게요
@SuppressLint("StaticFieldLeak") | ||
private var instance: GlideImageCacher? = null | ||
|
||
fun init(context: Context) { |
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.
init
에서 따로 초기화를 해주는 이유가 무엇인가요?
instance()
에서 instance: GlideImageCacher
에 할당을 해주는 것 외에 다른 이점이 또 있나요?
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.
매번 context를 넣어주지 않아도 된다는 장점이 있습니다 ㅎㅎ
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.
오
} | ||
} | ||
|
||
override suspend fun clear() { |
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.
clear 를 따로 호출해줄 필요가 없는 걸까요?
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.
이 함수를 호출해줘야 할 때가 있다면, 서버에서 내려오는 이미지가 변경이 되었을 때 호출하면 되는걸까요?
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.
맞습니다~ 만약 서버의 url 에 해당하는 이미지가 바뀌었다면 clear 하고 다시 받아야겠죠?
@@ -30,7 +30,7 @@ class PokemonIntroViewModel( | |||
coroutineScope { | |||
val warmUp = async { pokemonRepository.warmUp() } | |||
val delay = async { delay(1000) } |
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.
여기서 delay(1000)
을 해야 할 필요가 있었나요..?
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.
이래서 매직 넘버를 지양해야하는거군요!
스플래쉬 화면을 보여주는 최소 시간을 설정한 것입니다!
dataSource: DataSource?, | ||
isFirstResource: Boolean, | ||
): Boolean { | ||
con.resume(Unit) |
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.
Timber.d(" $dataSource")
여기에 로그 찍어 놓고 실행하면 처음에는 REMOTE 로 찍히다가, 나중에는 DATA_DISK_CACHE 처럼 떠야 하는 게 맞나요?
제가 찍어봤을 때 처음 REMOTE 만 뜨고 다시는 뜨지 않아서요.
그러면 프리로딩한 캐시 이미지를 쓰고 있는 게 맞나 싶어서요
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.
아아~ 이제 알았다 취소~
* 🎉 Chore: PR_Comment_Notification.yml PR Comment 에 '/noti' 를 포함할 경우 Andorid 채널 혹은 Backend 채널로 노티가 간다 * 🎉 Chore: �Avatar, Content, Description 수정 * docs: README v0.1 * CD: discord로 apk 전달 * CD: cd되는지 확인 * ci: artifact 버전 v3로 수정 * test * build : 병렬처리 * Revert "Merge branch 'main' into an/cd/send_to_discord" This reverts commit 925c8db, reversing changes made to 346391c. * ci: google-service추가 * ci: 버저닝 label 추가
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.
작업 하나 추가했어요~
try { | ||
coroutineScope { | ||
val warmUp = async { pokemonRepository.warmUp() } | ||
val delay = async { delay(MIN_SPLASH_TIME) } | ||
awaitAll(warmUp, delay) | ||
pokemonRepository.warmUp() | ||
} | ||
_navigationToHomeEvent.emit(Unit) | ||
} catch (e: Exception) { | ||
Timber.e(e) | ||
handlePokemonError(e) |
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.
이거 try-catch문을 추가해야하는데 제가 까먹었네요
이제 reconnect할 때 정상적으로 refresh될겁니당
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.
저번에 회의할 때 작성했던 코드군요 !
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.
미션하느라 리뷰가 늦었네요 🥲
고생하셨습니다 오둥이~
try { | ||
coroutineScope { | ||
val warmUp = async { pokemonRepository.warmUp() } | ||
val delay = async { delay(MIN_SPLASH_TIME) } | ||
awaitAll(warmUp, delay) | ||
pokemonRepository.warmUp() | ||
} | ||
_navigationToHomeEvent.emit(Unit) | ||
} catch (e: Exception) { | ||
Timber.e(e) | ||
handlePokemonError(e) |
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.
저번에 회의할 때 작성했던 코드군요 !
isFirstResource: Boolean, | ||
): Boolean { | ||
con.resume(Unit) | ||
return false |
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.
이미지 로딩에 성공했는데 왜 return false를 반환하는건지 궁금했는데, 성공과 실패 여부를 알리는 것이 아니였군요 😂
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.
그러네여 ,, Glide의 기본 성공 처리를 유지 여부에 관련된 것,,,, 메모,,
} | ||
} | ||
|
||
override suspend fun clear() { |
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.
이 함수를 호출해줘야 할 때가 있다면, 서버에서 내려오는 이미지가 변경이 되었을 때 호출하면 되는걸까요?
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.
수고하셨습니다오둥~~~~~ 👍
private val biomeRepository: BiomeRepository, | ||
private val analyticsLogger: AnalyticsLogger, | ||
) : DexRepository { | ||
private var cachedPokemons: List<Pokemon> = emptyList() | ||
|
||
override suspend fun warmUp() { | ||
if (localPokemonDataSource.pokemons().isEmpty()) { | ||
localPokemonDataSource.savePokemons(remotePokemonDataSource.pokemons2()) | ||
val pokemons = remotePokemonDataSource.pokemons2() | ||
cachePokemonData(pokemons) |
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.
cachePokemonData
에 pokemons
를 take
해서 넣어주는 것도 좋을둣요!!!
@SuppressLint("StaticFieldLeak") | ||
private var instance: GlideImageCacher? = null | ||
|
||
fun init(context: Context) { |
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.
오
isFirstResource: Boolean, | ||
): Boolean { | ||
con.resume(Unit) | ||
return false |
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.
그러네여 ,, Glide의 기본 성공 처리를 유지 여부에 관련된 것,,,, 메모,,
작업한 내용
나중에 Paging + 스크롤할 때마다 이미지 Preload 해야할 것 같습니다.
PR 포인트
우테코 5기의 Glide 캐시 정리 블로그
suspendCancellableCoroutine
🚀Next Feature