Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit db0c48cc authored by Nicolas Fella's avatar Nicolas Fella

Extract bigtext from notifications

parent 35635a0b
......@@ -304,17 +304,27 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
np.set("title", notification.extras.getString(Notification.EXTRA_TITLE));
}
if (conversation.second != null) {
np.set("text", conversation.second);
} else {
np.set("text", notification.extras.getString(Notification.EXTRA_TEXT));
}
np.set("text", extractText(notification, conversation));
}
}
device.sendPacket(np);
}
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
private String extractText(Notification notification, Pair<String, String> conversation) {
if (conversation.second != null) {
return conversation.second;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && notification.extras.containsKey(Notification.EXTRA_BIG_TEXT)) {
return extractStringFromExtra(notification.extras, Notification.EXTRA_BIG_TEXT);
}
return notification.extras.getString(Notification.EXTRA_TEXT);
}
private Pair<String, String> extractConversation(Notification notification) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N)
return new Pair<>(null, null);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment