From 80205e94fb647b82e3e7434b069ccd51c1e7f4c8 Mon Sep 17 00:00:00 2001 From: Peter Serwylo Date: Sat, 5 Jul 2014 07:49:37 +0930 Subject: [PATCH] Implemented client connection for swap. Listen for a new intent, show a screen to the user mentioning they are about to start a swap. Make FDroid receive repo intents, then dispatch to relevant Activity. Previously manage repo always got the intents. Now FDroid does, and chooses whether to give to ManageRepos or Client connect. Not sure if it is required to do it this way or not, but it seems to work. I had a bit of an issue getting the "Welcome to F-Droid" string to fit on one line, because it was breaking on the hyphen. That is still not resolved in this commit. Still need to: * Show error messages instead of the "connect" description * Jar signing seems not to work when connecting to other repo. In order to handle returning to F-Droid after connecting (or saying no) I tagged the intent with a "handled" extra value. That way, I can ignore trying to connect to a repo if we've already handled that event. Finally, I also fixed an issue regarding downloading of signed index.jar files with an uppercase fingerprint. The fingerprint from the jar differed from that in the swap url, in that one was upper case and the other was lower case. This uses an .equalsIgnoreCase check instead. It also adds an extra guard in case the repo doesn't have a fingerprint. Although it may not even use the signed repo updater if both the pubkey and fingerprint are null, it is nice to have the extra assurance. Fixes issue #19. I also left some more TODO's around. I should put them in issues, but I'm in a bit of a hurry. --- AndroidManifest.xml | 40 +++++ res/drawable/swap_confirm_button_skin.xml | 23 +++ res/drawable/swap_deny_button_skin.xml | 23 +++ res/layout/swap_confirm_receive.xml | 70 +++++++++ res/layout/swap_wifi_qr.xml | 7 +- res/values/colors.xml | 4 + res/values/strings.xml | 2 + res/values/styles.xml | 42 ++++- src/org/fdroid/fdroid/FDroid.java | 26 ++- src/org/fdroid/fdroid/RepoIntentParser.java | 148 ++++++++++++++++++ src/org/fdroid/fdroid/Utils.java | 5 +- src/org/fdroid/fdroid/data/RepoProvider.java | 32 ++-- .../fdroid/localrepo/LocalRepoManager.java | 4 +- .../fdroid/updater/SignedRepoUpdater.java | 19 ++- .../swap/ConfirmReceiveSwapFragment.java | 106 +++++++++++++ .../views/swap/ConnectSwapActivity.java | 41 +++++ .../fdroid/views/swap/WifiQrFragment.java | 40 ++++- 17 files changed, 596 insertions(+), 36 deletions(-) create mode 100644 res/drawable/swap_confirm_button_skin.xml create mode 100644 res/drawable/swap_deny_button_skin.xml create mode 100644 res/layout/swap_confirm_receive.xml create mode 100644 src/org/fdroid/fdroid/RepoIntentParser.java create mode 100644 src/org/fdroid/fdroid/views/swap/ConfirmReceiveSwapFragment.java create mode 100644 src/org/fdroid/fdroid/views/swap/ConnectSwapActivity.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index df38566c7..f3125071f 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -109,6 +109,22 @@ android:name="android.app.default_searchable" android:value=".SearchResults" /> + + + + + + + + + + + + + + + + + + + + + + + + +