Skip to content
Repos

DevPlaceApp

C++ 1.3 KB26 lines Opens in site

Directory Raw Download

// Spec: FR-CLI-02. Screen ids of the social area (messages, conversation, notifications, profile, profile-other)
// and the factories of Routes.hpp.
#include "api/mock/MockFixtures.hpp"
#include "app/ScreenRegistry.hpp"
#include "screens/Routes.hpp"
#include "screens/conversation/ConversationScreen.hpp"
#include "screens/messages/MessagesScreen.hpp"
#include "screens/notifications/NotificationsScreen.hpp"
#include "screens/profile/ProfileScreen.hpp"

namespace dp {

ui::ScreenPtr makeProfileScreen(std::optional<std::string> username) { return std::make_shared<ProfileScreen>(std::move(username)); }
ui::ScreenPtr makeMessagesScreen() { return std::make_shared<MessagesScreen>(); }
ui::ScreenPtr makeConversationScreen(User otherUser) { return std::make_shared<ConversationScreen>(std::move(otherUser)); }
ui::ScreenPtr makeNotificationsScreen() { return std::make_shared<NotificationsScreen>(); }

void registerSocialScreens(ScreenRegistry& r) {
  r.add("messages", [] { return makeMessagesScreen(); }, true);
  r.add("conversation", [] { return makeConversationScreen(MockFixtures::alice()); }, true);
  r.add("notifications", [] { return makeNotificationsScreen(); }, true);
  r.add("profile", [] { return makeProfileScreen(std::nullopt); }, true);
  r.add("profile-other", [] { return makeProfileScreen(MockFixtures::alice().username); });
}

}  // namespace dp
40.2ms