Migrate gotify to new client

This commit is contained in:
Jannis Mattheis
2018-11-14 19:39:22 +01:00
parent 3a9da353b4
commit d4c6273214
13 changed files with 209 additions and 117 deletions

View File

@@ -5,7 +5,6 @@ import com.github.gotify.SSLSettings;
import com.github.gotify.Utils;
import com.github.gotify.api.Callback;
import com.github.gotify.api.CertUtils;
import com.github.gotify.client.JSON;
import com.github.gotify.client.model.Message;
import com.github.gotify.log.Log;
import java.util.concurrent.TimeUnit;
@@ -18,7 +17,6 @@ import okhttp3.WebSocketListener;
public class WebSocketConnection {
private OkHttpClient client;
private static final JSON gson = Utils.json();
private final Handler handler = new Handler();
private int errorCount = 0;
@@ -125,7 +123,7 @@ public class WebSocketConnection {
public void onMessage(WebSocket webSocket, String text) {
Log.i("WebSocket: received message " + text);
synchronized (this) {
Message message = gson.deserialize(text, Message.class);
Message message = Utils.JSON.fromJson(text, Message.class);
onMessage.onSuccess(message);
}
super.onMessage(webSocket, text);