Dev SQL -> main#70
Conversation
Sqlite implementation
Setup and foundation fixes
Rankings fix
There was a problem hiding this comment.
Pull request overview
This PR migrates tournament-mode data handling from SharedPreferences/in-memory JSON to a persistent SQLite-backed cache, refactors multiple tournament UI surfaces to load progressively from cache/streams, and adds a shared loading indicator widget. It also includes several stability improvements (mounted checks, null-safety guards) and iOS/macOS project updates to support the new dependencies/assets.
Changes:
- Add SQLite caching layer for tournaments (sqflite + helper/validator/cache manager) and expose cache access helpers (
getTournamentFromCache, streaming tournament loaders). - Refactor tournament/tournament-mode screens & widgets to load tournament/game/stats data from the SQLite cache/streams and improve loading/error UI.
- Apply robustness fixes across setup/auth/screens (mounted checks, safer parsing, safer list access) and update iOS/macOS build artifacts/assets.
Reviewed changes
Copilot reviewed 66 out of 71 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| elapse_app/pubspec.yaml | Adds sqflite dependency and updates flutter_sticky_header. |
| elapse_app/macos/Flutter/GeneratedPluginRegistrant.swift | Registers sqflite + updates plugin registrant symbols. |
| elapse_app/lib/setup/signup/login_page.dart | Adds mounted checks and replaces .then/.catchError with try/catch. |
| elapse_app/lib/setup/signup/enter_details.dart | Safer initState + try/catch around createUser flow. |
| elapse_app/lib/setup/signup/create_account.dart | Adds mounted checks and wraps Firebase calls in try/catch. |
| elapse_app/lib/setup/configure/tournament_mode_setup.dart | Removes duplicate super.initState() call. |
| elapse_app/lib/setup/configure/match_notifs_setup.dart | Avoids indexing into empty saved teams list. |
| elapse_app/lib/setup/configure/join_team_group.dart | Refactors join flow to try/catch + mounted checks. |
| elapse_app/lib/setup/configure/join_team.dart | Refactors createUser flow to try/catch + mounted checks. |
| elapse_app/lib/setup/configure/create_team_group.dart | Refactors createTeamGroup flow to try/catch + mounted checks. |
| elapse_app/lib/setup/configure/complete_setup.dart | Changes “finish setup” navigation to route through SetupGate with transition. |
| elapse_app/lib/screens/widgets/elapse_loading_indicator.dart | New reusable loading indicator widget (section/fullscreen variants). |
| elapse_app/lib/screens/tournament_mode/widgets/next_game.dart | Converts to StatefulWidget; loads game from SQLite cache via composite key. |
| elapse_app/lib/screens/tournament_mode/tournament.dart | Switches tournament loading to stream subscription + loading/error UI. |
| elapse_app/lib/screens/tournament_mode/picklist/picklist_widget.dart | Converts to StatefulWidget; pulls stats from cached tournament rather than FutureBuilder. |
| elapse_app/lib/screens/tournament_mode/picklist/picklist.dart | Removes tournament Future plumbing (now handled by picklist widgets). |
| elapse_app/lib/screens/tournament_mode/my_teams.dart | Adds cached-tournament loading, refresh flow, and stronger guards around saved team parsing. |
| elapse_app/lib/screens/tournament/tournament.dart | Switches tournament loading to stream subscription (supports progressive updates). |
| elapse_app/lib/screens/tournament/pages/schedule/game_widget.dart | Makes alliance preview access null-safe; updates navigation to GameScreen composite key params. |
| elapse_app/lib/screens/tournament/pages/schedule/game_screen.dart | Loads game/teams/stats from cached tournament and improves loading/error states. |
| elapse_app/lib/screens/tournament/pages/rankings/tournament_stats_page.dart | Loads tournament from SQLite cache instead of prefs JSON; adds null guards. |
| elapse_app/lib/screens/tournament/pages/rankings/rankings_widget.dart | Removes implicit tournament load; requires TeamStats stats to be passed in. |
| elapse_app/lib/screens/tournament/pages/rankings/rankings.dart | Refactors rankings page to accept teams/rankings explicitly and improves filtering/sorting safety. |
| elapse_app/lib/screens/tournament/pages/main/search_screen.dart | Adds schedule-not-loaded UI and makes alliance list access safer. |
| elapse_app/lib/screens/tournament/pages/main/loading.dart | Uses ElapseLoadingIndicator instead of LinearProgressIndicator. |
| elapse_app/lib/screens/tournament/pages/info/info.dart | Converts to StatefulWidget; uses tournament’s awards + loading indicator for progressive load. |
| elapse_app/lib/screens/tournament/pages/info/all_teams.dart | Adds loading/empty states and safer async setState handling. |
| elapse_app/lib/screens/team_screen/team_screen.dart | Adds mounted guards around async setState; makes skills future nullable. |
| elapse_app/lib/screens/team_screen/scoutsheet/closed.dart | Prevents division-by-null in upload progress indicators. |
| elapse_app/lib/screens/team_screen/camera/photo_bottom_sheet.dart | Fixes metadata contentType construction when extension is missing. |
| elapse_app/lib/screens/settings/setup_group.dart | Adds join code validation and handles missing group info before join. |
| elapse_app/lib/screens/settings/settings.dart | Makes saved team parsing safer and updates TM cache invalidation/reload flow. |
| elapse_app/lib/screens/settings/account_settings.dart | Improves null-safety around user fields and wraps email verification in try/catch. |
| elapse_app/lib/screens/scout/cloud_scout.dart | Adds RefreshIndicator wrapper and keeps scroll always-refreshable. |
| elapse_app/lib/screens/home/home.dart | Switches app reload key usage to setupGateKey. |
| elapse_app/lib/screens/explore/worldRankings/world_rankings_search_screen.dart | Simplifies to skills-only search and updates header layout. |
| elapse_app/lib/screens/explore/worldRankings/world_rankings_filter.dart | Removes unused VDA import. |
| elapse_app/lib/screens/explore/worldRankings/topWorldSkills.dart | Uses ElapseLoadingIndicator while loading. |
| elapse_app/lib/screens/explore/worldRankings/skills/world_skills_widget.dart | Refactors layout to Row/Expanded for simpler rendering. |
| elapse_app/lib/screens/explore/worldRankings.dart | Removes TrueSkill tab; updates search/filter and uses cached tournament when in TM. |
| elapse_app/lib/screens/explore/upcoming_tournaments.dart | Uses ElapseLoadingIndicator while loading. |
| elapse_app/lib/screens/explore/explore.dart | Converts to StatefulWidget with pull-to-refresh for upcoming lists/top skills. |
| elapse_app/lib/main.dart | Introduces SetupGate and app reload key, initializes SQLite, restructures navigation stack. |
| elapse_app/lib/extras/database.dart | Adds missing empty-query guards and fixes “clear all docs” behavior. |
| elapse_app/lib/database/validators.dart | Adds tournament ingestion validation utilities for SQLite storage. |
| elapse_app/lib/database/database_helper.dart | Adds SQLite schema + lifecycle management for cached tournament data. |
| elapse_app/lib/database/cache_manager.dart | Adds higher-level cache orchestration with stale-cache fallback behavior. |
| elapse_app/lib/classes/Tournament/tstats.dart | Makes alliance/team indexing safer during stats calculation. |
| elapse_app/lib/classes/Tournament/tournament.dart | Adds league session support, SQLite-backed TM caching APIs, and streaming tournament loader. |
| elapse_app/lib/classes/Tournament/league_session.dart | New model for league sessions parsed from API “locations”. |
| elapse_app/lib/classes/Tournament/game.dart | Adds divisionId and strengthens parsing; updates JSON serialization and fetch helpers. |
| elapse_app/lib/classes/Team/world_skills.dart | Makes team skills lookup nullable using singleWhereOrNull. |
| elapse_app/lib/classes/Team/vdaStats.dart | Fixes ties calculation and makes team lookup safer. |
| elapse_app/ios/Runner/Info.plist | Reorders keys, adds ATS settings and Firebase messaging init keys, adds scene manifest. |
| elapse_app/ios/Runner/Assets.xcassets/LaunchImage.launchimage/Contents.json | Adds launch image asset catalog metadata. |
| elapse_app/ios/Runner/Assets.xcassets/Contents.json | Adds root asset catalog metadata. |
| elapse_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json | Adds app icon asset catalog metadata (light/dark/tinted). |
| elapse_app/ios/Runner/AppDelegate.swift | Changes plugin registration strategy for implicit engine initialization. |
| elapse_app/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme | Adds custom LLDB init file path. |
| elapse_app/ios/Runner.xcodeproj/project.pbxproj | Adds new asset catalog reference and updates deployment target/bundle ID quoting. |
| elapse_app/ios/Flutter/AppFrameworkInfo.plist | Updates CFBundleIdentifier and removes MinimumOSVersion key. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 66 out of 71 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
data stream actually implemented
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 69 out of 74 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
elapse_app/lib/screens/tournament_mode/my_teams.dart:127
reload()appends tosavedTeamPreviews/savedTeamPreviewswithout clearing them first. Sincereload()can be triggered multiple times (e.g., from the settings callback), this can keep teams that were removed from prefs and generally accumulate stale entries. Clear/rebuild these lists at the start ofreload()before adding the current prefs values.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 69 out of 74 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
elapse_app/lib/screens/settings/setup_group.dart:214
- This handler awaits
database.getGroupInfoand then callsshowDialog/setState/Navigator.pushReplacementusing the same BuildContext. Addmountedchecks after awaits (and before setState/navigation) to avoid exceptions when the page is dismissed while the async work is in-flight.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 69 out of 74 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.