From 81ffcf9f249086c312d1104a7c5e981c7c9bd07f Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Sun, 25 Sep 2016 10:39:31 +0200 Subject: check internet connection before start looking for updates... ...and don't automatically look for updates if you are connected via roaming --- src/main/java/de/pixart/messenger/ui/ConversationActivity.java | 5 ++++- src/main/java/de/pixart/messenger/ui/XmppActivity.java | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java index 4ee5aab59..c1b9574ba 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java @@ -1462,7 +1462,10 @@ public class ConversationActivity extends XmppActivity } if (xmppConnectionService.getAccounts().size() != 0) { - AppUpdate(); + if (xmppConnectionService.hasInternetConnection()) { + if (xmppConnectionService.isWIFI() || (xmppConnectionService.isMobile() && !xmppConnectionService.isMobileRoaming())) + AppUpdate(); + } } if (this.mPostponedActivityResult != null) { diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java index 35d4c8219..1e011de8c 100644 --- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java +++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java @@ -396,7 +396,11 @@ public abstract class XmppActivity extends Activity { startActivity(new Intent(this, SettingsActivity.class)); break; case R.id.action_check_updates: - startActivity(new Intent(this, UpdaterActivity.class)); + if (xmppConnectionService.hasInternetConnection()) { + startActivity(new Intent(this, UpdaterActivity.class)); + } else { + Toast.makeText(this, R.string.account_status_no_internet, Toast.LENGTH_LONG).show(); + } break; case R.id.action_accounts: final Intent intent = new Intent(getApplicationContext(), EditAccountActivity.class); -- cgit v1.2.3