From 9824e8df0964d4bb5e066993d1e48b2c8a13962c Mon Sep 17 00:00:00 2001 From: Peter Serwylo Date: Wed, 20 May 2015 22:10:18 +1000 Subject: [PATCH] NFC swap now goes to confirm swap, not manage repos activity. The NFC message now is handled by the FDroid activity, so it is treated the same way as every other incoming repo URL. Because FDroid handles incoming intents correctly, the NFC one just magically works when the is moved from ManageReposAcivity to FDroid without further code changes. The other change is that the two way swap only happens when both are actually swapping. Otherwise, we will send a request for someone to swap with us, when we are incapable of swapping with them. Fixes #267. --- F-Droid/AndroidManifest.xml | 27 ++++++++++--------- .../views/swap/ConnectSwapActivity.java | 5 +++- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/F-Droid/AndroidManifest.xml b/F-Droid/AndroidManifest.xml index 402629bd5..8015d268c 100644 --- a/F-Droid/AndroidManifest.xml +++ b/F-Droid/AndroidManifest.xml @@ -210,6 +210,20 @@ + + + + + + + + + + + - - - - - - - - - diff --git a/F-Droid/src/org/fdroid/fdroid/views/swap/ConnectSwapActivity.java b/F-Droid/src/org/fdroid/fdroid/views/swap/ConnectSwapActivity.java index aab818f48..93b0837ab 100644 --- a/F-Droid/src/org/fdroid/fdroid/views/swap/ConnectSwapActivity.java +++ b/F-Droid/src/org/fdroid/fdroid/views/swap/ConnectSwapActivity.java @@ -156,7 +156,10 @@ public class ConnectSwapActivity extends ActionBarActivity implements ProgressLi RepoProvider.Helper.update(this, repo, values); } - if (!newRepoConfig.preventFurtherSwaps()) { + // Only ask server to swap with us, if we are actually running a local repo service. + // It is possible to have a swap initiated without first starting a swap, in which + // case swapping back is pointless. + if (!newRepoConfig.preventFurtherSwaps() && FDroidApp.isLocalRepoServiceRunning()) { askServerToSwapWithUs(); }