diff --git a/android/app/build.gradle b/android/app/build.gradle index 3798d4a6..3737bfe9 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -28,6 +28,13 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: project(':flutter_config').projectDir.getPath() + "/dotenv.gradle" +def keystoreProperties = new Properties() +def keystorePropertiesFile = rootProject.file('key.properties') +if (keystorePropertiesFile.exists()) { + keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) +} + + android { compileSdkVersion 34 buildToolsVersion '29.0.0' @@ -38,7 +45,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.example.beacon" + applicationId "com.ccextractor.beacon" minSdkVersion 23 targetSdkVersion 30 multiDexEnabled true @@ -46,11 +53,24 @@ android { versionName flutterVersionName } + signingConfigs { + release { + keyAlias = keystoreProperties['keyAlias'] + keyPassword = keystoreProperties['keyPassword'] + storeFile = keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null + storePassword = keystoreProperties['storePassword'] + } + } + buildTypes { release { // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug + // Signing with the debug keys for now, + // so `flutter run --release` works. + crunchPngs false + shrinkResources true + signingConfig = signingConfigs.debug + signingConfig = signingConfigs.release } } } diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index 226f7bad..b9aa510a 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.ccextractor.beacon"> diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 480c3165..641aac40 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.ccextractor.beacon"> diff --git a/android/app/src/main/kotlin/com/example/beacon/MainActivity.kt b/android/app/src/main/kotlin/com/example/beacon/MainActivity.kt deleted file mode 100644 index 0553af8d..00000000 --- a/android/app/src/main/kotlin/com/example/beacon/MainActivity.kt +++ /dev/null @@ -1,21 +0,0 @@ -package com.example.beacon - -import android.content.res.Configuration -import androidx.annotation.NonNull -import cl.puntito.simple_pip_mode.PipCallbackHelper -import io.flutter.embedding.android.FlutterActivity -import io.flutter.embedding.engine.FlutterEngine - -class MainActivity : FlutterActivity() { - private var callbackHelper = PipCallbackHelper() - - override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { - super.configureFlutterEngine(flutterEngine) - callbackHelper.configureFlutterEngine(flutterEngine) - } - - override fun onPictureInPictureModeChanged(active: Boolean, newConfig: Configuration?) { - super.onPictureInPictureModeChanged(active, newConfig) - callbackHelper.onPictureInPictureModeChanged(active) - } -} diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml index 226f7bad..b9aa510a 100644 --- a/android/app/src/profile/AndroidManifest.xml +++ b/android/app/src/profile/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.ccextractor.beacon"> diff --git a/lib/core/utils/utils.dart b/lib/core/utils/utils.dart index 6b9021c8..302fb9bd 100644 --- a/lib/core/utils/utils.dart +++ b/lib/core/utils/utils.dart @@ -29,7 +29,7 @@ class Utils { ) ], ), - backgroundColor: kLightBlue.withOpacity(0.8), + backgroundColor: kLightBlue.withValues(alpha: 0.8), shape: RoundedRectangleBorder( borderRadius: BorderRadius.all( Radius.circular(10), diff --git a/lib/firebase_options.dart b/lib/firebase_options.dart new file mode 100644 index 00000000..af84ee9b --- /dev/null +++ b/lib/firebase_options.dart @@ -0,0 +1,70 @@ +// File generated by FlutterFire CLI. +// ignore_for_file: type=lint +import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; +import 'package:flutter/foundation.dart' + show defaultTargetPlatform, kIsWeb, TargetPlatform; + +/// Default [FirebaseOptions] for use with your Firebase apps. +/// +/// Example: +/// ```dart +/// import 'firebase_options.dart'; +/// // ... +/// await Firebase.initializeApp( +/// options: DefaultFirebaseOptions.currentPlatform, +/// ); +/// ``` +class DefaultFirebaseOptions { + static FirebaseOptions get currentPlatform { + if (kIsWeb) { + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for web - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + } + switch (defaultTargetPlatform) { + case TargetPlatform.android: + return android; + case TargetPlatform.iOS: + return ios; + case TargetPlatform.macOS: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for macos - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + case TargetPlatform.windows: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for windows - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + case TargetPlatform.linux: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for linux - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + default: + throw UnsupportedError( + 'DefaultFirebaseOptions are not supported for this platform.', + ); + } + } + + static const FirebaseOptions android = FirebaseOptions( + apiKey: '', + appId: '', + messagingSenderId: '', + projectId: '', + storageBucket: '', + ); + + static const FirebaseOptions ios = FirebaseOptions( + apiKey: '', + appId: '', + messagingSenderId: '', + projectId: '', + storageBucket: '', + androidClientId: '', + iosClientId: '', + iosBundleId: '', + ); +} diff --git a/lib/presentation/auth/auth_cubit/auth_cubit.dart b/lib/presentation/auth/auth_cubit/auth_cubit.dart index 8ed11a61..04fb0d7a 100644 --- a/lib/presentation/auth/auth_cubit/auth_cubit.dart +++ b/lib/presentation/auth/auth_cubit/auth_cubit.dart @@ -94,4 +94,10 @@ class AuthCubit extends Cubit { error: 'Something went wrong please try again later!')); } } + + void googleSignOut() async { + print('signing out'); + GoogleSignIn _googleSignIn = GoogleSignIn(); + await _googleSignIn.signOut(); + } } diff --git a/lib/presentation/auth/auth_screen.dart b/lib/presentation/auth/auth_screen.dart index 1cd86592..2293397c 100644 --- a/lib/presentation/auth/auth_screen.dart +++ b/lib/presentation/auth/auth_screen.dart @@ -69,12 +69,16 @@ class _AuthScreenState extends State final authCubit = BlocProvider.of(context); return PopScope( canPop: false, - onPopInvoked: (didPop) async { - bool? popped = await onPopHome(); + onPopInvokedWithResult: (bool didPop, Object? result) async { + if (didPop) { + return; + } + bool? popped = await onPopHome(); if (popped == true) { await SystemNavigator.pop(); } + return; }, child: BlocConsumer( listener: (context, state) { diff --git a/lib/presentation/group/widgets/beacon_card.dart b/lib/presentation/group/widgets/beacon_card.dart index 0e330e2f..2656c305 100644 --- a/lib/presentation/group/widgets/beacon_card.dart +++ b/lib/presentation/group/widgets/beacon_card.dart @@ -71,7 +71,7 @@ class _BeaconCardState extends State { '${widget.beacon.title} is now active! \nYou can join the hike', style: TextStyle(color: Colors.black), ), - backgroundColor: kLightBlue.withOpacity(0.8), + backgroundColor: kLightBlue.withValues(alpha: 0.8), shape: RoundedRectangleBorder( borderRadius: BorderRadius.all( Radius.circular(10), diff --git a/lib/presentation/hike/cubit/location_cubit/location_cubit.dart b/lib/presentation/hike/cubit/location_cubit/location_cubit.dart index 301afe1b..82dbc6c7 100644 --- a/lib/presentation/hike/cubit/location_cubit/location_cubit.dart +++ b/lib/presentation/hike/cubit/location_cubit/location_cubit.dart @@ -441,7 +441,7 @@ class LocationCubit extends Cubit { )) ], ), - backgroundColor: kLightBlue.withOpacity(0.8), + backgroundColor: kLightBlue.withValues(alpha: 0.8), shape: RoundedRectangleBorder( borderRadius: BorderRadius.all( Radius.circular(10), @@ -526,8 +526,8 @@ class LocationCubit extends Cubit { circleId: CircleId('rippleCircle$index'), center: locationToLatLng(user.location!), radius: radius < 0 ? 0 : radius, - fillColor: Colors.red.withOpacity((0.5).clamp(0.0, 1.0)), - strokeColor: Colors.red.withOpacity(0.5), + fillColor: Colors.red.withValues(alpha: (0.5).clamp(0.0, 1.0)), + strokeColor: Colors.red.withValues(alpha: 0.5), strokeWidth: 2, ); }); @@ -752,7 +752,7 @@ class LocationCubit extends Cubit { radius: radius, strokeColor: Colors.blue, strokeWidth: 2, - fillColor: Colors.blue.withOpacity(0.1), + fillColor: Colors.blue.withValues(alpha: 0.1), )); } emit(LoadedLocationState( diff --git a/lib/presentation/home/home_screen.dart b/lib/presentation/home/home_screen.dart index f1018b85..300b54b7 100644 --- a/lib/presentation/home/home_screen.dart +++ b/lib/presentation/home/home_screen.dart @@ -1,5 +1,6 @@ import 'package:auto_route/auto_route.dart'; import 'package:beacon/domain/entities/group/group_entity.dart'; +import 'package:beacon/presentation/auth/auth_cubit/auth_cubit.dart'; import 'package:beacon/presentation/home/home_cubit/home_cubit.dart'; import 'package:beacon/presentation/home/home_cubit/home_state.dart'; import 'package:beacon/presentation/group/widgets/create_join_dialog.dart'; @@ -99,9 +100,12 @@ class _HomeScreenState extends State { Widget build(BuildContext context) { return PopScope( canPop: false, - onPopInvoked: (didPop) async { - bool? popped = await _onPopHome(context); + onPopInvokedWithResult: (bool didPop, Object? result) async { + if (didPop) { + return; + } + bool? popped = await _onPopHome(context); if (popped == true) { await SystemNavigator.pop(); } @@ -172,6 +176,9 @@ class _HomeScreenState extends State { onTap: () async { appRouter.replaceNamed('/auth'); localApi.deleteUser(); + context + .read() + .googleSignOut(); }, text: 'Yes', textSize: 18.0, diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 3b47e80a..721b7b57 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -7,6 +7,7 @@ import Foundation import connectivity_plus import device_info_plus +import firebase_core import flutter_local_notifications import geolocator_apple import google_sign_in_ios @@ -18,6 +19,7 @@ import shared_preferences_foundation func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin")) DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) + FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin")) GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin")) FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin")) diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 1032d3a8..a1f1d1a3 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -7,6 +7,7 @@ #include "generated_plugin_registrant.h" #include +#include #include #include #include @@ -14,6 +15,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { ConnectivityPlusWindowsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin")); + FirebaseCorePluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("FirebaseCorePluginCApi")); GeolocatorWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("GeolocatorWindows")); SharePlusWindowsPluginCApiRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 684998e8..122018f1 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -4,6 +4,7 @@ list(APPEND FLUTTER_PLUGIN_LIST connectivity_plus + firebase_core geolocator_windows share_plus url_launcher_windows