Merge request changes

- Moved certificate-related utilities to separate class

- Added settings method to return an entire SSLSettings object; refactored
  methods using separate parameters to take single SSLSettings parameter

- Advanced Settings section on login page now hides / shows along with
  other buttons to prevent it from showing up in front of the loading
  spinner

- Fixed star imports

- Refactored applySslSettings as per code from merge request

- Fixed formatting
This commit is contained in:
Galen Abell
2018-11-08 17:43:12 -05:00
parent 2d14ef1b6f
commit 8e2d90ef50
10 changed files with 274 additions and 209 deletions

View File

@@ -3,6 +3,7 @@ package com.github.gotify.service;
import android.os.Handler;
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;
@@ -32,12 +33,17 @@ public class WebSocketConnection {
private Runnable onReconnected;
private boolean isClosed;
WebSocketConnection(String baseUrl, boolean validateSSL, String cert, String token) {
OkHttpClient.Builder builder = new OkHttpClient.Builder()
.readTimeout(0, TimeUnit.MILLISECONDS)
.pingInterval(1, TimeUnit.MINUTES)
.connectTimeout(10, TimeUnit.SECONDS);
Utils.applySslSettings(builder, new Utils.SSLSettings(validateSSL, cert));
WebSocketConnection(String baseUrl, CertUtils.SSLSettings settings, String token) {
// client = new ApiClient()
// .setVerifyingSsl(validateSSL)
// .setSslCaCert(Utils.stringToInputStream(cert))
// .getHttpClient();
OkHttpClient.Builder builder =
new OkHttpClient.Builder()
.readTimeout(0, TimeUnit.MILLISECONDS)
.pingInterval(1, TimeUnit.MINUTES)
.connectTimeout(10, TimeUnit.SECONDS);
CertUtils.applySslSettings(builder, settings);
client = builder.build();