Skip to content

Commit

Permalink
Merge pull request #336 from mash-up-kr/feature/#284
Browse files Browse the repository at this point in the history
[#284] 그룹 홈 화면 - 그룹보기 정렬 추가
  • Loading branch information
JeonK1 authored Oct 4, 2024
2 parents c78dd20 + ab5caf1 commit 84835cd
Show file tree
Hide file tree
Showing 15 changed files with 306 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ class LocalDataSourceImpl @Inject constructor(
return getBoolean(KEY_IS_FIRST_OPEN, true)
}

override fun saveHomeAlignState(alignState: String) {
putString(KEY_HOME_ALIGN_STATE, alignState)
}

override fun getHomeAlignState(): String {
return getString(KEY_HOME_ALIGN_STATE, "")
}

companion object {
private const val TAG = "preferences"
private const val PREF_NAME = "pic_preferences"
Expand All @@ -171,5 +179,6 @@ class LocalDataSourceImpl @Inject constructor(
private const val KEY_USER_NAME = "key_user_name"
private const val KEY_VOTE_FIRST_VISIT = "key_vote_first_visit"
private const val KEY_IS_FIRST_OPEN = "key_is_first_open"
private const val KEY_HOME_ALIGN_STATE = "key_home_align_state"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,12 @@ class ConfigRepositoryImpl @Inject constructor(
override suspend fun getIsFirstOpen(): Boolean {
return localDataSource.getIsFirstOpen()
}

override suspend fun saveHomeAlignState(alignState: String) {
localDataSource.saveHomeAlignState(alignState)
}

override suspend fun getHomeAlignState(): String {
return localDataSource.getHomeAlignState()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ interface LocalDataSource {
fun getVoteFirstVisit(): Boolean
fun saveIsFirstOpen(isFirstOpen: Boolean)
fun getIsFirstOpen(): Boolean
fun saveHomeAlignState(alignState: String)
fun getHomeAlignState(): String
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ package com.mashup.gabbangzip.sharedalbum.domain.repository
interface ConfigRepository {
suspend fun saveIsFirstOpen(isFirstOpen: Boolean)
suspend fun getIsFirstOpen(): Boolean
suspend fun saveHomeAlignState(alignState: String)
suspend fun getHomeAlignState(): String
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.mashup.gabbangzip.sharedalbum.domain.usecase.config

import com.mashup.gabbangzip.sharedalbum.domain.repository.ConfigRepository
import dagger.Reusable
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import javax.inject.Inject

@Reusable
class GetHomeAlignStateUseCase @Inject constructor(
private val configRepository: ConfigRepository,
) {
operator fun invoke(): Flow<String> {
return flow {
emit(configRepository.getHomeAlignState())
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.mashup.gabbangzip.sharedalbum.domain.usecase.config

import com.mashup.gabbangzip.sharedalbum.domain.repository.ConfigRepository
import dagger.Reusable
import javax.inject.Inject

@Reusable
class GetIsFirstOpenUseCase @Inject constructor(
private val configRepository: ConfigRepository,
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.mashup.gabbangzip.sharedalbum.domain.usecase.config

import com.mashup.gabbangzip.sharedalbum.domain.repository.ConfigRepository
import dagger.Reusable
import javax.inject.Inject

@Reusable
class SaveHomeAlignStateUseCase @Inject constructor(
private val configRepository: ConfigRepository,
) {
suspend operator fun invoke(alignState: String) {
configRepository.saveHomeAlignState(alignState)
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.mashup.gabbangzip.sharedalbum.domain.usecase.config

import com.mashup.gabbangzip.sharedalbum.domain.repository.ConfigRepository
import dagger.Reusable
import javax.inject.Inject

@Reusable
class SaveIsFirstOpenUseCase @Inject constructor(
private val configRepository: ConfigRepository,
) {
Expand Down
Loading

0 comments on commit 84835cd

Please sign in to comment.