
Refactor database schema constants **Note:** When this is merged I'll rebase !347 and remove its WIP. ## Summary In order to do the database changes required for #511, I've found that it is difficult due to my inclination to switch between referring to database columns by either a Java constant such as `AppProvider.DataColumns.NAME` and string literals such as `"name"`. All string literals should be migrated to constants, and that will happen in my next MR. In order to prepare for this, I've gathered together the constants into one common place: `org.fdroid.fdroid.data.Schema`. This is going to be the authoritative place for the schema to be stored going forward, and will help when reasoning about the database structure. Although it seems large, this change is a fairly straightforward find/replace job. It also passes all tests for which there is good test coverage in the content providers. ## Changes Create `Schema` interface to make it simpler to replace string literals with constants. Right now, table names are in `DBHelper.TABLE_*` constants, and each tables fields are in `*Provider.DataColumns.*` constants. This brings them all into a predictable location. In addition, it makes it easier to statically import `Schema` so that instead of, e.g., * `AppProvider.DataColumns.PACKAGE_NAME` We can choose one of the following, based on our current context: * `Schema.AppTable.Cols.PACKAGE_NAME` * `AppTable.Cols.PACKAGE_NAME` * `Cols.PACKAGE_NAME` In the worst case, it isa couple of chars shorter than now. In the best case, if we are writing a class that primarily deals with Apps (e.g. App.java or AppProvider.java) then we get a big win with just `Cols.PACKAGE_NAME`. Having these things slightly shorter may seem like it is pointless, but the length of each constant probably contributed to my lack of willingness to use constants instead of string literals when constructing queries. In the future, this should be moved towards something more akin to: > http://openhms.sourceforge.net/sqlbuilder/ and I hope that extracting all the schema stuff into one interface may help that. See merge request !346
F-Droid Client
Client for F-Droid, the Free Software repository system for Android.
Building with Gradle
./gradlew assembleRelease
Direct download
You can download the application directly from our site or browse it in the repo.
Contributing
See our Contributing doc for information on how to report issues, translate the app into your language or help with development.
IRC
We are on #fdroid
and #fdroid-dev
on Freenode. We hold weekly dev meetings
on #fdroid-dev
on Tuesdays at 20h UTC, which usually last half an hour.
FAQ
- Why does F-Droid require "Unknown Sources" to install apps by default?
Because a regular Android app cannot act as a package manager on its own. To do so, it would require system privileges (see below), similar to what Google Play does.
- Can I avoid enabling "Unknown Sources" by installing F-Droid as a privileged system app?
This used to be the case, but no longer is. Now the Privileged Extension is the one that should be placed in the system. It can be bundled with a ROM or installed via a zip, or alternatively F-Droid can install it as a system app using root.
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.
Other icons are from the Material Design Icon set released under an Attribution 4.0 International license.