init static method

dynamic init()

Implementation

static init() {
  // ContactKitClientRepo.init();
  IMKitRouter.instance.registerRouter(
    RouterConstants.PATH_CONTACT_PAGE,
    (context) => ContactPage(),
  );

  IMKitRouter.instance.registerRouter(
    RouterConstants.PATH_CONTACT_SELECTOR_PAGE,
    (context) => ContactKitSelectorPage(
      mostSelectedCount: IMKitRouter.getArgumentFormMap<int>(
        context,
        'mostCount',
      ),
      filterUsers: IMKitRouter.getArgumentFormMap<List<String>>(
        context,
        'filterUser',
      ),
      returnContact: IMKitRouter.getArgumentFormMap<bool>(
        context,
        'returnContact',
      ),
      includeAIUser:
          IMKitRouter.getArgumentFormMap<bool>(context, 'includeAIUser') ??
              false,
      includeBlackList:
          IMKitRouter.getArgumentFormMap<bool>(context, 'includeBlackList') ??
              false,
      includeSelf:
          IMKitRouter.getArgumentFormMap<bool>(context, 'includeSelf') ??
              false,
      isDialog:
          IMKitRouter.getArgumentFormMap<bool>(context, 'isDialog') ?? false,
      isEmbed:
          IMKitRouter.getArgumentFormMap<bool>(context, 'isEmbed') ?? false,
      dialogTitle:
          IMKitRouter.getArgumentFormMap<String>(context, 'dialogTitle'),
      onSelectionChanged:
          IMKitRouter.getArgumentFormMap<ValueChanged<List<ContactInfo>>>(
              context, 'onSelectionChanged'),
    ),
  );

  IMKitRouter.instance.registerRouter(
    RouterConstants.PATH_USER_INFO_PAGE,
    (context) => ContactKitDetailPage(
      accId: IMKitRouter.getArgumentFormMap<String>(context, 'accId')!,
    ),
  );

  IMKitRouter.instance.registerRouter(
    RouterConstants.PATH_MY_BLACK_PAGE,
    (context) => ContactKitBlackListPage(),
  );

  IMKitRouter.instance.registerRouter(
    RouterConstants.PATH_MY_TEAM_PAGE,
    (context) => ContactKitTeamListPage(
      selectorModel: IMKitRouter.getArgumentFormMap<bool>(
        context,
        'selectorModel',
      ),
    ),
  );

  IMKitRouter.instance.registerRouter(
    RouterConstants.PATH_MY_NOTIFICATION_PAGE,
    (context) => ContactKitSystemNotifyMessagePage(),
  );

  // 桌面/Web 端:注入联系人详情弹框 Builder,使 goToContactDetail 在桌面端自动以 Dialog 展示
  // 仅桌面/Web 端注册,移动端不注入,保持原有 push 行为
  if (ChatKitUtils.isDesktopOrWeb) {
    setDesktopContactDetailBuilder(
      (accId) => ContactKitDetailPage(
        accId: accId,
        isDesktopDialog: true,
      ),
    );
  }

  XKitReporter().register(
    moduleName: 'ContactUIKit',
    moduleVersion: '10.3.0',
  );
}