mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-26 18:45:49 +01:00
Huami: Do not display firmware information and whitelist information when flashing watchfaces
Closes #1781
This commit is contained in:
parent
e5560fb182
commit
11d96e4641
@ -28,6 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.miband.AbstractMiBandFWHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiFirmwareInfo;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiFirmwareType;
|
||||
|
||||
public abstract class HuamiFWHelper extends AbstractMiBandFWHelper {
|
||||
protected HuamiFirmwareInfo firmwareInfo;
|
||||
@ -110,6 +111,10 @@ public abstract class HuamiFWHelper extends AbstractMiBandFWHelper {
|
||||
firmwareInfo.checkValid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HuamiFirmwareType getFirmwareType() {
|
||||
return firmwareInfo.getFirmwareType();
|
||||
}
|
||||
public HuamiFirmwareInfo getFirmwareInfo() {
|
||||
return firmwareInfo;
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ import androidx.annotation.NonNull;
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiFirmwareType;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.UriHelper;
|
||||
|
||||
@ -122,4 +123,6 @@ public abstract class AbstractMiBandFWHelper {
|
||||
protected abstract void determineFirmwareInfo(byte[] wholeFirmwareBytes);
|
||||
|
||||
public abstract void checkValid() throws IllegalArgumentException;
|
||||
|
||||
public abstract HuamiFirmwareType getFirmwareType();
|
||||
}
|
||||
|
@ -30,6 +30,8 @@ import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.GenericItem;
|
||||
|
||||
import static nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiFirmwareType.WATCHFACE;
|
||||
|
||||
public abstract class AbstractMiBandFWInstallHandler implements InstallHandler {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AbstractMiBandFWInstallHandler.class);
|
||||
|
||||
@ -58,7 +60,7 @@ public abstract class AbstractMiBandFWInstallHandler implements InstallHandler {
|
||||
|
||||
protected abstract AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException;
|
||||
|
||||
protected GenericItem createInstallItem(GBDevice device) {
|
||||
private GenericItem createInstallItem(GBDevice device) {
|
||||
return new GenericItem(mContext.getString(R.string.installhandler_firmware_name, mContext.getString(device.getType().getName()), helper.getFirmwareKind(), helper.getHumanFirmwareVersion()));
|
||||
}
|
||||
|
||||
@ -98,23 +100,25 @@ public abstract class AbstractMiBandFWInstallHandler implements InstallHandler {
|
||||
return;
|
||||
}
|
||||
StringBuilder builder = new StringBuilder();
|
||||
if (helper.isSingleFirmware()) {
|
||||
getFwUpgradeNotice();
|
||||
builder.append(getFwUpgradeNotice());
|
||||
} else {
|
||||
builder.append(mContext.getString(R.string.fw_multi_upgrade_notice, helper.getHumanFirmwareVersion(), helper.getHumanFirmwareVersion2()));
|
||||
}
|
||||
if (helper.getFirmwareType() != WATCHFACE) {
|
||||
if (helper.isSingleFirmware()) {
|
||||
getFwUpgradeNotice();
|
||||
builder.append(getFwUpgradeNotice());
|
||||
} else {
|
||||
builder.append(mContext.getString(R.string.fw_multi_upgrade_notice, helper.getHumanFirmwareVersion(), helper.getHumanFirmwareVersion2()));
|
||||
}
|
||||
|
||||
|
||||
if (helper.isFirmwareWhitelisted()) {
|
||||
builder.append(" ").append(mContext.getString(R.string.miband_firmware_known));
|
||||
fwItem.setDetails(mContext.getString(R.string.miband_fwinstaller_compatible_version));
|
||||
// TODO: set a CHECK (OKAY) button
|
||||
} else {
|
||||
builder.append(" ").append(mContext.getString(R.string.miband_firmware_unknown_warning)).append(" \n\n")
|
||||
.append(mContext.getString(R.string.miband_firmware_suggest_whitelist, String.valueOf(helper.getFirmwareVersion())));
|
||||
fwItem.setDetails(mContext.getString(R.string.miband_fwinstaller_untested_version));
|
||||
// TODO: set a UNKNOWN (question mark) button
|
||||
if (helper.isFirmwareWhitelisted()) {
|
||||
builder.append(" ").append(mContext.getString(R.string.miband_firmware_known));
|
||||
fwItem.setDetails(mContext.getString(R.string.miband_fwinstaller_compatible_version));
|
||||
// TODO: set a CHECK (OKAY) button
|
||||
} else {
|
||||
builder.append(" ").append(mContext.getString(R.string.miband_firmware_unknown_warning)).append(" \n\n")
|
||||
.append(mContext.getString(R.string.miband_firmware_suggest_whitelist, String.valueOf(helper.getFirmwareVersion())));
|
||||
fwItem.setDetails(mContext.getString(R.string.miband_fwinstaller_untested_version));
|
||||
// TODO: set a UNKNOWN (question mark) button
|
||||
}
|
||||
}
|
||||
installActivity.setInfoText(builder.toString());
|
||||
installActivity.setInstallItem(fwItem);
|
||||
|
@ -29,6 +29,7 @@ import androidx.annotation.NonNull;
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiFirmwareType;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.miband.AbstractMiFirmwareInfo;
|
||||
|
||||
/**
|
||||
@ -122,6 +123,11 @@ public class MiBandFWHelper extends AbstractMiBandFWHelper {
|
||||
firmwareInfo.checkValid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HuamiFirmwareType getFirmwareType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param wholeFirmwareBytes
|
||||
* @return
|
||||
|
Loading…
Reference in New Issue
Block a user