package org.yameida.worktool

import com.blankj.utilcode.util.TimeUtils
import org.yameida.worktool.service.MyLooper
import java.util.*

/**
 * 示例
 */
object Demo {

    fun test(flag: Boolean) {
        if (!flag) return

        MyLooper.getInstance().removeCallbacksAndMessages(null)

        //打印当前视图树
//        AccessibilityUtil.printNodeClazzTree(getRoot())

    }

    fun test2(name: String) {
        val time = TimeUtils.date2String(Date(), "MMddHHmm")
        val groupName = "$name"
        val json = """
            {
                "socketType":2,
                "list":[
                    {
                      "type": 210,
                      "groupName": "$groupName",
                      "titleList": [
                        "杨洋测试群1"
                      ],
                      "fileUrl":"https://img2.baidu.com/it/u=4275140052,831704139&fm=253&fmt=auto&app=120&f=JPEG?w=399&h=399",
                      "appId":"ww74795b61fcf19d03",
                      "agentId":"1000009",
                      "fileName":"1",
                      "extraText":"aa",
                      "maxRetryCount":1
                    }
                ]
            }
        """.trimIndent()
        MyLooper.onMessage(null, json)
    }

    fun test3() {
        val time = TimeUtils.date2String(Date(), "MMddHHmm")
        val groupName = "测试群"
        val json = """
            {
                "socketType":2,
                "list":[
                    {
                        "type":604,
                         "msgCheckFlag": "1",
                         "msgKeywordList":[
                            "aaa",
                            "bbb",
                            "cc"
                         ],
                         "miniSendFlag":"1",
                         "miniNameList":[
                            "和裂变"
                         ],
                         "urlSendFlag": 1,
                         "urlList": [
                         "baidu.com",
                         "taobao.com",
                         "aaaaa.com",
                         "bbbbb.com"
                        ],
                         "qrcodeSendFlag": 1,
                         "moreFlag":1,
                         "photoSendFlag": 1,
                            "chatSendFlag": 1,
                            "voiceSendFlag": 1,
                            "videoSendFlag": 1,
                            "fileSendFlag": 1,
                            "cardSendFlag": 1,
                            "nicknameCheckFlag": 1,
                            "nicknameKeywordList": [
                                "昵称关键词1",
                                "昵称关键词2",
                                "昵称关键词3"
                            ],
                           "maxLengthFlag": 1,
                            "msgMaxLength": 500,
                           "maxLineFlag": 1,
                            "msgMaxLine": 20
                    }
                ]
            }
        """.trimIndent()
        MyLooper.onMessage(null, json)
    }

    fun test5() {
        val time = TimeUtils.date2String(Date(), "MMddHHmm")
        val groupName = ""
        val json = """
            {
                "socketType":2,
                "list":[
                     {
                      "type": 303,
                      "receivedContent":"1"
                    }
                ]
            } 
        """.trimIndent()
        MyLooper.onMessage(null, json)
    }

}