@Override protected boolean execute(Conversation conversation) { PendingIntent pendingIntent = ApptentiveInternal.prepareMessageCenterPendingIntent(foreground.getApplicationContext(), conversation); if (pendingIntent != null) { final ApptentiveToastNotificationManager manager = ApptentiveToastNotificationManager.getInstance(foreground, true); final ApptentiveToastNotification.Builder builder = new ApptentiveToastNotification.Builder(foreground); builder.setContentTitle(foreground.getResources().getString(R.string.apptentive_message_center_title)) .setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_LIGHTS) .setSmallIcon(R.drawable.avatar).setContentText(apptentiveMsg.getBody()) .setContentIntent(pendingIntent) .setFullScreenIntent(pendingIntent, false); DispatchQueue.mainQueue().dispatchAsync(new DispatchTask() { @Override protected void execute() { ApptentiveToastNotification notification = builder.buildApptentiveToastNotification(); notification.setAvatarUrl(apptentiveMsg.getSenderProfilePhoto()); manager.notify(TOAST_TYPE_UNREAD_MESSAGE, notification);} }); } return true; } });
@Override protected void execute() { if (successful) { final Activity activity = getActivity(); dispatchOnConversationQueue(new DispatchTask() { @Override protected void execute() { ApptentiveInternal.getInstance().showMessageCenterInternal(activity, null); dispatchOnMainQueue(new DispatchTask() { @Override protected void execute() { transit(); } }); } }); } else { updateStatus(); } } });
@Override protected void execute() { Conversation conversation = notNull(ApptentiveInternal.getInstance().getConversation()); if (conversation == null) { dispatchOnMainQueue(new DispatchTask() { @Override protected void execute() { finish(); } }); } } });
private void invokeCallback(final boolean result) { if (callback != null) { try { if (callbackQueue != null) { callbackQueue.dispatchAsync(new DispatchTask() { @Override protected void execute() { callback.onFinish(result); } }); } else { callback.onFinish(result); } } catch (Exception e) { ApptentiveLog.e(CONVERSATION, "Exception while invoking callback"); logException(e); } } }