From c2b4fccc4dd0a7087e7d0dfd2d6cf9ca31bbb775 Mon Sep 17 00:00:00 2001 From: xAlpharax <42233094+xAlpharax@users.noreply.github.com> Date: Sun, 5 Nov 2023 04:46:48 +0200 Subject: Hooking up the whole firebase of the project via firebase CLI. Also used flutter_fire firebase_core among several other libs. Changes to be committed: new file: client_app_flutter/android/app/google-services.json modified: client_app_flutter/android/build.gradle new file: client_app_flutter/ios/Runner/GoogleService-Info.plist new file: client_app_flutter/ios/firebase_app_id_file.json new file: client_app_flutter/lib/firebase_options.dart modified: client_app_flutter/lib/main.dart modified: client_app_flutter/pubspec.lock modified: client_app_flutter/pubspec.yaml --- .../android/app/google-services.json | 29 +++++++++ client_app_flutter/android/build.gradle | 3 + .../ios/Runner/GoogleService-Info.plist | 30 +++++++++ client_app_flutter/ios/firebase_app_id_file.json | 7 ++ client_app_flutter/lib/firebase_options.dart | 75 ++++++++++++++++++++++ client_app_flutter/lib/main.dart | 7 +- client_app_flutter/pubspec.lock | 46 +++++++++++++ client_app_flutter/pubspec.yaml | 1 + 8 files changed, 197 insertions(+), 1 deletion(-) create mode 100644 client_app_flutter/android/app/google-services.json create mode 100644 client_app_flutter/ios/Runner/GoogleService-Info.plist create mode 100644 client_app_flutter/ios/firebase_app_id_file.json create mode 100644 client_app_flutter/lib/firebase_options.dart (limited to 'client_app_flutter') diff --git a/client_app_flutter/android/app/google-services.json b/client_app_flutter/android/app/google-services.json new file mode 100644 index 0000000..5bea544 --- /dev/null +++ b/client_app_flutter/android/app/google-services.json @@ -0,0 +1,29 @@ +{ + "project_info": { + "project_number": "443484865448", + "project_id": "meteo-board", + "storage_bucket": "meteo-board.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:443484865448:android:896502083b5ab60d5c539d", + "android_client_info": { + "package_name": "com.example.client_app_flutter" + } + }, + "oauth_client": [], + "api_key": [ + { + "current_key": "AIzaSyAY0cu67hMFb_5BHj3iG9afj73d_7UMSY0" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/client_app_flutter/android/build.gradle b/client_app_flutter/android/build.gradle index f7eb7f6..0391438 100644 --- a/client_app_flutter/android/build.gradle +++ b/client_app_flutter/android/build.gradle @@ -7,6 +7,9 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:7.3.0' + // START: FlutterFire Configuration + classpath 'com.google.gms:google-services:4.3.10' + // END: FlutterFire Configuration classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/client_app_flutter/ios/Runner/GoogleService-Info.plist b/client_app_flutter/ios/Runner/GoogleService-Info.plist new file mode 100644 index 0000000..5a9bea1 --- /dev/null +++ b/client_app_flutter/ios/Runner/GoogleService-Info.plist @@ -0,0 +1,30 @@ + + + + + API_KEY + AIzaSyAtgMdecbtsvfeUFxCMw9GzJ1hlwgoRWg8 + GCM_SENDER_ID + 443484865448 + PLIST_VERSION + 1 + BUNDLE_ID + com.example.clientAppFlutter + PROJECT_ID + meteo-board + STORAGE_BUCKET + meteo-board.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:443484865448:ios:2616959ce13fc6615c539d + + \ No newline at end of file diff --git a/client_app_flutter/ios/firebase_app_id_file.json b/client_app_flutter/ios/firebase_app_id_file.json new file mode 100644 index 0000000..4fb4455 --- /dev/null +++ b/client_app_flutter/ios/firebase_app_id_file.json @@ -0,0 +1,7 @@ +{ + "file_generated_by": "FlutterFire CLI", + "purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory", + "GOOGLE_APP_ID": "1:443484865448:ios:2616959ce13fc6615c539d", + "FIREBASE_PROJECT_ID": "meteo-board", + "GCM_SENDER_ID": "443484865448" +} \ No newline at end of file diff --git a/client_app_flutter/lib/firebase_options.dart b/client_app_flutter/lib/firebase_options.dart new file mode 100644 index 0000000..74ffc72 --- /dev/null +++ b/client_app_flutter/lib/firebase_options.dart @@ -0,0 +1,75 @@ +// File generated by FlutterFire CLI. +// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members +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) { + return web; + } + 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 web = FirebaseOptions( + apiKey: 'AIzaSyD-EugJi1MyqWe4l8G4DqtjykEeqnevsT8', + appId: '1:443484865448:web:dffd1d739cceccf25c539d', + messagingSenderId: '443484865448', + projectId: 'meteo-board', + authDomain: 'meteo-board.firebaseapp.com', + storageBucket: 'meteo-board.appspot.com', + measurementId: 'G-7GCWGR3SVN', + ); + + static const FirebaseOptions android = FirebaseOptions( + apiKey: 'AIzaSyAY0cu67hMFb_5BHj3iG9afj73d_7UMSY0', + appId: '1:443484865448:android:896502083b5ab60d5c539d', + messagingSenderId: '443484865448', + projectId: 'meteo-board', + storageBucket: 'meteo-board.appspot.com', + ); + + static const FirebaseOptions ios = FirebaseOptions( + apiKey: 'AIzaSyAtgMdecbtsvfeUFxCMw9GzJ1hlwgoRWg8', + appId: '1:443484865448:ios:2616959ce13fc6615c539d', + messagingSenderId: '443484865448', + projectId: 'meteo-board', + storageBucket: 'meteo-board.appspot.com', + iosBundleId: 'com.example.clientAppFlutter', + ); +} diff --git a/client_app_flutter/lib/main.dart b/client_app_flutter/lib/main.dart index dda5554..e00d0ae 100644 --- a/client_app_flutter/lib/main.dart +++ b/client_app_flutter/lib/main.dart @@ -1,6 +1,11 @@ import 'package:flutter/material.dart'; -void main() { +import 'package:firebase_core/firebase_core.dart'; +import 'package:client_app_flutter/firebase_options.dart'; + +Future main() async { + WidgetsFlutterBinding.ensureInitialized(); + await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); runApp(const MyApp()); } diff --git a/client_app_flutter/pubspec.lock b/client_app_flutter/pubspec.lock index 0b808da..b796c5a 100644 --- a/client_app_flutter/pubspec.lock +++ b/client_app_flutter/pubspec.lock @@ -57,6 +57,30 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.1" + firebase_core: + dependency: "direct main" + description: + name: firebase_core + sha256: "7706f4ade6cc2698c70074083bc262586a185047f6bfdd53938dcc35d35cbb9e" + url: "https://pub.dev" + source: hosted + version: "2.21.0" + firebase_core_platform_interface: + dependency: transitive + description: + name: firebase_core_platform_interface + sha256: c437ae5d17e6b5cc7981cf6fd458a5db4d12979905f9aafd1fea930428a9fe63 + url: "https://pub.dev" + source: hosted + version: "5.0.0" + firebase_core_web: + dependency: transitive + description: + name: firebase_core_web + sha256: "0631a2ec971dbc540275e2fa00c3a8a2676f0a7adbc3c197d6fba569db689d97" + url: "https://pub.dev" + source: hosted + version: "2.8.1" flutter: dependency: "direct main" description: flutter @@ -75,6 +99,19 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" lints: dependency: transitive description: @@ -115,6 +152,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.8.3" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d + url: "https://pub.dev" + source: hosted + version: "2.1.6" sky_engine: dependency: transitive description: flutter @@ -186,3 +231,4 @@ packages: version: "0.1.4-beta" sdks: dart: ">=3.1.4 <4.0.0" + flutter: ">=3.3.0" diff --git a/client_app_flutter/pubspec.yaml b/client_app_flutter/pubspec.yaml index c77b3d0..177ae79 100644 --- a/client_app_flutter/pubspec.yaml +++ b/client_app_flutter/pubspec.yaml @@ -35,6 +35,7 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 + firebase_core: ^2.21.0 dev_dependencies: flutter_test: -- cgit v1.2.3