How do I avoid displaying System messages to the customers

There’s this sample code from here:

public static func isVisible(message: BaseMessage) -> Bool {
    if let message = message as? AdminMessage, let data = Data(base64Encoded:, data.isEmpty == false {
        let isSystemMessage = (message.customType == "ADMIN_MESSAGE_CUSTOM_TYPE")
        let dataObject = try? JSONSerialization.jsonObject(with: data, options: []) as? [String: Any]
        let type = dataObject?["type"] as? String
        return !isSystemMessage && 
            type != EVENT_TYPE_ASSIGN &&
            type != EVENT_TYPE_TRANSFER &&
            type != EVENT_TYPE_CLOSE
    return true

I want to add it to the quickstart-desk-ios sample app.
Where and how exactly do I add that code?