package com.ydl.confide.router

import android.app.Activity
import android.content.Intent
import android.support.v7.app.AppCompatActivity
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.yidianling.im.api.service.IImService
import com.yidianling.user.api.service.IAppService
import com.yidianling.user.api.service.IUserService

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

    fun getImService(): IImService {
        return ModularServiceManager.provide(IImService::class.java)
    }

    fun getAppService(): IAppService {
        return ModularServiceManager.provide(IAppService::class.java)
    }

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

    fun isLogin(): Boolean {
        return getUserService()?.isLogin()?:false
    }


    fun loginWayIntent(activity: Activity): Intent? {
        return getUserService()?.loginWayIntent(activity)
    }

    /**
     * 私聊
     */
    fun startChat(context: AppCompatActivity, toUid: String, flag: Int, canTalk: Int) {
        getImService().startChat(context,toUid,flag,canTalk)
    }
}