diff --git a/aplicacion_hack/android/app/build.gradle.kts b/aplicacion_hack/android/app/build.gradle.kts index 8dfa486..e880649 100644 --- a/aplicacion_hack/android/app/build.gradle.kts +++ b/aplicacion_hack/android/app/build.gradle.kts @@ -1,5 +1,6 @@ plugins { id("com.android.application") + id("com.google.gms.google-services") // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. id("dev.flutter.flutter-gradle-plugin") } diff --git a/aplicacion_hack/android/app/google-services.json b/aplicacion_hack/android/app/google-services.json new file mode 100644 index 0000000..83ed588 --- /dev/null +++ b/aplicacion_hack/android/app/google-services.json @@ -0,0 +1,29 @@ +{ + "project_info": { + "project_number": "338042609701", + "project_id": "hackon-58b23", + "storage_bucket": "hackon-58b23.firebasestorage.app" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:338042609701:android:0f0f92d7f895794f371fcc", + "android_client_info": { + "package_name": "com.example.aplicacion_hack" + } + }, + "oauth_client": [], + "api_key": [ + { + "current_key": "AIzaSyBuT70SbADLeg92ll8keCySI8I4eYyqyLw" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/aplicacion_hack/android/build.gradle.kts b/aplicacion_hack/android/build.gradle.kts index dbee657..a2b1a8a 100644 --- a/aplicacion_hack/android/build.gradle.kts +++ b/aplicacion_hack/android/build.gradle.kts @@ -1,3 +1,14 @@ +buildscript { + repositories { + google() + mavenCentral() + } + dependencies { + // Añadimos la herramienta de Google Services para que Android la pueda usar + classpath("com.google.gms:google-services:4.4.1") + } +} + allprojects { repositories { google() @@ -21,4 +32,4 @@ subprojects { tasks.register("clean") { delete(rootProject.layout.buildDirectory) -} +} \ No newline at end of file diff --git a/aplicacion_hack/firebase.exe b/aplicacion_hack/firebase.exe new file mode 100644 index 0000000..8939ef9 Binary files /dev/null and b/aplicacion_hack/firebase.exe differ diff --git a/aplicacion_hack/lib/main.dart b/aplicacion_hack/lib/main.dart index 4002ec9..ab9a238 100644 --- a/aplicacion_hack/lib/main.dart +++ b/aplicacion_hack/lib/main.dart @@ -44,18 +44,18 @@ void main() async { // binding entre Flutter y el sistema operativo. WidgetsFlutterBinding.ensureInitialized(); - // Inicializar Firebase — REQUIERE que hayas corrido: - // > flutterfire configure - // Ese comando genera lib/firebase_options.dart automáticamente. - // - // ATAJO: Si aún no tienes Firebase configurado, comenta las - // siguientes 3 líneas y la app correrá sin notificaciones. - // ------------------------------------------------------- - // await Firebase.initializeApp( - // options: DefaultFirebaseOptions.currentPlatform, - // ); - // FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler); - // ------------------------------------------------------- + try { + // CAMBIAMOS EL BLOQUE COMENTADO POR ESTO: + // Al no pasarle opciones, lee el google-services.json automáticamente en Android. + await Firebase.initializeApp(); + + // Vinculamos el handler de notificaciones en segundo plano + FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler); + + debugPrint('🔥 Firebase inicializado con éxito en modo nativo.'); + } catch (e) { + debugPrint('❌ Error al inicializar Firebase: $e'); + } runApp(const ResiduosApp()); } diff --git a/aplicacion_hack/lib/services/api_service.dart b/aplicacion_hack/lib/services/api_service.dart index 3cbaa70..955922b 100644 --- a/aplicacion_hack/lib/services/api_service.dart +++ b/aplicacion_hack/lib/services/api_service.dart @@ -69,7 +69,7 @@ class ApiService { // // ATAJO: Cambia solo esta constante para apuntar a staging/prod. // ============================================================ - static const String _baseUrl = 'http://10.0.2.2:8000'; + static const String _baseUrl = 'http://192.168.192.116:8000'; // static const String _baseUrl = 'http://127.0.0.1:8000'; // iOS Simulator // static const String _baseUrl = 'http://192.168.1.XX:8000'; // Dispositivo físico diff --git a/aplicacion_hack/pubspec.yaml b/aplicacion_hack/pubspec.yaml index e56682c..6117384 100644 --- a/aplicacion_hack/pubspec.yaml +++ b/aplicacion_hack/pubspec.yaml @@ -1,4 +1,4 @@ -name: residuos_notif +name: hack_on_linces_app description: "Sistema de Notificación Privada de Recolección de Residuos - MVP Hackathon" publish_to: 'none' version: 1.0.0+1 @@ -22,7 +22,7 @@ dependencies: # REQUERIDO antes de cualquier otro plugin de Firebase. # Configura con: flutterfire configure (requiere Firebase CLI) # ------------------------------------------------------------ - firebase_core: ^3.0.0 + firebase_core: ^3.15.2 # ------------------------------------------------------------ # firebase_messaging: Recepción de notificaciones push (FCM). @@ -39,6 +39,7 @@ dependencies: shared_preferences: ^2.2.0 cupertino_icons: ^1.0.6 + firebase_auth: ^5.7.0 dev_dependencies: flutter_test: diff --git a/aplicacion_hack/test/widget_test.dart b/aplicacion_hack/test/widget_test.dart deleted file mode 100644 index a7cfe8a..0000000 --- a/aplicacion_hack/test/widget_test.dart +++ /dev/null @@ -1,30 +0,0 @@ -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility in the flutter_test package. For example, you can send tap and scroll -// gestures. You can also use WidgetTester to find child widgets in the widget -// tree, read text, and verify that the values of widget properties are correct. - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:aplicacion_hack/main.dart'; - -void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(const MyApp()); - - // Verify that our counter starts at 0. - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); - - // Tap the '+' icon and trigger a frame. - await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); - - // Verify that our counter has incremented. - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); - }); -} diff --git a/backend/hackathon.db b/backend/hackathon.db new file mode 100644 index 0000000..b5a7c63 Binary files /dev/null and b/backend/hackathon.db differ diff --git a/hackathon.db b/hackathon.db new file mode 100644 index 0000000..9df5177 Binary files /dev/null and b/hackathon.db differ