Skip to content

Commit

Permalink
Soft-deprecate (document) ConnectionTester
Browse files Browse the repository at this point in the history
  • Loading branch information
Him188 committed Feb 8, 2025
1 parent a58a7a4 commit 9ab27ca
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Copyright (C) 2024-2025 OpenAni and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license, which can be found at the following link.
*
* https://github.com/open-ani/ani/blob/main/LICENSE
*/

package me.him188.ani.app.ui.settings.framework

import androidx.compose.foundation.layout.Arrangement
Expand Down Expand Up @@ -25,11 +34,15 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import me.him188.ani.app.domain.settings.ServiceConnectionTester
import kotlin.time.Duration
import kotlin.time.DurationUnit
import kotlin.time.measureTimedValue


/**
* @suppress soft deprecated. use [ServiceConnectionTester] instead.
*/
@Immutable
enum class ConnectionTestResult {
SUCCESS,
Expand All @@ -40,8 +53,14 @@ enum class ConnectionTestResult {
fun Boolean.toConnectionTestResult() =
if (this) ConnectionTestResult.SUCCESS else ConnectionTestResult.FAILED

/**
* @suppress soft deprecated. use [ServiceConnectionTester] instead.
*/
typealias ConnectionTester = Tester<ConnectionTestResult>

/**
* @suppress soft deprecated. use [ServiceConnectionTester] instead.
*/
fun ConnectionTester(
id: String,
testConnection: suspend () -> ConnectionTestResult,
Expand All @@ -53,6 +72,9 @@ fun ConnectionTester(
},
)

/**
* @suppress soft deprecated. use [ServiceConnectionTester] instead.
*/
@Stable
open class Tester<T>(
val id: String,
Expand Down Expand Up @@ -96,6 +118,9 @@ open class Tester<T>(
}
}

/**
* @suppress deprecated.
*/
@Composable
fun ConnectionTesterResultIndicator(
tester: ConnectionTester,
Expand Down

0 comments on commit 9ab27ca

Please sign in to comment.