Skip to content

Commit

Permalink
Using GlobalConfig throttling value
Browse files Browse the repository at this point in the history
  • Loading branch information
mliao95 committed Jun 28, 2024
1 parent 68dca26 commit 5671f43
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions AmazonConnectChatIOS/Sources/Core/Models/GlobalConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ public struct Features {

public struct MessageReceipts {
public var shouldSendMessageReceipts: Bool
public var throttleTime: Int
public var throttleTime: Double

// Provides default MessageReceipts configuration
public static var defaultReceipts: MessageReceipts {
return MessageReceipts(shouldSendMessageReceipts: true, throttleTime: Constants.MESSAGE_RECEIPT_THROTTLE_TIME)
}

public init(shouldSendMessageReceipts: Bool, throttleTime: Int) {
public init(shouldSendMessageReceipts: Bool, throttleTime: Double) {
self.shouldSendMessageReceipts = shouldSendMessageReceipts
self.throttleTime = throttleTime
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class MessageReceiptsManager: MessageReceiptsManagerProtocol {
var deliveredReceiptSet = Set<String>()
var pendingMessageReceipts: PendingMessageReceipts = PendingMessageReceipts()
var timer: Timer?
var throttleTime: Double = 5
var throttleTime: Double = MessageReceipts.defaultReceipts.throttleTime
var deliveredThrottleTime: Double = 3

func throttleAndSendMessageReceipt(event: MessageReceiptType, messageId: String, completion: @escaping (Result<PendingMessageReceipts, Error>) -> Void) {
Expand Down
2 changes: 1 addition & 1 deletion AmazonConnectChatIOS/Sources/Core/Utils/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public struct Constants {
static let UNKNOWN = "UNKNOWN"
static let MESSAGE = "MESSAGE"
static let EVENT = "EVENT"
static let MESSAGE_RECEIPT_THROTTLE_TIME = 5000
static let MESSAGE_RECEIPT_THROTTLE_TIME = 5.0
static let DEFAULT_REGION : AWSRegionType = .USWest2
public static let QUICK_REPLY = "QuickReply"
public static let LIST_PICKER = "ListPicker"
Expand Down

0 comments on commit 5671f43

Please sign in to comment.