瀏覽代碼

删除废弃函数

drake 3 年之前
父節點
當前提交
711c0266db

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

@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2018 Drake, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.drake.net
-
-import com.drake.net.okhttp.toNetOkhttp
-import okhttp3.OkHttpClient
-
-
-/**
- * 初始化框架
- * @param host 请求url的主机名
- * @param config 进行配置网络请求
- *
- * 如果想要自动解析数据模型请配置转换器, 可以继承或者参考默认转换器
- *
- * @see com.drake.net.convert.JSONConvert
- */
-@Deprecated("函数迁移", replaceWith = ReplaceWith("NetConfig.init(host, config)"), DeprecationLevel.ERROR)
-fun initNet(host: String = "", config: OkHttpClient.Builder.() -> Unit = {}) {
-    NetConfig.host = host
-    val builder = OkHttpClient.Builder()
-    builder.config()
-    NetConfig.okHttpClient = builder.toNetOkhttp().build()
-}
-
-@Deprecated("函数迁移", replaceWith = ReplaceWith("NetConfig.init(host, config)"), DeprecationLevel.ERROR)
-fun initNet(host: String = "", config: OkHttpClient.Builder) {
-    NetConfig.host = host
-    NetConfig.okHttpClient = config.toNetOkhttp().build()
-}

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

@@ -17,11 +17,7 @@
 package com.drake.net
 package com.drake.net
 
 
 import android.annotation.SuppressLint
 import android.annotation.SuppressLint
-import android.app.Dialog
-import android.app.ProgressDialog
 import android.content.Context
 import android.content.Context
-import android.view.View
-import androidx.fragment.app.FragmentActivity
 import com.drake.net.NetConfig.app
 import com.drake.net.NetConfig.app
 import com.drake.net.NetConfig.converter
 import com.drake.net.NetConfig.converter
 import com.drake.net.NetConfig.dialogFactory
 import com.drake.net.NetConfig.dialogFactory
