-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #110 from YAPP-Github/feature/TNT-190
[TNT-190] ํธ๋ ์ด๋ ์ฐ๊ฒฐ ์์ฒญ ํ์ ๊ธฐ๋ฅ ๊ตฌํ
- Loading branch information
Showing
31 changed files
with
322 additions
and
70 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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
37 changes: 37 additions & 0 deletions
37
data/storage/src/main/java/co/kr/data/storage/source/ConnectLocalDataSource.kt
This file contains 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,37 @@ | ||
package co.kr.data.storage.source | ||
|
||
import androidx.datastore.core.DataStore | ||
import androidx.datastore.preferences.core.Preferences | ||
import androidx.datastore.preferences.core.edit | ||
import androidx.datastore.preferences.core.stringPreferencesKey | ||
import co.kr.data.storage.di.StorageModule.CONNECT_STORAGE_NAME | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.map | ||
import javax.inject.Inject | ||
import javax.inject.Named | ||
import javax.inject.Singleton | ||
|
||
@Singleton | ||
class ConnectLocalDataSource @Inject constructor( | ||
@Named(CONNECT_STORAGE_NAME) private val connectPreferences: DataStore<Preferences>, | ||
) { | ||
val explicitDeniedConnectDate: Flow<String?> = connectPreferences.data.map { preferences -> | ||
preferences[EXPLICIT_DENIED_CONNECT_DATE] ?: "" | ||
} | ||
|
||
suspend fun updateExplicitDeniedConnectDate(startDate: String) { | ||
connectPreferences.edit { preferences -> | ||
preferences[EXPLICIT_DENIED_CONNECT_DATE] = startDate | ||
} | ||
} | ||
|
||
suspend fun clearExplicitDeniedConnectDate() { | ||
connectPreferences.edit { preferences -> | ||
preferences.remove(EXPLICIT_DENIED_CONNECT_DATE) | ||
} | ||
} | ||
|
||
companion object { | ||
private val EXPLICIT_DENIED_CONNECT_DATE = stringPreferencesKey("EXPLICIT_DENIED_CONNECT_DATE") | ||
} | ||
} |
This file contains 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 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.