package com.bc_chat.im.fragment.forword

import android.net.Uri
import com.bc_chat.im.R
import com.bc_chat.im.databinding.FragmentForwardChatBinding
import com.zhaohaoting.framework.abs.AbsV4Fragment
import com.zhaohaoting.framework.abs.contract.BaseContract
import io.rong.imlib.model.Conversation
import io.rong.imlib.model.Message
import org.jetbrains.anko.bundleOf

/**
 * author：Created by zhaohaoting on 2019/2/20
 * email：526309416@qq.com
 * desc：消息 10
 */
class ForwardChatFragment : AbsV4Fragment<BaseContract.BasePresenter>() {

    private val binding by lazy {
        rootDataBinding as FragmentForwardChatBinding
    }

    override fun initialize() {
        val forwardSelectMsgs = arguments?.getParcelableArrayList<Message>("selectList")
        val uri = Uri.parse("rong://" + context?.packageName).buildUpon()
                .appendPath("conversationlist")
                .appendQueryParameter(Conversation.ConversationType.PRIVATE.getName(), "false") //设置私聊会话是否聚合显示
                .appendQueryParameter(Conversation.ConversationType.GROUP.getName(), "false")//群组
                .appendQueryParameter(Conversation.ConversationType.PUBLIC_SERVICE.getName(), "false")//公共服务号
                .appendQueryParameter(Conversation.ConversationType.APP_PUBLIC_SERVICE.getName(), "false")//订阅号
                .appendQueryParameter(Conversation.ConversationType.SYSTEM.getName(), "false")//系统
                .build()
        val fragment = ForwardConversationListFragment()
        fragment.uri = uri
        fragment.arguments = bundleOf("selectList" to forwardSelectMsgs)
        addFragment(fragment, R.id.fl_chat_container)
    }

    override fun initPresenter(): BaseContract.BasePresenter? = null

    override fun getLayoutResId(): Int = R.layout.fragment_forward_chat
}
