rename Cols.SuggestedApk to AutoInstallApk #1063
This commit is contained in:
parent
cc3d874dc4
commit
cd635459ad
@ -303,7 +303,7 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
|
|||||||
case Cols.LIBERAPAY_ID:
|
case Cols.LIBERAPAY_ID:
|
||||||
liberapayID = cursor.getString(i);
|
liberapayID = cursor.getString(i);
|
||||||
break;
|
break;
|
||||||
case Cols.SuggestedApk.VERSION_NAME:
|
case Cols.AutoInstallApk.VERSION_NAME:
|
||||||
suggestedVersionName = cursor.getString(i);
|
suggestedVersionName = cursor.getString(i);
|
||||||
break;
|
break;
|
||||||
case Cols.PREFERRED_SIGNER:
|
case Cols.PREFERRED_SIGNER:
|
||||||
|
@ -32,17 +32,17 @@ import java.util.Set;
|
|||||||
/**
|
/**
|
||||||
* Each app has a bunch of metadata that it associates with a package name (such as org.fdroid.fdroid).
|
* Each app has a bunch of metadata that it associates with a package name (such as org.fdroid.fdroid).
|
||||||
* Multiple repositories can host the same package, and provide different metadata for that app.
|
* Multiple repositories can host the same package, and provide different metadata for that app.
|
||||||
*
|
* <p>
|
||||||
* As such, it is usually the case that you are interested in an {@link App} which has its metadata
|
* As such, it is usually the case that you are interested in an {@link App} which has its metadata
|
||||||
* provided by "the repo with the best priority", rather than "specific repo X". This is important
|
* provided by "the repo with the best priority", rather than "specific repo X". This is important
|
||||||
* when asking for an apk, whereby the preferable way is likely using:
|
* when asking for an apk, whereby the preferable way is likely using:
|
||||||
*
|
* <p>
|
||||||
* * {@link AppProvider.Helper#findHighestPriorityMetadata(ContentResolver, String)}
|
* * {@link AppProvider.Helper#findHighestPriorityMetadata(ContentResolver, String)}
|
||||||
*
|
* <p>
|
||||||
* rather than:
|
* rather than:
|
||||||
*
|
* <p>
|
||||||
* * {@link AppProvider.Helper#findSpecificApp(ContentResolver, String, long, String[])}
|
* * {@link AppProvider.Helper#findSpecificApp(ContentResolver, String, long, String[])}
|
||||||
*
|
* <p>
|
||||||
* The same can be said of retrieving a list of {@link App} objects, where the metadata for each app
|
* The same can be said of retrieving a list of {@link App} objects, where the metadata for each app
|
||||||
* in the result set should be populated from the repository with the best priority.
|
* in the result set should be populated from the repository with the best priority.
|
||||||
*/
|
*/
|
||||||
@ -53,7 +53,8 @@ public class AppProvider extends FDroidProvider {
|
|||||||
|
|
||||||
public static final class Helper {
|
public static final class Helper {
|
||||||
|
|
||||||
private Helper() { }
|
private Helper() {
|
||||||
|
}
|
||||||
|
|
||||||
public static List<App> all(ContentResolver resolver) {
|
public static List<App> all(ContentResolver resolver) {
|
||||||
return all(resolver, Cols.ALL);
|
return all(resolver, Cols.ALL);
|
||||||
@ -192,6 +193,7 @@ public class AppProvider extends FDroidProvider {
|
|||||||
* Tells the query selection that it will need to join onto the installed apps table
|
* Tells the query selection that it will need to join onto the installed apps table
|
||||||
* when used. This should be called when your query makes use of fields from that table
|
* when used. This should be called when your query makes use of fields from that table
|
||||||
* (for example, list all installed, or list those which can be updated).
|
* (for example, list all installed, or list those which can be updated).
|
||||||
|
*
|
||||||
* @return A reference to this object, to allow method chaining, for example
|
* @return A reference to this object, to allow method chaining, for example
|
||||||
* <code>return new AppQuerySelection(selection).requiresInstalledTable())</code>
|
* <code>return new AppQuerySelection(selection).requiresInstalledTable())</code>
|
||||||
*/
|
*/
|
||||||
@ -361,8 +363,8 @@ public class AppProvider extends FDroidProvider {
|
|||||||
case Cols.Package.PACKAGE_NAME:
|
case Cols.Package.PACKAGE_NAME:
|
||||||
appendField(PackageTable.Cols.PACKAGE_NAME, PackageTable.NAME, Cols.Package.PACKAGE_NAME);
|
appendField(PackageTable.Cols.PACKAGE_NAME, PackageTable.NAME, Cols.Package.PACKAGE_NAME);
|
||||||
break;
|
break;
|
||||||
case Cols.SuggestedApk.VERSION_NAME:
|
case Cols.AutoInstallApk.VERSION_NAME:
|
||||||
addSuggestedApkVersionField();
|
addAutoInstallApkVersionField();
|
||||||
break;
|
break;
|
||||||
case Cols.InstalledApp.VERSION_NAME:
|
case Cols.InstalledApp.VERSION_NAME:
|
||||||
addInstalledAppVersionName();
|
addInstalledAppVersionName();
|
||||||
@ -387,13 +389,16 @@ public class AppProvider extends FDroidProvider {
|
|||||||
appendField("COUNT( DISTINCT " + getTableName() + "." + Cols.ROW_ID + " ) AS " + Cols._COUNT);
|
appendField("COUNT( DISTINCT " + getTableName() + "." + Cols.ROW_ID + " ) AS " + Cols._COUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addSuggestedApkVersionField() {
|
private void addAutoInstallApkVersionField() {
|
||||||
addSuggestedApkField(
|
addAutoInstallApkField(
|
||||||
ApkTable.Cols.VERSION_NAME,
|
ApkTable.Cols.VERSION_NAME,
|
||||||
Cols.SuggestedApk.VERSION_NAME);
|
Cols.AutoInstallApk.VERSION_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addSuggestedApkField(String fieldName, String alias) {
|
/**
|
||||||
|
* @see <a href="https://gitlab.com/fdroid/fdroidclient/issues/1063">suggestedApk name mismatch #1063</a>
|
||||||
|
*/
|
||||||
|
private void addAutoInstallApkField(String fieldName, String alias) {
|
||||||
if (!isSuggestedApkTableAdded) {
|
if (!isSuggestedApkTableAdded) {
|
||||||
isSuggestedApkTableAdded = true;
|
isSuggestedApkTableAdded = true;
|
||||||
leftJoin(
|
leftJoin(
|
||||||
|
@ -210,7 +210,7 @@ public interface Schema {
|
|||||||
String IS_APK = "isApk";
|
String IS_APK = "isApk";
|
||||||
String IS_LOCALIZED = "isLocalized";
|
String IS_LOCALIZED = "isLocalized";
|
||||||
|
|
||||||
interface SuggestedApk {
|
interface AutoInstallApk {
|
||||||
String VERSION_NAME = "suggestedApkVersion";
|
String VERSION_NAME = "suggestedApkVersion";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ public interface Schema {
|
|||||||
/**
|
/**
|
||||||
* Each of the physical columns in the sqlite table. Differs from {@link Cols#ALL} in
|
* Each of the physical columns in the sqlite table. Differs from {@link Cols#ALL} in
|
||||||
* that it doesn't include fields which are aliases of other fields (e.g. {@link Cols#_ID}
|
* that it doesn't include fields which are aliases of other fields (e.g. {@link Cols#_ID}
|
||||||
* or which are from other related tables (e.g. {@link Cols.SuggestedApk#VERSION_NAME}).
|
* or which are from other related tables (e.g. {@link AutoInstallApk#VERSION_NAME}).
|
||||||
*/
|
*/
|
||||||
String[] ALL_COLS = {
|
String[] ALL_COLS = {
|
||||||
ROW_ID, PACKAGE_ID, REPO_ID, IS_COMPATIBLE, NAME, SUMMARY, ICON, DESCRIPTION,
|
ROW_ID, PACKAGE_ID, REPO_ID, IS_COMPATIBLE, NAME, SUMMARY, ICON, DESCRIPTION,
|
||||||
@ -265,7 +265,7 @@ public interface Schema {
|
|||||||
ANTI_FEATURES, REQUIREMENTS, ICON_URL,
|
ANTI_FEATURES, REQUIREMENTS, ICON_URL,
|
||||||
FEATURE_GRAPHIC, PROMO_GRAPHIC, TV_BANNER, PHONE_SCREENSHOTS,
|
FEATURE_GRAPHIC, PROMO_GRAPHIC, TV_BANNER, PHONE_SCREENSHOTS,
|
||||||
SEVEN_INCH_SCREENSHOTS, TEN_INCH_SCREENSHOTS, TV_SCREENSHOTS, WEAR_SCREENSHOTS,
|
SEVEN_INCH_SCREENSHOTS, TEN_INCH_SCREENSHOTS, TV_SCREENSHOTS, WEAR_SCREENSHOTS,
|
||||||
PREFERRED_SIGNER, AUTO_INSTALL_VERSION_CODE, IS_APK, IS_LOCALIZED, SuggestedApk.VERSION_NAME,
|
PREFERRED_SIGNER, AUTO_INSTALL_VERSION_CODE, IS_APK, IS_LOCALIZED, AutoInstallApk.VERSION_NAME,
|
||||||
InstalledApp.VERSION_CODE, InstalledApp.VERSION_NAME,
|
InstalledApp.VERSION_CODE, InstalledApp.VERSION_NAME,
|
||||||
InstalledApp.SIGNATURE, Package.PACKAGE_NAME,
|
InstalledApp.SIGNATURE, Package.PACKAGE_NAME,
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user