Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
1a1e6a1
[fix]: 충돌 해결(#74)
JJUYAAA Aug 12, 2025
41b3d52
Merge branch 'JJUYAAA-ui/#74-empty_data_screen' into develop
JJUYAAA Aug 12, 2025
f2d6e22
Merge branch 'develop' of https://github.com/THIP-TextHip/THIP-Androi…
JJUYAAA Aug 12, 2025
5e4a428
Merge branch 'develop' of https://github.com/THIP-TextHip/THIP-Androi…
JJUYAAA Aug 12, 2025
7ce2517
[feat]: 내 팔로잉 목록 조회 dto(#72)
JJUYAAA Aug 13, 2025
4876dc9
[feat]: user 서비스, 레포지토리 생성 (#72)
JJUYAAA Aug 13, 2025
dcb3844
[feat]: 내 팔로잉 목록 뷰모델 생성 (#72)
JJUYAAA Aug 13, 2025
e0d94cc
[feat]: AuthorHeader 색상 외부에서 받아오도록 수정 (#72)
JJUYAAA Aug 13, 2025
bf05950
[feat]: 내 팔로잉 목록 페이지 코드수정 -> screen, content 분리 (#72)
JJUYAAA Aug 13, 2025
38c0349
[feat]: 서비스모듈 유저서비스 추가 (#72)
JJUYAAA Aug 13, 2025
225ea7a
[feat]: FeedScreen에 내 띱 리스트바 뷰모델 요청 추가 (#72)
JJUYAAA Aug 13, 2025
9c62a3d
[feat]: Feed Route 추가 (#72)
JJUYAAA Aug 13, 2025
27be2a5
[refactor]: textAlign 수정(#72)
JJUYAAA Aug 13, 2025
97ce79e
[refactor]: hexTocolor 유틸패키지로 이동(#72)
JJUYAAA Aug 13, 2025
9dd50b1
[refactor]: 뷰모델에서 uimodel 삭제 및 응답 dto로 대체(#72)
JJUYAAA Aug 13, 2025
1816db9
[refactor]: followingDto -> FollowingList 네이밍 변경(#72)
JJUYAAA Aug 13, 2025
e931517
[refactor]: 네비게이션 수정(#72)
JJUYAAA Aug 13, 2025
9b42b3e
Merge branch 'develop' of https://github.com/THIP-TextHip/THIP-Androi…
JJUYAAA Aug 13, 2025
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
7 changes: 7 additions & 0 deletions app/src/main/java/com/texthip/thip/data/di/ServiceModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.texthip.thip.data.di
import com.texthip.thip.data.service.BookService
import com.texthip.thip.data.service.GroupService
import com.texthip.thip.data.service.RoomsService
import com.texthip.thip.data.service.UserService
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
Expand All @@ -29,4 +30,10 @@ object ServiceModule {
@Singleton
fun providesRoomsService(retrofit: Retrofit): RoomsService =
retrofit.create(RoomsService::class.java)

@Provides
@Singleton
fun provideUserService(retrofit: Retrofit): UserService {
return retrofit.create(UserService::class.java)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.texthip.thip.data.model.users

import com.google.gson.annotations.SerializedName
import kotlinx.serialization.Serializable

@Serializable
data class MyFollowingsResponse(
@SerializedName("followings") val followings: List<FollowingList>,
@SerializedName("totalFollowingCount") val totalFollowingCount: Int,
@SerializedName("nextCursor") val nextCursor: String?,
@SerializedName("isLast") val isLast: Boolean
)

@Serializable
data class FollowingList(
@SerializedName("userId") val userId: Int,
@SerializedName("nickname") val nickname: String,
@SerializedName("profileImageUrl") val profileImageUrl: String?,
@SerializedName("aliasName") val aliasName: String,
@SerializedName("aliasColor") val aliasColor: String,
@SerializedName("isFollowing") val isFollowing: Boolean
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.texthip.thip.data.repository

import com.texthip.thip.data.model.base.handleBaseResponse
import com.texthip.thip.data.model.users.MyFollowingsResponse
import com.texthip.thip.data.service.UserService
import javax.inject.Inject
import javax.inject.Singleton

@Singleton
class UserRepository@Inject constructor(
private val userService: UserService
) {
suspend fun getMyFollowings(
cursor: String?,
size: Int = 10
): Result<MyFollowingsResponse?> = runCatching {
userService.getMyFollowings(cursor = cursor, size = size)
.handleBaseResponse()
.getOrThrow()
}
}
17 changes: 17 additions & 0 deletions app/src/main/java/com/texthip/thip/data/service/UserService.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.texthip.thip.data.service

import com.texthip.thip.data.model.base.BaseResponse
import com.texthip.thip.data.model.rooms.response.RoomsUsersResponse
import com.texthip.thip.data.model.users.MyFollowingsResponse
import retrofit2.http.GET
import retrofit2.http.Path
import retrofit2.http.Query

interface UserService {
@GET("users/my-followings")
suspend fun getMyFollowings(
@Query("size") size: Int = 10,
@Query("cursor") cursor: String? = null
): BaseResponse<MyFollowingsResponse>

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ import com.texthip.thip.ui.common.buttons.OutlinedButton
import com.texthip.thip.ui.theme.ThipTheme
import com.texthip.thip.ui.theme.ThipTheme.colors
import com.texthip.thip.ui.theme.ThipTheme.typography
import androidx.compose.ui.graphics.Color

@Composable
fun AuthorHeader(
modifier: Modifier = Modifier,
profileImage: String?,
nickname: String,
badgeText: String,
badgeTextColor: Color = colors.NeonGreen,
buttonText: String = "",
buttonWidth: Dp = 60.dp,
showButton: Boolean = true,
Expand Down Expand Up @@ -80,7 +82,7 @@ fun AuthorHeader(
Text(
text = badgeText,
style = typography.feedcopy_r400_s14_h20,
color = colors.NeonGreen,
color = badgeTextColor,
maxLines = 1
)
}
Expand Down Expand Up @@ -131,6 +133,7 @@ fun PreviewAuthorHeader() {
profileImage = null,
nickname = "열자자제한열열자제한",
badgeText = "칭호칭호칭호",
badgeTextColor = colors.Yellow,
showButton = false,
showThipNum = true,
thipNum = 10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -105,7 +106,8 @@ fun MySubscribeBarlist(
overflow = TextOverflow.Ellipsis,
style = typography.view_r400_s11_h20,
color = colors.White,
modifier = Modifier.width(36.dp)
modifier = Modifier.width(36.dp),
textAlign = TextAlign.Center
)
}
Spacer(modifier = Modifier.width(12.dp))
Expand Down Expand Up @@ -160,7 +162,7 @@ private fun MySubscribeBarlistPrev() {
val previewData = List(10) {
MySubscriptionData(
profileImageUrl = "https://example.com/profile$it.jpg",
nickname = "닉네임$it",
nickname = "닉네임임$it",
role = "문학가",
roleColor = colors.Red,
subscriberCount = 100 + it
Expand Down
31 changes: 25 additions & 6 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 @@ -13,16 +13,19 @@ import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavController
import com.texthip.thip.R
import com.texthip.thip.ui.common.buttons.FloatingButton
Expand All @@ -33,21 +36,26 @@ 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.MySubscriptionViewModel
import com.texthip.thip.ui.mypage.component.SavedFeedCard
import com.texthip.thip.ui.mypage.mock.FeedItem
import com.texthip.thip.ui.navigator.routes.FeedRoutes
import com.texthip.thip.ui.theme.ThipTheme
import com.texthip.thip.ui.theme.ThipTheme.colors
import com.texthip.thip.ui.theme.ThipTheme.typography


@Composable
fun FeedScreen(
navController: NavController? = null,
onNavigateToMySubscription: () -> Unit = {},
nickname: String = "",
userRole: String = "",
feeds: List<FeedItem> = emptyList(),
totalFeedCount: Int = 0,
selectedTabIndex: Int = 0,
followerProfileImageUrls: List<String> = emptyList()
followerProfileImageUrls: List<String> = emptyList(),
viewModel: MySubscriptionViewModel = hiltViewModel()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거 screen이랑 content랑 분리해서 screen에서 viewmodel을 주입받고 content에서는 ui만 다루도록 수정해주세여 !

) {
val selectedIndex = rememberSaveable { mutableIntStateOf(selectedTabIndex) }
val feedStateList = remember {
Expand Down Expand Up @@ -105,6 +113,7 @@ fun FeedScreen(
roleColor = colors.SocialScience
)
)
val subscriptionUiState by viewModel.uiState.collectAsState()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

❓ Verification inconclusive

수명 주기 인식 상태 수집으로 전환 권장: collectAsStateWithLifecycle

수명 주기와 동기화된 상태 수집으로 전환하면 백그라운드에서 불필요한 수집을 방지할 수 있습니다.

아래 변경을 제안합니다:

-import androidx.compose.runtime.collectAsState
+import androidx.lifecycle.compose.collectAsStateWithLifecycle
-val subscriptionUiState by viewModel.uiState.collectAsState()
+val subscriptionUiState by viewModel.uiState.collectAsStateWithLifecycle()

Gradle 의존성에 lifecycle-runtime-compose가 포함되어 있는지 확인해 주세요. 아래 스크립트로 점검할 수 있습니다.


🏁 Script executed:

#!/bin/bash
# lifecycle-runtime-compose 의존성 존재 여부 확인
rg -n "lifecycle-runtime-compose" -A 2

Length of output: 38


다음 스크립트로 Gradle 파일 내에 lifecycle-runtime-compose 의존성이 있는지 다시 한번 확인해주세요.


🏁 Script executed:

#!/bin/bash
# Gradle 파일 (*.gradle, *.gradle.kts) 내 lifecycle-runtime-compose 의존성 검색
rg -n "lifecycle-runtime-compose" --glob "*.gradle*" -A2

Length of output: 56


수명 주기 인식 상태 수집으로 전환 및 의존성 추가 필요

아래와 같이 collectAsStatecollectAsStateWithLifecycle로 교체하고, 관련 Compose-용 Lifecycle 의존성을 Gradle에 추가해주세요.

위치: app/src/main/java/com/texthip/thip/ui/feed/screen/FeedScreen.kt (116행)

제안 변경사항:

-import androidx.compose.runtime.collectAsState
+import androidx.lifecycle.compose.collectAsStateWithLifecycle
-val subscriptionUiState by viewModel.uiState.collectAsState()
+val subscriptionUiState by viewModel.uiState.collectAsStateWithLifecycle()

추가로, 프로젝트의 build.gradle 또는 build.gradle.kts에 다음 의존성을 선언해야 합니다.
(스크립트 확인 결과 이미 선언된 항목이 없어 직접 추가가 필요합니다.)

implementation "androidx.lifecycle:lifecycle-runtime-compose:<최신_버전>"
  • <최신_버전>은 기존 androidx.lifecycle 의존성과 맞추거나 Maven Central에서 확인하세요.
  • 선언 후 프로젝트 Sync를 실행해 의존성이 정상 반영되는지 확인해주세요.
🤖 Prompt for AI Agents
In app/src/main/java/com/texthip/thip/ui/feed/screen/FeedScreen.kt around line
116, replace usage of viewModel.uiState.collectAsState() with
viewModel.uiState.collectAsStateWithLifecycle() and add the corresponding import
for the lifecycle Compose extension; then add the lifecycle runtime compose
dependency to the project build file (build.gradle or build.gradle.kts):
implementation "androidx.lifecycle:lifecycle-runtime-compose:<latest_version>"
where <latest_version> matches your existing androidx.lifecycle versions or the
latest on Maven Central, sync the project, and verify the new symbol resolves.

Box(modifier = Modifier.fillMaxSize()) {
Column(
modifier = Modifier.fillMaxSize()
Expand All @@ -121,7 +130,8 @@ fun FeedScreen(
selectedTabIndex = selectedIndex.value,
onTabSelected = { selectedIndex.value = it }
)
// 스크롤 영역

// 스크롤 영역 전체
LazyColumn(
modifier = Modifier.weight(1f),
verticalArrangement = Arrangement.spacedBy(12.dp)
Expand Down Expand Up @@ -203,11 +213,20 @@ fun FeedScreen(
//피드
item {
Spacer(modifier = Modifier.height(20.dp))
val subscriptionsForBar = subscriptionUiState.followings.map { user ->
MySubscriptionData(
profileImageUrl = user.profileImageUrl,
nickname = user.nickname,
role = user.aliasName,
roleColor = colors.White,
subscriberCount = 0,
isSubscribed = user.isFollowing
)
}
MySubscribeBarlist(
modifier = Modifier.padding(horizontal = 20.dp),
subscriptions = mySubscriptions,
onClick = {
}
subscriptions = subscriptionsForBar,
onClick = onNavigateToMySubscription
)
}
itemsIndexed(feedStateList, key = { _, item -> item.id }) { index, feed ->
Expand Down Expand Up @@ -300,7 +319,7 @@ private fun FeedScreenWithoutDataPreview() {
FeedScreen(
nickname = "ThipUser01",
userRole = "문학 칭호",
selectedTabIndex = 1,
selectedTabIndex = 0,
feeds = mockFeeds,
totalFeedCount = mockFeeds.size,
followerProfileImageUrls = mockFollowerImages
Expand Down
Loading