fetch user profile 👍
This commit is contained in:
12
README.md
12
README.md
@@ -1,13 +1,17 @@
|
||||
# Friendolls (Desktop)
|
||||
|
||||
Run the following command in project root on first run & after changes to models on Rust side to generate TypeScript type bindings from Rust models
|
||||
This repository contins source for Friendolls desktop app. Will add more info when the app scales.
|
||||
|
||||
Run the following command in project root after changes to models on Rust side to generate TypeScript type bindings from Rust models
|
||||
|
||||
```sh
|
||||
# unix
|
||||
TS_RS_EXPORT_DIR="../src/types/bindings" cargo test export_bindings --manifest-path=./src-tauri/Cargo.toml
|
||||
# average unix shells
|
||||
TS_RS_EXPORT_DIR="../src/types/bindings" cargo test export_bindings --manifest-path="./src-tauri/Cargo.toml"
|
||||
```
|
||||
|
||||
```sh
|
||||
# powershell
|
||||
$Env:TS_RS_EXPORT_DIR = "../src/types/bindings"; cargo test export_bindings --manifest-path=./src-tauri/Cargo.toml
|
||||
$Env:TS_RS_EXPORT_DIR = "../src/types/bindings"; cargo test export_bindings --manifest-path="./src-tauri/Cargo.toml"
|
||||
```
|
||||
|
||||
> _To the gods of programming, please grant me the perseverance to push through and get this app into production_ 🙏
|
||||
|
||||
@@ -4,20 +4,29 @@ use tracing::{error, info};
|
||||
|
||||
use crate::{
|
||||
get_app_handle,
|
||||
services::overlay::{overlay_fullscreen, SCENE_WINDOW_LABEL},
|
||||
services::{auth::get_tokens, preferences::create_preferences_window},
|
||||
services::{
|
||||
auth::get_tokens,
|
||||
overlay::{overlay_fullscreen, SCENE_WINDOW_LABEL},
|
||||
preferences::create_preferences_window,
|
||||
},
|
||||
state::init_app_data,
|
||||
};
|
||||
|
||||
pub async fn start_fdoll() {
|
||||
init_session().await;
|
||||
bootstrap().await;
|
||||
}
|
||||
|
||||
pub async fn init_session() {
|
||||
async fn construct_app() {
|
||||
init_app_data().await;
|
||||
create_scene();
|
||||
create_preferences_window();
|
||||
}
|
||||
|
||||
pub async fn bootstrap() {
|
||||
match get_tokens().await {
|
||||
Some(_) => {
|
||||
info!("User session restored");
|
||||
create_scene();
|
||||
create_preferences_window();
|
||||
construct_app().await;
|
||||
}
|
||||
None => {
|
||||
info!("No active session, user needs to authenticate");
|
||||
@@ -25,8 +34,7 @@ pub async fn init_session() {
|
||||
info!("Authentication successful, creating scene...");
|
||||
tauri::async_runtime::spawn(async {
|
||||
info!("Creating scene after auth success...");
|
||||
create_scene();
|
||||
create_preferences_window();
|
||||
construct_app().await;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use crate::state::init_app_data;
|
||||
use crate::{lock_r, lock_w, state::FDOLL, APP_HANDLE};
|
||||
use base64::{engine::general_purpose::URL_SAFE_NO_PAD, Engine};
|
||||
use flate2::{read::GzDecoder, write::GzEncoder, Compression};
|
||||
|
||||
@@ -90,12 +90,6 @@ pub fn init_fdoll_state() {
|
||||
async_runtime::spawn(async move {
|
||||
crate::services::ws::init_ws_client().await;
|
||||
});
|
||||
|
||||
// TODO: seems like even under `has_auth` token may not be present when init app data
|
||||
async_runtime::spawn(async move {
|
||||
info!("Initializing user data");
|
||||
init_app_data().await;
|
||||
});
|
||||
}
|
||||
|
||||
info!("Initialized FDOLL state (WebSocket client & user data initializing asynchronously)");
|
||||
|
||||
Reference in New Issue
Block a user