#pragma once // Spec: INV-social 15.5 (routing, priority order) and the redirect parsing of NotificationsView.ViewModel. #include #include #include "model/Notification.hpp" #include "model/User.hpp" #include "screens/PostDestination.hpp" namespace dp { struct NotificationRoute { enum class Kind { Post, Conversation, Web, OwnProfile }; Kind kind = Kind::Post; PostDestination post; User user; std::string url; }; class NotificationRouting { public: // 1 message+actor -> conversation, 2 badge -> own profile, 3 issue -> web, 4 redirect with /posts/ -> post. static std::optional route(const Notification& notification, const std::string& redirect); static std::optional postDestination(const std::string& redirect); static std::optional postSlug(const std::string& url); // Fragment (comment-, comment_, comment:, comment prefixes), then query (comment, comment_id, commentId, // comment_uid), then the path segment after "comments". static std::optional commentUid(const std::string& url); }; } // namespace dp