From 570548bbba73ad49d2a94e81a7b1052b86cce33a Mon Sep 17 00:00:00 2001 From: Vladislav Gruchik <4280527+vagruchi@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:12:18 +0100 Subject: [PATCH] fix: version file read happens only once (#160) Co-authored-by: Ali Momen Sani --- .../getstream/chat/java/services/framework/DefaultClient.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/getstream/chat/java/services/framework/DefaultClient.java b/src/main/java/io/getstream/chat/java/services/framework/DefaultClient.java index e42801bc..a7cde751 100644 --- a/src/main/java/io/getstream/chat/java/services/framework/DefaultClient.java +++ b/src/main/java/io/getstream/chat/java/services/framework/DefaultClient.java @@ -95,7 +95,7 @@ private Retrofit buildRetrofitClient() { .newBuilder() .url(url) .header("Content-Type", "application/json") - .header("X-Stream-Client", "stream-java-client-" + getSdkVersion()) + .header("X-Stream-Client", "stream-java-client-" + sdkVersion) .header("Stream-Auth-Type", "jwt") .header("Authorization", jwtToken(apiSecret)) .build(); @@ -203,6 +203,8 @@ private static String getStreamChatBaseUrl(@NotNull Properties properties) { return url.toString(); } + private static final @NotNull String sdkVersion = getSdkVersion(); + private static @NotNull String getSdkVersion() { var clsLoader = DefaultClient.class.getClassLoader(); try (var inputStream = clsLoader.getResourceAsStream("version.properties")) {