mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Support both "label" and "itemLabel" for NearbyResultItem mapping (#6386)
* Support both label and itemLabel for robust NearbyResultItem mapping. * fix code style * Add getOriginalLabel() for Wikidata edits to avoid fallback issues with itemLabel * Fix Wikidata edit failure by resetting hasInvalidLocation flag on upload confirmation --------- Co-authored-by: Sonal Yadav <sonalyadav@Sonals-MacBook-Air.local>
This commit is contained in:
parent
6dcce45c59
commit
ffb9af1f1c
3 changed files with 32 additions and 41 deletions
|
|
@ -7,7 +7,8 @@ class NearbyResultItem(
|
|||
private val wikipediaArticle: ResultTuple?,
|
||||
private val commonsArticle: ResultTuple?,
|
||||
private val location: ResultTuple?,
|
||||
private val label: ResultTuple?,
|
||||
@field:SerializedName("label") private val label: ResultTuple?,
|
||||
@field:SerializedName("itemLabel") private val itemLabel: ResultTuple?,
|
||||
@field:SerializedName("streetAddress") private val address: ResultTuple?,
|
||||
private val icon: ResultTuple?,
|
||||
@field:SerializedName("class") private val className: ResultTuple?,
|
||||
|
|
@ -29,7 +30,15 @@ class NearbyResultItem(
|
|||
|
||||
fun getLocation(): ResultTuple = location ?: ResultTuple()
|
||||
|
||||
fun getLabel(): ResultTuple = label ?: ResultTuple()
|
||||
/**
|
||||
* Returns label for display (pins, popup), using fallback to itemLabel if needed.
|
||||
*/
|
||||
fun getLabel(): ResultTuple = label ?: itemLabel ?: ResultTuple()
|
||||
|
||||
/**
|
||||
* Returns only the original label field, for Wikidata edits.
|
||||
*/
|
||||
fun getOriginalLabel(): ResultTuple = label ?: ResultTuple()
|
||||
|
||||
fun getIcon(): ResultTuple = icon ?: ResultTuple()
|
||||
|
||||
|
|
|
|||
|
|
@ -821,6 +821,7 @@ class UploadMediaDetailFragment : UploadBaseFragment(), UploadMediaDetailsContra
|
|||
{
|
||||
showProgress(false)
|
||||
uploadItem.imageQuality = IMAGE_OK
|
||||
uploadItem.hasInvalidLocation = false // Reset invalid location flag when user confirms upload
|
||||
},
|
||||
{
|
||||
presenterCallback!!.deletePictureAtIndex(index)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue