1diff --git a/src-tauri/src/qf_client/modules/analytics.rs b/src-tauri/src/qf_client/modules/analytics.rs
2index f68e185..355723e 100644
3--- a/src-tauri/src/qf_client/modules/analytics.rs
4+++ b/src-tauri/src/qf_client/modules/analytics.rs
5@@ -37,7 +37,7 @@ impl AnalyticsModule {
6 current_page: "home".to_string(),
7 component: "Analytics".to_string(),
8 is_init: false,
9- send_metrics: true,
10+ send_metrics: false,
11 last_user_activity: Arc::new(Mutex::new(Instant::now())),
12 metricAndLabelPairsScheduledToSend: vec![],
13 }
14@@ -77,90 +77,7 @@ impl AnalyticsModule {
15 }
16 pub fn init(&mut self) -> Result<(), AppError> {
17 let app = states::app_state()?;
18- if self.is_init {
19- return Ok(());
20- }
21- self.is_init = true;
22- self.update_state();
23-
24- let is_first_install = app.is_first_install.clone();
25- tauri::async_runtime::spawn({
26- async move {
27- // Create a new instance of the QFClient and store it in the app state
28- let qf = states::qf_client().expect("Failed to get qf client");
29-
30- // Create Timer for sending metrics
31- let mut last_metric_time = Instant::now();
32-
33- if is_first_install {
34- qf.analytics()
35- .metricAndLabelPairsScheduledToSend
36- .push(HashMap::from([(
37- "First_Install".to_string(),
38- "true".to_string(),
39- )]));
40- }
41- loop {
42- let send_metrics = qf.analytics().send_metrics;
43- if !send_metrics {
44- tokio::time::sleep(std::time::Duration::from_secs(60)).await;
45- continue;
46- }
47-
48- if last_metric_time.elapsed() < Duration::from_secs(15)
49- || !qf.analytics().is_user_active()
50- {
51- tokio::time::sleep(std::time::Duration::from_secs(5)).await;
52- continue;
53- }
54-
55- if last_metric_time.elapsed() < Duration::from_secs(60)
56- && !qf.analytics().is_user_active()
57- {
58- tokio::time::sleep(std::time::Duration::from_secs(5)).await;
59- continue;
60- }
61-
62- last_metric_time = Instant::now();
63- // logger::info_con(
64- // &qf.analytics().get_component("TrySendAnalytics"),
65- // "Sending user activity",
66- // );
67- match qf
68- .analytics()
69- .try_send_analytics(
70- "users/metrics/periodic",
71- 3,
72- json!(qf.analytics().metricAndLabelPairsScheduledToSend),
73- )
74- .await
75- {
76- Ok(_) => {
77- qf.analytics().clear_metrics();
78- }
79- Err(e) => {
80- if e.cause().contains("Unauthorized")
81- || e.cause().contains("Banned")
82- || e.cause().contains("WFMBanned")
83- {
84- error::create_log_file("analytics.log", &e);
85- break;
86- } else if e.cause().contains("429") {
87- logger::info(
88- &qf.analytics().get_component("TrySendAnalytics"),
89- "Rate limit reached, waiting for 60 seconds",
90- LoggerOptions::default(),
91- );
92- tokio::time::sleep(std::time::Duration::from_secs(60)).await;
93- continue;
94- }
95- error::create_log_file("analytics.log", &e);
96- }
97- };
98- }
99- qf.analytics().is_init = false;
100- }
101- });
102+ self.is_init = false;
103 Ok(())
104 }
105 pub fn set_send_metrics(&mut self, send_metrics: bool) {
106@@ -173,45 +90,6 @@ impl AnalyticsModule {
107 mut retry_count: i64,
108 data: Value,
109 ) -> Result<(), AppError> {
110- let mut parameters: Vec<String> = vec![];
111- if self.is_user_active() {
112- parameters.push(format!("Active_Page={}", self.current_page));
113- }
114-
115- while retry_count >= 0 {
116- let err = match self
117- .client
118- .post::<Value>(
119- format!("{}?{}", url, parameters.join("&")).as_str(),
120- data.clone(),
121- )
122- .await
123- {
124- Ok(ApiResult::Success(_, _)) => {
125- return Ok(());
126- }
127- Ok(ApiResult::Error(e, _headers)) => AppError::new_api(
128- &self.get_component("TrySendAnalytics"),
129- e,
130- eyre!("Failed to send analytics"),
131- LogLevel::Error,
132- ),
133- Err(e) => e,
134- };
135- if retry_count == 0 {
136- return Err(err);
137- }
138- retry_count -= 1;
139- logger::warning(
140- &self.get_component("TrySendAnalytics"),
141- &format!(
142- "Failed to send analytics, retrying in 5 seconds, retries left: {}",
143- retry_count
144- ),
145- LoggerOptions::default(),
146- );
147- tokio::time::sleep(std::time::Duration::from_secs(5)).await;
148- }
149 Ok(())
150 }
151 }
152diff --git a/src/contexts/app.context.tsx b/src/contexts/app.context.tsx
153index 7897db9..1945ab9 100644
154--- a/src/contexts/app.context.tsx
155+++ b/src/contexts/app.context.tsx
156@@ -160,7 +160,7 @@ export function AppContextProvider({ children }: AppContextProviderProps) {
157 const id = context.substring(start, end);
158
159 console.log("OpenTos", settings?.tos_uuid, id);
160- if (id == settings?.tos_uuid) return;
161+ if (true) return;
162 modals.open({
163 title: useTranslateModals("tos.title"),
164 size: "100%",