TestsIn.kt 2.36 KB
Newer Older
konghaorui committed
1 2 3 4
package com.yidianling.tests.router

import android.app.Activity
import android.content.Intent
5 6
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.router.YdlUserInfo
konghaorui committed
7 8 9
import com.yidianling.dynamic.api.IDynamicService
import com.yidianling.im.api.bean.IMRequestCallback
import com.yidianling.im.api.service.IImService
10 11
import com.yidianling.tests.api.service.ITestsApiService
import com.yidianling.user.api.bean.UserResponseBean
konghaorui committed
12
import com.yidianling.user.api.service.IAppService
13
import com.yidianling.user.api.service.IUserService
konghaorui committed
14 15 16 17 18 19 20 21

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

konghaorui committed
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
    fun getUserService(): IUserService {
        return ModularServiceManager.provide(IUserService::class.java)
    }

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

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

    fun getDynamicService(): IDynamicService {
        return ModularServiceManager.provide(IDynamicService::class.java)
    }

38 39 40
    fun getTestsImpl(): ITestsApiService {
        return ModularServiceManager.provide(ITestsApiService::class.java)
    }
konghaorui committed
41
    fun isLogin(): Boolean {
42 43 44 45 46 47 48 49 50
        return ModularServiceManager.provide(IUserService::class.java).isLogin()
    }

    fun getYDLUserInfo(): YdlUserInfo? {
        return ModularServiceManager.getPlatformUserService()?.getUser()
    }

    fun getUserInfo(): UserResponseBean.UserInfo? {
        return ModularServiceManager.provide(IUserService::class.java).getUserInfo()
konghaorui committed
51 52 53
    }

    fun loginWayIntent(activity: Activity): Intent? {
54
        return  ModularServiceManager.provide(IUserService::class.java).loginWayIntent(activity)
konghaorui committed
55 56 57
    }

    fun publishTrendIntent(activity: Activity, url: String, cover: String, title: String): Intent? {
konghaorui committed
58
        return getDynamicService()?.publishTrendIntent(activity, url, cover, title)
konghaorui committed
59 60 61
    }

    fun sendTestResultMessage(uid : String,content : String,title: String?,head : String?,url : String?,id : Int,share_url : String?, callback: IMRequestCallback<Void>) {
konghaorui committed
62
        getImService().sendTestResultMessage(uid, content, title, head, url, id, share_url, callback)
konghaorui committed
63 64 65 66 67 68
    }

    /**
     * 跳转红包
     */
    fun myRedPockIntent(activity: Activity){
konghaorui committed
69
        getAppService().myRedPockIntent(activity)
konghaorui committed
70 71
    }
}