44 lines
1.3 KiB
Kotlin
44 lines
1.3 KiB
Kotlin
package com.gh.common.util
|
|
|
|
import com.gh.common.constant.Config
|
|
import com.gh.gamecenter.entity.StartupAdEntity
|
|
import com.gh.gamecenter.feature.entity.SettingsEntity
|
|
|
|
object AdHelper {
|
|
|
|
// 搜索为空/求版本/意见反馈-功能收录/发现/模拟器游戏
|
|
const val LOCATION_SEARCH_EMPTY = "search_empty"
|
|
const val LOCATION_GAME_REQUEST_VERSION = "game_request_version"
|
|
const val LOCATION_SUGGESTION_FUNCTION = "suggestion_function"
|
|
const val LOCATION_SIMULATOR_GAME = "simulator_game"
|
|
|
|
@JvmStatic
|
|
fun getStartUp(): StartupAdEntity? {
|
|
return Config.getNewApiSettingsEntity()?.startup
|
|
}
|
|
|
|
fun getAd(location: String): SettingsEntity.AD? {
|
|
val adList = Config.getSettings()?.adList ?: return null
|
|
|
|
for (ad in adList) {
|
|
if (ad.location == location) return ad
|
|
}
|
|
return null
|
|
}
|
|
|
|
fun getAdForLocation(location: String): SettingsEntity.AD? {
|
|
val adList = Config.getSettings()?.adList ?: return null
|
|
|
|
var result: SettingsEntity.AD? = null
|
|
run outside@{
|
|
for (ad in adList) {
|
|
if (ad.location == location) {
|
|
result = ad
|
|
return@outside
|
|
}
|
|
}
|
|
}
|
|
|
|
return result
|
|
}
|
|
} |