parent
673a58d6e7
commit
a6a7b80b73
@ -0,0 +1,13 @@
|
||||
package com.common.commonlibtest.manager
|
||||
|
||||
import com.common.commonlib.net.interceptor.RequestHeadInterceptor
|
||||
|
||||
class CookieInterceptor : RequestHeadInterceptor() {
|
||||
override fun getType(): String {
|
||||
return LoaderType.LOGIN.type
|
||||
}
|
||||
|
||||
override fun getKey(): String {
|
||||
return LoaderType.LOGIN.key
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package com.common.commonlibtest.manager
|
||||
|
||||
enum class LoaderType(val type: String, val key: String) {
|
||||
LOGIN("login", "cookie")
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
package com.common.commonlib.net;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import okhttp3.Interceptor;
|
||||
|
||||
public class CommonLoader<T> extends BaseObserve<T> {
|
||||
|
||||
public CommonLoader(@NonNull Class<T> clazz) {
|
||||
this(clazz, getBaseInterceptors());
|
||||
}
|
||||
|
||||
public CommonLoader(@NonNull Class<T> clazz, @NonNull List<? extends Interceptor> interceptors) {
|
||||
super(clazz, interceptors);
|
||||
}
|
||||
|
||||
private static List<? extends Interceptor> getBaseInterceptors() {
|
||||
List<Interceptor> interceptors = new ArrayList<>();
|
||||
//interceptors.add(new SessionExpiredInterceptor());
|
||||
return interceptors;
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.common.commonlib.net.interfaces
|
||||
|
||||
/**
|
||||
* 获取请求类别基础接口
|
||||
*
|
||||
* @author Alex Wang
|
||||
* @since 2022-2-25
|
||||
*/
|
||||
interface ITypedCommon {
|
||||
/**
|
||||
* 获取请求类别
|
||||
*/
|
||||
fun getType(): String
|
||||
}
|
Loading…
Reference in New Issue