setupIMServiceLocator function

void setupIMServiceLocator()

Implementation

void setupIMServiceLocator() {
  if (!boolIsInitailized) {
    // setting
    serviceLocator.registerSingleton<TCustomerSettingModel>(TCustomerSettingModel());

    // services
    serviceLocator.registerSingleton<TCustomerCoreServicesImpl>(TCustomerCoreServicesImpl());
    serviceLocator
        .registerSingleton<TCustomerSelfInfoViewModel>(TCustomerSelfInfoViewModel());
    serviceLocator
        .registerSingleton<TCustomerConversationService>(TCustomerConversationServicesImpl());
    serviceLocator.registerSingleton<TCustomerMessageService>(TCustomerMessageServiceImpl());
    serviceLocator
        .registerSingleton<TCustomerFriendshipServices>(TCustomerFriendshipServicesImpl());
    serviceLocator.registerSingleton<TCustomerGroupServices>(TCustomerGroupServicesImpl());

    // view models
    serviceLocator.registerSingleton<TCustomerChatGlobalModel>(TCustomerChatGlobalModel());
    serviceLocator.registerSingleton<TCustomerChatModelTools>(TCustomerChatModelTools());
    serviceLocator.registerSingleton<TCustomerConversationViewModel>(
        TCustomerConversationViewModel());

    try{
      if (!serviceLocator.isRegistered<TUIThemeViewModel>()) {
        serviceLocator.registerSingleton<TUIThemeViewModel>(TUIThemeViewModel());
      }
    }catch(e){
      print('TUIThemeViewModel already registered: $e');
    }

    // listener models
    serviceLocator
        .registerSingleton<TCustomerGroupListenerModel>(TCustomerGroupListenerModel());

    // Desk Data
    serviceLocator
        .registerSingleton<TencentCloudCustomerData>(TencentCloudCustomerData());

    boolIsInitailized = true;
  }
}