feat: servicios WhatsApp, Bitácora WebControl, SQLite v4, UI y store listing
This commit is contained in:
+79
-2
@@ -8,9 +8,16 @@ import 'theme.dart';
|
||||
import 'main_page.dart';
|
||||
import 'pages/register_page.dart';
|
||||
import 'widgets/app_menu_button.dart';
|
||||
// Importación del servicio de datos demo para poblar automáticamente la base de datos local
|
||||
// durante la revisión de tiendas de aplicaciones (Google Play / App Store).
|
||||
import 'services/demo_data_service.dart';
|
||||
// Servicio de Bitácora Centralizada de Errores para telemetría hacia API-SIGMA-WEBCONTROL
|
||||
import 'services/bitacora_service.dart';
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
// Inicialización de la bitácora centralizada de errores (captura global FlutterError y PlatformDispatcher)
|
||||
BitacoraService.inicializar();
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
@@ -120,6 +127,18 @@ class _LoginPageState extends State<LoginPage> {
|
||||
return;
|
||||
}
|
||||
|
||||
// ── Datos de prueba automáticos para el revisor de la tienda ────────────
|
||||
// Si el evaluador ingresa con el PIN demo fijo (123456), poblamos
|
||||
// inmediatamente las tablas operacionales (alarmas, accesos, eventos, mensajes)
|
||||
// utilizando DemoDataService para asegurar que ninguna pantalla se muestre vacía.
|
||||
if (pin == _defaultPin) {
|
||||
try {
|
||||
await DemoDataService.instance.cargarDatos();
|
||||
} catch (_) {
|
||||
// Si ocurre alguna excepción local, continuamos con la navegación normal.
|
||||
}
|
||||
}
|
||||
|
||||
if (!mounted) return;
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
@@ -135,6 +154,15 @@ class _LoginPageState extends State<LoginPage> {
|
||||
}
|
||||
}
|
||||
|
||||
// Permite al revisor de la tienda rellenar el PIN demo fijo ('123456') con un solo toque
|
||||
void _rellenarPinDemo() {
|
||||
for (int i = 0; i < _codeLength; i++) {
|
||||
_controllers[i].text = _defaultPin[i];
|
||||
}
|
||||
setState(() {});
|
||||
_handleLogin();
|
||||
}
|
||||
|
||||
void _clearCode() {
|
||||
for (final c in _controllers) c.clear();
|
||||
_focusNodes[0].requestFocus();
|
||||
@@ -234,8 +262,9 @@ class _LoginPageState extends State<LoginPage> {
|
||||
child: ElevatedButton(
|
||||
onPressed: (filled >= 4 && !_cargando) ? _handleLogin : null,
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: AppColors.primary,
|
||||
onPrimary: AppColors.primaryContainer,
|
||||
// Compatibilidad Flutter 3+: uso de backgroundColor y foregroundColor
|
||||
backgroundColor: AppColors.primary,
|
||||
foregroundColor: AppColors.primaryContainer,
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12)),
|
||||
@@ -266,6 +295,54 @@ class _LoginPageState extends State<LoginPage> {
|
||||
style: GoogleFonts.inter(
|
||||
color: AppColors.onSurfaceVariant, fontSize: 13)),
|
||||
),
|
||||
// ── Acceso demo para evaluación de tienda (Google Play / App Store) ──
|
||||
Container(
|
||||
margin: const EdgeInsets.only(top: 16, bottom: 8),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.surfaceLow,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: AppColors.outlineVariant.withOpacity(0.4)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.verified_user_outlined,
|
||||
size: 20, color: AppColors.primary),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('MODO EVALUACIÓN / REVISOR',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.primary,
|
||||
letterSpacing: 1.0)),
|
||||
const SizedBox(height: 2),
|
||||
Text('PIN Demo: 123456 (carga datos offline)',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 11,
|
||||
color: AppColors.onSurfaceVariant)),
|
||||
],
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: _cargando ? null : _rellenarPinDemo,
|
||||
style: TextButton.styleFrom(
|
||||
backgroundColor: AppColors.primary.withOpacity(0.15),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
),
|
||||
child: Text('Auto-llenar',
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.primary)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.push(
|
||||
|
||||
Reference in New Issue
Block a user