mirror of
https://github.com/whitechi73/OpenShamrock.git
synced 2024-08-14 13:12:17 +08:00
Shamrock
: add version restrictions for GuildSdk
This commit is contained in:
parent
036f8a49ac
commit
b10b10d4a2
@ -8,8 +8,10 @@ import moe.fuqiuluo.shamrock.remote.action.ActionSession
|
|||||||
import moe.fuqiuluo.shamrock.remote.action.IActionHandler
|
import moe.fuqiuluo.shamrock.remote.action.IActionHandler
|
||||||
import moe.fuqiuluo.shamrock.tools.EmptyJsonArray
|
import moe.fuqiuluo.shamrock.tools.EmptyJsonArray
|
||||||
import moe.fuqiuluo.shamrock.tools.EmptyJsonString
|
import moe.fuqiuluo.shamrock.tools.EmptyJsonString
|
||||||
|
import moe.fuqiuluo.shamrock.utils.PlatformUtils
|
||||||
import moe.fuqiuluo.shamrock.xposed.helper.NTServiceFetcher
|
import moe.fuqiuluo.shamrock.xposed.helper.NTServiceFetcher
|
||||||
import moe.fuqiuluo.symbols.OneBotHandler
|
import moe.fuqiuluo.symbols.OneBotHandler
|
||||||
|
import mqq.app.MobileQQ
|
||||||
|
|
||||||
@OneBotHandler("get_guild_list")
|
@OneBotHandler("get_guild_list")
|
||||||
internal object GetGuildList : IActionHandler() {
|
internal object GetGuildList : IActionHandler() {
|
||||||
@ -22,6 +24,7 @@ internal object GetGuildList : IActionHandler() {
|
|||||||
if (refresh) {
|
if (refresh) {
|
||||||
kernelGProService.refreshGuildList(true)
|
kernelGProService.refreshGuildList(true)
|
||||||
}
|
}
|
||||||
|
PlatformUtils.requireMinQQVersion(version = PlatformUtils.QQ_9_0_8_VER)
|
||||||
val result = arrayListOf<GuildInfo>()
|
val result = arrayListOf<GuildInfo>()
|
||||||
kernelGProService.guildListFromCache.forEach {
|
kernelGProService.guildListFromCache.forEach {
|
||||||
if (it.result != 0) return@forEach
|
if (it.result != 0) return@forEach
|
||||||
|
@ -16,11 +16,24 @@ import mqq.app.MobileQQ
|
|||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
|
|
||||||
internal object PlatformUtils {
|
internal object PlatformUtils {
|
||||||
|
const val QQ_9_0_8_VER = 5540
|
||||||
|
|
||||||
fun getQQVersion(context: Context): String {
|
fun getQQVersion(context: Context): String {
|
||||||
val packageInfo: PackageInfo = context.packageManager.getPackageInfo(context.packageName, 0)
|
val packageInfo: PackageInfo = context.packageManager.getPackageInfo(context.packageName, 0)
|
||||||
return packageInfo.versionName
|
return packageInfo.versionName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getQQVersionCode(context: Context = MobileQQ.getContext()): Int {
|
||||||
|
val packageInfo: PackageInfo = context.packageManager.getPackageInfo(context.packageName, 0)
|
||||||
|
return packageInfo.versionCode
|
||||||
|
}
|
||||||
|
|
||||||
|
fun requireMinQQVersion(context: Context = MobileQQ.getContext(), version: Int) {
|
||||||
|
require(getQQVersionCode(context) >= version) {
|
||||||
|
"require QQ version >= $version, but current version is ${getQQVersionCode(context)}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取OIDB包的ClientVersion信息
|
* 获取OIDB包的ClientVersion信息
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user