@@ -41,6 +41,7 @@ data class Product(
4141 i18nLocalization : I18nLocalization ,
4242 sizeComparisonRecommendedSize : SizeComparisonRecommendedSize ? ,
4343 bodyProfileRecommendedSizeName : String? ,
44+ bodyProfileWillFit : Boolean? = null,
4445 ): String {
4546 return when {
4647 isAccessory() -> accessoryText(i18nLocalization, sizeComparisonRecommendedSize)
@@ -49,12 +50,14 @@ data class Product(
4950 i18nLocalization = i18nLocalization,
5051 sizeComparisonRecommendedSize = sizeComparisonRecommendedSize,
5152 bodyProfileRecommendedSizeName = bodyProfileRecommendedSizeName,
53+ bodyProfileWillFit = bodyProfileWillFit,
5254 )
5355 else ->
5456 multiSizeText(
5557 i18nLocalization,
5658 sizeComparisonRecommendedSize,
5759 bodyProfileRecommendedSizeName,
60+ bodyProfileWillFit,
5861 )
5962 }
6063 }
@@ -88,13 +91,27 @@ data class Product(
8891 i18nLocalization : I18nLocalization ,
8992 sizeComparisonRecommendedSize : SizeComparisonRecommendedSize ? ,
9093 bodyProfileRecommendedSizeName : String? ,
94+ bodyProfileWillFit : Boolean? ,
9195 ): String {
92- bodyProfileRecommendedSizeName?.let {
93- return i18nLocalization.oneSizeWillFitResultText
96+ // Check if body data is provided (bodyProfileRecommendedSizeName is not null means body data was provided)
97+ val hasBodyData = bodyProfileRecommendedSizeName != null
98+
99+ // For one-size products with body data provided
100+ if (hasBodyData) {
101+ // If willFit is not explicitly false and we have a recommended size, show the will fit message
102+ if (bodyProfileWillFit != false ) {
103+ return i18nLocalization.oneSizeWillFitResultText
104+ }
105+ // If willFit is false or no recommended size, show "Your size not found"
106+ return i18nLocalization.willNotFitResultDefaultText
94107 }
108+
109+ // No body data provided, check for product comparison
95110 sizeComparisonRecommendedSize?.let {
96111 return i18nLocalization.getOneSizeProductComparisonText(it)
97112 }
113+
114+ // No data at all, show body data empty message
98115 return i18nLocalization.bodyDataEmptyText
99116 }
100117
@@ -105,15 +122,29 @@ data class Product(
105122 i18nLocalization : I18nLocalization ,
106123 sizeComparisonRecommendedSize : SizeComparisonRecommendedSize ? ,
107124 bodyProfileRecommendedSizeName : String? ,
125+ bodyProfileWillFit : Boolean? ,
108126 ): String {
109- bodyProfileRecommendedSizeName?.let {
110- return i18nLocalization.getMultiSizeBodyProfileText(
111- bodyProfileRecommendedSizeName = bodyProfileRecommendedSizeName,
112- )
127+ // Check if body data is provided
128+ val hasBodyData = bodyProfileRecommendedSizeName != null
129+
130+ // For multi-size products with body data provided
131+ if (hasBodyData) {
132+ // If willFit is not explicitly false and we have a recommended size, show it
133+ if (bodyProfileWillFit != false && bodyProfileRecommendedSizeName.isNotEmpty()) {
134+ return i18nLocalization.getMultiSizeBodyProfileText(
135+ bodyProfileRecommendedSizeName = bodyProfileRecommendedSizeName,
136+ )
137+ }
138+ // If willFit is false or no recommended size, show "Your size not found"
139+ return i18nLocalization.willNotFitResultDefaultText
113140 }
141+
142+ // No body data provided, check for product comparison
114143 sizeComparisonRecommendedSize?.bestStoreProductSize?.name?.let {
115144 return i18nLocalization.getMultiSizeProductComparisonText(it)
116145 }
146+
147+ // No data at all, show body data empty message
117148 return i18nLocalization.bodyDataEmptyText
118149 }
119150
0 commit comments