Skip to content

Commit f7088dd

Browse files
committed
Change of some internal method names
1 parent d92bc67 commit f7088dd

File tree

8 files changed

+19
-22
lines changed

8 files changed

+19
-22
lines changed

build.gradle

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
plugins {
2-
// Apply the java-library plugin to add support for Java Library
3-
id 'java-library'
4-
id "com.github.johnrengelman.shadow" version "6.0.0"
2+
id 'java'
3+
id "com.github.johnrengelman.shadow" version "6.1.0"
54
}
65

76
jar {
@@ -22,22 +21,22 @@ dependencies {
2221
implementation 'com.google.code.gson:gson:2.8.6'
2322

2423
// https://mvnrepository.com/artifact/commons-codec/commons-codec
25-
compile group: 'commons-codec', name: 'commons-codec', version: '1.14'
24+
implementation group: 'commons-codec', name: 'commons-codec', version: '1.14'
2625

2726
// https://mvnrepository.com/artifact/commons-io/commons-io
28-
compile group: 'commons-io', name: 'commons-io', version: '2.7'
27+
implementation group: 'commons-io', name: 'commons-io', version: '2.7'
2928

3029
// https://mvnrepository.com/artifact/org.whispersystems/curve25519-java
31-
compile group: 'org.whispersystems', name: 'curve25519-java', version: '0.5.0'
30+
implementation group: 'org.whispersystems', name: 'curve25519-java', version: '0.5.0'
3231

3332
// https://mvnrepository.com/artifact/com.google.zxing/core
34-
compile group: 'com.google.zxing', name: 'core', version: '3.4.0'
33+
implementation group: 'com.google.zxing', name: 'core', version: '3.4.0'
3534

3635
// https://mvnrepository.com/artifact/at.favre.lib/hkdf
37-
compile group: 'at.favre.lib', name: 'hkdf', version: '1.0.2'
36+
implementation group: 'at.favre.lib', name: 'hkdf', version: '1.0.2'
3837

3938
// https://mvnrepository.com/artifact/com.neovisionaries/nv-websocket-client
40-
compile 'com.neovisionaries:nv-websocket-client:2.10'
39+
implementation 'com.neovisionaries:nv-websocket-client:2.10'
4140

4241
// Use JUnit test framework
4342
testImplementation 'junit:junit:4.12'
-642 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
-121 Bytes
Binary file not shown.
-6 Bytes
Binary file not shown.

src/main/java/icu/jnet/whatsjava/WAClient.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ private void login() {
9494

9595
// Random clientId as 16 base64-encoded bytes
9696
String clientId = credentials.getClientId();
97-
String loginRequest = Utils.buildWebsocketJsonRequest(RequestType.LOGIN, clientId);
98-
97+
String loginRequest = Utils.buildWebSocketJsonRequest(RequestType.LOGIN, clientId);
98+
9999
ws.sendText(loginRequest);
100100
}
101101

@@ -105,7 +105,7 @@ private void restoreSession() {
105105
String serverToken = credentials.getServerToken();
106106
String clientId = credentials.getClientId();
107107

108-
String restoreRequest = Utils.buildWebsocketJsonRequest(RequestType.RESTORE_SESSION,
108+
String restoreRequest = Utils.buildWebSocketJsonRequest(RequestType.RESTORE_SESSION,
109109
clientToken, serverToken, clientId);
110110

111111
ws.sendText(restoreRequest);
@@ -127,15 +127,15 @@ private void solveChallenge(String message) {
127127
String serverToken = credentials.getServerToken();
128128
String clientId = credentials.getClientId();
129129

130-
String challengeRequest = Utils.buildWebsocketJsonRequest(RequestType.SOLVE_CHALLENGE,
130+
String challengeRequest = Utils.buildWebSocketJsonRequest(RequestType.SOLVE_CHALLENGE,
131131
signedChallengeBase64, serverToken, clientId);
132132

133133
ws.sendText(challengeRequest);
134134
}
135135

136136
// QR code expired request a new one
137137
protected void requestNewServerId() {
138-
ws.sendText(Utils.buildWebsocketJsonRequest(RequestType.NEW_SERVER_ID, ""));
138+
ws.sendText(Utils.buildWebSocketJsonRequest(RequestType.NEW_SERVER_ID, ""));
139139
}
140140

141141
// Gets called after a successful login
@@ -219,14 +219,13 @@ public void onTextMessage(WebSocket websocket, String message) {
219219
if(message.contains("\"Props\"") && !loggedIn) {
220220
confirmLogin();
221221
}
222-
223222

224223
String clientId = credentials.getClientId();
225224

226225
switch(expectedResponse) {
227226
// Logging in procedure
228227
case ExpectedResponse.LOGIN:
229-
// If we can not find any data of a previous session we create a new one
228+
// If we can not find any information of a previous session we create a new one
230229

231230
if(credentials.getClientToken() == null) {
232231
// Request new qr code
@@ -249,7 +248,7 @@ public void onTextMessage(WebSocket websocket, String message) {
249248
int status = Utils.encodeValidJson(message).get("status").getAsInt();
250249

251250
if(status != 200) {
252-
// A error occurred during authentication
251+
// An error occurred during authentication
253252
// Old session data is invalid so it gets deleted
254253
AuthCredentialsHelper.deletePreviousSession(authCredentialsPath);
255254
disconnect();

src/main/java/icu/jnet/whatsjava/helper/Utils.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ public static int getMessageCount() {
8383
return wsRequestCount;
8484
}
8585

86-
// Create a new websocket json request string
87-
public static String buildWebsocketJsonRequest(int requestType, String... content) {
86+
// Create a new WebSocket json request string
87+
public static String buildWebSocketJsonRequest(int requestType, String... content) {
8888
String messageTag = getMessageTag();
8989

9090
String request = "";
@@ -110,9 +110,8 @@ public static String buildWebsocketJsonRequest(int requestType, String... conten
110110
request = "[\"admin\",\"Conn\",\"reref\"]";
111111
break;
112112
}
113-
114-
request = messageTag + "," + request;
115-
return request;
113+
114+
return messageTag + "," + request;
116115
}
117116

118117
// Create a new WebSocket binary request array

0 commit comments

Comments
 (0)