Skip to content

[layout] Modify Common Component #604

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

Merged
merged 19 commits into from
Dec 15, 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
28 changes: 3 additions & 25 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ build/

# Local configuration file (sdk path, etc)
local.properties
*.properties

# Proguard folder generated by Eclipse
proguard/
Expand All @@ -54,7 +55,7 @@ captures/
*.keystore

# Google Services (e.g. APIs or Firebase)
# google-services.json
google-services.json

# Android Patch
gen-external-apklibs
Expand All @@ -71,30 +72,7 @@ obj/
/out/

# User-specific configurations
.idea/caches/
.idea/libraries/
.idea/shelf/
.idea/workspace.xml
.idea/tasks.xml
.idea/.name
.idea/compiler.xml
.idea/copyright/profiles_settings.xml
.idea/encodings.xml
.idea/misc.xml
.idea/modules.xml
.idea/scopes/scope_settings.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml
.idea/datasources.xml
.idea/dataSources.ids
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml
.idea/assetWizardSettings.xml
.idea/gradle.xml
.idea/jarRepositories.xml
.idea/navEditor.xml
.idea/

# OS-specific files
.DS_Store
Expand Down
18 changes: 9 additions & 9 deletions data/src/main/java/daily/dayo/data/mapper/FollowMapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ import daily.dayo.data.datasource.remote.follow.CreateFollowUpResponse
import daily.dayo.data.datasource.remote.follow.ListAllFollowerResponse
import daily.dayo.data.datasource.remote.follow.ListAllFollowingResponse
import daily.dayo.data.datasource.remote.follow.MyFollowerDto
import daily.dayo.domain.model.Follow
import daily.dayo.domain.model.FollowCreateResponse
import daily.dayo.domain.model.FollowUpCreateResponse
import daily.dayo.domain.model.Followers
import daily.dayo.domain.model.Followings
import daily.dayo.domain.model.MyFollower
import daily.dayo.domain.model.Follower
import daily.dayo.domain.model.Following

fun CreateFollowResponse.toFollowCreateResponse(): FollowCreateResponse =
FollowCreateResponse(followerId = followerId, isAccept = isAccept, memberId = memberId)

fun CreateFollowUpResponse.toFollowUpCreateResponse(): FollowUpCreateResponse =
FollowUpCreateResponse(followId = followId, isAccept = isAccept, memberId = memberId)

fun ListAllFollowingResponse.toFollowings(): Followings =
Followings(count = count, data = data.map { it.toMyFollower() })
fun ListAllFollowingResponse.toFollowings(): Following =
Following(count = count, data = data.map { it.toMyFollower() })

fun ListAllFollowerResponse.toFollowers(): Followers =
Followers(count = count, data = data.map { it.toMyFollower() })
fun ListAllFollowerResponse.toFollowers(): Follower =
Follower(count = count, data = data.map { it.toMyFollower() })

