PhoneCallIn.kt 1.64 KB
Newer Older
洪国微 committed
1 2 3
package com.ydl.confide.router

import android.app.Activity
4
import android.content.Context
洪国微 committed
5
import android.content.Intent
YKai committed
6
import androidx.appcompat.app.AppCompatActivity
konghaorui committed
7 8 9 10
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
洪国微 committed
11 12 13 14 15 16 17 18

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

konghaorui committed
19 20
    fun getImService(): IImService {
        return ModularServiceManager.provide(IImService::class.java)
洪国微 committed
21 22
    }

konghaorui committed
23 24
    fun getAppService(): IAppService {
        return ModularServiceManager.provide(IAppService::class.java)
洪国微 committed
25 26
    }

konghaorui committed
27 28
    fun getUserService(): IUserService {
        return ModularServiceManager.provide(IUserService::class.java)
洪国微 committed
29 30
    }

konghaorui committed
31 32
    fun isLogin(): Boolean {
        return getUserService()?.isLogin()?:false
洪国微 committed
33 34 35
    }


konghaorui committed
36 37
    fun loginWayIntent(activity: Activity): Intent? {
        return getUserService()?.loginWayIntent(activity)
洪国微 committed
38 39 40 41 42 43
    }

    /**
     * 私聊
     */
    fun startChat(context: AppCompatActivity, toUid: String, flag: Int, canTalk: Int) {
konghaorui committed
44
        getImService().startChat(context,toUid,flag,canTalk)
洪国微 committed
45
    }
46 47 48 49 50 51 52 53 54 55


    /**
     * 调用优先使用一键登录,并返回调用时的登录状态,
     * @param isOpenDialog true:一键登录使用弹窗展示 false:一键登录使用全屏模式
     * @return true:已登录,不触发登录跳转,false:未登录,优先一键登录
     * */
    fun loginByOneKeyLogin(context: Context, isOpenDialog: Boolean) :Boolean{
        return getUserService().loginByOneKeyLogin(context,isOpenDialog)
    }
洪国微 committed
56
}