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

feat: timed out messages use different color

parent 9b77b6ab
No related branches found
No related tags found
2 merge requests!8Fixing failed verification due to wrong fact passed,!2Use orange color for timed out messages
......@@ -147,7 +147,6 @@
02FDD06021EDA39A000F1286 /* Resources */,
028B1320260A99C800054510 /* ShellScript */,
32179BAD26410149008B26EC /* Embed App Extensions */,
32B1E78E278FEBF600A77C0E /* ShellScript */,
);
buildRules = (
);
......@@ -282,23 +281,6 @@
shellPath = /bin/sh;
shellScript = "$SRCROOT/set_build_number.sh\n";
};
32B1E78E278FEBF600A77C0E /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "${BUILD_DIR%Build/*}SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run\n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
......
......@@ -19,6 +19,11 @@ final class Bubbler {
audioBubble.backgroundColor = Asset.neutralWhite.color
audioBubble.dateLabel.textColor = Asset.neutralDisabled.color
audioBubble.progressLabel.textColor = Asset.neutralDisabled.color
case .timedOut:
audioBubble.lockerView.fail()
audioBubble.backgroundColor = Asset.accentWarning.color
audioBubble.dateLabel.textColor = Asset.neutralWhite.color
audioBubble.progressLabel.textColor = Asset.neutralWhite.color
case .failedToSend:
audioBubble.lockerView.fail()
audioBubble.backgroundColor = Asset.accentDanger.color
......@@ -61,6 +66,11 @@ final class Bubbler {
imageBubble.backgroundColor = Asset.accentDanger.color
imageBubble.dateLabel.textColor = Asset.neutralWhite.color
imageBubble.progressLabel.textColor = Asset.neutralWhite.color
case .timedOut:
imageBubble.lockerView.fail()
imageBubble.backgroundColor = Asset.accentWarning.color
imageBubble.dateLabel.textColor = Asset.neutralWhite.color
imageBubble.progressLabel.textColor = Asset.neutralWhite.color
case .sent:
imageBubble.lockerView.stop()
imageBubble.backgroundColor = Asset.brandBubble.color
......@@ -92,6 +102,12 @@ final class Bubbler {
bubble.dateLabel.textColor = Asset.neutralDisabled.color
roundButtonColor = Asset.neutralDisabled.color
bubble.revertBottomStackOrder()
case .timedOut:
bubble.lockerView.fail()
bubble.backgroundColor = Asset.accentWarning.color
bubble.textView.textColor = Asset.neutralWhite.color
bubble.dateLabel.textColor = Asset.neutralWhite.color
roundButtonColor = Asset.neutralWhite.color
case .failedToSend:
bubble.lockerView.fail()
bubble.backgroundColor = Asset.accentDanger.color
......@@ -206,6 +222,14 @@ final class Bubbler {
bubble.replyView.container.backgroundColor = Asset.brandDefault.color
bubble.replyView.space.backgroundColor = Asset.brandPrimary.color
bubble.revertBottomStackOrder()
case .timedOut:
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
case .failedToSend:
bubble.senderLabel.removeFromSuperview()
bubble.backgroundColor = Asset.accentDanger.color
......@@ -239,7 +263,7 @@ final class Bubbler {
switch item.status {
case .sent:
bubble.lockerView.stop()
case .failedToSend:
case .failedToSend, .timedOut:
bubble.lockerView.fail()
case .sending, .sendingAttachment:
bubble.lockerView.animate()
......
......@@ -113,7 +113,10 @@ extension CellFactory {
) -> Self {
.init(
canBuild: { item in
(item.status == .sent || item.status == .failedToSend || item.status == .sendingAttachment)
(item.status == .sent ||
item.status == .failedToSend ||
item.status == .sendingAttachment ||
item.status == .timedOut)
&& item.payload.reply == nil
&& item.payload.attachment != nil
&& item.payload.attachment?._extension == .audio
......@@ -178,7 +181,10 @@ extension CellFactory {
static func outgoingImage() -> Self {
.init(
canBuild: { item in
(item.status == .sent || item.status == .failedToSend || item.status == .sendingAttachment)
(item.status == .sent ||
item.status == .failedToSend ||
item.status == .sendingAttachment ||
item.status == .timedOut)
&& item.payload.reply == nil
&& item.payload.attachment != nil
&& item.payload.attachment?._extension == .image
......@@ -299,7 +305,7 @@ extension CellFactory {
) -> Self {
.init(
canBuild: { item in
item.status == .failedToSend
(item.status == .failedToSend || item.status == .timedOut)
&& item.payload.reply != nil
&& item.payload.attachment == nil
......@@ -375,7 +381,7 @@ extension CellFactory {
static func outgoingFailedText(performReply: @escaping () -> Void) -> Self {
.init(
canBuild: { item in
item.status == .failedToSend
(item.status == .failedToSend || item.status == .timedOut)
&& item.payload.reply == nil
&& item.payload.attachment == nil
......@@ -425,7 +431,7 @@ struct ActionFactory {
case .reply:
guard item.status == .read || item.status == .received || item.status == .sent else { return nil }
case .retry:
guard item.status == .failedToSend else { return nil }
guard item.status == .failedToSend || item.status == .timedOut else { return nil }
case .delete, .copy:
break
}
......
......@@ -377,9 +377,11 @@ extension BindingsClient: BindingsInterface {
/// values *completed* or *Error*
/// upon throwing
///
public func listen(report: Data, _ completion: @escaping (Result<Bool, Error>) -> Void) {
public func listen(report: Data, _ completion: @escaping (Result<MessageDeliveryStatus, Error>) -> Void) {
do {
try listenDelivery(of: report) { msgId, delivered, timedOut, roundResults in
let status: MessageDeliveryStatus
if delivered == false {
let extendedLogs =
"""
......@@ -389,9 +391,17 @@ extension BindingsClient: BindingsInterface {
"""
log(string: extendedLogs, type: .error)
log(string: extendedLogs, type: .error)
if timedOut == true {
status = .timedout
} else {
status = .failed
}
} else {
status = .sent
}
completion(.success(delivered))
completion(.success(status))
}
} catch {
completion(.failure(error))
......
import Models
import Foundation
public enum MessageDeliveryStatus {
case sent
case failed
case timedout
}
public typealias BackendEvent = (Int, String?, String?, String?)
public typealias DeliveryResult = (Data?, Bool, Bool, Data?)
......@@ -70,7 +76,7 @@ public protocol BindingsInterface {
func listen(
report: Data,
_: @escaping (Result<Bool, Error>) -> Void
_: @escaping (Result<MessageDeliveryStatus, Error>) -> Void
)
func listenRound(
......
......@@ -116,10 +116,10 @@ public final class BindingsMock: BindingsInterface {
public func listen(
report: Data,
_ completion: @escaping (Result<Bool, Error>) -> Void
_ completion: @escaping (Result<MessageDeliveryStatus, Error>) -> Void
) {
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
completion(.success(true))
completion(.success(.sent))
}
}
......
......@@ -124,7 +124,14 @@ extension Session {
self.client.bindings.listen(report: report.marshalled) { result in
switch result {
case .success(let status):
message.status = status ? .sent : .failedToSend
switch status {
case .failed:
message.status = .failedToSend
case .sent:
message.status = .sent
case .timedout:
message.status = .timedOut
}
case .failure:
message.status = .failedToSend
}
......
......@@ -20,6 +20,7 @@ public struct Message: Codable, Equatable, Hashable {
case receivingAttachment
case received
case failedToSend
case timedOut
}
public var id: Int64?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment