diff --git a/android/build.gradle b/android/build.gradle index b22bba6..77081da 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -40,8 +40,17 @@ android { } dependencies { + + implementation 'com.google.android.flexbox:flexbox:3.0.0' + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation group: 'com.zendesk', name: 'chat', version: '3.1.0' - implementation group: 'com.zendesk', name: 'messaging', version: '5.1.0' implementation group: 'com.zendesk', name: 'chat-providers', version: '3.1.0' + + implementation(group: 'com.zendesk', name: 'messaging', version: '5.1.0') { + exclude group: "com.google.android", module: "flexbox" + } + implementation(group: 'com.zendesk', name: 'chat', version: '3.1.0') { + exclude group: "com.google.android", module: "flexbox" + } + } diff --git a/ios/Classes/SwiftZendeskHelper.swift b/ios/Classes/SwiftZendeskHelper.swift index ae395f8..c3b979b 100644 --- a/ios/Classes/SwiftZendeskHelper.swift +++ b/ios/Classes/SwiftZendeskHelper.swift @@ -90,7 +90,7 @@ public class SwiftZendeskHelper: NSObject, FlutterPlugin { } // Name for Bot messages let messagingConfiguration = MessagingConfiguration() - messagingConfiguration.name = "Chat Bot" + messagingConfiguration.name = dictionary["botName"] as? String ?? "Answer Bot" // Chat configuration let chatConfiguration = ChatConfiguration() @@ -120,20 +120,14 @@ public class SwiftZendeskHelper: NSObject, FlutterPlugin { func presentViewController(rootViewController: UIViewController?, view: UIViewController) { - if (rootViewController is UINavigationController) { - (rootViewController as! UINavigationController).pushViewController(view, animated: true) - } else { - if #available(iOS 13.0, *) { - if var topController = UIApplication.shared.keyWindow?.rootViewController { + if var topController = UIApplication.shared.keyWindow?.rootViewController { while let presentedViewController = topController.presentedViewController { topController = presentedViewController } topController.present(view, animated: true, completion: nil) - } - } } - } + func uiColorFromHex(rgbValue: Int) -> UIColor { let red = CGFloat((rgbValue & 0xFF0000) >> 16) / 255.0 let green = CGFloat((rgbValue & 0x00FF00) >> 8) / 255.0 diff --git a/lib/zendesk_helper.dart b/lib/zendesk_helper.dart index c503710..9fd9567 100644 --- a/lib/zendesk_helper.dart +++ b/lib/zendesk_helper.dart @@ -49,12 +49,15 @@ class Zendesk { /// chat transcript at the end of the chat. /// /// If [isOfflineFormEnabled] is true, the offline form will be shown to the user. + /// + /// Optionally set bot's name using [botName] static Future startChat({bool? isDarkTheme, Color? primaryColor, bool isPreChatFormEnabled = true, bool isAgentAvailabilityEnabled = true, bool isChatTranscriptPromptEnabled = true, bool isOfflineFormEnabled = true, + String? botName, }) async { await _channel.invokeMethod('startChat', { 'isDarkTheme': isDarkTheme, @@ -62,7 +65,8 @@ class Zendesk { 'isPreChatFormEnabled': isPreChatFormEnabled, 'isAgentAvailabilityEnabled': isAgentAvailabilityEnabled, 'isChatTranscriptPromptEnabled': isChatTranscriptPromptEnabled, - 'isOfflineFormEnabled': isOfflineFormEnabled + 'isOfflineFormEnabled': isOfflineFormEnabled, + 'botName': botName, }); }