feat: add sync progress, break loops once we get 0 users back
This commit is contained in:
@ -5,6 +5,7 @@ use crate::{
|
||||
use lazy_static::lazy_static;
|
||||
use serde_json::Value;
|
||||
use tokio::sync::Mutex;
|
||||
use crate::handlers::fansly::{SyncProgress, PROGRESS};
|
||||
|
||||
lazy_static! {
|
||||
static ref FANSLY: Mutex<Fansly> = Mutex::new(Fansly::new(None));
|
||||
@ -28,7 +29,7 @@ pub async fn fansly_get_me() -> Result<FanslyBaseResponse<FanslyAccountResponse>
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn fansly_sync(auto: bool) -> Result<SyncDataResponse, String> {
|
||||
let fansly = FANSLY.lock().await;
|
||||
let mut fansly = FANSLY.lock().await;
|
||||
let response = fansly.sync(auto).await;
|
||||
|
||||
match response {
|
||||
@ -37,6 +38,11 @@ pub async fn fansly_sync(auto: bool) -> Result<SyncDataResponse, String> {
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn fansly_get_sync_status() -> SyncProgress {
|
||||
PROGRESS.lock().await.clone()
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn fansly_upload_auto_sync_data(
|
||||
data: SyncDataResponse,
|
||||
|
Reference in New Issue
Block a user