1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-06-20 12:00:51 +02:00

Fossil Hybrid HR: Show in appmanager which watch apps are outdated

This commit is contained in:
Arjan Schrijver 2022-07-16 23:03:06 +02:00
parent 93e9d407ec
commit 7e844367e6
2 changed files with 34 additions and 2 deletions

View File

@ -65,6 +65,7 @@ import nodomain.freeyourgadget.gadgetbridge.util.DeviceHelper;
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
import nodomain.freeyourgadget.gadgetbridge.util.GridAutoFitLayoutManager;
import nodomain.freeyourgadget.gadgetbridge.util.PebbleUtils;
import nodomain.freeyourgadget.gadgetbridge.util.Version;
public abstract class AbstractAppManagerFragment extends Fragment {
@ -133,6 +134,13 @@ public abstract class AbstractAppManagerFragment extends Fragment {
if ((mGBDevice.getType() == DeviceType.FOSSILQHYBRID) && (app.getType() == GBDeviceApp.Type.WATCHFACE) && (!QHybridConstants.HYBRIDHR_WATCHFACE_VERSION.equals(appVersion))) {
app.setUpToDate(false);
}
try {
if ((app.getType() == GBDeviceApp.Type.APP_GENERIC) && ((new Version(app.getVersion())).smallerThan(new Version(QHybridConstants.KNOWN_WAPP_VERSIONS.get(app.getName()))))) {
app.setUpToDate(false);
}
} catch (IllegalArgumentException e) {
LOG.warn("Couldn't read app version", e);
}
if (filterApp(app)) {
appList.add(app);
}
@ -206,8 +214,13 @@ public abstract class AbstractAppManagerFragment extends Fragment {
String jsonstring = FileUtils.getStringFromFile(jsonFile);
JSONObject json = new JSONObject(jsonstring);
GBDeviceApp app = new GBDeviceApp(json, configFile.exists(), getAppPreviewImage(baseName));
if ((mGBDevice.getType() == DeviceType.FOSSILQHYBRID) && (app.getType() == GBDeviceApp.Type.WATCHFACE) && (!QHybridConstants.HYBRIDHR_WATCHFACE_VERSION.equals(app.getVersion()))) {
app.setUpToDate(false);
if (mGBDevice.getType() == DeviceType.FOSSILQHYBRID) {
if ((app.getType() == GBDeviceApp.Type.WATCHFACE) && (!QHybridConstants.HYBRIDHR_WATCHFACE_VERSION.equals(app.getVersion()))) {
app.setUpToDate(false);
}
if ((app.getType() == GBDeviceApp.Type.APP_GENERIC) && ((new Version(app.getVersion())).smallerThan(new Version(QHybridConstants.KNOWN_WAPP_VERSIONS.get(app.getName()))))) {
app.setUpToDate(false);
}
}
cachedAppList.add(app);
} catch (Exception e) {

View File

@ -16,6 +16,25 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
package nodomain.freeyourgadget.gadgetbridge.devices.qhybrid;
import java.util.HashMap;
import java.util.Map;
public final class QHybridConstants {
public static final String HYBRIDHR_WATCHFACE_VERSION = "1.1";
public static Map<String, String> KNOWN_WAPP_VERSIONS = new HashMap<String, String>() {
{
put("buddyChallengeApp", "2.10");
put("commuteApp", "2.5");
put("launcherApp", "3.8");
put("musicApp", "3.4");
put("notificationsPanelApp", "3.5");
put("ringPhoneApp", "3.7");
put("settingApp", "3.12");
put("stopwatchApp", "3.5");
put("timerApp", "3.8");
put("weatherApp", "3.10");
put("wellnessApp", "3.15");
}
};
}