package com.gh.common.provider

import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.gh.gamecenter.R
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.core.provider.IAppProvider
import com.halo.assistant.HaloApp

@Route(path = RouteConsts.provider.app, name = "Application暴露服务")
class AppProviderImpl : IAppProvider {
    override fun init(context: Context?) {
        // Do nothing
    }

    override fun getAppName(): String {
        return HaloApp.getInstance().getString(R.string.app_name)
    }

    override fun getGid(): String {
        return HaloApp.getInstance().gid ?: ""
    }

    override fun refreshGid() {
        HaloApp.getInstance().refreshGid()
    }

    override fun getOaid(): String {
        return HaloApp.getInstance().oaid ?: ""
    }

    override fun getChannel(): String {
        return HaloApp.getInstance().channel ?: ""
    }

    override fun setChannel(channel: String) {
        HaloApp.getInstance().channel = channel
    }

    override fun getUserAgent(): String {
        return HaloApp.getInstance().userAgent ?: ""
    }

    override fun getServerUserMark(): String {
        return HaloApp.getInstance().serverUserMark ?: ""
    }

    override fun getDeviceRamSize(): Long {
        return HaloApp.getInstance().deviceRamSize
    }

    override fun getTemporaryLocalDeviceId(): String {
        return HaloApp.getInstance().temporaryLocalDeviceId ?: ""
    }

    override fun isUserAcceptPrivacyPolicy(context: Context): Boolean {
        return HaloApp.isUserAcceptPrivacyPolicy(context)
    }
}