UserIn.kt 1.58 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
package com.yidianling.user.route

import android.app.Activity
import android.content.Context
import android.content.Intent
import com.yidianling.router.RouterManager
import com.yidianling.router.im.IMLoginInfo
import com.yidianling.router.im.IMRequestCallback

/**
 * author : Zhangwenchao
 * e-mail : zhangwch@yidianling.com
 * time   : 2018/02/05
 */
object UserIn {

    fun mainIntent(activity: Activity): Intent? {
        return RouterManager.getAppRouter()?.mainIntent(activity)
    }
    fun mainIntent(context: Context, selectTab: Int): Intent? {
        return RouterManager.getAppRouter()?.mainIntent(context, selectTab, false)
    }

    fun imSetAccount(account: String) {
        RouterManager.getImRouter().setAccount(account)
    }


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

    fun setChattingAccountAll() {
        RouterManager.getImRouter().setChattingAccountAll()
    }

    fun setChattingAccountNone() {
        RouterManager.getImRouter().setChattingAccountNone()
    }

    fun imLogin(info: IMLoginInfo, callback: IMRequestCallback<IMLoginInfo>) {
        RouterManager.getImRouter().login(info, callback)
    }

    fun imLogout() {
        RouterManager.getImRouter().logout()
    }

    // 关闭音频播放
    fun closePlayer() {
        RouterManager.getCourseRouter()?.closePlayer()
        RouterManager.getFMRouter()?.closePlayer()
        RouterManager.getPhoneCallRouter()?.closePlayer()
    }

    // 清除 im 数据
    fun clearImData() {
        RouterManager.getImRouter().clear()
    }

}