Skip to content

Commit

Permalink
[Feat] #189 - 노티 인기글 뷰에 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
boogios committed Jun 16, 2024
1 parent d02ac18 commit e625ab4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ struct NotificationList {
let time: String
let notificationId: Int
let triggerMemberId: Int
let notificationText: String
}

extension NotificationList {
Expand All @@ -26,5 +27,6 @@ extension NotificationList {
notificationType: .contentLiked,
time: "",
notificationId: 0,
triggerMemberId: 0)
triggerMemberId: 0,
notificationText: "")
}
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,16 @@ extension NotificationViewController: UITableViewDataSource {
return cell
} else {
guard let cell = tableView.dequeueReusableCell(withIdentifier: NotificationTableViewCell.reuseIdentifier, for: indexPath) as? NotificationTableViewCell else { return UITableViewCell() }
cell.configureCell(list: viewModel.notificationLists[indexPath.row])
if viewModel.notificationLists[indexPath.row].notificationType == .popularContent {
cell.nicknameLabel.text = "어제 가장 인기있었던 글이에요.\n"
cell.notificationLabel.text = "어제 가장 인기있었던 글이에요.\n" + viewModel.notificationLists[indexPath.row].notificationText
cell.notificationLabel.setTextWithLineHeightAndFont(
text: cell.notificationLabel.text,
targetString: "어제 가장 인기있었던 글이에요.",
font: .font(.body3))
} else {
cell.configureCell(list: viewModel.notificationLists[indexPath.row])
}
cell.selectionStyle = .none
let numsOflines = UILabel.lineNumber(label: cell.notificationLabel, labelWidth: 216.adjusted)
numsOfLinesOfCellLabel = numsOflines
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ final class NotificationViewModel: ViewModelType {
triggerMemberProfileUrl: data.triggerMemberProfileUrl,
notificationTriggerId: data.notificationTriggerId,
notificationType: notificationType,
time: data.time, notificationId: data.notificationId,
triggerMemberId: data.triggerMemberId)
time: data.time,
notificationId: data.notificationId,
triggerMemberId: data.triggerMemberId,
notificationText: data.notificationText)
}
self.notificationList = myNotiList ?? []
notificationLists.append(contentsOf: notificationList)
Expand All @@ -76,7 +78,8 @@ final class NotificationViewModel: ViewModelType {
notificationType: notificationType,
time: data.time,
notificationId: data.notificationId,
triggerMemberId: data.triggerMemberId)
triggerMemberId: data.triggerMemberId,
notificationText: data.notificationText)
}
self.notificationList = myNotiList ?? []
_ = try await self.patchNotificationCheck()
Expand Down

0 comments on commit e625ab4

Please sign in to comment.