mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Improved Tap to View notification
This commit is contained in:
parent
51bdd2bca0
commit
6cf975fe49
4 changed files with 12 additions and 6 deletions
|
|
@ -1,5 +1,6 @@
|
|||
package fr.free.nrw.commons.upload;
|
||||
|
||||
import android.content.Context;
|
||||
import fr.free.nrw.commons.BasePresenter;
|
||||
import fr.free.nrw.commons.contributions.Contribution;
|
||||
|
||||
|
|
@ -17,6 +18,6 @@ public class PendingUploadsContract {
|
|||
public interface UserActionListener extends
|
||||
BasePresenter<fr.free.nrw.commons.upload.PendingUploadsContract.View> {
|
||||
|
||||
void deleteUpload(Contribution contribution);
|
||||
void deleteUpload(Contribution contribution, Context context);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ class PendingUploadsFragment : CommonsDaggerSupportFragment(), PendingUploadsCon
|
|||
String.format(Locale.getDefault(), getString(R.string.no)),
|
||||
{
|
||||
ViewUtil.showShortToast(context, R.string.cancelling_upload)
|
||||
pendingUploadsPresenter.deleteUpload(contribution)
|
||||
pendingUploadsPresenter.deleteUpload(contribution, this.requireContext().applicationContext)
|
||||
CommonsApplication.cancelledUploads.add(contribution!!.pageId)
|
||||
},
|
||||
{}
|
||||
|
|
|
|||
|
|
@ -108,11 +108,14 @@ public class PendingUploadsPresenter implements UserActionListener {
|
|||
* Delete a failed contribution from the local db
|
||||
*/
|
||||
@Override
|
||||
public void deleteUpload(final Contribution contribution) {
|
||||
public void deleteUpload(final Contribution contribution, Context context) {
|
||||
compositeDisposable.add(repository
|
||||
.deleteContributionFromDB(contribution)
|
||||
.subscribeOn(ioThreadScheduler)
|
||||
.subscribe());
|
||||
.subscribe(() ->
|
||||
WorkRequestHelper.Companion.makeOneTimeWorkRequest(
|
||||
context, ExistingWorkPolicy.KEEP)
|
||||
));
|
||||
}
|
||||
|
||||
public void saveContribution(Contribution contribution, Context context) {
|
||||
|
|
@ -126,7 +129,6 @@ public class PendingUploadsPresenter implements UserActionListener {
|
|||
}
|
||||
|
||||
public void pauseUploads(List<Contribution> l, int index, Context context) {
|
||||
Timber.tag("PRINT").e(CommonsApplication.pauseUploads.toString());
|
||||
if (index >= l.size()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import fr.free.nrw.commons.upload.FileUtilsWrapper
|
|||
import fr.free.nrw.commons.upload.StashUploadResult
|
||||
import fr.free.nrw.commons.upload.StashUploadState
|
||||
import fr.free.nrw.commons.upload.UploadClient
|
||||
import fr.free.nrw.commons.upload.UploadProgressActivity
|
||||
import fr.free.nrw.commons.upload.UploadResult
|
||||
import fr.free.nrw.commons.wikidata.WikidataEditService
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
|
|
@ -543,6 +544,7 @@ class UploadWorker(var appContext: Context, workerParams: WorkerParameters) :
|
|||
private fun showSuccessNotification(contribution: Contribution) {
|
||||
val displayTitle = contribution.media.displayTitle
|
||||
contribution.state=Contribution.STATE_COMPLETED
|
||||
curentNotification.setContentIntent(getPendingIntent(MainActivity::class.java))
|
||||
curentNotification.setContentTitle(
|
||||
appContext.getString(
|
||||
R.string.upload_completed_notification_title,
|
||||
|
|
@ -565,7 +567,7 @@ class UploadWorker(var appContext: Context, workerParams: WorkerParameters) :
|
|||
@SuppressLint("StringFormatInvalid")
|
||||
private fun showFailedNotification(contribution: Contribution) {
|
||||
val displayTitle = contribution.media.displayTitle
|
||||
curentNotification.setContentIntent(getPendingIntent(MainActivity::class.java))
|
||||
curentNotification.setContentIntent(getPendingIntent(UploadProgressActivity::class.java))
|
||||
curentNotification.setContentTitle(
|
||||
appContext.getString(
|
||||
R.string.upload_failed_notification_title,
|
||||
|
|
@ -604,6 +606,7 @@ class UploadWorker(var appContext: Context, workerParams: WorkerParameters) :
|
|||
*/
|
||||
private fun showPausedNotification(contribution: Contribution) {
|
||||
val displayTitle = contribution.media.displayTitle
|
||||
curentNotification.setContentIntent(getPendingIntent(UploadProgressActivity::class.java))
|
||||
curentNotification.setContentTitle(
|
||||
appContext.getString(
|
||||
R.string.upload_paused_notification_title,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue