Newer
Older
SmartKitchenTablet / app / src / main / java / com / casic / br / extensions / DeviceBean.kt
package com.casic.br.extensions

import com.tuya.smart.sdk.bean.DeviceBean

fun DeviceBean.toChineseTypeName(): String {
    return if (this.category.isNullOrBlank()) {
        if (this.productStandardConfig.category.isNullOrBlank()) {
            this.productBean.category.toChineseTypeName()
        } else {
            this.productStandardConfig.category.toChineseTypeName()
        }
    } else {
        this.category.toChineseTypeName()
    }
}

fun DeviceBean.selectCategory(): String {
    return if (this.category.isNullOrBlank()) {
        if (this.productStandardConfig.category.isNullOrBlank()) {
            this.productBean.category
        } else {
            this.productStandardConfig.category
        }
    } else {
        this.category
    }
}