Peter Serwylo 78b5f489ef Merge branch 'fix-263/explicitly-add-swap-repo' into 'master'
Fix #263 "cannot manually add repo that was swapped before"

Pretends that the swap repo never existed, by deleting it before adding
the new repo, and showing the same message that is shown when a new
repo is added. This does not change behaviour for existing non-swap
repos. They are not deleted before being added again, or else we would
lose the ability to verify the fingerprint of an existing repo is the
same as a newly added one with the same URL.

Note that this has the effect that the fingerprint/pubkey of the swap
repo is nuked when adding that repo manually.

Internationalised the string "BAD FINGERPRINT" while I was at it.

To test it out, here is some instructions to make life easier:

Firstly, go into manage repos and delete the guardian project main repo (going to pretend to use this for swapping to make life easier).

Then if you run `sqlite3 /data/data/org.fdroid.fdroid/databases/fdroid` and execute the query:

`select substr(fingerprint, 0, 10), substr(pubkey, 70, 10), address, isSwap from fdroid_repo order by fingerprint desc;`

You should see:

```
B7C2EEFD8|081ad310b3|https://guardianproject.info/fdroid/archive|0
43238D512|071310b300|https://f-droid.org/archive|0
43238D512|071310b300|https://f-droid.org/repo/|0
```

Now simulate a swap session like so:

```
adb shell am start -a android.intent.action.VIEW -d 'https://guardianproject.info/fdroid/repo?swap=1'
```

Which results in the following database:

```
B7C2EEFD8|081ad310b3|https://guardianproject.info/fdroid/archive|0
B7C2EEFD8|081ad310b3|https://guardianproject.info/fdroid/repo|1
43238D512|071310b300|https://f-droid.org/archive|0
43238D512|071310b300|https://f-droid.org/repo/|0
```

Note the last column (`isSwap`) is `1` for the newly added swap repo. Now we will add the repo (without a fingerprint) to the Manage Repo activity. If you are feeling lazy, execute:

```
adb shell am start -a android.intent.action.VIEW -d https://guardianproject.info/fdroid/repo
```

The repo will be removed, then re-added as a TOFU repo:

```
B7C2EEFD8|081ad310b3|https://guardianproject.info/fdroid/archive|0
43238D512|071310b300|https://f-droid.org/archive|0
43238D512|071310b300|https://f-droid.org/repo/|0
||https://guardianproject.info/fdroid/repo/|0
```

I noticed some bugginess with sending the same intent and it being ignored, I'll have to look at this another day (not caused by this change, it already existed in master).

See merge request !90
2015-06-15 09:33:06 +00:00
2015-05-29 12:34:02 +02:00
2014-12-11 13:50:05 +01:00
2015-05-15 00:25:44 +02:00
2015-04-29 22:16:14 +02:00
2015-06-14 19:46:41 +02:00
2013-04-12 14:45:48 +01:00
2015-06-14 14:57:15 +02:00

F-Droid Client

Client for F-Droid, the Free Software repository system for Android.

Building from source with Gradle

Once you have checked out the version you wish to build, install gradle on your system and run:

git submodule update --init
gradle build

Android Studio

From Android Studio: File -> Import Project -> Select the cloned top folder

Building from source with Ant

The only required tools are the Android SDK and Apache Ant.

Once you have checked out the version you wish to build, run:

git submodule update --init
cd F-Droid
./ant-prepare.sh # This runs 'android update' on the libs and the main project
ant clean release

Direct download

You can download the application directly from our site or browse it in the repo.

Contributing

You are welcome to submit Merge Requests via the Gitlab web interface. You can also follow our Issue tracker and our Forums.

Translating

The res/values-* dirs are kept up to date automatically via MediaWiki's Translate Extension. See our translation page if you would like to contribute.

Running the test suite

FDroid client includes a embedded Android Test Project for running tests. It is in the test/ subfolder. To run the tests from the command line, do:

git submodule update --init
./ant-prepare.sh # This runs 'android update' on the libs and the main project
ant clean emma debug install test

You can also run the tests in Eclipse. Here's how:

  1. Choose File -> Import -> Android -> Existing Android Code Into Workspace for the fdroidclient/ directory.
  2. Choose File -> Import -> Android -> Existing Android Code Into Workspace for the fdroidclient/test/ directory
  3. If fdroid-test has errors, right-click on it, select Properties, the Java Build Path, then click on the Projects tab.
  4. Click on the Add... button and select fdroidclient/
  5. Right-click on the fdroid-test project, then Run As... -> Android JUnit Test

Troubleshooting

When building F-Droid, the following error may occur:

Invalid file: extern/UniversalImageLoader/library/build.xml

Check the output of the ./ant-prepare.sh command. This error is often accompanied by the following message:

Error: The project either has no target set or the target is invalid. Please provide a --target to the 'android update' command.

The most likely cause of this is that your installed Android SDK is missing the target version specified by one of the dependencies. For example, at the time of writing this, UniversalImageLoader uses the "android-16" target API, however the default install of the Android SDK will usually only install the latest version ("android-20" as of writing). So you will have to install missings "android-xx" targets via the SDK manager. To get a list of already installed SDK targets, run:

$ android list targets

To get a list of targets used by fdroidclient libs, run:

$ for i in $(grep "android.library.reference" project.properties | cut -f2 -d'='); do
grep ^target $i/project.properties | cut -f2 -d'=';
done | sort | uniq | paste -s -d',' -

to install missing or all needed targets, for example "android-16" and "android-7" run:

$ android update sdk -u -t "android-16,android-7"

NOTE: While it may be tempting to add "--target=android-19" to the ant-prepare.sh script, it is not the correct solution. Although it may work, it can cause strange bugs at runtime.

License

This program is Free Software: You can use, study share and improve it at your will. Specifically you can redistribute and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Some icons are made by Picol, Icomoon or Dave Gandy from Flaticon or by Google and are licensed by Creative Commons BY 3.0.

Description
No description provided
Readme GPL-3.0 46 MiB
Languages
Java 98.5%
Shell 0.6%
Python 0.6%
AIDL 0.2%
HTML 0.1%