Skip to content

Commit

Permalink
1.4.9
Browse files Browse the repository at this point in the history
  • Loading branch information
mgy committed Aug 27, 2024
1 parent 7bbe32e commit 19b1841
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 20 deletions.
2 changes: 1 addition & 1 deletion connector-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>connector</artifactId>
<groupId>com.tuya</groupId>
<version>1.4.7</version>
<version>1.4.9</version>
</parent>

<artifactId>connector-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import lombok.*;
import lombok.experimental.FieldDefaults;
import okhttp3.OkHttpClient;
import retrofit2.Converter;

import java.util.Objects;

Expand Down Expand Up @@ -132,5 +133,5 @@ public ApiDataSource(String baseUrl, String ak, String sk,String entry) {
*/
OkHttpClient specificClient;

GsonBuilder gsonBuilder;
Converter.Factory converterFactory;
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import lombok.extern.slf4j.Slf4j;
import okhttp3.OkHttpClient;
import retrofit2.Call;
import retrofit2.Converter;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
Expand Down Expand Up @@ -279,13 +280,13 @@ private Retrofit getGlobalRetrofit() {
Logging.Level loggingLevel = apiDataSource.getLoggingLevel();
Logging.Strategy loggingStrategy = apiDataSource.getLoggingStrategy();
okHttpBuilder.connectionPool(new okhttp3.ConnectionPool(connectionPool.getMaxIdleConnections(),
connectionPool.getKeepAliveSecond(), TimeUnit.SECONDS))
.callTimeout(timeout.getCallTimeout(), TimeUnit.SECONDS)
.connectTimeout(timeout.getConnectTimeout(), TimeUnit.SECONDS)
.readTimeout(timeout.getReadTimeout(), TimeUnit.SECONDS)
.writeTimeout(timeout.getWriteTimeout(), TimeUnit.SECONDS)
.retryOnConnectionFailure(retryOnConnectionFailure)
.addInterceptor(HttpLoggingFactory.createHttpLoggingInterceptor(loggingLevel, loggingStrategy));
connectionPool.getKeepAliveSecond(), TimeUnit.SECONDS))
.callTimeout(timeout.getCallTimeout(), TimeUnit.SECONDS)
.connectTimeout(timeout.getConnectTimeout(), TimeUnit.SECONDS)
.readTimeout(timeout.getReadTimeout(), TimeUnit.SECONDS)
.writeTimeout(timeout.getWriteTimeout(), TimeUnit.SECONDS)
.retryOnConnectionFailure(retryOnConnectionFailure)
.addInterceptor(HttpLoggingFactory.createHttpLoggingInterceptor(loggingLevel, loggingStrategy));
}
boolean autoSetHeader = configuration.getApiDataSource().isAutoSetHeader();
HeaderProcessor headerProcessor = apiDataSource.getHeaderProcessor();
Expand All @@ -294,18 +295,18 @@ private Retrofit getGlobalRetrofit() {
Objects.requireNonNull(headerProcessor, "HeaderProcessor must not be null when autoSetHeader is enabled");
okHttpBuilder.addInterceptor(new DefaultHeaderInterceptor(headerProcessor, apiDataSource.getContextManager()));
}
GsonBuilder gsonBuilder = apiDataSource.getGsonBuilder();
if (Objects.isNull(gsonBuilder)) {
gsonBuilder = new GsonBuilder();
Converter.Factory converterFactory = apiDataSource.getConverterFactory();
if (Objects.isNull(converterFactory)) {
GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES);
gsonBuilder.setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE);
converterFactory = GsonConverterFactory.create(gsonBuilder.create());
}

retrofitClient = new Retrofit.Builder()
.baseUrl(apiDataSource.getBaseUrl())
.validateEagerly(validateEagerly)
.client(okHttpBuilder.build())
.addConverterFactory(GsonConverterFactory.create(gsonBuilder.create()))
.addConverterFactory(converterFactory)
.build();
}
}
Expand Down
2 changes: 1 addition & 1 deletion connector-messaging/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>connector</artifactId>
<groupId>com.tuya</groupId>
<version>1.4.7</version>
<version>1.4.9</version>
</parent>

<artifactId>connector-messaging</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>connector-spring-boot</artifactId>
<groupId>com.tuya</groupId>
<version>1.4.7</version>
<version>1.4.9</version>
</parent>

<artifactId>connector-spring-boot-autoconfigure</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>connector-spring-boot</artifactId>
<groupId>com.tuya</groupId>
<version>1.4.7</version>
<version>1.4.9</version>
</parent>

<artifactId>connector-spring-boot-starter</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion connector-spring-boot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>connector</artifactId>
<groupId>com.tuya</groupId>
<version>1.4.7</version>
<version>1.4.9</version>
</parent>

<artifactId>connector-spring-boot</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion connector-spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>connector</artifactId>
<groupId>com.tuya</groupId>
<version>1.4.7</version>
<version>1.4.9</version>
</parent>

<artifactId>connector-spring</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<groupId>com.tuya</groupId>
<artifactId>connector</artifactId>
<packaging>pom</packaging>
<version>1.4.7</version>
<version>1.4.9</version>

<modules>
<module>connector-api</module>
Expand Down

0 comments on commit 19b1841

Please sign in to comment.