feat(android): add keyman-version to package-version check

For Keyman for Android, add the new `keyman-version` parameter to the
api.keyman.com/package-version call so that updates to packages that are
not supported on the current version of Keyman will not be offered. This
supports the scenario where an updated keyboard or lexical model depends
on a newer version of Keyman. Note that an older version of the keyboard
or lexical model package will not be offered (the user can still
download and install an older version manually, but generally, the
recommended solution is to upgrade Keyman; there would be significant
cost to add support for querying and installation of older version
keyboards on the server side, for limited benefit).

Relates-to: keymanapp/api.keyman.com#325
This commit is contained in:
Marc Durdin 2026-06-25 11:02:46 +02:00
parent 58a565be21
commit 77ad99ee25

View file

@ -45,7 +45,7 @@ public class CloudRepository {
public static final String API_STAGING_HOST = "api.keyman.com"; // #7227 disabling: "api.keyman-staging.com";
public static final String API_MODEL_LANGUAGE_FORMATSTR = "https://%s/model?q=bcp47:%s";
public static final String API_PACKAGE_VERSION_FORMATSTR = "https://%s/package-version?platform=android%s%s";
public static final String API_PACKAGE_VERSION_FORMATSTR = "https://%s/package-version?platform=android&keyman-version=%s%s%s";
private Dataset memCachedDataset;
private Calendar lastLoad; // To be used for Dataset caching.
@ -205,7 +205,7 @@ public class CloudRepository {
}
}
String queryURL = String.format(API_PACKAGE_VERSION_FORMATSTR, getHost(), keyboardQuery, lexicalModelQuery);
String queryURL = String.format(API_PACKAGE_VERSION_FORMATSTR, getHost(), KMManager.getVersion(), keyboardQuery, lexicalModelQuery);
return new CloudApiTypes.CloudApiParam(
CloudApiTypes.ApiTarget.PackageVersion, queryURL).setType(CloudApiTypes.JSONType.Object);
}