ConsultantIn.kt 2.13 KB
Newer Older
1 2 3 4
package com.yidianling.consultant.router

import android.app.Activity
import android.content.Context
5
import com.ydl.ydlcommon.modular.ModularServiceManager
konghaorui committed
6 7
import com.yidianling.im.api.service.IImService
import com.yidianling.user.api.service.IAppService
8
import com.yidianling.user.api.service.IUserService
9 10 11 12 13 14 15 16

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

konghaorui committed
17 18 19 20 21 22 23
    fun getImService(): IImService {
        return ModularServiceManager.provide(IImService::class.java)
    }

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

konghaorui committed
25 26 27 28
    fun getUserService(): IUserService {
        return ModularServiceManager.provide(IUserService::class.java)
    }

29 30
    // 打开小壹聊天界面
    fun startP2PXiaoYi(context: Context) {
konghaorui committed
31
        getImService().startP2PXiaoYi(context)
32 33
    }

34 35 36 37
    fun isLogin(): Boolean {
        return ModularServiceManager.provide(IUserService::class.java).isLogin()
    }

严久程 committed
38
    fun startP2PSession(context: Activity, toUid: String) {
konghaorui committed
39
        getImService().startP2PSession(context, toUid)
40 41
    }

42 43 44 45 46 47 48 49
    /**
     * 去前置信息收集页
     * */
    fun startP2PSession(context: Activity, location: Int, ffrom2: String?) {
        getImService().startP2PSession(context, location, ffrom2)
    }

    fun mainIntent(activity: Activity) {
konghaorui committed
50
        getAppService().mainIntent(activity)
51 52
    }

53 54 55 56
    fun getUserImpl(): IUserService {
        return ModularServiceManager.provide(IUserService::class.java)
    }

57
    fun toLogin(activity: Activity) {
58 59 60
        activity.startActivity(
            ModularServiceManager.provide(IUserService::class.java).loginWayIntent(activity)
        )
61 62
    }

63 64 65 66 67
    /**
     * 调用优先使用一键登录,并返回调用时的登录状态,
     * @param isOpenDialog true:一键登录使用弹窗展示 false:一键登录使用全屏模式
     * @return true:已登录,不触发登录跳转,false:未登录,优先一键登录
     * */
68 69
    fun loginByOneKeyLogin(context: Context, isOpenDialog: Boolean): Boolean {
        return getUserService().loginByOneKeyLogin(context, isOpenDialog)
70
    }
71
}