diff --git a/app/src/main/java/io/lbry/browser/ui/findcontent/FileViewFragment.java b/app/src/main/java/io/lbry/browser/ui/findcontent/FileViewFragment.java index 8e4a0b03..7dd6ef74 100644 --- a/app/src/main/java/io/lbry/browser/ui/findcontent/FileViewFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/findcontent/FileViewFragment.java @@ -1725,6 +1725,7 @@ public class FileViewFragment extends BaseFragment implements " \n" + " \n" + " \n" + diff --git a/app/src/main/java/io/lbry/browser/utils/LbryAnalytics.java b/app/src/main/java/io/lbry/browser/utils/LbryAnalytics.java index fc667a11..a8f446ab 100644 --- a/app/src/main/java/io/lbry/browser/utils/LbryAnalytics.java +++ b/app/src/main/java/io/lbry/browser/utils/LbryAnalytics.java @@ -8,7 +8,7 @@ import com.google.firebase.analytics.FirebaseAnalytics; public class LbryAnalytics { - public static final String EVENT_APP_EXCEPTION = "app_exception"; + public static final String EVENT_APP_ERROR = "app_error"; public static final String EVENT_APP_LAUNCH = "app_launch"; public static final String EVENT_EMAIL_ADDED = "email_added"; public static final String EVENT_EMAIL_VERIFIED = "email_verified"; @@ -56,10 +56,10 @@ public class LbryAnalytics { } } - public static void logException(String message, String exceptionName) { + public static void logError(String message, String exceptionName) { Bundle bundle = new Bundle(); bundle.putString("message", message); bundle.putString("name", exceptionName); - logEvent("app_exception", bundle); + logEvent(EVENT_APP_ERROR, bundle); } } diff --git a/app/src/main/java/io/lbry/browser/utils/Lbryio.java b/app/src/main/java/io/lbry/browser/utils/Lbryio.java index 02e9b07d..8b96f6a7 100644 --- a/app/src/main/java/io/lbry/browser/utils/Lbryio.java +++ b/app/src/main/java/io/lbry/browser/utils/Lbryio.java @@ -12,7 +12,6 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; -import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -24,6 +23,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.TimeUnit; import io.lbry.browser.MainActivity; import io.lbry.browser.exceptions.LbryioRequestException; @@ -102,7 +102,10 @@ public final class Lbryio { } Request request = builder.build(); - OkHttpClient client = new OkHttpClient(); + OkHttpClient client = new OkHttpClient.Builder(). + writeTimeout(120, TimeUnit.SECONDS). + readTimeout(120, TimeUnit.SECONDS). + build(); try { return client.newCall(request).execute(); } catch (IOException ex) { @@ -154,6 +157,7 @@ public final class Lbryio { AUTH_TOKEN = json.getString(AUTH_TOKEN_PARAM); broadcastAuthTokenGenerated(context); } catch (JSONException | ClassCastException ex) { + LbryAnalytics.logError(String.format("/user/new failed: %s", ex.getMessage()), ex.getClass().getName()); throw new LbryioResponseException("auth_token was not set in the response", ex); } finally { generatingAuthToken = false; @@ -193,7 +197,7 @@ public final class Lbryio { User user = gson.fromJson(object.toString(), type); return user; } catch (LbryioRequestException | LbryioResponseException | ClassCastException | IllegalStateException ex) { - LbryAnalytics.logException(String.format("/user/me failed: %s", ex.getMessage()), ex.getClass().getName()); + LbryAnalytics.logError(String.format("/user/me failed: %s", ex.getMessage()), ex.getClass().getName()); android.util.Log.e(TAG, "Could not retrieve the current user", ex); return null; }