clearNotice method

Future clearNotice({
  1. required String convId,
})

清空通知

Implementation

Future clearNotice({
  required String convId,
}) async {
  List<NoticeModel> list = await _sdkManager.findAll(
    query: _sdkManager
        .noticeModels()
        .filter()
        .convIdEqualTo(
          convId,
        )
        .build(),
  );
  if (list.isEmpty) return;
  await _sdkManager.isar.writeTxn(() async {
    for (NoticeModel noticeModel in list) {
      noticeModel.contentType = NoticeContentType.invalid;
      noticeModel.content = "";
      noticeModel.deleted = true;
    }
    await _sdkManager.noticeModels().putAll(list);
  });
}