use of org.wikipedia.analytics.NotificationFunnel in project apps-android-wikipedia by wikimedia.
the class NotificationItemActionsDialog method onActionClick.
@OnClick({ R.id.notification_action_primary, R.id.notification_action_secondary, R.id.notification_action_tertiary })
void onActionClick(View v) {
Notification.Link link = (Notification.Link) v.getTag();
int linkIndex = v.getId() == R.id.notification_action_primary ? 0 : v.getId() == R.id.notification_action_secondary ? 1 : 2;
String url = link.getUrl();
if (TextUtils.isEmpty(url)) {
return;
}
new NotificationFunnel(WikipediaApp.getInstance(), notification).logAction(linkIndex, link);
linkHandler.setWikiSite(new WikiSite(url));
linkHandler.onUrlClick(url, null, "");
}
use of org.wikipedia.analytics.NotificationFunnel in project apps-android-wikipedia by wikimedia.
the class NotificationActivity method deleteItems.
private void deleteItems(List<NotificationListItemContainer> items, boolean markUnread) {
Map<WikiSite, List<Notification>> notificationsPerWiki = new HashMap<>();
Long selectionKey = items.size() > 1 ? new Random().nextLong() : null;
for (NotificationListItemContainer item : items) {
WikiSite wiki = dbNameMap.containsKey(item.notification.wiki()) ? dbNameMap.get(item.notification.wiki()) : WikipediaApp.getInstance().getWikiSite();
if (!notificationsPerWiki.containsKey(wiki)) {
notificationsPerWiki.put(wiki, new ArrayList<>());
}
notificationsPerWiki.get(wiki).add(item.notification);
if (markUnread && !displayArchived) {
notificationList.add(item.notification);
} else {
notificationList.remove(item.notification);
new NotificationFunnel(WikipediaApp.getInstance(), item.notification).logMarkRead(selectionKey);
}
}
for (WikiSite wiki : notificationsPerWiki.keySet()) {
if (markUnread) {
NotificationPollBroadcastReceiver.markRead(wiki, notificationsPerWiki.get(wiki), true);
} else {
NotificationPollBroadcastReceiver.markRead(wiki, notificationsPerWiki.get(wiki), false);
showDeleteItemsUndoSnackbar(items);
}
}
postprocessAndDisplay();
}