setGroupNotification static method

dynamic setGroupNotification({
  1. required String groupId,
  2. required String notification,
})

Implementation

static setGroupNotification({
  required String groupId,
  required String notification,
}) async {
  final value = await getGroupInfo(groupId);
  if (value.code != 0) {
    TCICLog.error(
      "Failed to get group info: code=${value.code}, message=${value.desc}",
      actionModule: ActionModule.imSDK.name,
      actionName: ActionName.setGroupNotification.name,
    );
    return;
  }
  value.data?.forEach((element) {
    final groupInfo = element.groupInfo;
    if (groupInfo?.groupID == groupId) {
      groupInfo?.notification = notification;
      TencentImSDKPlugin.v2TIMManager
          .getGroupManager()
          .setGroupInfo(
            info: V2TimGroupInfo(
              groupID: groupId,
              groupType: 'Failed to set group',
              notification: notification,
            ),
          )
          .then((v) {
            TCICLog.info("setGroupNotification: ${groupInfo?.groupType} ${v.code == 0}",actionModule: ActionModule.imSDK.name,actionName: ActionName.setGroupNotification.name);
            if (v.code != 0) {
              TCICLog.error(
                "Failed to set group notification: code=${v.code}, message=${v.desc}",
                actionModule: ActionModule.imSDK.name,
                actionName: ActionName.setGroupNotification.name,
              );
            } else {
              TCICLog.info("Set group notification success",actionModule: ActionModule.imSDK.name,actionName: ActionName.setGroupNotification.name);
            }
          });
    }
  });
}