Skip to content
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
4 changes: 4 additions & 0 deletions .idea/deviceManager.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
@@ -1,4 +1,4 @@
package com.texthip.thip.data.model.feeds.response
package com.texthip.thip.data.model.feed.response

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.texthip.thip.data.model.feeds.response
package com.texthip.thip.data.model.feed.response

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import com.texthip.thip.data.model.feed.request.CreateFeedRequest
import com.texthip.thip.data.model.feed.response.CreateFeedResponse
import com.texthip.thip.data.model.feed.response.FeedDetailResponse
import com.texthip.thip.data.model.feed.response.FeedWriteInfoResponse
import com.texthip.thip.data.model.feeds.response.AllFeedResponse
import com.texthip.thip.data.model.feeds.response.MyFeedResponse
import com.texthip.thip.data.model.feed.response.AllFeedResponse
import com.texthip.thip.data.model.feed.response.MyFeedResponse
import com.texthip.thip.data.service.FeedService
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.Dispatchers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import com.texthip.thip.data.model.feed.response.FeedDetailResponse
import com.texthip.thip.data.model.feed.response.FeedUsersInfoResponse
import com.texthip.thip.data.model.feed.response.FeedUsersResponse
import com.texthip.thip.data.model.feed.response.FeedWriteInfoResponse
import com.texthip.thip.data.model.feeds.response.AllFeedResponse
import com.texthip.thip.data.model.feeds.response.MyFeedResponse
import com.texthip.thip.data.model.feed.response.AllFeedResponse
import com.texthip.thip.data.model.feed.response.MyFeedResponse
import okhttp3.MultipartBody
import okhttp3.RequestBody
import retrofit2.http.GET
Expand Down
23 changes: 1 addition & 22 deletions app/src/main/java/com/texthip/thip/ui/feed/screen/FeedScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
Expand All @@ -50,7 +49,6 @@ import com.texthip.thip.ui.common.topappbar.LogoTopAppBar
import com.texthip.thip.ui.feed.component.FeedSubscribeBarlist
import com.texthip.thip.ui.feed.component.MyFeedCard
import com.texthip.thip.ui.feed.component.MySubscribeBarlist
import com.texthip.thip.ui.feed.mock.MySubscriptionData
import com.texthip.thip.ui.feed.viewmodel.FeedViewModel
import com.texthip.thip.ui.feed.viewmodel.MySubscriptionViewModel
import com.texthip.thip.ui.mypage.component.SavedFeedCard
Expand All @@ -71,9 +69,6 @@ fun FeedScreen(
onNavigateToFeedComment: (Int) -> Unit = {},
nickname: String = "",
userRole: String = "",
feeds: List<FeedItem> = emptyList(),
totalFeedCount: Int = 0,
selectedTabIndex: Int = 0,
followerProfileImageUrls: List<String> = emptyList(),
resultFeedId: Int? = null,
onResultConsumed: () -> Unit = {},
Expand Down Expand Up @@ -309,19 +304,9 @@ fun FeedScreen(
//피드
item {
Spacer(modifier = Modifier.height(20.dp))
val subscriptionsForBar = feedUiState.recentWriters.map { user ->
MySubscriptionData(
profileImageUrl = user.profileImageUrl,
nickname = user.nickname,
role = "",
roleColor = colors.White,
subscriberCount = 0,
isSubscribed = true
)
}
MySubscribeBarlist(
modifier = Modifier.padding(horizontal = 20.dp),
subscriptions = subscriptionsForBar,
subscriptions = feedUiState.recentWriters,
onClick = onNavigateToMySubscription
)
}
Expand Down Expand Up @@ -431,9 +416,6 @@ private fun FeedScreenPreview() {
FeedScreen(
nickname = "ThipUser01",
userRole = "문학 칭호",
selectedTabIndex = 1,
feeds = mockFeeds,
totalFeedCount = mockFeeds.size,
followerProfileImageUrls = mockFollowerImages,
onNavigateToFeedWrite = { }
)
Expand All @@ -452,9 +434,6 @@ private fun FeedScreenWithoutDataPreview() {
FeedScreen(
nickname = "ThipUser01",
userRole = "문학 칭호",
selectedTabIndex = 0,
feeds = mockFeeds,
totalFeedCount = mockFeeds.size,
followerProfileImageUrls = mockFollowerImages,
onNavigateToFeedWrite = { }
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package com.texthip.thip.ui.feed.viewmodel

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.texthip.thip.data.model.feeds.response.AllFeedItem
import com.texthip.thip.data.model.feeds.response.MyFeedItem
import com.texthip.thip.data.model.feed.response.AllFeedItem
import com.texthip.thip.data.model.feed.response.MyFeedItem
import com.texthip.thip.data.model.users.response.RecentWriterList
import com.texthip.thip.data.repository.FeedRepository
import com.texthip.thip.data.repository.UserRepository
Expand Down Expand Up @@ -255,27 +255,32 @@ class FeedViewModel @Inject constructor(
0 -> loadAllFeeds(isInitial = false)
1 -> loadMyFeeds(isInitial = false)
}
}

fun refreshData() {
fetchRecentWriters()

}

private fun fetchRecentWriters() {
viewModelScope.launch {
_uiState.update { it.copy(isLoading = true) }
updateState { it.copy(isLoading = true) }
userRepository.getMyFollowingsRecentFeeds()
.onSuccess { data ->
val writers = data?.recentWriters ?: emptyList()
_uiState.update {
updateState {
it.copy(
isLoading = false,
recentWriters = writers
)
}
}
.onFailure { exception ->
updateState { it.copy(error = exception.message) }
updateState {
it.copy(
isLoading = false,
error = exception.message
)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ fun NavHostController.navigateToMySubscription() {

// 피드 작성으로
fun NavHostController.navigateToFeedWrite() {
navigate(FeedRoutes.Write)
navigate(FeedRoutes.Write())
}

// 피드 댓글으로
fun NavHostController.navigateToFeedComment(feedId: Int) {
navigate(FeedRoutes.Comment(feedId))
}

fun NavHostController.navigateToFeedWrite(
isbn: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ import com.texthip.thip.ui.feed.screen.MySubscriptionScreen
import com.texthip.thip.ui.navigator.extensions.navigateToFeedComment
import androidx.navigation.toRoute
import com.texthip.thip.ui.feed.screen.FeedOthersScreen
import com.texthip.thip.ui.feed.screen.FeedScreen
import com.texthip.thip.ui.feed.screen.FeedWriteScreen
import com.texthip.thip.ui.feed.screen.MySubscriptionScreen
import com.texthip.thip.ui.feed.viewmodel.FeedWriteViewModel
import com.texthip.thip.ui.navigator.extensions.navigateToFeedWrite
import com.texthip.thip.ui.navigator.extensions.navigateToMySubscription
Expand All @@ -29,9 +26,6 @@ fun NavGraphBuilder.feedNavigation(navController: NavHostController, navigateBac
FeedScreen(
nickname = "ThipUser01",
userRole = "문학가",
feeds = emptyList(),
totalFeedCount = 0,
selectedTabIndex = 0,
followerProfileImageUrls = emptyList(),
resultFeedId = resultFeedId,
onResultConsumed = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import kotlinx.serialization.Serializable
sealed class FeedRoutes : Routes() {

@Serializable data object MySubscription : FeedRoutes()

@Serializable data object Write : FeedRoutes()

@Serializable data class Comment(val feedId: Int) : FeedRoutes()

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
<string name="report">신고하기</string>
<string name="group_room_no_chat_title">아직 대화가 없어요</string>
<string name="group_room_no_chat_content">첫번째 한마디를 남겨보세요!</string>
<string name="numbering">%d. %s</string>
<string name="numbering" formatted="false">%d. %s</string>

<!-- group note -->
<string name="tilde">~</string>
Expand Down