Skip to content

Commit 871bd62

Browse files
committed
[refactor]: 내구독리스트 스트링추출(#37)
1 parent 883491d commit 871bd62

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

app/src/main/java/com/texthip/thip/ui/feed/screen/MySubscriptionListScreen.kt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import androidx.compose.runtime.saveable.rememberSaveable
2020
import androidx.compose.runtime.setValue
2121
import androidx.compose.ui.Alignment
2222
import androidx.compose.ui.Modifier
23+
import androidx.compose.ui.platform.LocalContext
2324
import androidx.compose.ui.res.stringResource
2425
import androidx.compose.ui.tooling.preview.Preview
2526
import androidx.compose.ui.unit.dp
@@ -125,6 +126,8 @@ fun MySubscriptionScreen(
125126
subscriberCount = 100
126127
),
127128
)
129+
val context = LocalContext.current
130+
128131
var members by remember { mutableStateOf(initialmembers) }
129132
var toastMessage by rememberSaveable { mutableStateOf<String?>(null) }
130133

@@ -190,12 +193,15 @@ fun MySubscriptionScreen(
190193
if (it.nickname == nickname) it.copy(isSubscribed = !it.isSubscribed)
191194
else it
192195
}
193-
toastMessage = if (members.find { it.nickname == nickname }?.isSubscribed == true) {
194-
"@$nickname 님을 구독했어요"
195-
} else {
196-
"@$nickname 님을 구독취소했어요"
197-
} }
198-
) }
196+
toastMessage =
197+
if (members.find { it.nickname == nickname }?.isSubscribed == true) {
198+
context.getString(R.string.toast_subscribe, nickname)
199+
} else {
200+
context.getString(R.string.toast_unsubscribe, nickname)
201+
}
202+
}
203+
)
204+
}
199205
}
200206
}
201207
}

app/src/main/res/values/strings.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,5 +176,9 @@
176176
<!-- feed -->
177177
<string name="my_subscription_list">내 구독 리스트</string>
178178
<string name="whole_num">전체 %d</string>
179+
<string name="toast_subscribe">%1$s 님을 구독했어요</string>
180+
<string name="toast_unsubscribe">%1$s 님을 구독취소했어요</string>
179181
<string name="subscribe_cancel">구독취소</string>
182+
183+
180184
</resources>

0 commit comments

Comments
 (0)