package com.yidianling.consultant.router

import android.app.Activity
import android.content.Context
import android.content.Intent
import android.support.v7.app.AppCompatActivity
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.yidianling.router.RouterManager
import com.yidianling.user.api.service.IUserService

/**
 * author : Zhangwenchao
 * e-mail : zhangwch@yidianling.com
 * time   : 2018/04/23
 */
object ConsultantIn {

    // 打开小壹聊天界面
    fun startP2PXiaoYi(context: Context) {
        RouterManager.getImRouter().startP2PXiaoYi(context)
    }

    fun isLogin(): Boolean {
        return ModularServiceManager.provide(IUserService::class.java).isLogin()
    }

    fun startP2PSession(context: AppCompatActivity, toUid: String) {
        RouterManager.getImRouter().startP2PSession(context, toUid)
    }

    fun mainIntent(activity: Activity): Intent? {
        return RouterManager.getAppRouter()?.mainIntent(activity)
    }

    fun getUserImpl(): IUserService {
        return ModularServiceManager.provide(IUserService::class.java)
    }

    fun toLogin(activity: Activity) {
        activity.startActivity(ModularServiceManager.provide(IUserService::class.java).loginWayIntent(activity))
    }

}