[Huawei] Rename needsAuth to firstConnection

This commit is contained in:
Damien 'Psolyca' Gaignon 2024-04-07 20:54:13 +02:00 committed by José Rebelo
parent 065f8cdaa7
commit 52e61e36fe
3 changed files with 8 additions and 8 deletions

View File

@ -51,7 +51,7 @@ public class HuaweiBRSupport extends AbstractBTBRDeviceSupport {
@Override @Override
public boolean connectFirstTime() { public boolean connectFirstTime() {
supportProvider.setNeedsAuth(true); supportProvider.setFirstConnection(true);
return connect(); return connect();
} }

View File

@ -57,7 +57,7 @@ public class HuaweiLESupport extends AbstractBTLEDeviceSupport {
@Override @Override
public boolean connectFirstTime() { public boolean connectFirstTime() {
supportProvider.setNeedsAuth(true); supportProvider.setFirstConnection(true);
return connect(); return connect();
} }

View File

@ -163,7 +163,7 @@ public class HuaweiSupportProvider {
private Context context; private Context context;
private HuaweiCoordinatorSupplier.HuaweiDeviceType huaweiType; private HuaweiCoordinatorSupplier.HuaweiDeviceType huaweiType;
private boolean needsAuth = false; private boolean firstConnection = false;
protected byte protocolVersion; protected byte protocolVersion;
public String deviceMac; //get it from GB public String deviceMac; //get it from GB
protected String macAddress; protected String macAddress;
@ -412,7 +412,7 @@ public class HuaweiSupportProvider {
protected void initializeDeviceHiChainMode(int authType) { protected void initializeDeviceHiChainMode(int authType) {
try { try {
GetHiChainRequest hiChainReq = new GetHiChainRequest(this, needsAuth); GetHiChainRequest hiChainReq = new GetHiChainRequest(this, firstConnection);
hiChainReq.setFinalizeReq(configureReq); hiChainReq.setFinalizeReq(configureReq);
if (paramsProvider.getPinCode() == null) { if (paramsProvider.getPinCode() == null) {
GetPincodeRequest pincodeReq = new GetPincodeRequest(this); GetPincodeRequest pincodeReq = new GetPincodeRequest(this);
@ -491,7 +491,7 @@ public class HuaweiSupportProvider {
productInformationReq.nextRequest(setTimeReq); productInformationReq.nextRequest(setTimeReq);
setTimeReq.nextRequest(supportedServicesReq); setTimeReq.nextRequest(supportedServicesReq);
productInformationReq.doPerform(); productInformationReq.doPerform();
if (needsAuth) { if (firstConnection) {
// Workaround to enable PREF_HUAWEI_ROTATE_WRIST_TO_SWITCH_INFO preference // Workaround to enable PREF_HUAWEI_ROTATE_WRIST_TO_SWITCH_INFO preference
SharedPreferences sharedPrefs = GBApplication.getDeviceSpecificSharedPrefs(deviceMac); SharedPreferences sharedPrefs = GBApplication.getDeviceSpecificSharedPrefs(deviceMac);
SharedPreferences.Editor editor = sharedPrefs.edit(); SharedPreferences.Editor editor = sharedPrefs.edit();
@ -556,8 +556,8 @@ public class HuaweiSupportProvider {
return paramsProvider; return paramsProvider;
} }
public void setNeedsAuth(boolean needsAuth) { public void setFirstConnection(boolean firstConnection) {
this.needsAuth = needsAuth; this.firstConnection = firstConnection;
} }
protected void createRandomMacAddress() { protected void createRandomMacAddress() {
@ -623,7 +623,7 @@ public class HuaweiSupportProvider {
// Setup the alarms // Setup the alarms
if (!getHuaweiCoordinator().supportsChangingAlarm()) { if (!getHuaweiCoordinator().supportsChangingAlarm()) {
if (needsAuth) { if (firstConnection) {
// TODO: not really sure if this is necessary, but it probably won't do any harm // TODO: not really sure if this is necessary, but it probably won't do any harm
initializeAlarms(); initializeAlarms();
} }