Skip to content
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

[#284] 그룹 홈 화면 - 그룹보기 정렬 추가 #336

Merged
merged 13 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading