mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 06:43:56 +01:00 
			
		
		
		
	Merge branch 'main' into added-button
This commit is contained in:
		
						commit
						d505266985
					
				
					 278 changed files with 9071 additions and 6727 deletions
				
			
		|  | @ -13,6 +13,7 @@ import android.os.Build.VERSION_CODES | |||
| import android.os.Bundle | ||||
| import android.provider.Settings | ||||
| import android.view.View | ||||
| import android.view.inputmethod.InputMethodManager | ||||
| import android.widget.CheckBox | ||||
| import androidx.activity.OnBackPressedCallback | ||||
| import androidx.appcompat.app.AlertDialog | ||||
|  | @ -38,6 +39,7 @@ import fr.free.nrw.commons.mwapi.UserClient | |||
| import fr.free.nrw.commons.nearby.Place | ||||
| import fr.free.nrw.commons.settings.Prefs | ||||
| import fr.free.nrw.commons.theme.BaseActivity | ||||
| import fr.free.nrw.commons.utils.applyEdgeToEdgeAllInsets | ||||
| import fr.free.nrw.commons.upload.ThumbnailsAdapter.OnThumbnailDeletedListener | ||||
| import fr.free.nrw.commons.upload.categories.UploadCategoriesFragment | ||||
| import fr.free.nrw.commons.upload.depicts.DepictsFragment | ||||
|  | @ -177,6 +179,7 @@ class UploadActivity : BaseActivity(), UploadContract.View, UploadBaseFragment.C | |||
|         presenter?.setupBasicKvStoreFactory { BasicKvStore(this@UploadActivity, it) } | ||||
| 
 | ||||
|         _binding = ActivityUploadBinding.inflate(layoutInflater) | ||||
|         applyEdgeToEdgeAllInsets(_binding!!.root, false) | ||||
|         setContentView(binding.root) | ||||
| 
 | ||||
|         // Overrides the back button to make sure the user is prepared to lose their progress | ||||
|  | @ -443,7 +446,7 @@ class UploadActivity : BaseActivity(), UploadContract.View, UploadBaseFragment.C | |||
|                                 this, | ||||
|                                 getString(R.string.storage_permissions_denied), | ||||
|                                 getString(R.string.unable_to_share_upload_item), | ||||
|                                 getString(android.R.string.ok) | ||||
|                                 getString(R.string.ok) | ||||
|                             ) { finish() } | ||||
|                         } else { | ||||
|                             showAlertDialog( | ||||
|  | @ -452,7 +455,7 @@ class UploadActivity : BaseActivity(), UploadContract.View, UploadBaseFragment.C | |||
|                                 getString( | ||||
|                                     R.string.write_storage_permission_rationale_for_image_share | ||||
|                                 ), | ||||
|                                 getString(android.R.string.ok) | ||||
|                                 getString(R.string.ok) | ||||
|                             ) { checkStoragePermissions() } | ||||
|                         } | ||||
|                     } | ||||
|  | @ -505,24 +508,17 @@ class UploadActivity : BaseActivity(), UploadContract.View, UploadBaseFragment.C | |||
|                 fragments = mutableListOf() | ||||
|             } | ||||
| 
 | ||||
| 
 | ||||
|             for (uploadableFile in uploadableFiles) { | ||||
|                 val uploadMediaDetailFragment = UploadMediaDetailFragment() | ||||
| 
 | ||||
|                 if (!uploadIsOfAPlace) { | ||||
|                 // set fragment properties but defer initialization | ||||
|                 uploadMediaDetailFragment.uploadableFile = uploadableFile | ||||
|                 uploadMediaDetailFragment.place = place | ||||
|                 uploadMediaDetailFragment.inAppPictureLocation = if (!uploadIsOfAPlace) { | ||||
|                     handleLocation() | ||||
|                     uploadMediaDetailFragment.setImageToBeUploaded( | ||||
|                         uploadableFile, | ||||
|                         place, | ||||
|                         currLocation | ||||
|                     ) | ||||
|                     locationManager!!.unregisterLocationManager() | ||||
|                     currLocation | ||||
|                 } else { | ||||
|                     uploadMediaDetailFragment.setImageToBeUploaded( | ||||
|                         uploadableFile, | ||||
|                         place, | ||||
|                         currLocation | ||||
|                     ) | ||||
|                     currLocation | ||||
|                 } | ||||
| 
 | ||||
|                 val uploadMediaDetailFragmentCallback: UploadMediaDetailFragmentCallback = | ||||
|  | @ -577,13 +573,19 @@ class UploadActivity : BaseActivity(), UploadContract.View, UploadBaseFragment.C | |||
|                 if (isFragmentsSaved) { | ||||
|                     val fragment = fragments!![0] as UploadMediaDetailFragment? | ||||
|                     fragment!!.fragmentCallback = uploadMediaDetailFragmentCallback | ||||
|                     fragment.initializeFragment() | ||||
|                 } else { | ||||
|                     uploadMediaDetailFragment.fragmentCallback = uploadMediaDetailFragmentCallback | ||||
|                     fragments!!.add(uploadMediaDetailFragment) | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             //If fragments are not created, create them and add them to the fragments ArrayList | ||||
|             // unregister location manager after loop if needed | ||||
|             if (!uploadIsOfAPlace) { | ||||
|                 locationManager!!.unregisterLocationManager() | ||||
|             } | ||||
| 
 | ||||
|             // If fragments are not created, create them and add them to the fragments ArrayList | ||||
|             if (!isFragmentsSaved) { | ||||
|                 uploadCategoriesFragment = UploadCategoriesFragment() | ||||
|                 if (place != null) { | ||||
|  | @ -803,6 +805,19 @@ class UploadActivity : BaseActivity(), UploadContract.View, UploadBaseFragment.C | |||
| 
 | ||||
|     override fun onNextButtonClicked(index: Int) { | ||||
|         if (index < fragments!!.size - 1) { | ||||
|             // Hide the keyboard before navigating to Media License screen | ||||
|             val isUploadCategoriesFragment = fragments!!.getOrNull(index)?.let { | ||||
|                 it is UploadCategoriesFragment | ||||
|             } ?: false | ||||
|             if (isUploadCategoriesFragment) { | ||||
|                 val inputMethodManager = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager | ||||
|                 currentFocus?.let { focusedView -> | ||||
|                     inputMethodManager.hideSoftInputFromWindow( | ||||
|                         focusedView.windowToken, | ||||
|                         InputMethodManager.HIDE_NOT_ALWAYS | ||||
|                     ) | ||||
|                 } | ||||
|             } | ||||
|             binding.vpUpload.setCurrentItem(index + 1, false) | ||||
|             fragments!![index + 1].onBecameVisible() | ||||
|             (binding.rvThumbnails.layoutManager as LinearLayoutManager) | ||||
|  |  | |||
|  | @ -10,6 +10,7 @@ import fr.free.nrw.commons.ViewPagerAdapter | |||
| import fr.free.nrw.commons.contributions.ContributionDao | ||||
| import fr.free.nrw.commons.databinding.ActivityUploadProgressBinding | ||||
| import fr.free.nrw.commons.theme.BaseActivity | ||||
| import fr.free.nrw.commons.utils.applyEdgeToEdgeAllInsets | ||||
| import javax.inject.Inject | ||||
| 
 | ||||
| /** | ||||
|  | @ -35,6 +36,7 @@ class UploadProgressActivity : BaseActivity() { | |||
|     override fun onCreate(savedInstanceState: Bundle?) { | ||||
|         super.onCreate(savedInstanceState) | ||||
|         binding = ActivityUploadProgressBinding.inflate(layoutInflater) | ||||
|         applyEdgeToEdgeAllInsets(binding.root) | ||||
|         setContentView(binding.root) | ||||
|         viewPagerAdapter = ViewPagerAdapter(this, supportFragmentManager) | ||||
|         binding.uploadProgressViewPager.setAdapter(viewPagerAdapter) | ||||
|  | @ -56,11 +58,7 @@ class UploadProgressActivity : BaseActivity() { | |||
| 
 | ||||
|                 override fun onPageSelected(position: Int) { | ||||
|                     updateMenuItems(position) | ||||
|                     if (position == 2) { | ||||
|                         binding.uploadProgressViewPager.setCanScroll(false) | ||||
|                     } else { | ||||
|                         binding.uploadProgressViewPager.setCanScroll(true) | ||||
|                     } | ||||
|                     binding.uploadProgressViewPager.canScroll = (position != 2) | ||||
|                 } | ||||
| 
 | ||||
|                 override fun onPageScrollStateChanged(state: Int) { | ||||
|  |  | |||
|  | @ -26,6 +26,7 @@ import fr.free.nrw.commons.media.MediaDetailFragment | |||
| import fr.free.nrw.commons.upload.UploadActivity | ||||
| import fr.free.nrw.commons.upload.UploadBaseFragment | ||||
| import fr.free.nrw.commons.utils.DialogUtil.showAlertDialog | ||||
| import fr.free.nrw.commons.utils.handleKeyboardInsets | ||||
| import fr.free.nrw.commons.wikidata.WikidataConstants.SELECTED_NEARBY_PLACE_CATEGORY | ||||
| import io.reactivex.Notification | ||||
| import io.reactivex.android.schedulers.AndroidSchedulers | ||||
|  | @ -69,6 +70,7 @@ class UploadCategoriesFragment : UploadBaseFragment(), CategoriesContract.View { | |||
|         savedInstanceState: Bundle? | ||||
|     ): View? { | ||||
|         binding = UploadCategoriesFragmentBinding.inflate(inflater, container, false) | ||||
|         binding!!.llContainerButtons.handleKeyboardInsets() | ||||
|         return binding!!.root | ||||
|     } | ||||
| 
 | ||||
|  | @ -115,7 +117,7 @@ class UploadCategoriesFragment : UploadBaseFragment(), CategoriesContract.View { | |||
|                 requireActivity(), | ||||
|                 getString(R.string.categories_activity_title), | ||||
|                 getString(R.string.categories_tooltip), | ||||
|                 getString(android.R.string.ok), | ||||
|                 getString(R.string.ok), | ||||
|                 null | ||||
|             ) | ||||
|         } | ||||
|  |  | |||
|  | @ -27,6 +27,7 @@ import fr.free.nrw.commons.upload.UploadActivity | |||
| import fr.free.nrw.commons.upload.UploadBaseFragment | ||||
| import fr.free.nrw.commons.upload.structure.depictions.DepictedItem | ||||
| import fr.free.nrw.commons.utils.DialogUtil.showAlertDialog | ||||
| import fr.free.nrw.commons.utils.handleKeyboardInsets | ||||
| import fr.free.nrw.commons.wikidata.WikidataConstants.SELECTED_NEARBY_PLACE | ||||
| import io.reactivex.Notification | ||||
| import io.reactivex.android.schedulers.AndroidSchedulers | ||||
|  | @ -69,6 +70,7 @@ class DepictsFragment : UploadBaseFragment(), DepictsContract.View { | |||
|         savedInstanceState: Bundle? | ||||
|     ): View { | ||||
|         _binding = UploadDepictsFragmentBinding.inflate(inflater, container, false) | ||||
|         _binding!!.navigationButtonsContainer.handleKeyboardInsets() | ||||
|         return binding.root | ||||
|     } | ||||
| 
 | ||||
|  | @ -114,7 +116,7 @@ class DepictsFragment : UploadBaseFragment(), DepictsContract.View { | |||
|                 requireActivity(), | ||||
|                 getString(R.string.depicts_step_title), | ||||
|                 getString(R.string.depicts_tooltip), | ||||
|                 getString(android.R.string.ok), | ||||
|                 getString(R.string.ok), | ||||
|                 null | ||||
|             ) | ||||
|         } | ||||
|  |  | |||
|  | @ -70,7 +70,7 @@ class MediaLicenseFragment : UploadBaseFragment(), MediaLicenseContract.View { | |||
|                 requireActivity(), | ||||
|                 getString(R.string.license_step_title), | ||||
|                 getString(R.string.license_tooltip), | ||||
|                 getString(android.R.string.ok), | ||||
|                 getString(R.string.ok), | ||||
|                 null | ||||
|             ) | ||||
|         } | ||||
|  |  | |||
|  | @ -50,6 +50,7 @@ import fr.free.nrw.commons.utils.ImageUtils.IMAGE_OK | |||
| import fr.free.nrw.commons.utils.ImageUtils.getErrorMessageForResult | ||||
| import fr.free.nrw.commons.utils.NetworkUtils.isInternetConnectionEstablished | ||||
| import fr.free.nrw.commons.utils.ViewUtil.showLongToast | ||||
| import fr.free.nrw.commons.utils.handleKeyboardInsets | ||||
| import timber.log.Timber | ||||
| import java.io.File | ||||
| import java.util.ArrayList | ||||
|  | @ -118,8 +119,8 @@ class UploadMediaDetailFragment : UploadBaseFragment(), UploadMediaDetailsContra | |||
| 
 | ||||
|     private var basicKvStore: BasicKvStore? = null | ||||
|     private val keyForShowingAlertDialog = "isNoNetworkAlertDialogShowing" | ||||
|     private var uploadableFile: UploadableFile? = null | ||||
|     private var place: Place? = null | ||||
|     internal var uploadableFile: UploadableFile? = null | ||||
|     internal var place: Place? = null | ||||
|     private lateinit var uploadMediaDetailAdapter: UploadMediaDetailAdapter | ||||
|     var indexOfFragment = 0 | ||||
|     var isExpanded = true | ||||
|  | @ -141,18 +142,24 @@ class UploadMediaDetailFragment : UploadBaseFragment(), UploadMediaDetailsContra | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     fun setImageToBeUploaded( | ||||
|         uploadableFile: UploadableFile?, place: Place?, inAppPictureLocation: LatLng? | ||||
|     ) { | ||||
|         this.uploadableFile = uploadableFile | ||||
|         this.place = place | ||||
|         this.inAppPictureLocation = inAppPictureLocation | ||||
|     } | ||||
| 
 | ||||
|     override fun onCreateView( | ||||
|         inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? | ||||
|     ): View { | ||||
|         _binding = FragmentUploadMediaDetailFragmentBinding.inflate(inflater, container, false) | ||||
|         _binding!!.mediaDetailCardView.handleKeyboardInsets() | ||||
|         // intialise the adapter early to prevent uninitialized access | ||||
|         uploadMediaDetailAdapter = UploadMediaDetailAdapter( | ||||
|             this, | ||||
|             defaultKvStore.getString(Prefs.DESCRIPTION_LANGUAGE, "")!!, | ||||
|             recentLanguagesDao, voiceInputResultLauncher | ||||
|         ) | ||||
|         uploadMediaDetailAdapter.callback = | ||||
|             UploadMediaDetailAdapter.Callback { titleStringID: Int, messageStringId: Int -> | ||||
|                 showInfoAlert(titleStringID, messageStringId) | ||||
|             } | ||||
|         uploadMediaDetailAdapter.eventListener = this | ||||
|         binding.rvDescriptions.layoutManager = LinearLayoutManager(context) | ||||
|         binding.rvDescriptions.adapter = uploadMediaDetailAdapter | ||||
|         return binding.root | ||||
|     } | ||||
| 
 | ||||
|  | @ -161,20 +168,48 @@ class UploadMediaDetailFragment : UploadBaseFragment(), UploadMediaDetailsContra | |||
| 
 | ||||
|         basicKvStore = BasicKvStore(requireActivity(), "CurrentUploadImageQualities") | ||||
| 
 | ||||
|         if (fragmentCallback != null) { | ||||
|             indexOfFragment = fragmentCallback!!.getIndexInViewFlipper(this) | ||||
|             initializeFragment() | ||||
|         } | ||||
| 
 | ||||
|         // restore adapter items from savedInstanceState if available | ||||
|         if (savedInstanceState != null) { | ||||
|             if (uploadMediaDetailAdapter.items.isEmpty() && fragmentCallback != null) { | ||||
|                 uploadMediaDetailAdapter.items = savedInstanceState.getParcelableArrayList(UPLOAD_MEDIA_DETAILS)!! | ||||
|                 presenter.setUploadMediaDetails(uploadMediaDetailAdapter.items, indexOfFragment) | ||||
|             val savedItems = savedInstanceState.getParcelableArrayList<UploadMediaDetail>(UPLOAD_MEDIA_DETAILS) | ||||
|             Timber.d("Restoring state: savedItems size = %s", savedItems?.size ?: "null") | ||||
|             if (savedItems != null && savedItems.isNotEmpty()) { | ||||
|                 uploadMediaDetailAdapter.items = savedItems | ||||
|                 // only call setUploadMediaDetails if indexOfFragment is valid | ||||
|                 if (fragmentCallback != null) { | ||||
|                     indexOfFragment = fragmentCallback!!.getIndexInViewFlipper(this) | ||||
|                     if (indexOfFragment >= 0) { | ||||
|                         presenter.setUploadMediaDetails(uploadMediaDetailAdapter.items, indexOfFragment) | ||||
|                         Timber.d("Restored and set upload media details for index %d", indexOfFragment) | ||||
|                     } else { | ||||
|                         Timber.w("Invalid indexOfFragment %d, skipping setUploadMediaDetails", indexOfFragment) | ||||
|                     } | ||||
|                 } else { | ||||
|                     Timber.w("fragmentCallback is null, skipping setUploadMediaDetails") | ||||
|                 } | ||||
|             } else { | ||||
|                 // initialize with a default UploadMediaDetail if saved state is empty or null | ||||
|                 uploadMediaDetailAdapter.items = mutableListOf(UploadMediaDetail()) | ||||
|                 Timber.d("Initialized default UploadMediaDetail due to empty or null savedItems") | ||||
|             } | ||||
|         } else { | ||||
|             // intitialise with a default UploadMediaDetail for fresh fragment | ||||
|             if (uploadMediaDetailAdapter.items.isEmpty()) { | ||||
|                 uploadMediaDetailAdapter.items = mutableListOf(UploadMediaDetail()) | ||||
|                 Timber.d("Initialized default UploadMediaDetail for new fragment") | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         if (fragmentCallback != null) { | ||||
|             indexOfFragment = fragmentCallback!!.getIndexInViewFlipper(this) | ||||
|             Timber.d("Fragment callback present, indexOfFragment = %d", indexOfFragment) | ||||
|             initializeFragment() | ||||
|         } else { | ||||
|             Timber.w("Fragment callback is null, skipping initializeFragment") | ||||
|         } | ||||
| 
 | ||||
|         try { | ||||
|             if (!presenter.getImageQuality(indexOfFragment, inAppPictureLocation, requireActivity())) { | ||||
|             if (indexOfFragment >= 0 && !presenter.getImageQuality(indexOfFragment, inAppPictureLocation, requireActivity())) { | ||||
|                 Timber.d("Image quality check failed, redirecting to MainActivity") | ||||
|                 startActivityWithFlags( | ||||
|                     requireActivity(), | ||||
|                     MainActivity::class.java, | ||||
|  | @ -182,11 +217,12 @@ class UploadMediaDetailFragment : UploadBaseFragment(), UploadMediaDetailsContra | |||
|                     Intent.FLAG_ACTIVITY_SINGLE_TOP | ||||
|                 ) | ||||
|             } | ||||
|         } catch (_: Exception) { | ||||
|         } catch (e: Exception) { | ||||
|             Timber.e(e, "Error during image quality check") | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private fun initializeFragment() { | ||||
|     internal fun initializeFragment() { | ||||
|         if (_binding == null) { | ||||
|             return | ||||
|         } | ||||
|  | @ -204,7 +240,6 @@ class UploadMediaDetailFragment : UploadBaseFragment(), UploadMediaDetailsContra | |||
|         presenter.setupBasicKvStoreFactory { BasicKvStore(requireActivity(), it) } | ||||
| 
 | ||||
|         presenter.receiveImage(uploadableFile, place, inAppPictureLocation) | ||||
|         initRecyclerView() | ||||
| 
 | ||||
|         with (binding){ | ||||
|             if (indexOfFragment == 0) { | ||||
|  | @ -263,30 +298,12 @@ class UploadMediaDetailFragment : UploadBaseFragment(), UploadMediaDetailsContra | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * init the description recycler veiw and caption recyclerview | ||||
|      */ | ||||
|     private fun initRecyclerView() { | ||||
|         uploadMediaDetailAdapter = UploadMediaDetailAdapter( | ||||
|             this, | ||||
|             defaultKvStore.getString(Prefs.DESCRIPTION_LANGUAGE, "")!!, | ||||
|             recentLanguagesDao, voiceInputResultLauncher | ||||
|         ) | ||||
|         uploadMediaDetailAdapter.callback = | ||||
|             UploadMediaDetailAdapter.Callback { titleStringID: Int, messageStringId: Int -> | ||||
|                 showInfoAlert(titleStringID, messageStringId) | ||||
|             } | ||||
|         uploadMediaDetailAdapter.eventListener = this | ||||
|         binding.rvDescriptions.layoutManager = LinearLayoutManager(context) | ||||
|         binding.rvDescriptions.adapter = uploadMediaDetailAdapter | ||||
|     } | ||||
| 
 | ||||
|     private fun showInfoAlert(titleStringID: Int, messageStringId: Int) { | ||||
|         showAlertDialog( | ||||
|             requireActivity(), | ||||
|             getString(titleStringID), | ||||
|             getString(messageStringId), | ||||
|             getString(android.R.string.ok), | ||||
|             getString(R.string.ok), | ||||
|             null | ||||
|         ) | ||||
|     } | ||||
|  | @ -588,16 +605,14 @@ class UploadMediaDetailFragment : UploadBaseFragment(), UploadMediaDetailsContra | |||
|         var defaultLongitude = -122.431297 | ||||
|         var defaultZoom = 16.0 | ||||
| 
 | ||||
|         val locationPickerIntent: Intent | ||||
| 
 | ||||
|         /* Retrieve image location from EXIF if present or | ||||
|            check if user has provided location while using the in-app camera. | ||||
|            Use location of last UploadItem if none of them is available */ | ||||
|         val locationPickerIntent: Intent | ||||
|         if (uploadItem.gpsCoords != null && uploadItem.gpsCoords!! | ||||
|                 .decLatitude != 0.0 && uploadItem.gpsCoords!!.decLongitude != 0.0 | ||||
|         ) { | ||||
|             defaultLatitude = uploadItem.gpsCoords!! | ||||
|                 .decLatitude | ||||
|             defaultLatitude = uploadItem.gpsCoords!!.decLatitude | ||||
|             defaultLongitude = uploadItem.gpsCoords!!.decLongitude | ||||
|             defaultZoom = uploadItem.gpsCoords!!.zoomLevel | ||||
| 
 | ||||
|  | @ -613,8 +628,7 @@ class UploadMediaDetailFragment : UploadBaseFragment(), UploadMediaDetailsContra | |||
|                 defaultLongitude = locationLatLng[1].toDouble() | ||||
|             } | ||||
|             if (defaultKvStore.getString(LAST_ZOOM) != null) { | ||||
|                 defaultZoom = defaultKvStore.getString(LAST_ZOOM)!! | ||||
|                     .toDouble() | ||||
|                 defaultZoom = defaultKvStore.getString(LAST_ZOOM)!!.toDouble() | ||||
|             } | ||||
| 
 | ||||
|             locationPickerIntent = LocationPicker.IntentBuilder() | ||||
|  | @ -821,6 +835,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) | ||||
|  |  | |||
|  | @ -69,7 +69,18 @@ class UploadMediaPresenter @Inject constructor( | |||
|         uploadMediaDetails: List<UploadMediaDetail>, | ||||
|         uploadItemIndex: Int | ||||
|     ) { | ||||
|         repository.getUploads()[uploadItemIndex].uploadMediaDetails = uploadMediaDetails.toMutableList() | ||||
|         val uploadItems = repository.getUploads() | ||||
|         if (uploadItemIndex >= 0 && uploadItemIndex < uploadItems.size) { | ||||
|             if (uploadMediaDetails.isNotEmpty()) { | ||||
|                 uploadItems[uploadItemIndex].uploadMediaDetails = uploadMediaDetails.toMutableList() | ||||
|                 Timber.d("Set uploadMediaDetails for index %d, size %d", uploadItemIndex, uploadMediaDetails.size) | ||||
|             } else { | ||||
|                 uploadItems[uploadItemIndex].uploadMediaDetails = mutableListOf(UploadMediaDetail()) | ||||
|                 Timber.w("Received empty uploadMediaDetails for index %d, initialized default", uploadItemIndex) | ||||
|             } | ||||
|         } else { | ||||
|             Timber.e("Invalid index %d for uploadItems size %d, skipping setUploadMediaDetails", uploadItemIndex, uploadItems.size) | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     override fun setupBasicKvStoreFactory(factory: (String) -> BasicKvStore) { | ||||
|  |  | |||
|  | @ -393,6 +393,12 @@ class UploadWorker( | |||
|                                 makeWikiDataEdit(uploadResult, contribution) | ||||
|                             } | ||||
|                             showSuccessNotification(contribution) | ||||
|                             if (appContext.contentResolver.persistedUriPermissions.any { | ||||
|                                 it.uri == contribution.contentUri }) { | ||||
|                                 appContext.contentResolver.releasePersistableUriPermission( | ||||
|                                     contribution.contentUri!!, Intent.FLAG_GRANT_READ_URI_PERMISSION | ||||
|                                 ) | ||||
|                             } | ||||
|                         } else { | ||||
|                             Timber.e("Stash Upload failed") | ||||
|                             showFailedNotification(contribution) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Nicolas Raoul
						Nicolas Raoul