Skip to content

Commit

Permalink
Merge branch 'develop' into feature/jaino/#223
Browse files Browse the repository at this point in the history
  • Loading branch information
jeongjaino committed Jan 21, 2025
2 parents 1032844 + f00b0f2 commit 42a7d65
Show file tree
Hide file tree
Showing 37 changed files with 264 additions and 296 deletions.
2 changes: 0 additions & 2 deletions app/src/main/kotlin/com/bff/wespot/AppNavGraphs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import com.bff.wespot.entire.screen.destinations.RevokeConfirmScreenDestination
import com.bff.wespot.entire.screen.destinations.RevokeScreenDestination
import com.bff.wespot.entire.screen.destinations.SettingScreenDestination
import com.bff.wespot.message.screen.destinations.MessageEditScreenDestination
import com.bff.wespot.message.screen.destinations.MessageReportScreenDestination
import com.bff.wespot.message.screen.destinations.MessageScreenDestination
import com.bff.wespot.message.screen.destinations.MessageWriteScreenDestination
import com.bff.wespot.message.screen.destinations.ReceiverSelectionScreenDestination
Expand Down Expand Up @@ -76,7 +75,6 @@ object AppNavGraphs {
MessageEditScreenDestination,
ReceiverSelectionScreenDestination,
ReservedMessageScreenDestination,
MessageReportScreenDestination,
).routedIn(this)
.associateBy { it.route }
}
Expand Down
16 changes: 3 additions & 13 deletions app/src/main/kotlin/com/bff/wespot/CommonNavGraphNavigator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import com.bff.wespot.entire.screen.destinations.ProfileEditScreenDestination
import com.bff.wespot.entire.screen.destinations.RevokeConfirmScreenDestination
import com.bff.wespot.entire.screen.destinations.RevokeScreenDestination
import com.bff.wespot.entire.screen.destinations.SettingScreenDestination
import com.bff.wespot.entire.screen.edit.ProfileEditNavArgs
import com.bff.wespot.entire.screen.edit.ProfileEditNavigator
import com.bff.wespot.entire.screen.setting.AccountSettingNavigator
import com.bff.wespot.entire.screen.setting.BlockListNavigator
Expand All @@ -19,12 +18,8 @@ import com.bff.wespot.entire.screen.setting.RevokeConfirmNavigator
import com.bff.wespot.entire.screen.setting.RevokeNavigator
import com.bff.wespot.entire.screen.setting.SettingNavigator
import com.bff.wespot.message.screen.MessageNavigator
import com.bff.wespot.message.screen.MessageReportNavigator
import com.bff.wespot.message.screen.MessageReportScreenArgs
import com.bff.wespot.message.screen.MessageScreenArgs
import com.bff.wespot.message.screen.ReservedMessageNavigator
import com.bff.wespot.message.screen.destinations.MessageEditScreenDestination
import com.bff.wespot.message.screen.destinations.MessageReportScreenDestination
import com.bff.wespot.message.screen.destinations.MessageScreenDestination
import com.bff.wespot.message.screen.destinations.MessageWriteScreenDestination
import com.bff.wespot.message.screen.destinations.ReceiverSelectionScreenDestination
Expand Down Expand Up @@ -70,8 +65,7 @@ class CommonNavGraphNavigator(
VoteStorageNavigator,
ReservedMessageNavigator,
IndividualVoteNavigator,
ProfileEditNavigator,
MessageReportNavigator {
ProfileEditNavigator {
override fun navigateUp() {
navController.navigateUp()
}
Expand Down Expand Up @@ -150,15 +144,11 @@ class CommonNavGraphNavigator(
navController.navigate(BlockListScreenDestination within navGraph)
}

override fun navigateToProfileEditScreen(args: ProfileEditNavArgs) {
navController.navigate(ProfileEditScreenDestination(args) within navGraph)
override fun navigateToProfileEditScreen() {
navController.navigate(ProfileEditScreenDestination within navGraph)
}

override fun navigateToEntireScreen() {
navController.navigate(EntireScreenDestination within navGraph)
}

override fun navigateMessageReportScreen(args: MessageReportScreenArgs) {
navController.navigate(MessageReportScreenDestination(args) within navGraph)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.bff.wespot

import androidx.navigation.NavController
import com.bff.wespot.entire.screen.destinations.ProfileEditScreenDestination
import com.bff.wespot.entire.screen.edit.ProfileEditNavArgs
import com.bff.wespot.message.screen.MessageScreenArgs
import com.bff.wespot.message.screen.destinations.MessageScreenDestination
import com.bff.wespot.message.screen.destinations.ReceiverSelectionScreenDestination
Expand Down Expand Up @@ -64,6 +63,6 @@ class NotificationNavigatorImpl(private val navController: NavController): Notif
}

override fun navigateToProfileEditScreen() {
navController.navigate(ProfileEditScreenDestination(ProfileEditNavArgs(false)) within AppNavGraphs.entire)
navController.navigate(ProfileEditScreenDestination within AppNavGraphs.entire)
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package com.bff.wespot.model.user.response

/**
* params [iconUrl] URL of the profile image.
* params [backgroundColor] backgroundColor is no longer used.
*/
data class ProfileCharacter(
val iconUrl: String,
val backgroundColor: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.bff.wespot.data.remote.model.user.request

import kotlinx.serialization.Serializable

@Serializable
data class ProfileUpdateDto(
val introduction: String,
val url: String?,
)
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.bff.wespot.data.remote.source.user

import com.bff.wespot.data.remote.model.user.request.FeatureNotificationSettingDto
import com.bff.wespot.data.remote.model.user.request.IntroductionDto
import com.bff.wespot.data.remote.model.user.request.ProfileUpdateDto
import com.bff.wespot.data.remote.model.user.response.NotificationSettingDto
import com.bff.wespot.data.remote.model.user.response.ProfileCharacterDto
import com.bff.wespot.data.remote.model.user.response.ProfileDto
import com.bff.wespot.data.remote.model.user.response.UserListDto

Expand All @@ -20,9 +19,5 @@ interface UserDataSource {

suspend fun updateNotificationSetting(notificationSetting: NotificationSettingDto): Result<Unit>

suspend fun updateIntroduction(introduction: IntroductionDto): Result<Unit>

suspend fun updateCharacter(character: ProfileCharacterDto): Result<Unit>

suspend fun updateProfileImage(url: String?): Result<Unit>
suspend fun updateProfile(profileUpdateDto: ProfileUpdateDto): Result<Unit>
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.bff.wespot.data.remote.source.user

import com.bff.wespot.data.remote.model.user.request.FeatureNotificationSettingDto
import com.bff.wespot.data.remote.model.user.request.IntroductionDto
import com.bff.wespot.data.remote.model.user.request.ProfileUpdateDto
import com.bff.wespot.data.remote.model.user.response.NotificationSettingDto
import com.bff.wespot.data.remote.model.user.response.ProfileCharacterDto
import com.bff.wespot.data.remote.model.user.response.ProfileDto
import com.bff.wespot.data.remote.model.user.response.UserListDto
import com.bff.wespot.network.extensions.safeRequest
Expand Down Expand Up @@ -65,30 +64,12 @@ class UserDataSourceImpl @Inject constructor(
setBody(notificationSetting)
}

override suspend fun updateIntroduction(introduction: IntroductionDto): Result<Unit> =
httpClient.safeRequest {
url {
method = HttpMethod.Put
path("api/v1/users/me")
}
setBody(introduction)
}

override suspend fun updateCharacter(character: ProfileCharacterDto): Result<Unit> =
httpClient.safeRequest {
url {
method = HttpMethod.Put
path("api/v1/users/me")
}
setBody(character)
}

override suspend fun updateProfileImage(url: String?): Result<Unit> =
override suspend fun updateProfile(profileUpdateDto: ProfileUpdateDto): Result<Unit> =
httpClient.safeRequest {
url {
method = HttpMethod.Post
path("api/v1/image/update-profile")
parameter("url", url)
}
setBody(profileUpdateDto)
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.bff.wespot.data.repository.user

import com.bff.wespot.data.local.source.ProfileDataSource
import com.bff.wespot.data.remote.model.user.request.ProfileUpdateDto
import com.bff.wespot.data.remote.source.user.UserDataSource
import com.bff.wespot.domain.repository.user.ProfileRepository
import com.bff.wespot.model.user.response.Profile
Expand All @@ -23,8 +24,14 @@ class ProfileRepositoryImpl @Inject constructor(

override suspend fun clearProfile() = profileDataSource.clearProfile()

override suspend fun updateProfileImage(url: String?): Boolean {
val response = userDataSource.updateProfileImage(url)
return response.isSuccess
}
override suspend fun updateProfile(
introduction: String,
profileImageUrl: String?
): Result<Unit> =
userDataSource.updateProfile(
ProfileUpdateDto(
introduction = introduction,
url = profileImageUrl,
),
)
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
package com.bff.wespot.data.repository.user

import com.bff.wespot.data.mapper.user.toNotificationSettingDto
import com.bff.wespot.data.mapper.user.toProfileCharacterDto
import com.bff.wespot.data.remote.model.user.request.FeatureNotificationSettingDto
import com.bff.wespot.data.remote.model.user.request.IntroductionDto
import com.bff.wespot.data.remote.source.user.UserDataSource
import com.bff.wespot.domain.repository.DataStoreRepository
import com.bff.wespot.domain.repository.user.UserRepository
import com.bff.wespot.domain.util.DataStoreKey
import com.bff.wespot.model.user.response.NotificationSetting
import com.bff.wespot.model.user.response.Profile
import com.bff.wespot.model.user.response.ProfileCharacter
import javax.inject.Inject

class UserRepositoryImpl @Inject constructor(
Expand Down Expand Up @@ -44,10 +41,4 @@ class UserRepositoryImpl @Inject constructor(
notificationSetting: NotificationSetting,
): Result<Unit> =
userDataSource.updateNotificationSetting(notificationSetting.toNotificationSettingDto())

override suspend fun updateIntroduction(introduction: String): Result<Unit> =
userDataSource.updateIntroduction(introduction = IntroductionDto(introduction))

override suspend fun updateCharacter(character: ProfileCharacter): Result<Unit> =
userDataSource.updateCharacter(character.toProfileCharacterDto())
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ interface ProfileRepository {

suspend fun clearProfile()

suspend fun updateProfileImage(url: String?): Boolean
suspend fun updateProfile(introduction: String, profileImageUrl: String?): Result<Unit>
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.bff.wespot.domain.repository.user

import com.bff.wespot.model.user.response.NotificationSetting
import com.bff.wespot.model.user.response.Profile
import com.bff.wespot.model.user.response.ProfileCharacter

interface UserRepository {
suspend fun getProfile(): Result<Profile>
Expand All @@ -12,8 +11,4 @@ interface UserRepository {
suspend fun setFeatureNotificationSetting(isEnableNotification: Boolean): Result<Unit>

suspend fun updateNotificationSetting(notificationSetting: NotificationSetting): Result<Unit>

suspend fun updateIntroduction(introduction: String): Result<Unit>

suspend fun updateCharacter(character: ProfileCharacter): Result<Unit>
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import com.bff.wespot.designsystem.theme.WeSpotThemeManager
import com.bff.wespot.domain.util.RemoteConfigKey
import com.bff.wespot.entire.R
import com.bff.wespot.entire.component.EntireListItem
import com.bff.wespot.entire.screen.edit.ProfileEditNavArgs
import com.bff.wespot.entire.state.EntireAction
import com.bff.wespot.entire.viewmodel.EntireViewModel
import com.bff.wespot.model.user.response.Profile
Expand All @@ -47,7 +46,7 @@ import org.orbitmvi.orbit.compose.collectAsState

interface EntireNavigator {
fun navigateToSetting()
fun navigateToProfileEditScreen(args: ProfileEditNavArgs)
fun navigateToProfileEditScreen()
}

@Destination
Expand All @@ -69,7 +68,7 @@ internal fun EntireScreen(
) {
ProfileContent(
profile = state.profile,
onClick = { navigator.navigateToProfileEditScreen(ProfileEditNavArgs(false)) },
onClick = { navigator.navigateToProfileEditScreen() },
)

Spacer(modifier = Modifier.height(8.dp))
Expand Down
Loading

0 comments on commit 42a7d65

Please sign in to comment.