Live location tracking and playback for the game "manhunt"
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add complete_setup command

Ben C 908865ab 01357c7f

+36
+25
backend/src/lib.rs
··· 178 178 } 179 179 } 180 180 181 + pub fn complete_setup(&mut self, app: &AppHandle, profile: PlayerProfile) -> Result { 182 + if let AppState::Setup = self { 183 + profile.write_to_store(app); 184 + *self = AppState::Menu(profile); 185 + Self::emit_screen_change(app, AppScreen::Menu); 186 + Ok(()) 187 + } else { 188 + Err("Must be on the Setup screen".to_string()) 189 + } 190 + } 191 + 181 192 pub fn replay_game(&mut self, app: &AppHandle, id: UtcDT) -> Result { 182 193 if let AppState::Menu(_) = self { 183 194 let history = AppGameHistory::get_history(app, id) ··· 287 298 let mut state = state.write().await; 288 299 state.quit_to_menu(app); 289 300 Ok(()) 301 + } 302 + 303 + // == AppState::Setup COMMANDS 304 + 305 + #[tauri::command] 306 + #[specta::specta] 307 + /// (Screen: Setup) Complete user setup and go to the menu screen 308 + async fn complete_setup( 309 + profile: PlayerProfile, 310 + app: AppHandle, 311 + state: State<'_, AppStateHandle>, 312 + ) -> Result { 313 + state.write().await.complete_setup(&app, profile) 290 314 } 291 315 292 316 // == AppState::Menu COMMANDS == ··· 482 506 get_current_replay_history, 483 507 get_game_settings, 484 508 get_game_state, 509 + complete_setup, 485 510 ]) 486 511 .events(collect_events![ 487 512 ChangeScreen,
+11
frontend/src/bindings.ts
··· 229 229 if (e instanceof Error) throw e; 230 230 else return { status: "error", error: e as any }; 231 231 } 232 + }, 233 + /** 234 + * (Screen: Setup) Complete user setup and go to the menu screen 235 + */ 236 + async completeSetup(profile: PlayerProfile): Promise<Result<null, string>> { 237 + try { 238 + return { status: "ok", data: await TAURI_INVOKE("complete_setup", { profile }) }; 239 + } catch (e) { 240 + if (e instanceof Error) throw e; 241 + else return { status: "error", error: e as any }; 242 + } 232 243 } 233 244 }; 234 245