11#pragma once
22
3+ #include " bitchat/core/bitchat_manager.h"
34#include " bitchat/protocol/packet.h"
45#include " bitchat/services/message_service.h"
56#include < functional>
67#include < memory>
8+ #include < spdlog/fmt/fmt.h>
79#include < string>
810
911namespace bitchat
1012{
1113
1214// Forward declarations
1315class MessageService ;
16+ class BitchatManager ;
1417
1518// IUserInterface: Defines the contract for all UI implementations
1619class IUserInterface
@@ -19,7 +22,7 @@ class IUserInterface
1922 virtual ~IUserInterface () = default ;
2023
2124 // Initialize the UI with message service
22- virtual bool initialize (std::shared_ptr<MessageService> messageService) = 0;
25+ virtual bool initialize (std::shared_ptr<BitchatManager> manager, std::shared_ptr< MessageService> messageService) = 0;
2326
2427 // Message event callbacks
2528 virtual void onMessageReceived (const BitchatMessage &message) = 0;
@@ -48,6 +51,42 @@ class IUserInterface
4851 // Control methods
4952 virtual void start () = 0;
5053 virtual void stop () = 0;
54+
55+ // Helper methods
56+ template <typename ... Args>
57+ void showChatMessage (const std::string &format, Args &&...args)
58+ {
59+ std::string message = fmt::format (fmt::runtime (format), std::forward<Args>(args)...);
60+ showChatMessage (message);
61+ }
62+
63+ template <typename ... Args>
64+ void showChatMessageInfo (const std::string &format, Args &&...args)
65+ {
66+ std::string message = fmt::format (fmt::runtime (format), std::forward<Args>(args)...);
67+ showChatMessageInfo (message);
68+ }
69+
70+ template <typename ... Args>
71+ void showChatMessageWarn (const std::string &format, Args &&...args)
72+ {
73+ std::string message = fmt::format (fmt::runtime (format), std::forward<Args>(args)...);
74+ showChatMessageWarn (message);
75+ }
76+
77+ template <typename ... Args>
78+ void showChatMessageError (const std::string &format, Args &&...args)
79+ {
80+ std::string message = fmt::format (fmt::runtime (format), std::forward<Args>(args)...);
81+ showChatMessageError (message);
82+ }
83+
84+ template <typename ... Args>
85+ void showChatMessageSuccess (const std::string &format, Args &&...args)
86+ {
87+ std::string message = fmt::format (fmt::runtime (format), std::forward<Args>(args)...);
88+ showChatMessageSuccess (message);
89+ }
5190};
5291
5392} // namespace bitchat
0 commit comments