Skip to main content

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.

Functionality

UI Components

  • containerView: A LMView that serves as the main container for the screen
  • animationContainerView: A LMView that contains the Lottie animation
  • previewLabel: An LMLabel that displays the loading status text
  • animationView: A LottieAnimationView that shows the loading animation

Properties

  • viewModel: An instance of LMChatAIBotInitiationViewModel that handles the initialization logic

Methods

  • setupViews(): Configures the main UI components
  • setupLayouts(): Sets up the layout constraints for all UI components
  • setupAnimation(): Configures the Lottie animation
  • startAnimation(): Starts playing the animation
  • stopAnimation(): Stops the animation
  • didCompleteInitialization(chatroomId:): Handles successful initialization
  • didFailInitialization(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
}