replace network module
This commit is contained in:
@@ -37,16 +37,11 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.supportannos
|
||||
annotationProcessor rootProject.ext.dependencies.supportannos
|
||||
annotationProcessor rootProject.ext.dependencies.glidecompiler
|
||||
api rootProject.ext.dependencies.retrofit
|
||||
api rootProject.ext.dependencies.retrofitadapter
|
||||
api rootProject.ext.dependencies.retrofitconvertergson
|
||||
api rootProject.ext.dependencies.retrofitconverterscalars
|
||||
|
||||
api rootProject.ext.dependencies.mogoaicloudnetwork
|
||||
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
|
||||
@@ -1,46 +1,18 @@
|
||||
package com.mogo.utils.network;
|
||||
|
||||
|
||||
import androidx.collection.ArrayMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
|
||||
public final class RetrofitFactory {
|
||||
|
||||
private static final Map<String, Retrofit> sRpcServiceMap = new ArrayMap<String, Retrofit>();
|
||||
private static final Map<String, Retrofit> sRpcNoAdapterServiceMap = new ArrayMap<String, Retrofit>();
|
||||
|
||||
private RetrofitFactory() {
|
||||
}
|
||||
|
||||
public static synchronized Retrofit getInstance(String baseUrl) {
|
||||
Retrofit target = sRpcServiceMap.get(baseUrl);
|
||||
if (target == null) {
|
||||
target = new Retrofit.Builder().
|
||||
client(OkHttpFactory.getInstance()).
|
||||
baseUrl(baseUrl).
|
||||
addCallAdapterFactory(RxJava2CallAdapterFactory.create()).
|
||||
addConverterFactory(GsonConverterFactory.create()).
|
||||
build();
|
||||
sRpcServiceMap.put(baseUrl, target);
|
||||
}
|
||||
return target;
|
||||
return com.mogo.cloud.network.RetrofitFactory.INSTANCE.getInstance(baseUrl);
|
||||
}
|
||||
|
||||
public static synchronized Retrofit getInstanceNoCallAdapter(String baseUrl) {
|
||||
Retrofit target = sRpcNoAdapterServiceMap.get(baseUrl);
|
||||
if (target == null) {
|
||||
target = new Retrofit.Builder().
|
||||
client(OkHttpFactory.getInstance()).
|
||||
baseUrl(baseUrl).
|
||||
addConverterFactory(GsonConverterFactory.create()).
|
||||
build();
|
||||
sRpcNoAdapterServiceMap.put(baseUrl, target);
|
||||
}
|
||||
return target;
|
||||
return com.mogo.cloud.network.RetrofitFactory.INSTANCE.getInstanceNoCallAdapter(baseUrl);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user