FMIn.kt 1.73 KB
Newer Older
徐健 committed
1 2 3
package com.yidianling.fm.router

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

/**
 * author : Zhangwenchao
 * e-mail : zhangwch@yidianling.com
 * time   : 2018/04/25
 */
object FMIn {
konghaorui committed
17 18 19 20 21 22 23
    fun getAppService(): IAppService {
        return ModularServiceManager.provide(IAppService::class.java)
    }

    fun getDynamicService(): IDynamicService {
        return ModularServiceManager.provide(IDynamicService::class.java)
    }
徐健 committed
24 25 26 27 28

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

konghaorui committed
29 30
    fun mainIntent(activity: Activity){
        getAppService().mainIntent(activity)
徐健 committed
31 32 33 34 35 36 37 38 39 40
    }

    fun loginWayIntent(activity: Activity): Intent? {
        return ModularServiceManager.provide(IUserService::class.java).loginWayIntent(activity)
    }

    /**
     * FM分享到心事动态
     */
    fun publisFmToTrend(activity: Activity, url: String, cover: String, title: String) : Intent?{
konghaorui committed
41
        return getDynamicService()?.publishFmToTrend(activity,url,cover,title)
徐健 committed
42
    }
43 44 45 46 47 48 49 50
    /**
     * 调用优先使用一键登录,并返回调用时的登录状态,
     * @param isOpenDialog true:一键登录使用弹窗展示 false:一键登录使用全屏模式
     * @return true:已登录,不触发登录跳转,false:未登录,优先一键登录
     * */
    fun loginByOneKeyLogin(context: Context,isOpenDialog: Boolean) :Boolean{
        return ModularServiceManager.provide(IUserService::class.java).loginByOneKeyLogin(context,isOpenDialog)
    }
徐健 committed
51 52

}