|
7 | 7 | #include "bitchat/services/message_service.h" |
8 | 8 | #include "bitchat/services/network_service.h" |
9 | 9 | #include "bitchat/services/noise_service.h" |
10 | | -#include "bitchat/ui/console_ui.h" |
11 | 10 | #include <chrono> |
12 | 11 | #include <ctime> |
13 | 12 | #include <iostream> |
|
16 | 15 | #include <string> |
17 | 16 | #include <thread> |
18 | 17 |
|
| 18 | +// clang-format off |
| 19 | +#ifdef BITCHAT_GUI_CONSOLE |
| 20 | + #include "bitchat/ui/console_ui.h" |
| 21 | +#elif defined(BITCHAT_GUI_DUMMY) |
| 22 | + #include "bitchat/ui/dummy_ui.h" |
| 23 | +#endif |
| 24 | +// clang-format on |
| 25 | + |
19 | 26 | using namespace bitchat; |
20 | 27 |
|
21 | 28 | int main() |
@@ -48,14 +55,22 @@ int main() |
48 | 55 | auto bluetoothAnnounceRunner = std::make_shared<bitchat::BluetoothAnnounceRunner>(); |
49 | 56 | auto cleanupRunner = std::make_shared<bitchat::CleanupRunner>(); |
50 | 57 |
|
| 58 | + // clang-format off |
51 | 59 | // Create UI |
52 | | - auto consoleUserInterface = std::make_shared<bitchat::ConsoleUserInterface>(); |
| 60 | + #ifdef BITCHAT_GUI_CONSOLE |
| 61 | + auto userInterface = std::make_shared<bitchat::ConsoleUserInterface>(); |
| 62 | + #elif defined(BITCHAT_GUI_DUMMY) |
| 63 | + auto userInterface = std::make_shared<bitchat::DummyUserInterface>(); |
| 64 | + #else |
| 65 | + #error "No valid BITCHAT_GUI macro defined" |
| 66 | + #endif |
| 67 | + // clang-format on |
53 | 68 |
|
54 | 69 | // Create and initialize manager |
55 | 70 | auto manager = std::make_shared<BitchatManager>(); |
56 | 71 |
|
57 | 72 | // Initialize manager |
58 | | - if (!manager->initialize(consoleUserInterface, bluetoothNetworkInterface, networkService, messageService, cryptoService, noiseService, bluetoothAnnounceRunner, cleanupRunner)) |
| 73 | + if (!manager->initialize(userInterface, bluetoothNetworkInterface, networkService, messageService, cryptoService, noiseService, bluetoothAnnounceRunner, cleanupRunner)) |
59 | 74 | { |
60 | 75 | spdlog::error("Failed to initialize BitchatManager"); |
61 | 76 | return EXIT_FAILURE; |
|
0 commit comments