Skip to content

Commit

Permalink
Integrate zendesk close and minimise events
Browse files Browse the repository at this point in the history
  • Loading branch information
KartheekPa-Kore committed Nov 8, 2024
1 parent 8667ac0 commit ea8f6aa
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Sources/KoreBotSDK/AppKit/Common/BotConnect.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ open class BotConnect: NSObject {
public var closeAgentChatEventName = "close_agent_chat"
public var closeButtonEventName = "close_button_event"
public var minimizeButtonEventName = "minimize_button_event"
public var isZenDeskEvent = false

public var closeOrMinimizeEvent: ((_ dic: [String:Any]?) -> Void)!
// MARK: - init
Expand All @@ -35,6 +36,7 @@ open class BotConnect: NSObject {
close_AgentChat_EventName = closeAgentChatEventName
close_Button_EventName = closeButtonEventName
minimize_Button_EventName = minimizeButtonEventName
isZenDesk_Event = isZenDeskEvent
guard let rootViewController = UIApplication.shared.keyWindow?.rootViewController else {
return
}
Expand Down
1 change: 1 addition & 0 deletions Sources/KoreBotSDK/AppKit/Common/Common.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ var arrayOfSelectedBtnIndex:NSMutableArray = NSMutableArray()
var close_AgentChat_EventName = "close_agent_chat"
var close_Button_EventName = "close_button_event"
var minimize_Button_EventName = "minimize_button_event"
var isZenDesk_Event = false

open class Common : NSObject {
public static func UIColorRGB(_ rgb: Int) -> UIColor {
Expand Down
13 changes: 11 additions & 2 deletions Sources/KoreBotSDK/RTM/Library/RTM/RTMPersistentConnection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -368,13 +368,22 @@ open class RTMPersistentConnection : NSObject, WebSocketDelegate {
print("Socket is in OPEN state")
let dictionary: NSMutableDictionary = NSMutableDictionary()
let messageObject: NSMutableDictionary = NSMutableDictionary()
messageObject.addEntries(from: ["body": message, "attachments":[], "customData": parameters] as [String : Any])
if isZenDesk_Event{
messageObject.addEntries(from: ["body": eventName, "attachments":[], "customData": parameters] as [String : Any])
}else{
messageObject.addEntries(from: ["body": message, "attachments":[], "customData": parameters] as [String : Any])
}

if let object = options {
messageObject.addEntries(from: object)
}

dictionary.setObject(messageObject, forKey: "message" as NSCopying)
dictionary.setObject("/bot.message", forKey: "resourceid" as NSCopying)
if isZenDesk_Event{
dictionary.setObject("/bot.clientEvent", forKey: "resourceid" as NSCopying)
}else{
dictionary.setObject("/bot.message", forKey: "resourceid" as NSCopying)
}
if (self.botInfoParameters != nil) {
dictionary.setObject(self.botInfoParameters as Any, forKey: "botInfo" as NSCopying)
}
Expand Down

0 comments on commit ea8f6aa

Please sign in to comment.