mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-24 14:30:09 +08:00
Review and migrate deprecated calls
This commit is contained in:
parent
b5db147985
commit
02681428c9
@ -550,7 +550,9 @@ public open class BotConfiguration { // open for Java
|
||||
new.heartbeatTimeoutMillis = heartbeatTimeoutMillis
|
||||
new.statHeartbeatPeriodMillis = statHeartbeatPeriodMillis
|
||||
new.heartbeatStrategy = heartbeatStrategy
|
||||
@Suppress("DEPRECATION")
|
||||
new.firstReconnectDelayMillis = firstReconnectDelayMillis
|
||||
@Suppress("DEPRECATION")
|
||||
new.reconnectPeriodMillis = reconnectPeriodMillis
|
||||
new.reconnectionRetryTimes = reconnectionRetryTimes
|
||||
new.autoReconnectOnForceOffline = autoReconnectOnForceOffline
|
||||
|
@ -555,7 +555,7 @@ public interface RemoteFile {
|
||||
path: String,
|
||||
resource: ExternalResource,
|
||||
callback: ProgressionCallback? = null
|
||||
): FileMessage = this.filesRoot.resolve(path).upload(resource, callback)
|
||||
): FileMessage = @Suppress("DEPRECATION") this.filesRoot.resolve(path).upload(resource, callback)
|
||||
|
||||
/**
|
||||
* 上传文件并获取文件消息, 但不发送.
|
||||
@ -579,7 +579,7 @@ public interface RemoteFile {
|
||||
path: String,
|
||||
file: File,
|
||||
callback: ProgressionCallback? = null
|
||||
): FileMessage = this.filesRoot.resolve(path).upload(file, callback)
|
||||
): FileMessage = @Suppress("DEPRECATION") this.filesRoot.resolve(path).upload(file, callback)
|
||||
|
||||
/**
|
||||
* 上传文件并发送文件消息到相关 [FileSupported].
|
||||
@ -592,7 +592,9 @@ public interface RemoteFile {
|
||||
path: String,
|
||||
resource: ExternalResource,
|
||||
callback: ProgressionCallback? = null
|
||||
): MessageReceipt<C> = this.filesRoot.resolve(path).upload(resource, callback).sendTo(this)
|
||||
): MessageReceipt<C> =
|
||||
@Suppress("DEPRECATION")
|
||||
this.filesRoot.resolve(path).upload(resource, callback).sendTo(this)
|
||||
|
||||
/**
|
||||
* 上传文件并发送文件消息到相关 [FileSupported].
|
||||
@ -604,6 +606,8 @@ public interface RemoteFile {
|
||||
path: String,
|
||||
file: File,
|
||||
callback: ProgressionCallback? = null
|
||||
): MessageReceipt<C> = this.filesRoot.resolve(path).upload(file, callback).sendTo(this)
|
||||
): MessageReceipt<C> =
|
||||
@Suppress("DEPRECATION")
|
||||
this.filesRoot.resolve(path).upload(file, callback).sendTo(this)
|
||||
}
|
||||
}
|
||||
|
@ -230,8 +230,6 @@ internal val QQAndroidClient.apkId: ByteArray get() = "com.tencent.mobileqq".toB
|
||||
internal val QQAndroidClient.ssoVersion: Int get() = 15
|
||||
internal val QQAndroidClient.networkType: NetworkType get() = NetworkType.WIFI
|
||||
internal val QQAndroidClient.appClientVersion: Int get() = 0
|
||||
internal val QQAndroidClient.buildVer: String get() = "8.4.18.4810" // 8.2.0.1296 // 8.4.8.4810 // 8.2.7.4410
|
||||
internal val QQAndroidClient.apkVersionName: ByteArray get() = protocol.ver.toByteArray() //"8.4.18".toByteArray()
|
||||
internal val QQAndroidClient.mainSigMap: Int get() = protocol.mainSigMap
|
||||
internal val QQAndroidClient.miscBitMap: Int get() = protocol.miscBitMap // 184024956 // 也可能是 150470524 ?
|
||||
internal val QQAndroidClient.clientVersion: String get() = "android ${protocol.ver}" // android 8.5.0
|
||||
|
@ -71,7 +71,7 @@ internal interface StateObserver {
|
||||
val LOGGING: StateObserver? = when (systemProp(
|
||||
"mirai.debug.network.state.observer.logging",
|
||||
"off"
|
||||
).toLowerCase()) {
|
||||
).lowercase()) {
|
||||
"full" -> {
|
||||
SafeStateObserver(
|
||||
LoggingStateObserver(MiraiLogger.create("States"), true),
|
||||
|
@ -524,6 +524,7 @@ internal class RemoteFileImpl(
|
||||
}
|
||||
|
||||
override suspend fun uploadAndSend(resource: ExternalResource): MessageReceipt<Contact> {
|
||||
@Suppress("DEPRECATION")
|
||||
return upload(resource).sendTo(contact)
|
||||
}
|
||||
|
||||
|
@ -64,8 +64,6 @@ internal abstract class AbstractRealNetworkHandlerTest<H : NetworkHandler> : Abs
|
||||
* This overrides [QQAndroidBot.components]
|
||||
*/
|
||||
open val defaultComponents = ConcurrentComponentStorage().apply {
|
||||
val components = this
|
||||
val configuration = bot.configuration
|
||||
set(SsoProcessorContext, SsoProcessorContextImpl(bot))
|
||||
set(SsoProcessor, object : TestSsoProcessor(bot) {
|
||||
override suspend fun login(handler: NetworkHandler) {
|
||||
|
@ -14,7 +14,6 @@ import io.netty.channel.embedded.EmbeddedChannel
|
||||
import io.netty.util.ReferenceCountUtil
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import net.mamoe.mirai.internal.QQAndroidBot
|
||||
import net.mamoe.mirai.internal.network.components.EventDispatcher
|
||||
import net.mamoe.mirai.internal.network.components.SsoProcessor
|
||||
import net.mamoe.mirai.internal.network.framework.AbstractRealNetworkHandlerTest
|
||||
import net.mamoe.mirai.internal.network.framework.ITestNetworkHandler
|
||||
@ -98,6 +97,4 @@ internal fun AbstractNettyNHTest.setSsoProcessor(action: suspend SsoProcessor.(h
|
||||
defaultComponents[SsoProcessor] = object : SsoProcessor by defaultComponents[SsoProcessor] {
|
||||
override suspend fun login(handler: NetworkHandler) = action(handler)
|
||||
}
|
||||
}
|
||||
|
||||
internal val AbstractNettyNHTest.eventDispatcher get() = bot.components[EventDispatcher]
|
||||
}
|
@ -16,14 +16,13 @@ import kotlinx.coroutines.withTimeout
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
import kotlin.coroutines.EmptyCoroutineContext
|
||||
import kotlin.time.Duration
|
||||
import kotlin.time.seconds
|
||||
|
||||
fun runBlockingUnit(
|
||||
context: CoroutineContext = EmptyCoroutineContext,
|
||||
block: suspend CoroutineScope.() -> Unit
|
||||
) {
|
||||
return runBlocking(context) {
|
||||
withTimeout(60.seconds) { // always checks for infinite runs.
|
||||
withTimeout(Duration.seconds(60)) { // always checks for infinite runs.
|
||||
block()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user