From cb9563ac9864d9ace993ec3eef9cd63b2cd3d88f Mon Sep 17 00:00:00 2001 From: Vadim Date: Sun, 26 Mar 2023 12:02:21 +0300 Subject: [PATCH] added firebase to project --- .gitignore | 6 +++++- android/app/build.gradle | 1 + android/build.gradle | 1 + ios/Runner.xcodeproj/project.pbxproj | 4 ++++ lib/launch_app.dart | 5 ++++- pubspec.yaml | 1 + 6 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 9f9d636..301183f 100644 --- a/.gitignore +++ b/.gitignore @@ -53,4 +53,8 @@ pubspec.lock .fvm/ .jks -keystore.properties \ No newline at end of file +keystore.properties +android/app/google-services.json +ios/firebase_app_id_file.json +ios/Runner/GoogleService-Info.plist +lib/firebase_options.dart diff --git a/android/app/build.gradle b/android/app/build.gradle index 9379f02..5f24621 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -28,6 +28,7 @@ if (keystorePropertiesFile.exists()) { } apply plugin: 'com.android.application' +apply plugin: 'com.google.gms.google-services' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" diff --git a/android/build.gradle b/android/build.gradle index 83ae220..bb34f99 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -7,6 +7,7 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:7.1.2' + classpath 'com.google.gms:google-services:4.3.10' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 589478f..a858962 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -11,6 +11,7 @@ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 5A1AF02F1E4619A6E479AA8B /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C991C89D5763E562E77E475E /* Pods_Runner.framework */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 7759853DDE1156498D18536B /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 2913B1E428DD3F7921E898BC /* GoogleService-Info.plist */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; @@ -32,6 +33,7 @@ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 2913B1E428DD3F7921E898BC /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 4F64CFBF322918DEF6B858DA /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 5BEEF1AE48859B3E3AAAC421 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; @@ -86,6 +88,7 @@ 97C146EF1CF9000F007C117D /* Products */, CFB3DEB969CB62463CE0ACDF /* Pods */, A5DCEB322972D36722A63973 /* Frameworks */, + 2913B1E428DD3F7921E898BC /* GoogleService-Info.plist */, ); sourceTree = ""; }; @@ -203,6 +206,7 @@ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + 7759853DDE1156498D18536B /* GoogleService-Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/lib/launch_app.dart b/lib/launch_app.dart index f26dcca..69dfcb7 100644 --- a/lib/launch_app.dart +++ b/lib/launch_app.dart @@ -1,9 +1,12 @@ +import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; +import 'package:lightmeter/firebase_options.dart'; import 'application.dart'; import 'environment.dart'; -void launchApp(Environment env) { +Future launchApp(Environment env) async { WidgetsFlutterBinding.ensureInitialized(); + await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); runApp(Application(env)); } diff --git a/pubspec.yaml b/pubspec.yaml index d7bf55a..394d7d6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,6 +11,7 @@ dependencies: camera: 0.10.0+4 exif: 3.1.2 dynamic_color: 1.5.4 + firebase_core: 2.7.0 flutter: sdk: flutter flutter_bloc: 8.1.1