mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-09 09:50:16 +08:00
weakRef context
This commit is contained in:
parent
db214d948d
commit
d1419824a9
@ -32,7 +32,7 @@ import net.mamoe.mirai.utils.unsafeWeakRef
|
||||
|
||||
@PublishedApi
|
||||
internal open class QQAndroidClient(
|
||||
val context: Context,
|
||||
context: Context,
|
||||
@MiraiInternalAPI("Be careful. Do not use the id in BotAccount. use client.uin instead")
|
||||
val account: BotAccount,
|
||||
|
||||
@ -40,6 +40,7 @@ internal open class QQAndroidClient(
|
||||
val device: DeviceInfo = SystemDeviceInfo(context),
|
||||
bot: QQAndroidBot
|
||||
) {
|
||||
val context by context.unsafeWeakRef()
|
||||
val bot: QQAndroidBot by bot.unsafeWeakRef()
|
||||
|
||||
val tgtgtKey: ByteArray = ByteArray(16) // generateTgtgtKey(device.guid)
|
||||
|
@ -3,10 +3,13 @@ package net.mamoe.mirai.qqandroid.utils
|
||||
import kotlinx.serialization.SerialId
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.protobuf.ProtoBuf
|
||||
import net.mamoe.mirai.utils.unsafeWeakRef
|
||||
|
||||
abstract class DeviceInfo(
|
||||
val context: Context
|
||||
context: Context
|
||||
) {
|
||||
val context: Context by context.unsafeWeakRef()
|
||||
|
||||
abstract val display: ByteArray
|
||||
abstract val product: ByteArray
|
||||
abstract val device: ByteArray
|
||||
@ -34,7 +37,6 @@ abstract class DeviceInfo(
|
||||
|
||||
abstract val imsiMd5: ByteArray
|
||||
abstract val imei: String
|
||||
abstract val ksid: String
|
||||
|
||||
abstract val ipAddress: String
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user