refactor(apps): 重构数据层目录结构并新增启动预热编排器

This commit is contained in:
zl-q
2026-03-29 20:26:30 +08:00
parent 33340de8f9
commit 4db9a13bfe
108 changed files with 1653 additions and 1320 deletions
@@ -1,5 +1,5 @@
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../data/auth_repository.dart';
import '../../data/repositories/auth_repository.dart';
import 'auth_event.dart';
import 'auth_state.dart';
@@ -3,9 +3,9 @@ import 'dart:async';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:formz/formz.dart';
import 'package:equatable/equatable.dart';
import '../../../../core/network/api_exception.dart';
import '../../../../data/network/api_exception.dart';
import '../../../../core/l10n/l10n.dart';
import '../../data/auth_repository.dart';
import '../../data/repositories/auth_repository.dart';
import '../../data/models/auth_response.dart';
import '../../../../shared/forms/inputs.dart';
@@ -1,18 +1,45 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class AuthBootScreen extends StatelessWidget {
import '../../../../app/di/injection.dart';
import '../../../../app/services/app_prewarm_orchestrator.dart';
import '../bloc/auth_bloc.dart';
import '../bloc/auth_state.dart';
class AuthBootScreen extends StatefulWidget {
const AuthBootScreen({super.key});
@override
State<AuthBootScreen> createState() => _AuthBootScreenState();
}
class _AuthBootScreenState extends State<AuthBootScreen> {
@override
void initState() {
super.initState();
_triggerPrewarmIfAuthenticated(context.read<AuthBloc>().state);
}
void _triggerPrewarmIfAuthenticated(AuthState state) {
if (state is! AuthAuthenticated) {
return;
}
sl<AppPrewarmOrchestrator>().ensureStartedFor(state.user.id);
}
@override
Widget build(BuildContext context) {
final colorScheme = Theme.of(context).colorScheme;
return Scaffold(
backgroundColor: colorScheme.surface,
body: SafeArea(
child: Center(
child: Image.asset(
'assets/branding/assistant_octopus_foreground.png',
width: 260,
return BlocListener<AuthBloc, AuthState>(
listener: (context, state) => _triggerPrewarmIfAuthenticated(state),
child: Scaffold(
backgroundColor: colorScheme.surface,
body: SafeArea(
child: Center(
child: Image.asset(
'assets/branding/assistant_octopus_foreground.png',
width: 260,
),
),
),
),
@@ -14,7 +14,7 @@ import '../../../../shared/widgets/confirm_sheet.dart';
import '../../../../shared/widgets/link_button.dart';
import '../../../../shared/widgets/phone_prefix_selector.dart';
import '../../../../shared/widgets/toast/toast_type.dart';
import '../../data/auth_repository.dart';
import '../../data/repositories/auth_repository.dart';
import '../../presentation/bloc/auth_bloc.dart';
import '../../presentation/bloc/auth_event.dart';
import '../../presentation/cubits/login_cubit.dart';