From ab29a7bd6a8808929cc7e4c1b32ff116dfb03eb6 Mon Sep 17 00:00:00 2001 From: Sharjeel Yunus <61178058+sharjeelyunus@users.noreply.github.com> Date: Fri, 3 Jan 2025 20:50:37 +0500 Subject: [PATCH] refactor: update ProGuard rules for Firebase integration --- starter/scripts/constants.dart | 4 ++-- starter/scripts/firebase_performance.dart | 3 +++ starter/scripts/modules/enable_auth.dart | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/starter/scripts/constants.dart b/starter/scripts/constants.dart index 3200c1c40..21ea56664 100644 --- a/starter/scripts/constants.dart +++ b/starter/scripts/constants.dart @@ -1,5 +1,5 @@ -const authProguardRules = ''' -# Keep Google Play Services Auth classes +const firebaseProguardRules = ''' +# Keep Google Play Services classes -keep class com.google.android.gms.** { *; } -keep interface com.google.android.gms.** { *; } -dontwarn com.google.android.gms.** diff --git a/starter/scripts/firebase_performance.dart b/starter/scripts/firebase_performance.dart index 4d048f07d..7c11d09bc 100644 --- a/starter/scripts/firebase_performance.dart +++ b/starter/scripts/firebase_performance.dart @@ -2,6 +2,8 @@ import 'dart:io'; import 'utils.dart'; import 'utils/firebase_utils.dart'; +import 'utils/proguard_utils.dart'; +import 'constants.dart'; // Adds the Firebase Performance SDK to the project void main(List arguments) { @@ -11,6 +13,7 @@ void main(List arguments) { addDependency('firebase_performance', '^0.10.0+11'); if (platforms.contains('android')) { + createProguardRules(firebaseProguardRules); addClasspathDependency( "classpath 'com.google.firebase:perf-plugin:1.4.2'"); addPluginDependency("apply plugin: 'com.google.firebase.firebase-perf'"); diff --git a/starter/scripts/modules/enable_auth.dart b/starter/scripts/modules/enable_auth.dart index 7e06b5e9e..412743aa4 100644 --- a/starter/scripts/modules/enable_auth.dart +++ b/starter/scripts/modules/enable_auth.dart @@ -55,7 +55,7 @@ ensemble_auth: updateAuthConfig(iOSClientId, androidClientId, webClientId, serverClientId); updateFirebaseConfig(platforms, arguments); if (platforms.contains('android')) { - createProguardRules(authProguardRules); + createProguardRules(firebaseProguardRules); addClasspathDependency( "classpath 'com.google.gms:google-services:4.3.15'"); addPluginDependency("apply plugin: 'com.google.gms.google-services'");