Recent searches


No recent searches

Neil Hannah's Avatar

Neil Hannah

Joined Nov 30, 2021

·

Last activity Jan 11, 2022

Following

0

Followers

0

Total activity

4

Votes

0

Subscription

1

ACTIVITY OVERVIEW

Latest activity by Neil Hannah

Neil Hannah commented,

Community comment Developer - Zendesk SDKs

Hi,

As I initially found a workaround it took me a bit to get back to this, but using the example, which is in swift instead of ObjC, I find the exact same issue. I actually found another issue as well where setting department also caused message sending issues. So to reiterate, if the name is set to hidden, and not given, FAIL, if name required, and given, FAIL, if department given FAIL. Here is the sample code in a failed state... comment out the `.department` and swap the commented `visitorInfoTest` for the uncommented one and you will find another failure. You can paste this into your ZendeskMessaging file in the sample project, it has very few changes from that.

 

//

//  ZendeskMessaging.swift

//  UnifiedSDK

//

//  Created by Zendesk on 17/04/2020.

//  Copyright © 2020 Zendesk. All rights reserved.

//

 

import Foundation

import MessagingSDK

import MessagingAPI

import CommonUISDK

import ChatSDK

import ChatProvidersSDK

 

final class ZendeskMessaging: NSObject, JWTAuthenticator {

 

    static let instance = ZendeskMessaging()

 

    static var themeColor: UIColor? {

        didSet {

            guard let themeColor = themeColor else { return }

            CommonTheme.currentTheme.primaryColor = themeColor

        }

    }

 

    #warning("Please provide Chat account key")

    let accountKey = ""

 

    var authToken: String = "" {

        didSet {

            guard !authToken.isEmpty else {

                resetVisitorIdentity()

                return

            }

            Chat.instance?.setIdentity(authenticator: self)

        }

    }

 

    // MARK: Configurations

    var messagingConfiguration: MessagingConfiguration {

        let messagingConfiguration = MessagingConfiguration()

        messagingConfiguration.name = "Chat Bot"

        return messagingConfiguration

    }

 

    var chatConfiguration: ChatConfiguration {

        let chatConfiguration = ChatConfiguration()

        chatConfiguration.isAgentAvailabilityEnabled = true

        chatConfiguration.isPreChatFormEnabled = true

        chatConfiguration.preChatFormConfiguration.name = FormFieldStatus.required

        chatConfiguration.preChatFormConfiguration.email = FormFieldStatus.required

        chatConfiguration.preChatFormConfiguration.phoneNumber = FormFieldStatus.required

        chatConfiguration.preChatFormConfiguration.department = FormFieldStatus.hidden

        return chatConfiguration

    }

 

    var chatAPIConfig: ChatAPIConfiguration {

        let chatAPIConfig = ChatAPIConfiguration()

        chatAPIConfig.tags = ["iOS", "chat_v2"]

        chatAPIConfig.department = "Neil test" // This line commented out will work

        let visitorInfoTest = VisitorInfo(email: "neil@gmail.com", phoneNumber: "1111111111")

//        let visitorInfoTest = VisitorInfo(name: "Neil Test", email: "neil@gmail.com", phoneNumber: "8607489943") // This line replacing one above it causes app not to work

        chatAPIConfig.visitorInfo = visitorInfoTest

        return chatAPIConfig

    }

 

    // MARK: Chat

    func initialize() {

        setChatLogging(isEnabled: true, logLevel: .verbose)

        Chat.initialize(accountKey: accountKey, appId: "")

    }

 

    func setChatLogging(isEnabled: Bool, logLevel: LogLevel) {

        Logger.isEnabled = isEnabled

        Logger.defaultLevel = logLevel

    }

 

    func resetVisitorIdentity() {

        Chat.instance?.resetIdentity(nil)

    }

 

    func getToken(_ completion: @escaping (String?, Error?) -> Void) {

        completion(authToken, nil)

    }

 

    // MARK: View Controller

    func buildMessagingViewController() throws -> UIViewController {

        Chat.instance?.configuration = chatAPIConfig

        return try Messaging.instance.buildUI(engines: engines,

                                              configs: [messagingConfiguration, chatConfiguration])

    }

}

 

extension ZendeskMessaging {

    // MARK: Engines

    var engines: [Engine] {

        let engineTypes: [Engine.Type] = [ChatEngine.self]

        return engines(from: engineTypes)

    }

 

    func engines(from engineTypes: [Engine.Type]) -> [Engine] {

        engineTypes.compactMap { type -> Engine? in

            switch type {

            case is ChatEngine.Type:

                return try? ChatEngine.engine()

            default:

                fatalError("Unhandled engine of type: \(type)")

            }

        }

    }

}

View comment · Posted Jan 11, 2022 · Neil Hannah

0

Followers

0

Votes

0

Comments


Neil Hannah commented,

Community comment Developer - Zendesk SDKs

Hi Greg, I will try to sum it up here.

Working:

`config.visitorInfo = [[ZDKVisitorInfo alloc] initWithName:nil email:@"neil@test.com"phoneNumber:@"1234567890"];`

`[[ZDKChatFormConfiguration alloc] initWithName:ZDKFormFieldStatusOptional email:ZDKFormFieldStatusHidden phoneNumber:ZDKFormFieldStatusHidden department:ZDKFormFieldStatusHidden]`
Not working:
`config.visitorInfo = [[ZDKVisitorInfo alloc] initWithName:nil email:@"neil@test.com"phoneNumber:@"1234567890"];`
 
`[[ZDKChatFormConfiguration alloc] initWithName:ZDKFormFieldStatusHidden email:ZDKFormFieldStatusHidden phoneNumber:ZDKFormFieldStatusHidden department:ZDKFormFieldStatusHidden]`
 
Not working:
`config.visitorInfo = [[ZDKVisitorInfo alloc] initWithName:@"neil" email:@"neil@test.com"phoneNumber:@"1234567890"];`
 
`[[ZDKChatFormConfiguration alloc] initWithName:ZDKFormFieldStatusOptional email:ZDKFormFieldStatusHidden phoneNumber:ZDKFormFieldStatusHidden department:ZDKFormFieldStatusHidden]`
 
So basically if I provide the name, regardless of the form setting, I can no longer connect. If I don't provide the name, if the form setting has name optional or required, I can connect. But if I don't provide the name, and the form is set to hidden for name, I still cannot connect.

View comment · Posted Dec 02, 2021 · Neil Hannah

0

Followers

0

Votes

0

Comments


Neil Hannah created a post,

Post Developer - Zendesk SDKs

As of 2 days ago trying to set initWithName on ZDKVisitorInfo causes the chat not to work. The same issue is present if ZDKChatFormConfiguration is set with initWithName ZDKFormFieldHidden. Chat works fine with name set to NULL and the field required or optional in the form, but if the name is given, it does not connect to the chat. Also if the name is not given and the field in the form set to ZDKFormFieldHidden it also no longer connects. This started 2 days ago in prod apps and I suspect it's an issue in either the SDK or server. I cannot find actual support so posting here.

Posted Nov 30, 2021 · Neil Hannah

0

Followers

2

Votes

4

Comments