Skip to content

Commit

Permalink
fix: When nutriscore is not (yet) computed, hide the "Learn more" but…
Browse files Browse the repository at this point in the history
…ton (#4657)

* When nutriscore is not (yet) computed, hide the "Learn more" button

* Update app/src/main/java/openfoodfacts/github/scrachx/openfood/features/product/view/nutrition/NutritionProductFragment.kt

Co-authored-by: VaiTon <eyadlorenzo@gmail.com>

* Add missing import

Co-authored-by: VaiTon <eyadlorenzo@gmail.com>
  • Loading branch information
g123k and VaiTon committed Apr 15, 2022
1 parent 5c98aca commit a17ddb9
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -41,6 +41,7 @@ import androidx.core.text.bold
import androidx.core.text.buildSpannedString
import androidx.core.text.inSpans
import androidx.core.view.isGone
import androidx.core.view.isVisible
import androidx.fragment.app.viewModels
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.DividerItemDecoration
Expand Down Expand Up @@ -220,6 +221,8 @@ class NutritionProductFragment : BaseFragment(), CustomTabActivityHelper.Connect
}
}

binding.nutriscoreLink.isVisible = product.nutritionGradeFr != null

var servingSize: Measurement? = null
val servingSizeString = product.servingSize
if (servingSizeString.isNullOrEmpty()) {
Expand Down Expand Up @@ -274,7 +277,7 @@ class NutritionProductFragment : BaseFragment(), CustomTabActivityHelper.Connect
nutrientsImageUrl = product.getImageNutritionUrl(langCode)
}

// Wseful when this fragment is used in offline saving
// Useful when this fragment is used in offline saving
if (mSendProduct != null && mSendProduct!!.imgUploadNutrition.isNotBlank()) {
binding.addPhotoLabel.visibility = GONE
nutrientsImageUrl = mSendProduct!!.imgUploadNutrition
Expand Down

0 comments on commit a17ddb9

Please sign in to comment.