Newer
Older
final class Bubbler {
static func build(
audioBubble: AudioMessageView,
) {
audioBubble.dateLabel.text = item.date.asHoursAndMinutes()
switch item.status {
audioBubble.backgroundColor = Asset.neutralWhite.color
audioBubble.dateLabel.textColor = Asset.neutralDisabled.color
audioBubble.progressLabel.textColor = Asset.neutralDisabled.color
audioBubble.backgroundColor = Asset.neutralWhite.color
audioBubble.dateLabel.textColor = Asset.neutralDisabled.color
audioBubble.progressLabel.textColor = Asset.neutralDisabled.color
audioBubble.backgroundColor = Asset.accentWarning.color
audioBubble.dateLabel.textColor = Asset.neutralWhite.color
audioBubble.progressLabel.textColor = Asset.neutralWhite.color
audioBubble.backgroundColor = Asset.accentDanger.color
audioBubble.dateLabel.textColor = Asset.neutralWhite.color
audioBubble.progressLabel.textColor = Asset.neutralWhite.color
case .sent:
audioBubble.backgroundColor = Asset.brandBubble.color
audioBubble.dateLabel.textColor = Asset.neutralWhite.color
audioBubble.progressLabel.textColor = Asset.neutralWhite.color
audioBubble.backgroundColor = Asset.brandBubble.color
audioBubble.dateLabel.textColor = Asset.neutralWhite.color
audioBubble.progressLabel.textColor = Asset.neutralWhite.color
audioBubble.backgroundColor = Asset.accentWarning.color
audioBubble.dateLabel.textColor = Asset.neutralWhite.color
audioBubble.progressLabel.textColor = Asset.neutralWhite.color
}
}
static func build(
imageBubble: ImageMessageView,
with message: Message,
with transfer: FileTransfer
imageBubble.progressLabel.text = String(format: "%.1f%%", transfer.progress * 100)
imageBubble.dateLabel.text = message.date.asHoursAndMinutes()
imageBubble.backgroundColor = Asset.neutralWhite.color
imageBubble.dateLabel.textColor = Asset.neutralDisabled.color
imageBubble.progressLabel.textColor = Asset.neutralDisabled.color
imageBubble.backgroundColor = Asset.neutralWhite.color
imageBubble.dateLabel.textColor = Asset.neutralDisabled.color
imageBubble.progressLabel.textColor = Asset.neutralDisabled.color
imageBubble.backgroundColor = Asset.accentDanger.color
imageBubble.dateLabel.textColor = Asset.neutralWhite.color
imageBubble.progressLabel.textColor = Asset.neutralWhite.color
imageBubble.backgroundColor = Asset.accentWarning.color
imageBubble.dateLabel.textColor = Asset.neutralWhite.color
imageBubble.progressLabel.textColor = Asset.neutralWhite.color
case .sent:
imageBubble.backgroundColor = Asset.brandBubble.color
imageBubble.dateLabel.textColor = Asset.neutralWhite.color
imageBubble.progressLabel.textColor = Asset.neutralWhite.color
imageBubble.backgroundColor = Asset.brandBubble.color
imageBubble.dateLabel.textColor = Asset.neutralWhite.color
imageBubble.progressLabel.textColor = Asset.neutralWhite.color
imageBubble.backgroundColor = Asset.accentWarning.color
imageBubble.dateLabel.textColor = Asset.neutralWhite.color
imageBubble.progressLabel.textColor = Asset.neutralWhite.color
}
}
static func build(
bubble: StackMessageView,
bubble.senderLabel.removeFromSuperview()
bubble.dateLabel.text = item.date.asHoursAndMinutes()
let roundButtonColor: UIColor
switch item.status {
bubble.backgroundColor = Asset.neutralWhite.color
bubble.textView.textColor = Asset.neutralActive.color
bubble.dateLabel.textColor = Asset.neutralDisabled.color
roundButtonColor = Asset.neutralDisabled.color
bubble.revertBottomStackOrder()
bubble.backgroundColor = Asset.accentWarning.color
bubble.textView.textColor = Asset.neutralWhite.color
bubble.dateLabel.textColor = Asset.neutralWhite.color
roundButtonColor = Asset.neutralWhite.color
bubble.backgroundColor = Asset.accentDanger.color
bubble.textView.textColor = Asset.neutralWhite.color
bubble.dateLabel.textColor = Asset.neutralWhite.color
roundButtonColor = Asset.neutralWhite.color
case .sent:
bubble.backgroundColor = Asset.brandBubble.color
bubble.textView.textColor = Asset.neutralWhite.color
bubble.dateLabel.textColor = Asset.neutralWhite.color
roundButtonColor = Asset.neutralWhite.color
bubble.backgroundColor = Asset.brandBubble.color
bubble.textView.textColor = Asset.neutralWhite.color
bubble.dateLabel.textColor = Asset.neutralWhite.color
roundButtonColor = Asset.neutralWhite.color
bubble.backgroundColor = Asset.accentWarning.color
bubble.textView.textColor = Asset.neutralWhite.color
bubble.dateLabel.textColor = Asset.neutralWhite.color
roundButtonColor = Asset.neutralWhite.color
}
let attrString = NSAttributedString(
string: "show mix",
attributes: [
.underlineStyle: NSUnderlineStyle.single.rawValue,
.underlineColor: roundButtonColor,
.foregroundColor: roundButtonColor,
.font: Fonts.Mulish.regular.font(size: 12.0) as Any
]
)
bubble.roundButton.setAttributedTitle(attrString, for: .normal)
}
static func buildReply(
bubble: ReplyStackMessageView,
with item: Message,
reply: (contactTitle: String, messageText: String)
) {
bubble.dateLabel.text = item.date.asHoursAndMinutes()
bubble.replyView.message.text = reply.messageText
bubble.replyView.title.text = reply.contactTitle
let roundButtonColor: UIColor
switch item.status {
bubble.senderLabel.removeFromSuperview()
bubble.backgroundColor = Asset.neutralWhite.color
bubble.textView.textColor = Asset.neutralActive.color
bubble.dateLabel.textColor = Asset.neutralDisabled.color
roundButtonColor = Asset.neutralDisabled.color
bubble.replyView.container.backgroundColor = Asset.brandDefault.color
bubble.replyView.space.backgroundColor = Asset.brandPrimary.color
bubble.revertBottomStackOrder()
bubble.senderLabel.removeFromSuperview()
bubble.backgroundColor = Asset.accentWarning.color
bubble.textView.textColor = Asset.neutralWhite.color
bubble.dateLabel.textColor = Asset.neutralWhite.color
roundButtonColor = Asset.neutralWhite.color
bubble.replyView.space.backgroundColor = Asset.neutralWhite.color
bubble.replyView.container.backgroundColor = Asset.brandLight.color
bubble.senderLabel.removeFromSuperview()
bubble.backgroundColor = Asset.accentDanger.color
bubble.textView.textColor = Asset.neutralWhite.color
bubble.dateLabel.textColor = Asset.neutralWhite.color
roundButtonColor = Asset.neutralWhite.color
bubble.replyView.space.backgroundColor = Asset.neutralWhite.color
bubble.replyView.container.backgroundColor = Asset.brandLight.color
bubble.senderLabel.removeFromSuperview()
bubble.textView.textColor = Asset.neutralWhite.color
bubble.backgroundColor = Asset.brandBubble.color
bubble.dateLabel.textColor = Asset.neutralWhite.color
roundButtonColor = Asset.neutralWhite.color
bubble.replyView.space.backgroundColor = Asset.neutralWhite.color
bubble.replyView.container.backgroundColor = Asset.brandLight.color
bubble.senderLabel.removeFromSuperview()
bubble.textView.textColor = Asset.neutralWhite.color
bubble.backgroundColor = Asset.accentWarning.color
bubble.dateLabel.textColor = Asset.neutralWhite.color
roundButtonColor = Asset.neutralWhite.color
bubble.replyView.space.backgroundColor = Asset.neutralWhite.color
bubble.replyView.container.backgroundColor = Asset.brandLight.color
}
let attrString = NSAttributedString(
string: "show mix",
attributes: [
.underlineStyle: NSUnderlineStyle.single.rawValue,
.underlineColor: roundButtonColor,
.foregroundColor: roundButtonColor,
.font: Fonts.Mulish.regular.font(size: 12.0) as Any
]
)
bubble.roundButton.setAttributedTitle(attrString, for: .normal)
}
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
static func buildReplyGroup(
bubble: ReplyStackMessageView,
with item: Message,
reply: (contactTitle: String, messageText: String),
sender: String
) {
bubble.dateLabel.text = item.date.asHoursAndMinutes()
bubble.textView.text = item.text
bubble.replyView.message.text = reply.messageText
bubble.replyView.title.text = reply.contactTitle
let roundButtonColor: UIColor
switch item.status {
case .received, .receiving:
bubble.senderLabel.text = sender
bubble.backgroundColor = Asset.neutralWhite.color
bubble.textView.textColor = Asset.neutralActive.color
bubble.dateLabel.textColor = Asset.neutralDisabled.color
roundButtonColor = Asset.neutralDisabled.color
bubble.replyView.container.backgroundColor = Asset.brandDefault.color
bubble.replyView.space.backgroundColor = Asset.brandPrimary.color
bubble.lockerImageView.removeFromSuperview()
bubble.revertBottomStackOrder()
case .sendingFailed, .sendingTimedOut:
bubble.senderLabel.removeFromSuperview()
bubble.backgroundColor = Asset.accentDanger.color
bubble.textView.textColor = Asset.neutralWhite.color
bubble.dateLabel.textColor = Asset.neutralWhite.color
roundButtonColor = Asset.neutralWhite.color
bubble.replyView.space.backgroundColor = Asset.neutralWhite.color
bubble.replyView.container.backgroundColor = Asset.brandLight.color
case .sent, .sending:
bubble.senderLabel.removeFromSuperview()
bubble.textView.textColor = Asset.neutralWhite.color
bubble.backgroundColor = Asset.brandBubble.color
bubble.dateLabel.textColor = Asset.neutralWhite.color
roundButtonColor = Asset.neutralWhite.color
bubble.replyView.space.backgroundColor = Asset.neutralWhite.color
bubble.replyView.container.backgroundColor = Asset.brandLight.color
case .receivingFailed:
bubble.senderLabel.removeFromSuperview()
bubble.textView.textColor = Asset.neutralWhite.color
bubble.backgroundColor = Asset.accentWarning.color
bubble.dateLabel.textColor = Asset.neutralWhite.color
roundButtonColor = Asset.neutralWhite.color
bubble.replyView.space.backgroundColor = Asset.neutralWhite.color
bubble.replyView.container.backgroundColor = Asset.brandLight.color
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
}
let attrString = NSAttributedString(
string: "show mix",
attributes: [
.underlineStyle: NSUnderlineStyle.single.rawValue,
.underlineColor: roundButtonColor,
.foregroundColor: roundButtonColor,
.font: Fonts.Mulish.regular.font(size: 12.0) as Any
]
)
bubble.roundButton.setAttributedTitle(attrString, for: .normal)
}
static func buildGroup(
bubble: StackMessageView,
with item: Message,
with senderName: String
) {
bubble.textView.text = item.text
bubble.dateLabel.text = item.date.asHoursAndMinutes()
let roundButtonColor: UIColor
switch item.status {
case .received, .receiving:
bubble.senderLabel.text = senderName
bubble.backgroundColor = Asset.neutralWhite.color
bubble.textView.textColor = Asset.neutralActive.color
bubble.dateLabel.textColor = Asset.neutralDisabled.color
roundButtonColor = Asset.neutralDisabled.color
bubble.lockerImageView.removeFromSuperview()
bubble.revertBottomStackOrder()
case .sendingFailed, .sendingTimedOut:
bubble.senderLabel.removeFromSuperview()
bubble.backgroundColor = Asset.accentDanger.color
bubble.textView.textColor = Asset.neutralWhite.color
bubble.dateLabel.textColor = Asset.neutralWhite.color
roundButtonColor = Asset.neutralWhite.color
case .sent, .sending:
bubble.senderLabel.removeFromSuperview()
bubble.backgroundColor = Asset.brandBubble.color
bubble.textView.textColor = Asset.neutralWhite.color
bubble.dateLabel.textColor = Asset.neutralWhite.color
roundButtonColor = Asset.neutralWhite.color
case .receivingFailed:
bubble.senderLabel.removeFromSuperview()
bubble.backgroundColor = Asset.accentWarning.color
bubble.textView.textColor = Asset.neutralWhite.color
bubble.dateLabel.textColor = Asset.neutralWhite.color
roundButtonColor = Asset.neutralWhite.color
}
let attrString = NSAttributedString(
string: "show mix",
attributes: [
.underlineStyle: NSUnderlineStyle.single.rawValue,
.underlineColor: roundButtonColor,
.foregroundColor: roundButtonColor,
.font: Fonts.Mulish.regular.font(size: 12.0) as Any
]
)
bubble.roundButton.setAttributedTitle(attrString, for: .normal)
}