Skip to content
Snippets Groups Projects
Commit bfca8d84 authored by Bruno Muniz's avatar Bruno Muniz :apple:
Browse files

Updated cell configurations

parent db83f465
Branches
Tags
2 merge requests!40v1.1.2b166,!38Using new database structure
Showing with 95 additions and 77 deletions
import UIKit import UIKit
import Models import Models
import Shared import Shared
import XXModels
final class MembersController: UIViewController { final class MembersController: UIViewController {
lazy private var stackView = UIStackView() lazy private var stackView = UIStackView()
...@@ -33,8 +34,8 @@ final class MembersController: UIViewController { ...@@ -33,8 +34,8 @@ final class MembersController: UIViewController {
for member in members { for member in members {
let memberView = MemberView() let memberView = MemberView()
memberView.titleLabel.text = member.username // memberView.titleLabel.text = member.username
memberView.avatarView.setupProfile(title: member.username, image: member.photo, size: .small) // memberView.avatarView.setupProfile(title: member.username, image: member.photo, size: .small)
stackView.addArrangedSubview(memberView) stackView.addArrangedSubview(memberView)
} }
} }
......
import HUD import HUD
import DrawerFeature
import UIKit import UIKit
import Theme import Theme
import Models import Models
...@@ -7,8 +6,10 @@ import Shared ...@@ -7,8 +6,10 @@ import Shared
import Combine import Combine
import XXLogger import XXLogger
import QuickLook import QuickLook
import XXModels
import Voxophone import Voxophone
import ChatLayout import ChatLayout
import DrawerFeature
import DifferenceKit import DifferenceKit
import ChatInputFeature import ChatInputFeature
import DependencyInjection import DependencyInjection
......
...@@ -4,6 +4,7 @@ import Shared ...@@ -4,6 +4,7 @@ import Shared
import QuickLook import QuickLook
import Permissions import Permissions
import Presentation import Presentation
import XXModels
public protocol ChatCoordinating { public protocol ChatCoordinating {
func toCamera(from: UIViewController) func toCamera(from: UIViewController)
......
...@@ -9,20 +9,20 @@ final class Bubbler { ...@@ -9,20 +9,20 @@ final class Bubbler {
audioBubble.dateLabel.text = item.date.asHoursAndMinutes() audioBubble.dateLabel.text = item.date.asHoursAndMinutes()
switch item.status { switch item.status {
case .received, .read: case .received:
audioBubble.lockerImageView.removeFromSuperview() audioBubble.lockerImageView.removeFromSuperview()
audioBubble.backgroundColor = Asset.neutralWhite.color audioBubble.backgroundColor = Asset.neutralWhite.color
audioBubble.dateLabel.textColor = Asset.neutralDisabled.color audioBubble.dateLabel.textColor = Asset.neutralDisabled.color
audioBubble.progressLabel.textColor = Asset.neutralDisabled.color audioBubble.progressLabel.textColor = Asset.neutralDisabled.color
case .receivingAttachment: case .receiving:
audioBubble.backgroundColor = Asset.neutralWhite.color audioBubble.backgroundColor = Asset.neutralWhite.color
audioBubble.dateLabel.textColor = Asset.neutralDisabled.color audioBubble.dateLabel.textColor = Asset.neutralDisabled.color
audioBubble.progressLabel.textColor = Asset.neutralDisabled.color audioBubble.progressLabel.textColor = Asset.neutralDisabled.color
case .timedOut: case .sendingTimedOut:
audioBubble.backgroundColor = Asset.accentWarning.color audioBubble.backgroundColor = Asset.accentWarning.color
audioBubble.dateLabel.textColor = Asset.neutralWhite.color audioBubble.dateLabel.textColor = Asset.neutralWhite.color
audioBubble.progressLabel.textColor = Asset.neutralWhite.color audioBubble.progressLabel.textColor = Asset.neutralWhite.color
case .failedToSend: case .sendingFailed:
audioBubble.backgroundColor = Asset.accentDanger.color audioBubble.backgroundColor = Asset.accentDanger.color
audioBubble.dateLabel.textColor = Asset.neutralWhite.color audioBubble.dateLabel.textColor = Asset.neutralWhite.color
audioBubble.progressLabel.textColor = Asset.neutralWhite.color audioBubble.progressLabel.textColor = Asset.neutralWhite.color
...@@ -30,10 +30,12 @@ final class Bubbler { ...@@ -30,10 +30,12 @@ final class Bubbler {
audioBubble.backgroundColor = Asset.brandBubble.color audioBubble.backgroundColor = Asset.brandBubble.color
audioBubble.dateLabel.textColor = Asset.neutralWhite.color audioBubble.dateLabel.textColor = Asset.neutralWhite.color
audioBubble.progressLabel.textColor = Asset.neutralWhite.color audioBubble.progressLabel.textColor = Asset.neutralWhite.color
case .sending, .sendingAttachment: case .sending:
audioBubble.backgroundColor = Asset.brandBubble.color audioBubble.backgroundColor = Asset.brandBubble.color
audioBubble.dateLabel.textColor = Asset.neutralWhite.color audioBubble.dateLabel.textColor = Asset.neutralWhite.color
audioBubble.progressLabel.textColor = Asset.neutralWhite.color audioBubble.progressLabel.textColor = Asset.neutralWhite.color
case .receivingFailed:
fatalError()
} }
} }
...@@ -46,20 +48,20 @@ final class Bubbler { ...@@ -46,20 +48,20 @@ final class Bubbler {
imageBubble.dateLabel.text = item.date.asHoursAndMinutes() imageBubble.dateLabel.text = item.date.asHoursAndMinutes()
switch item.status { switch item.status {
case .received, .read: case .received:
imageBubble.lockerImageView.removeFromSuperview() imageBubble.lockerImageView.removeFromSuperview()
imageBubble.backgroundColor = Asset.neutralWhite.color imageBubble.backgroundColor = Asset.neutralWhite.color
imageBubble.dateLabel.textColor = Asset.neutralDisabled.color imageBubble.dateLabel.textColor = Asset.neutralDisabled.color
imageBubble.progressLabel.textColor = Asset.neutralDisabled.color imageBubble.progressLabel.textColor = Asset.neutralDisabled.color
case .receivingAttachment: case .receiving:
imageBubble.backgroundColor = Asset.neutralWhite.color imageBubble.backgroundColor = Asset.neutralWhite.color
imageBubble.dateLabel.textColor = Asset.neutralDisabled.color imageBubble.dateLabel.textColor = Asset.neutralDisabled.color
imageBubble.progressLabel.textColor = Asset.neutralDisabled.color imageBubble.progressLabel.textColor = Asset.neutralDisabled.color
case .failedToSend: case .sendingFailed:
imageBubble.backgroundColor = Asset.accentDanger.color imageBubble.backgroundColor = Asset.accentDanger.color
imageBubble.dateLabel.textColor = Asset.neutralWhite.color imageBubble.dateLabel.textColor = Asset.neutralWhite.color
imageBubble.progressLabel.textColor = Asset.neutralWhite.color imageBubble.progressLabel.textColor = Asset.neutralWhite.color
case .timedOut: case .sendingTimedOut:
imageBubble.backgroundColor = Asset.accentWarning.color imageBubble.backgroundColor = Asset.accentWarning.color
imageBubble.dateLabel.textColor = Asset.neutralWhite.color imageBubble.dateLabel.textColor = Asset.neutralWhite.color
imageBubble.progressLabel.textColor = Asset.neutralWhite.color imageBubble.progressLabel.textColor = Asset.neutralWhite.color
...@@ -67,10 +69,12 @@ final class Bubbler { ...@@ -67,10 +69,12 @@ final class Bubbler {
imageBubble.backgroundColor = Asset.brandBubble.color imageBubble.backgroundColor = Asset.brandBubble.color
imageBubble.dateLabel.textColor = Asset.neutralWhite.color imageBubble.dateLabel.textColor = Asset.neutralWhite.color
imageBubble.progressLabel.textColor = Asset.neutralWhite.color imageBubble.progressLabel.textColor = Asset.neutralWhite.color
case .sending, .sendingAttachment: case .sending:
imageBubble.backgroundColor = Asset.brandBubble.color imageBubble.backgroundColor = Asset.brandBubble.color
imageBubble.dateLabel.textColor = Asset.neutralWhite.color imageBubble.dateLabel.textColor = Asset.neutralWhite.color
imageBubble.progressLabel.textColor = Asset.neutralWhite.color imageBubble.progressLabel.textColor = Asset.neutralWhite.color
case .receivingFailed:
fatalError()
} }
} }
...@@ -85,19 +89,19 @@ final class Bubbler { ...@@ -85,19 +89,19 @@ final class Bubbler {
let roundButtonColor: UIColor let roundButtonColor: UIColor
switch item.status { switch item.status {
case .received, .read, .receivingAttachment: case .received, .receiving:
bubble.lockerImageView.removeFromSuperview() bubble.lockerImageView.removeFromSuperview()
bubble.backgroundColor = Asset.neutralWhite.color bubble.backgroundColor = Asset.neutralWhite.color
bubble.textView.textColor = Asset.neutralActive.color bubble.textView.textColor = Asset.neutralActive.color
bubble.dateLabel.textColor = Asset.neutralDisabled.color bubble.dateLabel.textColor = Asset.neutralDisabled.color
roundButtonColor = Asset.neutralDisabled.color roundButtonColor = Asset.neutralDisabled.color
bubble.revertBottomStackOrder() bubble.revertBottomStackOrder()
case .timedOut: case .sendingTimedOut:
bubble.backgroundColor = Asset.accentWarning.color bubble.backgroundColor = Asset.accentWarning.color
bubble.textView.textColor = Asset.neutralWhite.color bubble.textView.textColor = Asset.neutralWhite.color
bubble.dateLabel.textColor = Asset.neutralWhite.color bubble.dateLabel.textColor = Asset.neutralWhite.color
roundButtonColor = Asset.neutralWhite.color roundButtonColor = Asset.neutralWhite.color
case .failedToSend: case .sendingFailed:
bubble.backgroundColor = Asset.accentDanger.color bubble.backgroundColor = Asset.accentDanger.color
bubble.textView.textColor = Asset.neutralWhite.color bubble.textView.textColor = Asset.neutralWhite.color
bubble.dateLabel.textColor = Asset.neutralWhite.color bubble.dateLabel.textColor = Asset.neutralWhite.color
...@@ -107,11 +111,13 @@ final class Bubbler { ...@@ -107,11 +111,13 @@ final class Bubbler {
bubble.textView.textColor = Asset.neutralWhite.color bubble.textView.textColor = Asset.neutralWhite.color
bubble.dateLabel.textColor = Asset.neutralWhite.color bubble.dateLabel.textColor = Asset.neutralWhite.color
roundButtonColor = Asset.neutralWhite.color roundButtonColor = Asset.neutralWhite.color
case .sending, .sendingAttachment: case .sending:
bubble.backgroundColor = Asset.brandBubble.color bubble.backgroundColor = Asset.brandBubble.color
bubble.textView.textColor = Asset.neutralWhite.color bubble.textView.textColor = Asset.neutralWhite.color
bubble.dateLabel.textColor = Asset.neutralWhite.color bubble.dateLabel.textColor = Asset.neutralWhite.color
roundButtonColor = Asset.neutralWhite.color roundButtonColor = Asset.neutralWhite.color
case .receivingFailed:
fatalError()
} }
let attrString = NSAttributedString( let attrString = NSAttributedString(
...@@ -187,7 +193,7 @@ final class Bubbler { ...@@ -187,7 +193,7 @@ final class Bubbler {
let roundButtonColor: UIColor let roundButtonColor: UIColor
switch item.status { switch item.status {
case .received, .read, .receivingAttachment: case .received, .receiving:
bubble.senderLabel.removeFromSuperview() bubble.senderLabel.removeFromSuperview()
bubble.backgroundColor = Asset.neutralWhite.color bubble.backgroundColor = Asset.neutralWhite.color
bubble.textView.textColor = Asset.neutralActive.color bubble.textView.textColor = Asset.neutralActive.color
...@@ -196,7 +202,7 @@ final class Bubbler { ...@@ -196,7 +202,7 @@ final class Bubbler {
bubble.replyView.container.backgroundColor = Asset.brandDefault.color bubble.replyView.container.backgroundColor = Asset.brandDefault.color
bubble.replyView.space.backgroundColor = Asset.brandPrimary.color bubble.replyView.space.backgroundColor = Asset.brandPrimary.color
bubble.revertBottomStackOrder() bubble.revertBottomStackOrder()
case .timedOut: case .sendingTimedOut:
bubble.senderLabel.removeFromSuperview() bubble.senderLabel.removeFromSuperview()
bubble.backgroundColor = Asset.accentWarning.color bubble.backgroundColor = Asset.accentWarning.color
bubble.textView.textColor = Asset.neutralWhite.color bubble.textView.textColor = Asset.neutralWhite.color
...@@ -204,7 +210,7 @@ final class Bubbler { ...@@ -204,7 +210,7 @@ final class Bubbler {
roundButtonColor = Asset.neutralWhite.color roundButtonColor = Asset.neutralWhite.color
bubble.replyView.space.backgroundColor = Asset.neutralWhite.color bubble.replyView.space.backgroundColor = Asset.neutralWhite.color
bubble.replyView.container.backgroundColor = Asset.brandLight.color bubble.replyView.container.backgroundColor = Asset.brandLight.color
case .failedToSend: case .sendingFailed:
bubble.senderLabel.removeFromSuperview() bubble.senderLabel.removeFromSuperview()
bubble.backgroundColor = Asset.accentDanger.color bubble.backgroundColor = Asset.accentDanger.color
bubble.textView.textColor = Asset.neutralWhite.color bubble.textView.textColor = Asset.neutralWhite.color
...@@ -212,7 +218,7 @@ final class Bubbler { ...@@ -212,7 +218,7 @@ final class Bubbler {
roundButtonColor = Asset.neutralWhite.color roundButtonColor = Asset.neutralWhite.color
bubble.replyView.space.backgroundColor = Asset.neutralWhite.color bubble.replyView.space.backgroundColor = Asset.neutralWhite.color
bubble.replyView.container.backgroundColor = Asset.brandLight.color bubble.replyView.container.backgroundColor = Asset.brandLight.color
case .sent, .sending, .sendingAttachment: case .sent, .sending:
bubble.senderLabel.removeFromSuperview() bubble.senderLabel.removeFromSuperview()
bubble.textView.textColor = Asset.neutralWhite.color bubble.textView.textColor = Asset.neutralWhite.color
bubble.backgroundColor = Asset.brandBubble.color bubble.backgroundColor = Asset.brandBubble.color
...@@ -220,6 +226,8 @@ final class Bubbler { ...@@ -220,6 +226,8 @@ final class Bubbler {
roundButtonColor = Asset.neutralWhite.color roundButtonColor = Asset.neutralWhite.color
bubble.replyView.space.backgroundColor = Asset.neutralWhite.color bubble.replyView.space.backgroundColor = Asset.neutralWhite.color
bubble.replyView.container.backgroundColor = Asset.brandLight.color bubble.replyView.container.backgroundColor = Asset.brandLight.color
case .receivingFailed:
fatalError()
} }
let attrString = NSAttributedString( let attrString = NSAttributedString(
......
...@@ -43,7 +43,7 @@ extension CellFactory { ...@@ -43,7 +43,7 @@ extension CellFactory {
) -> Self { ) -> Self {
.init( .init(
canBuild: { item in canBuild: { item in
(item.status == .received || item.status == .read || item.status == .receivingAttachment) (item.status == .received || item.status == .receiving)
&& item.payload.reply == nil && item.payload.reply == nil
&& item.payload.attachment != nil && item.payload.attachment != nil
&& item.payload.attachment?._extension == .audio && item.payload.attachment?._extension == .audio
...@@ -65,7 +65,7 @@ extension CellFactory { ...@@ -65,7 +65,7 @@ extension CellFactory {
) )
cell.leftView.setup(with: model) cell.leftView.setup(with: model)
cell.canReply = item.status.canReply cell.canReply = false
cell.performReply = {} cell.performReply = {}
Bubbler.build(audioBubble: cell.leftView, with: item) Bubbler.build(audioBubble: cell.leftView, with: item)
...@@ -87,13 +87,13 @@ extension CellFactory { ...@@ -87,13 +87,13 @@ extension CellFactory {
}.store(in: &cell.leftView.cancellables) }.store(in: &cell.leftView.cancellables)
cell.leftView.didTapRight = { cell.leftView.didTapRight = {
guard item.status != .receivingAttachment else { return } guard item.status != .receiving else { return }
voxophone.toggleLoudspeaker() voxophone.toggleLoudspeaker()
} }
cell.leftView.didTapLeft = { cell.leftView.didTapLeft = {
guard item.status != .receivingAttachment else { return } guard item.status != .receiving else { return }
if case .playing(url, _, _, _) = voxophone.state { if case .playing(url, _, _, _) = voxophone.state {
voxophone.reset() voxophone.reset()
...@@ -114,9 +114,9 @@ extension CellFactory { ...@@ -114,9 +114,9 @@ extension CellFactory {
.init( .init(
canBuild: { item in canBuild: { item in
(item.status == .sent || (item.status == .sent ||
item.status == .failedToSend || item.status == .sending ||
item.status == .sendingAttachment || item.status == .sendingFailed ||
item.status == .timedOut) item.status == .sendingTimedOut)
&& item.payload.reply == nil && item.payload.reply == nil
&& item.payload.attachment != nil && item.payload.attachment != nil
&& item.payload.attachment?._extension == .audio && item.payload.attachment?._extension == .audio
...@@ -137,7 +137,7 @@ extension CellFactory { ...@@ -137,7 +137,7 @@ extension CellFactory {
) )
cell.rightView.setup(with: model) cell.rightView.setup(with: model)
cell.canReply = item.status.canReply cell.canReply = false
cell.performReply = {} cell.performReply = {}
Bubbler.build(audioBubble: cell.rightView, with: item) Bubbler.build(audioBubble: cell.rightView, with: item)
...@@ -182,9 +182,9 @@ extension CellFactory { ...@@ -182,9 +182,9 @@ extension CellFactory {
.init( .init(
canBuild: { item in canBuild: { item in
(item.status == .sent || (item.status == .sent ||
item.status == .failedToSend || item.status == .sending ||
item.status == .sendingAttachment || item.status == .sendingFailed ||
item.status == .timedOut) item.status == .sendingTimedOut)
&& item.payload.reply == nil && item.payload.reply == nil
&& item.payload.attachment != nil && item.payload.attachment != nil
&& item.payload.attachment?._extension == .image && item.payload.attachment?._extension == .image
...@@ -196,7 +196,7 @@ extension CellFactory { ...@@ -196,7 +196,7 @@ extension CellFactory {
Bubbler.build(imageBubble: cell.rightView, with: item) Bubbler.build(imageBubble: cell.rightView, with: item)
cell.canReply = item.status.canReply cell.canReply = false
cell.performReply = {} cell.performReply = {}
if let image = UIImage(data: attachment.data!) { if let image = UIImage(data: attachment.data!) {
...@@ -211,7 +211,7 @@ extension CellFactory { ...@@ -211,7 +211,7 @@ extension CellFactory {
static func incomingImage() -> Self { static func incomingImage() -> Self {
.init( .init(
canBuild: { item in canBuild: { item in
(item.status == .received || item.status == .read || item.status == .receivingAttachment) (item.status == .received || item.status == .receiving)
&& item.payload.reply == nil && item.payload.reply == nil
&& item.payload.attachment != nil && item.payload.attachment != nil
&& item.payload.attachment?._extension == .image && item.payload.attachment?._extension == .image
...@@ -222,7 +222,7 @@ extension CellFactory { ...@@ -222,7 +222,7 @@ extension CellFactory {
let cell: IncomingImageCell = collectionView.dequeueReusableCell(forIndexPath: indexPath) let cell: IncomingImageCell = collectionView.dequeueReusableCell(forIndexPath: indexPath)
Bubbler.build(imageBubble: cell.leftView, with: item) Bubbler.build(imageBubble: cell.leftView, with: item)
cell.canReply = item.status.canReply cell.canReply = false
cell.performReply = {} cell.performReply = {}
cell.leftView.imageView.image = UIImage(data: attachment.data!) cell.leftView.imageView.image = UIImage(data: attachment.data!)
return cell return cell
...@@ -256,7 +256,7 @@ extension CellFactory { ...@@ -256,7 +256,7 @@ extension CellFactory {
) )
) )
cell.canReply = item.status.canReply cell.canReply = item.status == .sent
cell.performReply = performReply cell.performReply = performReply
cell.rightView.didTapShowRound = { showRound(item.roundURL) } cell.rightView.didTapShowRound = { showRound(item.roundURL) }
return cell return cell
...@@ -272,7 +272,7 @@ extension CellFactory { ...@@ -272,7 +272,7 @@ extension CellFactory {
) -> Self { ) -> Self {
.init( .init(
canBuild: { item in canBuild: { item in
(item.status == .received || item.status == .read) item.status == .received
&& item.payload.reply != nil && item.payload.reply != nil
&& item.payload.attachment == nil && item.payload.attachment == nil
...@@ -287,7 +287,7 @@ extension CellFactory { ...@@ -287,7 +287,7 @@ extension CellFactory {
sender: name(item.payload.reply!.senderId) sender: name(item.payload.reply!.senderId)
) )
) )
cell.canReply = item.status.canReply cell.canReply = item.status == .received
cell.performReply = performReply cell.performReply = performReply
cell.leftView.didTapShowRound = { showRound(item.roundURL) } cell.leftView.didTapShowRound = { showRound(item.roundURL) }
cell.leftView.revertBottomStackOrder() cell.leftView.revertBottomStackOrder()
...@@ -303,7 +303,7 @@ extension CellFactory { ...@@ -303,7 +303,7 @@ extension CellFactory {
) -> Self { ) -> Self {
.init( .init(
canBuild: { item in canBuild: { item in
(item.status == .failedToSend || item.status == .timedOut) (item.status == .sendingFailed || item.status == .sendingTimedOut)
&& item.payload.reply != nil && item.payload.reply != nil
&& item.payload.attachment == nil && item.payload.attachment == nil
...@@ -319,7 +319,7 @@ extension CellFactory { ...@@ -319,7 +319,7 @@ extension CellFactory {
) )
) )
cell.canReply = item.status.canReply cell.canReply = false
cell.performReply = performReply cell.performReply = performReply
return cell return cell
} }
...@@ -334,7 +334,7 @@ extension CellFactory { ...@@ -334,7 +334,7 @@ extension CellFactory {
) -> Self { ) -> Self {
.init( .init(
canBuild: { item in canBuild: { item in
(item.status == .received || item.status == .read) item.status == .received
&& item.payload.reply == nil && item.payload.reply == nil
&& item.payload.attachment == nil && item.payload.attachment == nil
...@@ -342,7 +342,7 @@ extension CellFactory { ...@@ -342,7 +342,7 @@ extension CellFactory {
let cell: IncomingTextCell = collectionView.dequeueReusableCell(forIndexPath: indexPath) let cell: IncomingTextCell = collectionView.dequeueReusableCell(forIndexPath: indexPath)
Bubbler.build(bubble: cell.leftView, with: item) Bubbler.build(bubble: cell.leftView, with: item)
cell.canReply = item.status.canReply cell.canReply = item.status == .received
cell.performReply = performReply cell.performReply = performReply
cell.leftView.didTapShowRound = { showRound(item.roundURL) } cell.leftView.didTapShowRound = { showRound(item.roundURL) }
cell.leftView.revertBottomStackOrder() cell.leftView.revertBottomStackOrder()
...@@ -365,7 +365,7 @@ extension CellFactory { ...@@ -365,7 +365,7 @@ extension CellFactory {
let cell: OutgoingTextCell = collectionView.dequeueReusableCell(forIndexPath: indexPath) let cell: OutgoingTextCell = collectionView.dequeueReusableCell(forIndexPath: indexPath)
Bubbler.build(bubble: cell.rightView, with: item) Bubbler.build(bubble: cell.rightView, with: item)
cell.canReply = item.status.canReply cell.canReply = item.status == .sent
cell.performReply = performReply cell.performReply = performReply
cell.rightView.didTapShowRound = { showRound(item.roundURL) } cell.rightView.didTapShowRound = { showRound(item.roundURL) }
...@@ -377,7 +377,7 @@ extension CellFactory { ...@@ -377,7 +377,7 @@ extension CellFactory {
static func outgoingFailedText(performReply: @escaping () -> Void) -> Self { static func outgoingFailedText(performReply: @escaping () -> Void) -> Self {
.init( .init(
canBuild: { item in canBuild: { item in
(item.status == .failedToSend || item.status == .timedOut) (item.status == .sendingFailed || item.status == .sendingTimedOut)
&& item.payload.reply == nil && item.payload.reply == nil
&& item.payload.attachment == nil && item.payload.attachment == nil
...@@ -385,7 +385,7 @@ extension CellFactory { ...@@ -385,7 +385,7 @@ extension CellFactory {
let cell: OutgoingFailedTextCell = collectionView.dequeueReusableCell(forIndexPath: indexPath) let cell: OutgoingFailedTextCell = collectionView.dequeueReusableCell(forIndexPath: indexPath)
Bubbler.build(bubble: cell.rightView, with: item) Bubbler.build(bubble: cell.rightView, with: item)
cell.canReply = item.status.canReply cell.canReply = false
cell.performReply = performReply cell.performReply = performReply
return cell return cell
} }
...@@ -425,9 +425,9 @@ struct ActionFactory { ...@@ -425,9 +425,9 @@ struct ActionFactory {
switch action { switch action {
case .reply: case .reply:
guard item.status == .read || item.status == .received || item.status == .sent else { return nil } guard item.status == .received || item.status == .sent else { return nil }
case .retry: case .retry:
guard item.status == .failedToSend || item.status == .timedOut else { return nil } guard item.status == .sendingFailed || item.status == .sendingTimedOut else { return nil }
case .delete, .copy: case .delete, .copy:
break break
} }
......
import Models import Models
import XXModels
import Foundation import Foundation
import DifferenceKit import DifferenceKit
......
...@@ -4,6 +4,7 @@ import Models ...@@ -4,6 +4,7 @@ import Models
import Shared import Shared
import Combine import Combine
import XXLogger import XXLogger
import XXModels
import Foundation import Foundation
import Integration import Integration
import Permissions import Permissions
......
...@@ -10,6 +10,8 @@ public protocol SessionType { ...@@ -10,6 +10,8 @@ public protocol SessionType {
var hasRunningTasks: Bool { get } var hasRunningTasks: Bool { get }
var isOnline: AnyPublisher<Bool, Never> { get } var isOnline: AnyPublisher<Bool, Never> { get }
var dbManager: Database { get }
func deleteMyself() throws func deleteMyself() throws
func getId(from: Data) -> Data? func getId(from: Data) -> Data?
......
import UIKit import UIKit
import Models import Models
import XXModels
import Presentation import Presentation
public protocol LaunchCoordinating { public protocol LaunchCoordinating {
......
import HUD import HUD
import Shared import Shared
import Models import Models
import Combine import Combine
import Defaults import Defaults
import XXModels
import Foundation import Foundation
import Integration import Integration
import Permissions import Permissions
...@@ -118,21 +120,23 @@ final class LaunchViewModel { ...@@ -118,21 +120,23 @@ final class LaunchViewModel {
} }
func getContactWith(userId: Data) -> Contact? { func getContactWith(userId: Data) -> Contact? {
guard let session = try? DependencyInjection.Container.shared.resolve() as SessionType, fatalError()
let contact = session.getContactWith(userId: userId) else { // guard let session = try? DependencyInjection.Container.shared.resolve() as SessionType,
return nil // let contact = session.getContactWith(userId: userId) else {
} // return nil
// }
return contact //
// return contact
} }
func getGroupInfoWith(groupId: Data) -> GroupChatInfo? { func getGroupInfoWith(groupId: Data) -> GroupChatInfo? {
guard let session: SessionType = try? DependencyInjection.Container.shared.resolve(), fatalError()
let info = session.getGroupChatInfoWith(groupId: groupId) else { // guard let session: SessionType = try? DependencyInjection.Container.shared.resolve(),
return nil // let info = session.getGroupChatInfoWith(groupId: groupId) else {
} // return nil
// }
return info //
// return info
} }
private func versionFailed(error: Error) { private func versionFailed(error: Error) {
......
import Combine import Combine
import XXModels
import Defaults import Defaults
import Foundation import Foundation
import Integration import Integration
...@@ -11,24 +12,21 @@ final class MenuViewModel { ...@@ -11,24 +12,21 @@ final class MenuViewModel {
@KeyObject(.username, defaultValue: "") var username: String @KeyObject(.username, defaultValue: "") var username: String
var requestCount: AnyPublisher<Int, Never> { var requestCount: AnyPublisher<Int, Never> {
Publishers.CombineLatest( let groupQuery = Group.Query(authStatus: [.pending])
session.contacts(.received), let contactsQuery = Contact.Query(authStatus: [
session.groups(.pending) .verified,
).map { (contacts, groups) in .confirming,
let contactRequests = contacts.filter { .confirmationFailed,
$0.status == .verified || .verificationFailed,
$0.status == .confirming || .verificationInProgress
$0.status == .confirmationFailed || ])
$0.status == .verificationFailed ||
$0.status == .verificationInProgress return Publishers.CombineLatest(
} session.dbManager.fetchContactsPublisher(contactsQuery).catch { _ in Just([]) },
session.dbManager.fetchGroupsPublisher(groupQuery).catch { _ in Just([]) }
let groupRequests = groups.filter { )
$0.status == .pending .map { $0.0.count + $0.1.count }
} .eraseToAnyPublisher()
return contactRequests.count + groupRequests.count
}.eraseToAnyPublisher()
} }
var xxdk: String { var xxdk: String {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment