diff --git a/Sources/ChatFeature/Controllers/GroupChatController.swift b/Sources/ChatFeature/Controllers/GroupChatController.swift index cbcabb54ac827e27e98614ad1ae5a2d81c5dc613..b168e70c438b6660f637758270bc28761dfa5c0c 100644 --- a/Sources/ChatFeature/Controllers/GroupChatController.swift +++ b/Sources/ChatFeature/Controllers/GroupChatController.swift @@ -375,7 +375,7 @@ extension GroupChatController: UICollectionViewDataSource { Bubbler.buildReplyGroup( bubble: cell.rightView, with: item, - reply: replyContent(item.replyMessageId), + reply: replyContent(replyMessageId), sender: name(item.senderId) ) @@ -404,7 +404,7 @@ extension GroupChatController: UICollectionViewDataSource { Bubbler.buildReplyGroup( bubble: cell.rightView, with: item, - reply: replyContent(item.replyMessageId), + reply: replyContent(replyMessageId), sender: name(item.senderId) ) diff --git a/Sources/ContactFeature/Controllers/ContactController.swift b/Sources/ContactFeature/Controllers/ContactController.swift index 5dd2b37eb68790365da473f6a5c9e9acbb535a34..1ef8e96ffba5f58ec2ae2ac6e03adc701e1b3ffb 100644 --- a/Sources/ContactFeature/Controllers/ContactController.swift +++ b/Sources/ContactFeature/Controllers/ContactController.swift @@ -169,7 +169,7 @@ public final class ContactController: UIViewController { .sink { [unowned self] in coordinator.toNickname( from: self, - prefilled: viewModel.contact.nickname ?? viewModel.contact.username!, + prefilled: (viewModel.contact.nickname ?? viewModel.contact.username) ?? "", viewModel.didTapRequest(with:) ) }.store(in: &cancellables) @@ -181,7 +181,7 @@ public final class ContactController: UIViewController { .sink { [unowned self] in coordinator.toNickname( from: self, - prefilled: viewModel.contact.nickname ?? viewModel.contact.username!, + prefilled: (viewModel.contact.nickname ?? viewModel.contact.username) ?? "", viewModel.didTapAccept(_:) ) }.store(in: &cancellables) @@ -243,7 +243,7 @@ public final class ContactController: UIViewController { .sink { [unowned self] in coordinator.toNickname( from: self, - prefilled: viewModel.contact.nickname ?? viewModel.contact.username!, + prefilled: (viewModel.contact.nickname ?? viewModel.contact.username) ?? "", viewModel.didUpdateNickname(_:) ) } diff --git a/Sources/ContactListFeature/Controllers/CreateGroupController.swift b/Sources/ContactListFeature/Controllers/CreateGroupController.swift index 73c9f8b18595cc242a07e66c7d253c51cf573921..9e9d039dd5e5fe2dd4adfa179fc736ab51fa6c4b 100644 --- a/Sources/ContactListFeature/Controllers/CreateGroupController.swift +++ b/Sources/ContactListFeature/Controllers/CreateGroupController.swift @@ -74,7 +74,8 @@ public final class CreateGroupController: UIViewController { ) { [weak viewModel] collectionView, indexPath, contact in let cell: CreateGroupCollectionCell = collectionView.dequeueReusableCell(forIndexPath: indexPath) - cell.setup(title: contact.nickname ?? contact.username!, image: contact.photo) + let title = (contact.nickname ?? contact.username) ?? "" + cell.setup(title: title, image: contact.photo) cell.didTapRemove = { viewModel?.didSelect(contact: contact) } return cell @@ -84,8 +85,9 @@ public final class CreateGroupController: UIViewController { tableView: screenView.tableView ) { [weak self] tableView, indexPath, contact in let cell = tableView.dequeueReusableCell(forIndexPath: indexPath, ofType: SmallAvatarAndTitleCell.self) - cell.titleLabel.text = contact.nickname ?? contact.username - cell.avatarView.setupProfile(title: contact.nickname ?? contact.username!, image: contact.photo, size: .medium) + let title = (contact.nickname ?? contact.username) ?? "" + cell.titleLabel.text = title + cell.avatarView.setupProfile(title: title, image: contact.photo, size: .medium) if let selectedElements = self?.selectedElements, selectedElements.contains(contact) { tableView.selectRow(at: indexPath, animated: true, scrollPosition: .none) diff --git a/Sources/ContactListFeature/ViewModels/CreateGroupViewModel.swift b/Sources/ContactListFeature/ViewModels/CreateGroupViewModel.swift index 38717ac21153c846c1165fa023369fc7b15305f1..70485e37b03b91b5d98d6f59f53c9f2a4dafa901 100644 --- a/Sources/ContactListFeature/ViewModels/CreateGroupViewModel.swift +++ b/Sources/ContactListFeature/ViewModels/CreateGroupViewModel.swift @@ -67,7 +67,11 @@ final class CreateGroupViewModel { return } - contactsRelay.send(allContacts.filter { $0.username!.contains(text.lowercased()) }) + contactsRelay.send( + allContacts.filter { + ($0.username ?? "").contains(text.lowercased()) + } + ) } func create(name: String, welcome: String?, members: [Contact]) { diff --git a/Sources/PushFeature/PushHandler.swift b/Sources/PushFeature/PushHandler.swift index 4259476ed9000cbc5bd0440f443c26c59b81aa62..adb0feb4d96a9908ad9cc1990dd0d4f4c6af76e4 100644 --- a/Sources/PushFeature/PushHandler.swift +++ b/Sources/PushFeature/PushHandler.swift @@ -110,7 +110,7 @@ public final class PushHandler: PushHandling { return ($0.type.unknownSenderContent!, $0) } - let name = contact.nickname ?? contact.username! + let name = (contact.nickname ?? contact.username) ?? "" return ($0.type.knownSenderContent(name)!, $0) } diff --git a/Sources/RequestsFeature/Controllers/RequestsReceivedController.swift b/Sources/RequestsFeature/Controllers/RequestsReceivedController.swift index e9de6a320d86525050224105aa8e6fa1d374b733..5edb77726fa6d43ba7d4e2a816192fcadd39303b 100644 --- a/Sources/RequestsFeature/Controllers/RequestsReceivedController.swift +++ b/Sources/RequestsFeature/Controllers/RequestsReceivedController.swift @@ -212,7 +212,7 @@ extension RequestsReceivedController { let drawerNickname = DrawerText( font: Fonts.Mulish.extraBold.font(size: 26.0), - text: contact.nickname ?? contact.username!, + text: (contact.nickname ?? contact.username) ?? "", color: Asset.neutralDark.color, spacingAfter: 20 ) @@ -393,7 +393,7 @@ extension RequestsReceivedController { let drawerUsername = DrawerText( font: Fonts.Mulish.extraBold.font(size: 26.0), - text: contact.username!, + text: contact.username ?? "", color: Asset.neutralDark.color, spacingAfter: 25 ) @@ -453,7 +453,7 @@ extension RequestsReceivedController { items.append(drawerNicknameTitle) let drawerNicknameInput = DrawerInput( - placeholder: contact.username!, + placeholder: contact.username ?? "", validator: .init( wrongIcon: .image(Asset.sharedError.image), correctIcon: .image(Asset.sharedSuccess.image), diff --git a/Sources/RequestsFeature/Views/RequestCell.swift b/Sources/RequestsFeature/Views/RequestCell.swift index d82093630e165f487d023eca2b099f5447492a37..e0af9ec6017ef1241ed0831ee0dbad71af7dc3d4 100644 --- a/Sources/RequestsFeature/Views/RequestCell.swift +++ b/Sources/RequestsFeature/Views/RequestCell.swift @@ -89,7 +89,7 @@ final class RequestCell: UICollectionViewCell { } setupContact( - title: contact.nickname ?? contact.username!, + title: (contact.nickname ?? contact.username) ?? "", photo: contact.photo, phone: phone, email: contact.email, @@ -128,7 +128,7 @@ final class RequestCell: UICollectionViewCell { } setupContact( - title: contact.nickname ?? contact.username!, + title: (contact.nickname ?? contact.username) ?? "", photo: contact.photo, phone: phone, email: contact.email, @@ -165,7 +165,7 @@ final class RequestCell: UICollectionViewCell { } setupContact( - title: contact.nickname ?? contact.username!, + title: (contact.nickname ?? contact.username) ?? "", photo: contact.photo, phone: phone, email: contact.email,