Chatbot Initiation Screen
Overview
The LMChatAIBotInitiationViewController is responsible for managing the initialization and setup of AI chatbot conversations. It displays a loading animation while performing the necessary setup steps in the background.
File Location:
LMChatAIBotInitiaitionViewController.swift
Functionality
UI Components
containerView: ALMViewthat serves as the main container for the screenanimationContainerView: ALMViewthat contains the Lottie animationpreviewLabel: AnLMLabelthat displays the loading status textanimationView: ALottieAnimationViewthat shows the loading animation
Properties
viewModel: An instance ofLMChatAIBotInitiationViewModelthat handles the initialization logic
Methods
setupViews(): Configures the main UI componentssetupLayouts(): Sets up the layout constraints for all UI componentssetupAnimation(): Configures the Lottie animationstartAnimation(): Starts playing the animationstopAnimation(): Stops the animationdidCompleteInitialization(chatroomId:): Handles successful initializationdidFailInitialization(with:): Handles initialization failure
Customization
CustomAIBotInitiationViewController.swift
class CustomAIBotInitiationViewController: LMChatAIBotInitiationViewController {
override func setupViews() {
super.setupViews()
containerView.backgroundColor = .systemBackground
}
override func setupAnimation() {
// Custom animation setup
let customAnimation = LottieAnimation.named("custom_loading")
setupAnimationView(with: customAnimation)
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
LMCoreComponents.shared.aiBotInitiationScreen = CustomAIBotInitiationViewController.self
// ...
return true
}