Browse Source

refactor: 删除废弃函数

drake 1 năm trước cách đây
mục cha
commit
b8a5d14426

+ 0 - 9
net/src/main/java/com/drake/net/Net.kt

@@ -366,15 +366,6 @@ object Net {
     //</editor-fold>
 
     //<editor-fold desc="日志">
-    /**
-     * 输出异常日志
-     * @see NetConfig.debug
-     */
-    @Deprecated("命名变更, 后续版本将被删除", ReplaceWith("Net.debug(t)"))
-    fun printStackTrace(t: Throwable) {
-        debug(t)
-    }
-
     /**
      * 输出异常日志
      * @param message 如果非[Throwable]则会自动追加代码位置(文件:行号)

+ 0 - 44
net/src/main/java/com/drake/net/NetConfig.kt

@@ -64,25 +64,9 @@ object NetConfig {
      */
     internal var forceCache: ForceCache? = null
 
-    /** 是否启用日志 */
-    @Deprecated("命名变更, 后续版本将被删除", ReplaceWith("NetConfig.debug"))
-    var logEnabled
-        get() = debug
-        set(value) {
-            debug = value
-        }
-
     /** 是否启用日志 */
     var debug = true
 
-    /** 网络异常日志的标签 */
-    @Deprecated("命名变更, 后续版本将被删除", ReplaceWith("NetConfig.TAG"))
-    var logTag
-        get() = TAG
-        set(value) {
-            TAG = value
-        }
-
     /** 网络异常日志的标签 */
     var TAG = "NET_LOG"
 
@@ -103,34 +87,6 @@ object NetConfig {
     var dialogFactory: NetDialogFactory = NetDialogFactory
 
     //<editor-fold desc="初始化">
-    /**
-     * 初始化框架
-     * 不初始化也可以使用, 但是App使用多进程情况下要求为[NetConfig.host]或者[context]赋值, 否则会导致无法正常吐司或其他意外问题
-     * @param host 请求url的主机名, 该参数会在每次请求时自动和请求路径进行拼接(如果路径包含https/http则不会拼接)
-     * @param context 如果应用存在多进程请指定此参数初始化[NetConfig.app]
-     * @param config 进行配置网络请求
-     */
-    @Deprecated("命名变更, 后续版本将被删除", ReplaceWith("initialize(host, context, config)"))
-    fun init(
-        host: String = "",
-        context: Context? = null,
-        config: OkHttpClient.Builder.() -> Unit = {}
-    ) = initialize(host, context, config)
-
-    /**
-     * 初始化框架
-     * 不初始化也可以使用, 但是App使用多进程情况下要求为[NetConfig.host]或者[context]赋值, 否则会导致无法正常吐司或其他意外问题
-     * @param host 请求url的主机名
-     * @param context 如果应用存在多进程请指定此参数初始化[NetConfig.app]
-     * @param config 进行配置网络请求
-     */
-    @Deprecated("命名变更, 后续版本将被删除", ReplaceWith("initialize(host, context, config)"))
-    fun init(
-        host: String = "",
-        context: Context? = null,
-        config: OkHttpClient.Builder
-    ) = initialize(host, context, config)
-
     /**
      * 初始化框架
      * 不初始化也可以使用, 但是App使用多进程情况下要求为[NetConfig.host]或者[context]赋值, 否则会导致无法正常吐司或其他意外问题

+ 0 - 8
net/src/main/java/com/drake/net/cache/ForceCache.kt

@@ -377,14 +377,6 @@ class ForceCache internal constructor(
     val directory: File
         get() = cache.directory
 
-    @JvmName("-deprecated_directory")
-    @Deprecated(
-        message = "moved to val",
-        replaceWith = ReplaceWith(expression = "directory"),
-        level = DeprecationLevel.ERROR
-    )
-    fun directory(): File = cache.directory
-
     private inner class RealCacheRequest(
         private val editor: DiskLruCache.Editor
     ) : CacheRequest {

+ 0 - 9
net/src/main/java/com/drake/net/okhttp/OkHttpBuilder.kt

@@ -42,15 +42,6 @@ import javax.net.ssl.SSLContext
 import javax.net.ssl.TrustManager
 import javax.net.ssl.X509TrustManager
 
-/**
- * 开启日志
- * @param enabled 是否启用日志
- */
-@Deprecated("命名变更, 后续版本将被删除", ReplaceWith("setDebug(enabled)"))
-fun OkHttpClient.Builder.setLog(enabled: Boolean) = apply {
-    NetConfig.logEnabled = enabled
-}
-
 /**
  * 开启日志
  * @param enabled 是否启用日志

+ 0 - 31
net/src/main/java/com/drake/net/utils/FlowUtils.kt

@@ -37,37 +37,6 @@ import kotlinx.coroutines.flow.FlowCollector
 import kotlinx.coroutines.flow.callbackFlow
 import kotlinx.coroutines.flow.debounce
 
-/**
- * 收集Flow结果并过滤重复结果
- */
-@Deprecated("规范命名", ReplaceWith("launchIn(owner,event,dispatcher,action)"), DeprecationLevel.ERROR)
-@OptIn(InternalCoroutinesApi::class)
-inline fun <T> Flow<T>.listen(
-    owner: LifecycleOwner? = null,
-    event: Lifecycle.Event = Lifecycle.Event.ON_DESTROY,
-    dispatcher: CoroutineDispatcher = Dispatchers.Main,
-    crossinline action: suspend CoroutineScope.(value: T) -> Unit
-): AndroidScope = AndroidScope(owner, event, dispatcher).launch {
-    this@listen.collect(object : FlowCollector<T> {
-        override suspend fun emit(value: T) = action(this@launch, value)
-    })
-}
-
-/**
- * Flow直接创建作用域
- * @param owner 跟随的生命周期组件
- * @param event 销毁时机
- * @param dispatcher 指定调度器
- */
-@Deprecated("规范命名", ReplaceWith("launchIn(owner,event,dispatcher,action)"), DeprecationLevel.ERROR)
-@OptIn(InternalCoroutinesApi::class)
-inline fun <T> Flow<T>.scope(
-    owner: LifecycleOwner? = null,
-    event: Lifecycle.Event = Lifecycle.Event.ON_DESTROY,
-    dispatcher: CoroutineDispatcher = Dispatchers.Main,
-    crossinline action: suspend CoroutineScope.(value: T) -> Unit
-): AndroidScope = launchIn(owner, event, dispatcher, action)
-
 /**
  * Flow直接创建作用域
  * @param owner 跟随的生命周期组件