fun MyFollowerDto.toMyFollower(): MyFollower =
MyFollower(
fun MyFollowerDto.toMyFollower(): Follow =
Follow(
isFollow = isFollow,
memberId = memberId,
nickname = nickname,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package daily.dayo.data.repository

import daily.dayo.data.datasource.remote.follow.*
import daily.dayo.data.datasource.remote.follow.CreateFollowRequest
import daily.dayo.data.datasource.remote.follow.CreateFollowUpRequest
import daily.dayo.data.datasource.remote.follow.FollowApiService
import daily.dayo.data.mapper.toFollowCreateResponse
import daily.dayo.data.mapper.toFollowUpCreateResponse
import daily.dayo.data.mapper.toFollowers
import daily.dayo.data.mapper.toFollowings
import daily.dayo.domain.model.FollowCreateResponse
import daily.dayo.domain.model.FollowUpCreateResponse
import daily.dayo.domain.model.Followers
import daily.dayo.domain.model.Followings
import daily.dayo.domain.model.Follower
import daily.dayo.domain.model.Following
import daily.dayo.domain.model.NetworkResponse
import daily.dayo.domain.repository.FollowRepository
import javax.inject.Inject
Expand All @@ -18,25 +20,25 @@ class FollowRepositoryImpl @Inject constructor(
) : FollowRepository {

override suspend fun requestCreateFollow(followerId: String): NetworkResponse<FollowCreateResponse> =
when (val response = followApiService.requestCreateFollow(CreateFollowRequest(followerId = followerId))) {
is NetworkResponse.Success -> NetworkResponse.Success(response.body?.toFollowCreateResponse())
is NetworkResponse.NetworkError -> response
is NetworkResponse.ApiError -> response
is NetworkResponse.UnknownError -> response
}
when (val response = followApiService.requestCreateFollow(CreateFollowRequest(followerId = followerId))) {
is NetworkResponse.Success -> NetworkResponse.Success(response.body?.toFollowCreateResponse())
is NetworkResponse.NetworkError -> response
is NetworkResponse.ApiError -> response
is NetworkResponse.UnknownError -> response
}

override suspend fun requestDeleteFollow(followerId: String): NetworkResponse<Void> =
followApiService.requestDeleteFollow(followerId)

override suspend fun requestListAllFollower(memberId: String): NetworkResponse<Followers> =
override suspend fun requestListAllFollower(memberId: String): NetworkResponse<Follower> =
when (val response = followApiService.requestListAllFollower(memberId)) {
is NetworkResponse.Success -> NetworkResponse.Success(response.body?.toFollowers())
is NetworkResponse.NetworkError -> response
is NetworkResponse.ApiError -> response
is NetworkResponse.UnknownError -> response
}

override suspend fun requestListAllFollowing(memberId: String): NetworkResponse<Followings> =
override suspend fun requestListAllFollowing(memberId: String): NetworkResponse<Following> =
when (val response = followApiService.requestListAllFollowing(memberId)) {
is NetworkResponse.Success -> NetworkResponse.Success(response.body?.toFollowings())
is NetworkResponse.NetworkError -> response
Expand Down
15 changes: 5 additions & 10 deletions domain/src/main/java/daily/dayo/domain/model/Follow.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,14 @@ data class Follow(
val profileImg: String
)

data class Followings(
data class Following(
val count: Int,
val data: List<MyFollower>
val data: List<Follow>
)
data class Followers(

data class Follower(
val count: Int,
val data: List<MyFollower>
)
data class MyFollower(
val isFollow: Boolean,
val memberId: String,
val nickname: String,
val profileImg: String
val data: List<Follow>
)

data class FollowCreateResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ package daily.dayo.domain.repository

import daily.dayo.domain.model.FollowCreateResponse
import daily.dayo.domain.model.FollowUpCreateResponse
import daily.dayo.domain.model.Followers
import daily.dayo.domain.model.Followings
import daily.dayo.domain.model.Follower
import daily.dayo.domain.model.Following
import daily.dayo.domain.model.NetworkResponse

interface FollowRepository {

suspend fun requestCreateFollow(followerId: String): NetworkResponse<FollowCreateResponse>
suspend fun requestDeleteFollow(followerId: String): NetworkResponse<Void>
suspend fun requestListAllFollower(memberId: String): NetworkResponse<Followers>
suspend fun requestListAllFollowing(memberId: String): NetworkResponse<Followings>
suspend fun requestListAllFollower(memberId: String): NetworkResponse<Follower>
suspend fun requestListAllFollowing(memberId: String): NetworkResponse<Following>
suspend fun requestCreateFollowUp(followerId: String): NetworkResponse<FollowUpCreateResponse>
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import daily.dayo.presentation.R
import daily.dayo.presentation.databinding.ActivityMainBinding
import daily.dayo.presentation.fragment.home.HomeFragmentDirections
import daily.dayo.presentation.screen.main.MainScreen
import daily.dayo.presentation.theme.DayoTheme
import daily.dayo.presentation.viewmodel.AccountViewModel
import daily.dayo.presentation.viewmodel.SettingNotificationViewModel

Expand All @@ -47,7 +48,9 @@ class MainActivity : AppCompatActivity() {
getNotificationData()
askNotificationPermission()
setContent {
MainScreen()
DayoTheme {
MainScreen()
}
}
}

Expand Down

This file was deleted.

Loading
Loading