@@ -89,25 +85,6 @@ object NetConfig {
     /** 对话框构建工厂 */
     /** 对话框构建工厂 */
     var dialogFactory: NetDialogFactory = NetDialogFactory
     var dialogFactory: NetDialogFactory = NetDialogFactory
 
 
-    /** 对话框, 已废弃, 请使用[dialogFactory] */
-    @Deprecated("废弃", replaceWith = ReplaceWith("NetConfig.dialogFactory"), DeprecationLevel.ERROR)
-    var onDialog: (FragmentActivity) -> Dialog = { activity ->
-        val progress = ProgressDialog(activity)
-        progress.setMessage(activity.getString(R.string.net_dialog_msg))
-        progress
-    }
-
-    /** 全局错误处理器, 已废弃, 请使用[errorHandler] */
-    @Deprecated("使用NetErrorHandler统一处理错误", replaceWith = ReplaceWith("NetConfig.errorHandler"), DeprecationLevel.ERROR)
-    var onError: Throwable.() -> Unit = onError@{
-    }
-
-
-    /** 网络请求自动处理缺省页时发生错误的处理逻辑 */
-    @Deprecated("使用NetErrorHandler统一处理错误", replaceWith = ReplaceWith("NetConfig.errorHandler"), DeprecationLevel.ERROR)
-    var onStateError: Throwable.(view: View) -> Unit = {
-    }
-
     //<editor-fold desc="初始化">
     //<editor-fold desc="初始化">
     /**
     /**
      * 初始化框架, 该函数仅在Kotlin下有效
      * 初始化框架, 该函数仅在Kotlin下有效

+ 0 - 43
net/src/main/java/com/drake/net/okhttp/OkHttpExtension.kt

@@ -16,9 +16,6 @@
 
 
 package com.drake.net.okhttp
 package com.drake.net.okhttp
 
 
-import android.app.Dialog
-import android.view.View
-import androidx.fragment.app.FragmentActivity
 import com.drake.net.NetConfig
 import com.drake.net.NetConfig
 import com.drake.net.convert.NetConverter
 import com.drake.net.convert.NetConverter
 import com.drake.net.interceptor.NetOkHttpInterceptor
 import com.drake.net.interceptor.NetOkHttpInterceptor
@@ -135,48 +132,8 @@ fun OkHttpClient.Builder.setRequestInterceptor(interceptor: RequestInterceptor)
     NetConfig.requestInterceptor = interceptor
     NetConfig.requestInterceptor = interceptor
 }
 }
 
 
-/**
- * 全局网络请求错误捕获
- */
-@Deprecated(
-    message = "使用NetErrorHandler统一处理错误",
-    replaceWith = ReplaceWith("setErrorHandler(NetErrorHandler())"),
-    DeprecationLevel.ERROR
-)
-fun OkHttpClient.Builder.onError(block: Throwable.() -> Unit) = apply {
-    // NetConfig.onError = block
-}
-
-/**
- * 全局缺省页错误捕获
- */
-@Deprecated(
-    message = "使用NetErrorHandler统一处理错误",
-    replaceWith = ReplaceWith("setErrorHandler(NetErrorHandler())"),
-    DeprecationLevel.ERROR
-)
-fun OkHttpClient.Builder.onStateError(block: Throwable.(view: View) -> Unit) = apply {
-    // NetConfig.onStateError = block
-}
-
-/**
- * 全局加载对话框设置
- * 设置在使用scopeDialog自动弹出的加载对话框
- */
-@Deprecated(
-    message = "使用NetDialogFactory创建",
-    replaceWith = ReplaceWith("setDialogFactory(NetDialogFactory())"),
-    DeprecationLevel.ERROR
-)
-fun OkHttpClient.Builder.onDialog(block: (FragmentActivity) -> Dialog) =
-    apply {
-        // NetConfig.onDialog = block
-    }
-
 /**
 /**
  * 全局错误处理器
  * 全局错误处理器
- *
- * 会覆盖[onError]和[onStateError]
  */
  */
 fun OkHttpClient.Builder.setErrorHandler(handler: NetErrorHandler) = apply {
 fun OkHttpClient.Builder.setErrorHandler(handler: NetErrorHandler) = apply {
     NetConfig.errorHandler = handler
     NetConfig.errorHandler = handler

+ 0 - 78
net/src/main/java/com/drake/net/reflect/TypeToken.java

@@ -17,7 +17,6 @@
 package com.drake.net.reflect;
 package com.drake.net.reflect;
 
 
 
 
-import java.lang.reflect.GenericArrayType;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.lang.reflect.Type;
 import java.lang.reflect.TypeVariable;
 import java.lang.reflect.TypeVariable;
@@ -100,83 +99,6 @@ public class TypeToken<T> {
     return type;
     return type;
   }
   }
 
 
-  /**
-   * Check if this type is assignable from the given class object.
-   *
-   * @deprecated this implementation may be inconsistent with javac for types
-   *     with wildcards.
-   */
-  @Deprecated
-  public boolean isAssignableFrom(Class<?> cls) {
-    return isAssignableFrom((Type) cls);
-  }
-
-  /**
-   * Check if this type is assignable from the given Type.
-   *
-   * @deprecated this implementation may be inconsistent with javac for types
-   *     with wildcards.
-   */
-  @Deprecated
-  public boolean isAssignableFrom(Type from) {
-    if (from == null) {
-      return false;
-    }
-
-    if (type.equals(from)) {
-      return true;
-    }
-
-    if (type instanceof Class<?>) {
-      return rawType.isAssignableFrom($Gson$Types.getRawType(from));
-    } else if (type instanceof ParameterizedType) {
-      return isAssignableFrom(from, (ParameterizedType) type,
-          new HashMap<String, Type>());
-    } else if (type instanceof GenericArrayType) {
-      return rawType.isAssignableFrom($Gson$Types.getRawType(from))
-          && isAssignableFrom(from, (GenericArrayType) type);
-    } else {
-      throw buildUnexpectedTypeError(
-          type, Class.class, ParameterizedType.class, GenericArrayType.class);
-    }
-  }
-
-  /**
-   * Check if this type is assignable from the given type token.
-   *
-   * @deprecated this implementation may be inconsistent with javac for types
-   *     with wildcards.
-   */
-  @Deprecated
-  public boolean isAssignableFrom(TypeToken<?> token) {
-    return isAssignableFrom(token.getType());
-  }
-
-  /**
-   * Private helper function that performs some assignability checks for
-   * the provided GenericArrayType.
-   */
-  private static boolean isAssignableFrom(Type from, GenericArrayType to) {
-    Type toGenericComponentType = to.getGenericComponentType();
-    if (toGenericComponentType instanceof ParameterizedType) {
-      Type t = from;
-      if (from instanceof GenericArrayType) {
-        t = ((GenericArrayType) from).getGenericComponentType();
-      } else if (from instanceof Class<?>) {
-        Class<?> classType = (Class<?>) from;
-        while (classType.isArray()) {
-          classType = classType.getComponentType();
-        }
-        t = classType;
-      }
-      return isAssignableFrom(t, (ParameterizedType) toGenericComponentType,
-          new HashMap<String, Type>());
-    }
-    // No generic defined on "to"; therefore, return true and let other
-    // checks determine assignability
-    return true;
-  }
-
   /**
   /**
    * Private recursive helper function to actually do the type-safe checking
    * Private recursive helper function to actually do the type-safe checking
    * of assignability.
    * of assignability.

+ 0 - 20
net/src/main/java/com/drake/net/request/RequestExtension.kt

@@ -70,26 +70,6 @@ var Request.kType: KType?
         setLabel(NetLabel.RequestKType(value))
         setLabel(NetLabel.RequestKType(value))
     }
     }
 
 
-@Deprecated("建议使用属性", ReplaceWith("id"), DeprecationLevel.ERROR)
-fun Request.id(): Any? {
-    return id
-}
-
-@Deprecated("建议使用属性", ReplaceWith("group"), DeprecationLevel.ERROR)
-fun Request.group(): Any? {
-    return group
-}
-
-@Deprecated("建议使用属性", ReplaceWith("logRecord"), DeprecationLevel.ERROR)
-fun Request.isLogRecord(): Boolean? {
-    return logRecord
-}
-
-@Deprecated("建议使用属性", ReplaceWith("kType"), DeprecationLevel.ERROR)
-fun Request.kType(): KType? {
-    return kType
-}
-
 //</editor-fold>
 //</editor-fold>
 
 
 //<editor-fold desc="Request.Builder">
 //<editor-fold desc="Request.Builder">