diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-04-18 20:23:08 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-04-18 20:23:08 +0200 |
commit | a8d08cbdc241aa8ead3fab13350412d80e6424a2 (patch) | |
tree | 51385800aca000755adc0a0d5699509e3951d50b /src/main/java/de/pixart | |
parent | be75c1da31f3d29c3d7dcb72234ebc0accba0cd0 (diff) |
reused code to retrieve AutoAcceptFileSize for AutoResend
Diffstat (limited to 'src/main/java/de/pixart')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 02f9273c7..97999a587 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -1470,30 +1470,12 @@ public class XmppConnectionService extends Service { }); } - private long AcceptFileSize() { - String config = "0"; - SharedPreferences sharedPref = getPreferences(); - if (isWIFI()) { - config = sharedPref.getString("auto_accept_file_size_wifi", "10485760"); - } else if (isMobile() && !isMobileRoaming()) { - config = sharedPref.getString("auto_accept_file_size_mobile", "262144"); - } else if (isMobile() && isMobileRoaming()) { - config = sharedPref.getString("auto_accept_file_size_roaming", "1"); - } - - try { - return Long.parseLong(config); - } catch (NumberFormatException e) { - return 1048576; - } - } - private void resendFailedFileMessages(final Conversation conversation) { conversation.findFailedMessagesWithFiles(new Conversation.OnMessageFound() { @Override public void onMessageFound(Message message) { - if (AcceptFileSize() >= message.getFileParams().size) { + if (mHttpConnectionManager.getAutoAcceptFileSize() >= message.getFileParams().size) { Log.d(Config.LOGTAG, "Resend failed message with size " + message.getFileParams().size + " bytes for " + conversation.getJid()); resendMessage(message, true); } |