From 11413b9ffb4585c193e594c367730d75f669f1d8 Mon Sep 17 00:00:00 2001 From: Cody Weaver Date: Sat, 23 Dec 2023 00:15:13 -0700 Subject: [PATCH] fix emulator bux --- app/build.gradle.kts | 13 +++++++++++++ .../java/com/android/pocketalchemy/PaApplication.kt | 4 ---- .../android/pocketalchemy/firebase/AuthProvider.kt | 3 ++- .../pocketalchemy/firebase/FirestoreProvider.kt | 4 ++-- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 232c3fb..7bad2a8 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -30,8 +30,20 @@ android { } buildTypes { + debug { + isMinifyEnabled = false + isDebuggable = true + isDefault = true + buildConfigField("Boolean", "DEBUG", "true") + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + release { isMinifyEnabled = false + isDebuggable = false proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" @@ -47,6 +59,7 @@ android { } buildFeatures { compose = true + buildConfig = true } composeOptions { kotlinCompilerExtensionVersion = "1.5.3" diff --git a/app/src/main/java/com/android/pocketalchemy/PaApplication.kt b/app/src/main/java/com/android/pocketalchemy/PaApplication.kt index 0a90553..be0f9a6 100644 --- a/app/src/main/java/com/android/pocketalchemy/PaApplication.kt +++ b/app/src/main/java/com/android/pocketalchemy/PaApplication.kt @@ -3,9 +3,5 @@ package com.android.pocketalchemy import android.app.Application import dagger.hilt.android.HiltAndroidApp -object Config { - const val DEBUG = true -} - @HiltAndroidApp class PaApplication: Application() \ No newline at end of file diff --git a/app/src/main/java/com/android/pocketalchemy/firebase/AuthProvider.kt b/app/src/main/java/com/android/pocketalchemy/firebase/AuthProvider.kt index 72726bd..ccd50b1 100644 --- a/app/src/main/java/com/android/pocketalchemy/firebase/AuthProvider.kt +++ b/app/src/main/java/com/android/pocketalchemy/firebase/AuthProvider.kt @@ -1,6 +1,7 @@ package com.android.pocketalchemy.firebase import android.util.Log +import com.android.pocketalchemy.BuildConfig import com.google.firebase.Firebase import com.google.firebase.auth.FirebaseAuth import com.google.firebase.auth.auth @@ -20,7 +21,7 @@ object AuthProvider { fun provideFirebaseAuth(): FirebaseAuth { val firebaseAuth = Firebase.auth - if (/*Config.DEBUG*/false) { + if (BuildConfig.DEBUG) { // Use emulator for debug Log.d(TAG, "Connecting to emulator...") firebaseAuth.useEmulator(EMULATOR_HOST, AUTH_EMULATOR_PORT) diff --git a/app/src/main/java/com/android/pocketalchemy/firebase/FirestoreProvider.kt b/app/src/main/java/com/android/pocketalchemy/firebase/FirestoreProvider.kt index c6631c2..bf2761c 100644 --- a/app/src/main/java/com/android/pocketalchemy/firebase/FirestoreProvider.kt +++ b/app/src/main/java/com/android/pocketalchemy/firebase/FirestoreProvider.kt @@ -1,7 +1,7 @@ package com.android.pocketalchemy.firebase import android.util.Log -import com.android.pocketalchemy.Config +import com.android.pocketalchemy.BuildConfig import com.google.firebase.Firebase import com.google.firebase.firestore.FirebaseFirestore import com.google.firebase.firestore.firestore @@ -21,7 +21,7 @@ object FirestoreProvider { fun provideFirestore(): FirebaseFirestore { val firebaseFirestore = Firebase.firestore - if (Config.DEBUG) { + if (BuildConfig.DEBUG) { Log.d(TAG, "Connecting to emulator...") firebaseFirestore.useEmulator(EMULATOR_HOST, FIRESTORE_EMULATOR_PORT) }