2323#include " countly/event.hpp"
2424#include " countly/logger_module.hpp"
2525#include " countly/views_module.hpp"
26+ #include < countly/request_builder.hpp>
27+ #include < countly/request_module.hpp>
2628
2729namespace cly {
2830class Countly : public cly ::CountlyDelegates {
@@ -112,10 +114,6 @@ class Countly : public cly::CountlyDelegates {
112114
113115 static std::chrono::system_clock::time_point getTimestamp ();
114116
115- static std::string encodeURL (const std::string &data);
116-
117- static std::string serializeForm (const std::map<std::string, std::string> data);
118-
119117 std::string calculateChecksum (const std::string &salt, const std::string &data);
120118
121119#ifdef COUNTLY_USE_SQLITE
@@ -199,29 +197,26 @@ class Countly : public cly::CountlyDelegates {
199197 }
200198
201199 /* *
202- * Convert request queue into list.
203- * Warning: This method is for debugging purposes, and it is going to be removed in the future.
204- * You should not be using this method.
205- * @return a vector object containing events.
200+ * This function should not be used as it will be removed in a future release.
201+ * It is currently added as a temporary workaround.
206202 */
207- const std::vector<std::string> debugReturnStateOfRQ () {
208- std::vector<std::string> v (request_queue.begin (), request_queue.end ());
209- return v;
210- }
211-
212- /* *
213- * This function should not be used as it will be removed in a future release.
214- * It is currently added as a temporary workaround.
215- */
216203 inline std::function<void (LogLevel, const std::string &)> getLogger () { return logger->getLogger (); }
217204
218205 /* *
219- * This function should not be used as it will be removed in a future release.
220- * It is currently added as a temporary workaround.
221- */
222- inline void processRQDebug () { processRequestQueue (); }
206+ * This function should not be used as it will be removed in a future release.
207+ * It is currently added as a temporary workaround.
208+ */
209+ inline void processRQDebug () {
210+ if (is_sdk_initialized) {
211+ requestModule->processQueue (mutex);
212+ }
213+ }
223214
224- inline void clearRequestQueue () { request_queue.clear (); }
215+ inline void clearRequestQueue () {
216+ if (is_sdk_initialized) {
217+ requestModule->clearRequestQueue ();
218+ }
219+ }
225220
226221 inline const CountlyConfiguration &getConfiguration () { return *configuration.get (); }
227222
@@ -241,10 +236,6 @@ class Countly : public cly::CountlyDelegates {
241236 void _updateRemoteConfigWithSpecificValues (const std::map<std::string, std::string> &data);
242237#pragma endregion Remote_Config_Helper_Methods
243238
244- void processRequestQueue ();
245- void addToRequestQueue (const std::string &data);
246- HTTPResponse sendHTTP (std::string path, std::string data);
247-
248239 void _changeDeviceIdWithMerge (const std::string &value);
249240
250241 void _changeDeviceIdWithoutMerge (const std::string &value);
@@ -254,22 +245,20 @@ class Countly : public cly::CountlyDelegates {
254245 std::chrono::system_clock::duration getSessionDuration ();
255246
256247 void updateLoop ();
257-
258- bool use_https = false ;
259-
260248 bool began_session = false ;
261249 bool is_being_disposed = false ;
262250 bool is_sdk_initialized = false ;
263251
264252 std::chrono::system_clock::time_point last_sent_session_request;
265-
266253 nlohmann::json session_params;
267254
268255 std::unique_ptr<std::thread> thread;
269256 std::unique_ptr<cly::ViewsModule> views_module;
270257 std::shared_ptr<cly::CountlyConfiguration> configuration;
271258 std::shared_ptr<cly::LoggerModule> logger;
272259
260+ std::shared_ptr<cly::RequestBuilder> requestBuilder;
261+ std::unique_ptr<cly::RequestModule> requestModule;
273262 std::shared_ptr<std::mutex> mutex = std::make_shared<std::mutex>();
274263
275264 bool is_queue_being_processed = false ;
@@ -279,7 +268,6 @@ class Countly : public cly::CountlyDelegates {
279268 size_t wait_milliseconds = COUNTLY_KEEPALIVE_INTERVAL;
280269
281270 size_t max_events = COUNTLY_MAX_EVENTS_DEFAULT;
282- std::deque<std::string> request_queue;
283271#ifndef COUNTLY_USE_SQLITE
284272 std::deque<std::string> event_queue;
285273#else
@@ -290,5 +278,4 @@ class Countly : public cly::CountlyDelegates {
290278 nlohmann::json remote_config;
291279};
292280} // namespace cly
293-
294281#endif
0 commit comments