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;
|
package fr.free.nrw.commons.upload;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import fr.free.nrw.commons.BasePresenter;
|
import fr.free.nrw.commons.BasePresenter;
|
||||||
import fr.free.nrw.commons.contributions.Contribution;
|
import fr.free.nrw.commons.contributions.Contribution;
|
||||||
|
|
||||||
|
|
@ -17,6 +18,6 @@ public class PendingUploadsContract {
|
||||||
public interface UserActionListener extends
|
public interface UserActionListener extends
|
||||||
BasePresenter<fr.free.nrw.commons.upload.PendingUploadsContract.View> {
|
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)),
|
String.format(Locale.getDefault(), getString(R.string.no)),
|
||||||
{
|
{
|
||||||
ViewUtil.showShortToast(context, R.string.cancelling_upload)
|
ViewUtil.showShortToast(context, R.string.cancelling_upload)
|
||||||
pendingUploadsPresenter.deleteUpload(contribution)
|
pendingUploadsPresenter.deleteUpload(contribution, this.requireContext().applicationContext)
|
||||||
CommonsApplication.cancelledUploads.add(contribution!!.pageId)
|
CommonsApplication.cancelledUploads.add(contribution!!.pageId)
|
||||||
},
|
},
|
||||||
{}
|
{}
|
||||||
|
|
|
||||||
|
|
@ -108,11 +108,14 @@ public class PendingUploadsPresenter implements UserActionListener {
|
||||||
* Delete a failed contribution from the local db
|
* Delete a failed contribution from the local db
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void deleteUpload(final Contribution contribution) {
|
public void deleteUpload(final Contribution contribution, Context context) {
|
||||||
compositeDisposable.add(repository
|
compositeDisposable.add(repository
|
||||||
.deleteContributionFromDB(contribution)
|
.deleteContributionFromDB(contribution)
|
||||||
.subscribeOn(ioThreadScheduler)
|
.subscribeOn(ioThreadScheduler)
|
||||||
.subscribe());
|
.subscribe(() ->
|
||||||
|
WorkRequestHelper.Companion.makeOneTimeWorkRequest(
|
||||||
|
context, ExistingWorkPolicy.KEEP)
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveContribution(Contribution contribution, Context context) {
|
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) {
|
public void pauseUploads(List<Contribution> l, int index, Context context) {
|
||||||
Timber.tag("PRINT").e(CommonsApplication.pauseUploads.toString());
|
|
||||||
if (index >= l.size()) {
|
if (index >= l.size()) {
|
||||||
return;
|
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.StashUploadResult
|
||||||
import fr.free.nrw.commons.upload.StashUploadState
|
import fr.free.nrw.commons.upload.StashUploadState
|
||||||
import fr.free.nrw.commons.upload.UploadClient
|
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.upload.UploadResult
|
||||||
import fr.free.nrw.commons.wikidata.WikidataEditService
|
import fr.free.nrw.commons.wikidata.WikidataEditService
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
|
@ -543,6 +544,7 @@ class UploadWorker(var appContext: Context, workerParams: WorkerParameters) :
|
||||||
private fun showSuccessNotification(contribution: Contribution) {
|
private fun showSuccessNotification(contribution: Contribution) {
|
||||||
val displayTitle = contribution.media.displayTitle
|
val displayTitle = contribution.media.displayTitle
|
||||||
contribution.state=Contribution.STATE_COMPLETED
|
contribution.state=Contribution.STATE_COMPLETED
|
||||||
|
curentNotification.setContentIntent(getPendingIntent(MainActivity::class.java))
|
||||||
curentNotification.setContentTitle(
|
curentNotification.setContentTitle(
|
||||||
appContext.getString(
|
appContext.getString(
|
||||||
R.string.upload_completed_notification_title,
|
R.string.upload_completed_notification_title,
|
||||||
|
|
@ -565,7 +567,7 @@ class UploadWorker(var appContext: Context, workerParams: WorkerParameters) :
|
||||||
@SuppressLint("StringFormatInvalid")
|
@SuppressLint("StringFormatInvalid")
|
||||||
private fun showFailedNotification(contribution: Contribution) {
|
private fun showFailedNotification(contribution: Contribution) {
|
||||||
val displayTitle = contribution.media.displayTitle
|
val displayTitle = contribution.media.displayTitle
|
||||||
curentNotification.setContentIntent(getPendingIntent(MainActivity::class.java))
|
curentNotification.setContentIntent(getPendingIntent(UploadProgressActivity::class.java))
|
||||||
curentNotification.setContentTitle(
|
curentNotification.setContentTitle(
|
||||||
appContext.getString(
|
appContext.getString(
|
||||||
R.string.upload_failed_notification_title,
|
R.string.upload_failed_notification_title,
|
||||||
|
|
@ -604,6 +606,7 @@ class UploadWorker(var appContext: Context, workerParams: WorkerParameters) :
|
||||||
*/
|
*/
|
||||||
private fun showPausedNotification(contribution: Contribution) {
|
private fun showPausedNotification(contribution: Contribution) {
|
||||||
val displayTitle = contribution.media.displayTitle
|
val displayTitle = contribution.media.displayTitle
|
||||||
|
curentNotification.setContentIntent(getPendingIntent(UploadProgressActivity::class.java))
|
||||||
curentNotification.setContentTitle(
|
curentNotification.setContentTitle(
|
||||||
appContext.getString(
|
appContext.getString(
|
||||||
R.string.upload_paused_notification_title,
|
R.string.upload_paused_notification_title,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue