diff --git a/android/app/build.gradle b/android/app/build.gradle index 0c1d8e9fe4..d802383b26 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -1,10 +1,13 @@ plugins { id "com.android.application" + // START: FlutterFire Configuration + id 'com.google.gms.google-services' + id 'com.google.firebase.crashlytics' + // END: FlutterFire Configuration id "kotlin-android" // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. id "dev.flutter.flutter-gradle-plugin" id "kotlinx-serialization" - id "com.google.gms.google-services" } def localProperties = new Properties() @@ -72,6 +75,8 @@ android { dependencies { implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0" + implementation platform('com.google.firebase:firebase-bom:30.0.0') + implementation 'com.google.firebase:firebase-analytics' } flutter { diff --git a/android/app/google-services.json b/android/app/google-services.json index 1a89584862..b58a60379a 100644 --- a/android/app/google-services.json +++ b/android/app/google-services.json @@ -2,7 +2,7 @@ "project_info": { "project_number": "316045786606", "project_id": "fingrom", - "storage_bucket": "fingrom.appspot.com" + "storage_bucket": "fingrom.firebasestorage.app" }, "client": [ { diff --git a/android/build.gradle b/android/build.gradle index 1f6960dc6e..681bbc55a8 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -7,6 +7,8 @@ buildscript { dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" + classpath "com.google.gms:google-services:4.3.15" + classpath "com.google.firebase:firebase-crashlytics-gradle:2.9.2" } } allprojects { diff --git a/android/settings.gradle b/android/settings.gradle index 8f27083f86..03db858613 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -20,7 +20,7 @@ plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "7.3.0" apply false id "org.jetbrains.kotlin.android" version "1.9.0" apply false - id 'com.google.gms.google-services' version '4.4.2' apply false + id 'com.google.gms.google-services' version '4.3.15' apply false } include ":app" diff --git a/docs/implementation-flow/ch04-s03-telemetry.tex b/docs/implementation-flow/ch04-s03-telemetry.tex index 64672b5a71..2028b573f3 100644 --- a/docs/implementation-flow/ch04-s03-telemetry.tex +++ b/docs/implementation-flow/ch04-s03-telemetry.tex @@ -89,7 +89,7 @@ \subsubsection{Activating Google Analytics} } \end{lstlisting} -\noindent That might be the case for web, android, ios, and macos; but we have additionally linux and windows that are +\noindent That might be the case for web, android, ios, macos, and windows; but we have additionally linux that is not supported by now, so, let's patch \q{firebase\_options.dart}-file to return null instead of throwing an exception: \begin{lstlisting} @@ -100,13 +100,7 @@ \subsubsection{Activating Google Analytics} return web; } switch (defaultTargetPlatform) { - case TargetPlatform.android: - return android; - case TargetPlatform.iOS: - return ios; - case TargetPlatform.macOS: - return macos; - case TargetPlatform.windows: + /* ... other cases ... */ case TargetPlatform.linux: default: return null; @@ -148,45 +142,48 @@ \subsubsection{Activating Google Analytics} \noindent It's not yet completed unless we follow additional instructions from \href{https://firebase.google.com/docs/guides/}{https://firebase.google.com/docs/guides/} to configure -Firebase Analytics per each thread (Android, iOS, Macos, Web); as for Android: +Firebase Analytics per each thread (Android, iOS, Web); as for Android: \begin{lstlisting}[language=yaml] +## ./android/settings.gradle +plugins { +\end{lstlisting} +{ +\xpretocmd{\lstlisting}{\vspace{-12pt}}{}{} +\begin{lstlisting}[firstnumber=3, language=yaml, backgroundcolor=\color{backgreen}] + id 'com.google.gms.google-services' version '4.3.15' apply false +\end{lstlisting} +\begin{lstlisting}[firstnumber=4, language=yaml] +}(*@ \stopnumber @*) + ## ./android/build.gradle buildscript { repositories { \end{lstlisting} -{ -\xpretocmd{\lstlisting}{\vspace{-12pt}}{}{} \begin{lstlisting}[firstnumber=4, language=yaml, backgroundcolor=\color{backgreen}] - google() + google() \end{lstlisting} \begin{lstlisting}[firstnumber=5, language=yaml] - # ... other settings + mavenCentral() } dependencies { # ... other settings \end{lstlisting} \begin{lstlisting}[firstnumber=9, language=yaml, backgroundcolor=\color{backgreen}] - classpath 'com.google.gms:google-services:4.3.3' + classpath 'com.google.gms:google-services:4.3.15' \end{lstlisting} \begin{lstlisting}[firstnumber=10, language=yaml] - }(*@ \stopnumber @*) -} + } +}(*@ \stopnumber @*) ## ./android/app/build.gradle -\end{lstlisting} -\begin{lstlisting}[firstnumber=2, language=yaml, backgroundcolor=\color{backgreen}] -apply plugin: 'com.google.gms.google-services' -\end{lstlisting} -\begin{lstlisting}[firstnumber=3, language=yaml] -# ... other settings -dependencies { +plugins { # ... other settings \end{lstlisting} -\begin{lstlisting}[firstnumber=6, language=yaml, backgroundcolor=\color{backgreen}] - implementation 'com.google.firebase:firebase-analytics:17.4.1' +\begin{lstlisting}[firstnumber=4, language=yaml, backgroundcolor=\color{backgreen}] + id 'com.google.gms.google-services' \end{lstlisting} -\begin{lstlisting}[firstnumber=7, language=yaml] +\begin{lstlisting}[firstnumber=5, language=yaml] } \end{lstlisting} } diff --git a/firebase.json b/firebase.json new file mode 100644 index 0000000000..6474428ee0 --- /dev/null +++ b/firebase.json @@ -0,0 +1 @@ +{"flutter":{"platforms":{"android":{"default":{"projectId":"fingrom","appId":"1:316045786606:android:56767cb0c0a39bbfd562ff","fileOutput":"android/app/google-services.json"}},"dart":{"lib/firebase_options.dart":{"projectId":"fingrom","configurations":{"android":"1:316045786606:android:56767cb0c0a39bbfd562ff","ios":"1:316045786606:ios:87bd828f023ae743d562ff","macos":"1:316045786606:ios:87bd828f023ae743d562ff","web":"1:316045786606:web:e9346723741d371ad562ff","windows":"1:316045786606:web:8cdba83e8f2fd15ad562ff"}}}}}} \ No newline at end of file diff --git a/lib/_configs/firebase_options.dart b/lib/_configs/firebase_options.dart index ff62c946f7..ed1ce22201 100644 --- a/lib/_configs/firebase_options.dart +++ b/lib/_configs/firebase_options.dart @@ -1,5 +1,5 @@ // File generated by FlutterFire CLI. -// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members +// ignore_for_file: type=lint import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; import 'package:flutter/foundation.dart' show defaultTargetPlatform, kIsWeb, TargetPlatform; @@ -26,6 +26,7 @@ class DefaultFirebaseOptions { case TargetPlatform.macOS: return macos; case TargetPlatform.windows: + return windows; case TargetPlatform.linux: default: return null; @@ -38,7 +39,7 @@ class DefaultFirebaseOptions { messagingSenderId: '316045786606', projectId: 'fingrom', authDomain: 'fingrom.firebaseapp.com', - storageBucket: 'fingrom.appspot.com', + storageBucket: 'fingrom.firebasestorage.app', measurementId: 'G-ZLKVBF1H4V', ); @@ -47,7 +48,7 @@ class DefaultFirebaseOptions { appId: '1:316045786606:android:56767cb0c0a39bbfd562ff', messagingSenderId: '316045786606', projectId: 'fingrom', - storageBucket: 'fingrom.appspot.com', + storageBucket: 'fingrom.firebasestorage.app', ); static const FirebaseOptions ios = FirebaseOptions( @@ -55,18 +56,28 @@ class DefaultFirebaseOptions { appId: '1:316045786606:ios:87bd828f023ae743d562ff', messagingSenderId: '316045786606', projectId: 'fingrom', - storageBucket: 'fingrom.appspot.com', + storageBucket: 'fingrom.firebasestorage.app', iosClientId: '316045786606-d806bn8s90gj03nil8gooku2frptvrge.apps.googleusercontent.com', iosBundleId: 'com.tercad.fingrom', ); static const FirebaseOptions macos = FirebaseOptions( apiKey: 'AIzaSyByWAdeAUDluD-dlJHrt4Z1oyValCuFBpM', - appId: '1:316045786606:ios:34250e2deee54195d562ff', + appId: '1:316045786606:ios:87bd828f023ae743d562ff', + messagingSenderId: '316045786606', + projectId: 'fingrom', + storageBucket: 'fingrom.firebasestorage.app', + iosClientId: '316045786606-d806bn8s90gj03nil8gooku2frptvrge.apps.googleusercontent.com', + iosBundleId: 'com.tercad.fingrom', + ); + + static const FirebaseOptions windows = FirebaseOptions( + apiKey: 'AIzaSyDj5sNiVmNi4x1PcL5ciYrX90n2VlMlOwY', + appId: '1:316045786606:web:8cdba83e8f2fd15ad562ff', messagingSenderId: '316045786606', projectId: 'fingrom', - storageBucket: 'fingrom.appspot.com', - iosClientId: '316045786606-8tl5sft03rmf5tbdd4k9pk12a4f47d6m.apps.googleusercontent.com', - iosBundleId: 'com.tercad.fingrom.RunnerTests', + authDomain: 'fingrom.firebaseapp.com', + storageBucket: 'fingrom.firebasestorage.app', + measurementId: 'G-4XJJ4TVMGE', ); }