@@ -33,6 +33,7 @@ class ViberClient {
3333 static final String VIBER_AUTH_TOKEN_HEADER = "X-Viber-Auth-Token" ;
3434 static final String USER_AGENT_HEADER_FIELD = "User-Agent" ;
3535 static final String USER_AGENT_HEADER_VALUE = "ViberBot-Java/" ;
36+ static final String VIBER_LIBRARY_VERSION = "1.0.7" ;
3637
3738 private static final String STATUS = "status" ;
3839 private static final int MAX_GET_ONLINE_IDS = 100 ;
@@ -51,7 +52,7 @@ class ViberClient {
5152 ViberClient (final @ Nonnull String apiUrl , final @ Nonnull String authToken ) {
5253 this .apiUrl = checkNotEmpty (apiUrl );
5354 this .authToken = checkNotEmpty (authToken );
54- this .userAgent = String .format ("%s%s" , USER_AGENT_HEADER_VALUE , fetchUserAgentVersion () );
55+ this .userAgent = String .format ("%s%s" , USER_AGENT_HEADER_VALUE , VIBER_LIBRARY_VERSION );
5556 }
5657
5758 ListenableFuture <ApiResponse > setWebhook (final @ Nullable String url , final @ Nonnull Collection <Event > events ) {
@@ -84,18 +85,6 @@ ListenableFuture<ApiResponse> getOnlineStatus(final @Nonnull Collection<String>
8485 }});
8586 }
8687
87- @ VisibleForTesting
88- String fetchUserAgentVersion () {
89- Properties properties = new Properties ();
90- try {
91- properties .load (getClass ().getClassLoader ().getResourceAsStream ("./version.properties" ));
92- return properties .getProperty ("version" );
93- } catch (Exception e ) {
94- logger .error ("Could not fetch user agent" , e );
95- return "unknown" ;
96- }
97- }
98-
9988 @ VisibleForTesting
10089 Request createRequest (@ Nonnull Endpoint endpoint , RequestBody body ) {
10190 return new Request .Builder ()
0 commit comments