From 0772ec526e1d031372b5eb8caf24ca06f8dbb6f8 Mon Sep 17 00:00:00 2001 From: freetlab Date: Tue, 5 May 2026 23:00:29 +0200 Subject: [PATCH] =?UTF-8?q?Eliminar=20valores=20innecesarios=20de=20la=20c?= =?UTF-8?q?onfiguraci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../es/freetimelab/farolero/MainActivity.kt | 34 +------ lib/pantallas/pantalla_ajustes.dart | 99 ------------------- lib/servicios/servicio_version_app.dart | 29 ------ 3 files changed, 1 insertion(+), 161 deletions(-) delete mode 100644 lib/servicios/servicio_version_app.dart diff --git a/android/app/src/main/kotlin/es/freetimelab/farolero/MainActivity.kt b/android/app/src/main/kotlin/es/freetimelab/farolero/MainActivity.kt index 805ba75..1be3777 100644 --- a/android/app/src/main/kotlin/es/freetimelab/farolero/MainActivity.kt +++ b/android/app/src/main/kotlin/es/freetimelab/farolero/MainActivity.kt @@ -1,37 +1,5 @@ package es.freetimelab.farolero -import android.os.Build -import io.flutter.embedding.engine.FlutterEngine import io.flutter.embedding.android.FlutterActivity -import io.flutter.plugin.common.MethodChannel -class MainActivity: FlutterActivity() { - override fun configureFlutterEngine(flutterEngine: FlutterEngine) { - super.configureFlutterEngine(flutterEngine) - - MethodChannel( - flutterEngine.dartExecutor.binaryMessenger, - "farolero/app_info" - ).setMethodCallHandler { call, result -> - if (call.method != "getAppVersion") { - result.notImplemented() - return@setMethodCallHandler - } - - val info = packageManager.getPackageInfo(packageName, 0) - val versionCode = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { - info.longVersionCode - } else { - @Suppress("DEPRECATION") - info.versionCode.toLong() - } - - result.success( - mapOf( - "versionName" to (info.versionName ?: ""), - "versionCode" to versionCode, - ) - ) - } - } -} +class MainActivity: FlutterActivity() diff --git a/lib/pantallas/pantalla_ajustes.dart b/lib/pantallas/pantalla_ajustes.dart index 6b7cb04..d61b982 100644 --- a/lib/pantallas/pantalla_ajustes.dart +++ b/lib/pantallas/pantalla_ajustes.dart @@ -3,7 +3,6 @@ import 'package:farolero/l10n/generated/app_localizations.dart'; import 'package:provider/provider.dart'; import '../servicios/servicio_idioma.dart'; import '../servicios/servicio_perfil_usuario.dart'; -import '../servicios/servicio_version_app.dart'; import '../tema/componentes_farolero.dart'; import '../tema/tema_app.dart'; @@ -15,16 +14,6 @@ class PantallaAjustes extends StatefulWidget { } class _PantallaAjustesState extends State { - double _volumen = 0.7; - bool _vibracion = true; - late final Future _versionApp; - - @override - void initState() { - super.initState(); - _versionApp = ServicioVersionApp.obtenerVersion(); - } - @override Widget build(BuildContext context) { final l10n = AppLocalizations.of(context)!; @@ -92,84 +81,6 @@ class _PantallaAjustesState extends State { ), ), const SizedBox(height: 12), - - // Volumen de efectos de sonido - Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(l10n.soundVolume, - style: Theme.of(context).textTheme.titleLarge), - const SizedBox(height: 8), - Slider( - value: _volumen, - onChanged: (v) => setState(() => _volumen = v), - activeColor: TemaApp.colorAcento, - inactiveColor: TemaApp.colorTarjeta, - ), - ], - ), - ), - ), - const SizedBox(height: 12), - - // Vibración - Card( - child: SwitchListTile( - title: Text(l10n.vibration), - value: _vibracion, - onChanged: (v) => setState(() => _vibracion = v), - contentPadding: - const EdgeInsets.symmetric(horizontal: 16, vertical: 4), - ), - ), - const SizedBox(height: 12), - - // Acerca de - Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(l10n.about, - style: Theme.of(context).textTheme.titleLarge), - const SizedBox(height: 12), - FutureBuilder( - future: _versionApp, - builder: (context, snapshot) { - return _filaInfo( - context, - l10n.version, - snapshot.data ?? '-', - ); - }, - ), - const SizedBox(height: 8), - _filaInfo(context, l10n.developer, 'FreeTTimeLab'), - const SizedBox(height: 8), - SizedBox( - width: double.infinity, - child: OutlinedButton( - onPressed: () async { - final version = await _versionApp; - if (!context.mounted) return; - showLicensePage( - context: context, - applicationName: 'Farolero', - applicationVersion: version, - ); - }, - child: Text(l10n.licenses), - ), - ), - ], - ), - ), - ), - const SizedBox(height: 16), ], ), ), @@ -199,16 +110,6 @@ class _PantallaAjustesState extends State { ); } - Widget _filaInfo(BuildContext context, String etiqueta, String valor) { - return Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text(etiqueta, style: Theme.of(context).textTheme.bodyMedium), - Text(valor, style: Theme.of(context).textTheme.bodyLarge), - ], - ); - } - Future _editarPerfil(BuildContext context) async { final servicioPerfil = context.read(); final actual = servicioPerfil.perfil; diff --git a/lib/servicios/servicio_version_app.dart b/lib/servicios/servicio_version_app.dart deleted file mode 100644 index 12da712..0000000 --- a/lib/servicios/servicio_version_app.dart +++ /dev/null @@ -1,29 +0,0 @@ -import 'package:flutter/services.dart'; - -class ServicioVersionApp { - static const _channel = MethodChannel('farolero/app_info'); - - static Future obtenerVersion() async { - final Map? info; - try { - info = await _channel.invokeMapMethod( - 'getAppVersion', - ); - } on PlatformException { - return '-'; - } on MissingPluginException { - return '-'; - } - - final versionName = info?['versionName']?.toString(); - final versionCode = info?['versionCode']?.toString(); - - if (versionName == null || versionName.isEmpty) { - return '-'; - } - if (versionCode == null || versionCode.isEmpty) { - return versionName; - } - return '$versionName+$versionCode'; - } -}