formatNotification method

  1. @override
Future<String> formatNotification(
  1. Message message
)
override

Implementation

@override
Future<String> formatNotification(Message message) async {
  if (operateUser == await FlutterImclient.currentUserId) {
    return '你 销毁了群组';
  } else {
    UserInfo? userInfo =
        await FlutterImclient.getUserInfo(operateUser, groupId: groupId);
    if (userInfo != null) {
      if (userInfo.friendAlias != null && userInfo.friendAlias!.isNotEmpty) {
        return '${userInfo.friendAlias} 销毁了群组';
      } else if (userInfo.groupAlias != null &&
          userInfo.groupAlias!.isNotEmpty) {
        return '${userInfo.groupAlias} 销毁了群组';
      } else if (userInfo.displayName != null &&
          userInfo.displayName!.isNotEmpty) {
        return '${userInfo.displayName} 销毁了群组';
      } else {
        return '$operateUser 销毁了群组';
      }
    } else {
      return '$operateUser 销毁了群组';
    }
  }
}