From 077524b41aab453ea5895eff4bc394fec7430671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Thu, 15 Aug 2013 18:56:04 +0200 Subject: AlertDialog for failed downloads. The dialog shows only an "OK" button to dismiss it, and the reason why the download failed. Right now, this dialog appears if a download is not successful. If it's too intrusive, I can remove some cases. Let's try how it feels. --- src/se/leap/bitmaskclient/ConfigHelper.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/se/leap/bitmaskclient/ConfigHelper.java') diff --git a/src/se/leap/bitmaskclient/ConfigHelper.java b/src/se/leap/bitmaskclient/ConfigHelper.java index b916a9ac..d2253dfe 100644 --- a/src/se/leap/bitmaskclient/ConfigHelper.java +++ b/src/se/leap/bitmaskclient/ConfigHelper.java @@ -178,6 +178,18 @@ public class ConfigHelper { shared_preferences_editor.remove(shared_preferences_key); return shared_preferences_editor.commit(); } + + public static boolean checkErroneousDownload(String downloaded_string) { + try { + if(new JSONObject(downloaded_string).has(ProviderAPI.ERRORS) || downloaded_string.isEmpty()) { + return true; + } else { + return false; + } + } catch(JSONException e) { + return false; + } + } /** * Treat the input as the MSB representation of a number, -- cgit v1.2.3