Skip to content

Commit

Permalink
Merge branch 'dev' into feature/implement-board
Browse files Browse the repository at this point in the history
  • Loading branch information
eshc123 authored Aug 17, 2024
2 parents 56ee1c0 + e391475 commit a87b320
Show file tree
Hide file tree
Showing 14 changed files with 438 additions and 10 deletions.
18 changes: 18 additions & 0 deletions .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

252 changes: 252 additions & 0 deletions .idea/other.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ interface DefaultDataSource {
fun getUserProfile() : Flow<UserProfile?>
fun getViewedTooltip() : Flow<Boolean>
fun setViewedTooltip() : Flow<Unit>
fun setMemberId(data: Long) : Flow<Unit>
fun getMemberId() : Flow<Long?>
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.core.booleanPreferencesKey
import androidx.datastore.preferences.core.edit
import androidx.datastore.preferences.core.longPreferencesKey
import androidx.datastore.preferences.core.stringPreferencesKey
import com.luckyoct.core.model.CharacterType
import com.luckyoct.core.model.UserProfile
Expand All @@ -20,6 +21,7 @@ class DefaultDataSourceImpl @Inject constructor(
val USER_NICKNAME = stringPreferencesKey("USER_NICKNAME")
val USER_CHARACTER = stringPreferencesKey("USER_CHARACTER")
val VIEWED_TOOLTIP = booleanPreferencesKey("VIEWED_TOOLTIP")
val MEMBER_ID = longPreferencesKey("MEMBER_ID")
}

override fun clearUserData(): Flow<Unit> = flow {
Expand Down Expand Up @@ -58,4 +60,15 @@ class DefaultDataSourceImpl @Inject constructor(
}
emit(Unit)
}

override fun setMemberId(data: Long): Flow<Unit> = flow {
dataStore.edit { preferences ->
preferences[PreferencesKey.MEMBER_ID] = data
}
emit(Unit)
}

override fun getMemberId(): Flow<Long?> = dataStore.data.map { preferences ->
preferences[PreferencesKey.MEMBER_ID]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class LoginUseCase @Inject constructor(
response.data.also {
authDataSource.setAccessToken(it.accessToken).first()
authDataSource.setRefreshToken(it.refreshToken).first()
defaultDataSource.setMemberId(it.memberId).first()
(it.nickname to it.characterType).let { (nickname, character) ->
if (nickname != null && character != null) {
defaultDataSource.setUserProfile(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.luckyoct.core.model.request

import kotlinx.serialization.Serializable

@Serializable
data class TokenReissueRequest(
val refreshToken: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ data class GoogleLogin(
val refreshToken: String,
val nickname: String?,
val characterType: CharacterType?,
val isProfileSet: Boolean
val isProfileSet: Boolean,
val memberId: Long
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.luckyoct.core.model.response

import kotlinx.serialization.Serializable

@Serializable
data class TokenReissue(
val accessToken: String,
val refreshToken: String
)
Loading

0 comments on commit a87b320

Please sign in to comment.