From 16d1dacf662d2a509363ae1cea8e042a285c6f10 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Wed, 10 May 2017 21:02:39 +0200 Subject: jump directly to account on error --- .../messenger/services/NotificationService.java | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/main/java/de/pixart') diff --git a/src/main/java/de/pixart/messenger/services/NotificationService.java b/src/main/java/de/pixart/messenger/services/NotificationService.java index edc93d7b7..e351bbb89 100644 --- a/src/main/java/de/pixart/messenger/services/NotificationService.java +++ b/src/main/java/de/pixart/messenger/services/NotificationService.java @@ -41,6 +41,7 @@ import de.pixart.messenger.entities.Contact; import de.pixart.messenger.entities.Conversation; import de.pixart.messenger.entities.Message; import de.pixart.messenger.ui.ConversationActivity; +import de.pixart.messenger.ui.EditAccountActivity; import de.pixart.messenger.ui.ManageAccountActivity; import de.pixart.messenger.ui.TimePreference; import de.pixart.messenger.utils.GeoHelper; @@ -747,10 +748,22 @@ public class NotificationService { mBuilder.setDeleteIntent(createDismissErrorIntent()); mBuilder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC); mBuilder.setSmallIcon(R.drawable.ic_warning_white_24dp); - mBuilder.setContentIntent(PendingIntent.getActivity(mXmppConnectionService, - 145, - new Intent(mXmppConnectionService, ManageAccountActivity.class), - PendingIntent.FLAG_UPDATE_CURRENT)); + if (errors.size() == 1) { + Intent intent = new Intent(mXmppConnectionService, EditAccountActivity.class); + Account mAccount = mXmppConnectionService.getAccounts().get(0); + intent.putExtra("jid", mAccount.getJid().toBareJid().toString()); + intent.putExtra("init", false); + mBuilder.setContentIntent(PendingIntent.getActivity(mXmppConnectionService, + 145, + intent, + PendingIntent.FLAG_UPDATE_CURRENT)); + } else { + mBuilder.setContentIntent(PendingIntent.getActivity(mXmppConnectionService, + 145, + new Intent(mXmppConnectionService, ManageAccountActivity.class), + PendingIntent.FLAG_UPDATE_CURRENT)); + } + notificationManager.notify(ERROR_NOTIFICATION_ID, mBuilder.build()); } } -- cgit v1.2.3