refactor: return boolean values from LocalProfileAssistantImpl
This commit is contained in:
parent
6032d381d3
commit
3cc1421905
|
@ -103,7 +103,7 @@ class OpenEuiccService : EuiccService() {
|
|||
return RESULT_FIRST_USER
|
||||
}
|
||||
|
||||
return if (channel.lpa.deleteProfile(iccid, Progress()) == "0") {
|
||||
return if (channel.lpa.deleteProfile(iccid, Progress())) {
|
||||
RESULT_OK
|
||||
} else {
|
||||
RESULT_FIRST_USER
|
||||
|
@ -135,13 +135,13 @@ class OpenEuiccService : EuiccService() {
|
|||
it.state == LocalProfileInfo.State.Enabled
|
||||
} ?: return RESULT_OK
|
||||
|
||||
return if (channel.lpa.disableProfile(activeProfile.iccid, Progress()) == "0") {
|
||||
return if (channel.lpa.disableProfile(activeProfile.iccid, Progress())) {
|
||||
RESULT_OK
|
||||
} else {
|
||||
RESULT_FIRST_USER
|
||||
}
|
||||
} else {
|
||||
return if (channel.lpa.enableProfile(iccid, Progress()) == "0") {
|
||||
return if (channel.lpa.enableProfile(iccid, Progress())) {
|
||||
RESULT_OK
|
||||
} else {
|
||||
RESULT_FIRST_USER
|
||||
|
|
|
@ -8,11 +8,11 @@ import java.util.Map;
|
|||
|
||||
public interface LocalProfileAssistant {
|
||||
|
||||
String enableProfile(String iccid, Progress progress);
|
||||
boolean enableProfile(String iccid, Progress progress);
|
||||
|
||||
String disableProfile(String iccid, Progress progress);
|
||||
boolean disableProfile(String iccid, Progress progress);
|
||||
|
||||
String deleteProfile(String iccid, Progress progress);
|
||||
boolean deleteProfile(String iccid, Progress progress);
|
||||
|
||||
String getDefaultSMDP();
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ import java.util.logging.Logger;
|
|||
public class LocalProfileAssistantImpl implements LocalProfileAssistant {
|
||||
static final String PROFILE_RESULT_SUCESS = "0";
|
||||
static final String TRIGGER_PROFILE_REFRESH = "FF";
|
||||
static final String DISABLED_STATE = PROFILE_RESULT_SUCESS;
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(LocalProfileAssistantImpl.class.getName());
|
||||
|
||||
|
@ -44,21 +43,25 @@ public class LocalProfileAssistantImpl implements LocalProfileAssistant {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String enableProfile(final String iccid,
|
||||
public boolean enableProfile(final String iccid,
|
||||
final Progress progress) {
|
||||
|
||||
return new EnableProfileWorker(TextUtil.iccidLittleToBig(iccid), progress, apduChannel).run();
|
||||
return PROFILE_RESULT_SUCESS.equals(
|
||||
new EnableProfileWorker(TextUtil.iccidLittleToBig(iccid), progress, apduChannel).run()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String disableProfile(final String iccid,
|
||||
public boolean disableProfile(final String iccid,
|
||||
final Progress progress) {
|
||||
|
||||
return new DisableProfileWorker(TextUtil.iccidLittleToBig(iccid), progress, apduChannel).run();
|
||||
return PROFILE_RESULT_SUCESS.equals(
|
||||
new DisableProfileWorker(TextUtil.iccidLittleToBig(iccid), progress, apduChannel).run()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String deleteProfile(final String iccid,
|
||||
public boolean deleteProfile(final String iccid,
|
||||
final Progress progress) {
|
||||
|
||||
DeleteProfileWorker deleteProfileWorker = new DeleteProfileWorker(progress, apduChannel);
|
||||
|
@ -66,7 +69,7 @@ public class LocalProfileAssistantImpl implements LocalProfileAssistant {
|
|||
LpadWorkerExchange<DeleteProfileWorker.DeleteProfileInputParams> exchange =
|
||||
new LpadWorkerExchange<>(deleteProfileWorker.new DeleteProfileInputParams(TextUtil.iccidLittleToBig(iccid)));
|
||||
|
||||
return deleteProfileWorker.run(exchange);
|
||||
return PROFILE_RESULT_SUCESS.equals(deleteProfileWorker.run(exchange));
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue