Skip to content

Commit 04ead8f

Browse files
author
Julian Kast
committed
Fixed Error with shouldUpdateSecondaryImage and made change to shouldUpdatePrimaryImage to be consistent
1 parent ff2c6e9 commit 04ead8f

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

base/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperation.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -556,11 +556,12 @@ private boolean sdlArtworkNeedsUpload(SdlArtwork artwork) {
556556
*/
557557
private boolean shouldUpdatePrimaryImage() {
558558
boolean templateSupportsPrimaryArtwork = templateSupportsImageField(ImageFieldName.graphic);
559-
560559
String currentScreenDataPrimaryGraphicName = (currentScreenData != null && currentScreenData.getGraphic() != null) ? currentScreenData.getGraphic().getValue() : null;
561560
String primaryGraphicName = updatedState.getPrimaryGraphic() != null ? updatedState.getPrimaryGraphic().getName() : null;
562-
return templateSupportsPrimaryArtwork
563-
&& !CompareUtils.areStringsEqual(currentScreenDataPrimaryGraphicName, primaryGraphicName, true, true);
561+
562+
boolean graphicMatchesExisting = CompareUtils.areStringsEqual(currentScreenDataPrimaryGraphicName, primaryGraphicName, true, true);
563+
564+
return templateSupportsPrimaryArtwork && !graphicMatchesExisting;
564565
}
565566

566567
/**
@@ -570,14 +571,16 @@ private boolean shouldUpdatePrimaryImage() {
570571
*/
571572
private boolean shouldUpdateSecondaryImage() {
572573
boolean templateSupportsSecondaryArtwork = templateSupportsImageField(ImageFieldName.secondaryGraphic);
573-
574574
String currentScreenDataSecondaryGraphicName = (currentScreenData != null && currentScreenData.getSecondaryGraphic() != null) ? currentScreenData.getSecondaryGraphic().getValue() : null;
575575
String secondaryGraphicName = updatedState.getSecondaryGraphic() != null ? updatedState.getSecondaryGraphic().getName() : null;
576+
577+
boolean graphicMatchesExisting = CompareUtils.areStringsEqual(currentScreenDataSecondaryGraphicName, secondaryGraphicName, true, true);
578+
576579
// Cannot detect if there is a secondary image below v5.0, so we'll just try to detect if the primary image is allowed and allow the secondary image if it is.
577580
if (internalInterface.get().getSdlMsgVersion().getMajorVersion() >= 5) {
578-
return templateSupportsSecondaryArtwork && !CompareUtils.areStringsEqual(currentScreenDataSecondaryGraphicName, secondaryGraphicName, true, true);
581+
return templateSupportsSecondaryArtwork && !graphicMatchesExisting;
579582
} else {
580-
return templateSupportsImageField(ImageFieldName.graphic);
583+
return templateSupportsImageField(ImageFieldName.graphic) && !graphicMatchesExisting;
581584
}
582585
}
583586

0 commit comments

Comments
 (0)