Skip to content

Commit 4a4a821

Browse files
Disable firebase for free build (#187)
* Initial plan * Add auto backup feature with configurable location and interval Co-authored-by: yogeshpaliyal <[email protected]> * Fix auto backup to support user-selected location via document picker Co-authored-by: yogeshpaliyal <[email protected]> * feat: add auto backup functionality with CSV export support * feat: add script to enable/disable Firebase services in build configurations * feat: add script to enable/disable Firebase services in build configurations * Enhance Firebase enable/disable script to use project root path and improve error handling * Add androidx.documentfile dependency to build.gradle.kts --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: yogeshpaliyal <[email protected]>
1 parent 9dc6cd0 commit 4a4a821

File tree

7 files changed

+73
-8
lines changed

7 files changed

+73
-8
lines changed

.github/workflows/playstore-pro.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ jobs:
2323
run: |
2424
echo "${{ github.ref_name || github.event.inputs.version }}"
2525
26+
- name: 🏗 Enable Firebase
27+
id: enable-firebase
28+
run: |
29+
bash ./scripts/enableDisableFirebase.sh true
30+
2631
- name: Build Release AAB
2732
run: ./gradlew bundleProRelease
2833

.github/workflows/playstore.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ jobs:
2626
- name: Build Release AAB
2727
run: ./gradlew bundleFreePlaystoreRelease
2828

29+
- name: 🏗 Enable Firebase
30+
id: enable-firebase
31+
run: |
32+
bash ./scripts/enableDisableFirebase.sh true
33+
2934
- name: Sign Release AAB
3035
id: signAAB
3136
uses: r0adkll/sign-android-release@fix/bundle-signing

.github/workflows/pr-check.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,17 @@ jobs:
3737
- name: Lint Check
3838
run: bash ./gradlew lintKotlin
3939

40+
- name: 🏗 Disable Firebase
41+
run: |
42+
bash ./scripts/enableDisableFirebase.sh false
43+
4044
- name: 🏗 Build Free APK
4145
run: bash ./gradlew assembleFreeDebug
4246

47+
- name: 🏗 Enable Firebase
48+
run: |
49+
bash ./scripts/enableDisableFirebase.sh true
50+
4351
- name: 🏗 Build Free Play store APK
4452
run: bash ./gradlew assembleFreePlaystoreDebug
4553

.github/workflows/versionBump.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ jobs:
3535
TYPE: ${{ inputs.type }}
3636
RELEASE_NOTES: ${{ inputs.releaseNote }}
3737

38+
- name: 🏗 Disable Firebase
39+
id: disable-firebase
40+
run: |
41+
bash ./scripts/enableDisableFirebase.sh false
42+
3843
- name: Git Add and Commit
3944
run: |
4045
git config --global user.name 'Yogesh Choudhary Paliyal'

app/build.gradle.kts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ plugins {
44
alias(libs.plugins.kotlin.compose)
55
alias(libs.plugins.kotlin.serialization)
66
alias(libs.plugins.sqldelight)
7-
alias(libs.plugins.kotlinter)
8-
alias(libs.plugins.googleServices)
9-
alias(libs.plugins.firebaseCrashlytics)
7+
id("org.jmailen.kotlinter")
8+
// id("com.google.gms.google-services")
9+
// id("com.google.firebase.crashlytics")
1010
}
1111

1212
android {
@@ -150,11 +150,7 @@ dependencies {
150150
implementation(libs.coil.network.ktor3)
151151
implementation(libs.ktor.client.android)
152152
implementation(libs.androidx.work.runtime.ktx)
153-
154-
// Firebase dependencies - use platform BOM and then add implementations
155-
implementation(platform(libs.firebase.bom))
156-
implementation(libs.firebase.analytics)
157-
implementation(libs.firebase.crashlytics.ndk)
153+
implementation(libs.androidx.documentfile)
158154

159155
// Add Firebase dependencies to pro and freePlayStore flavors specifically
160156
"proImplementation"(platform(libs.firebase.bom))

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
agp = "8.11.1"
33
androidDriver = "2.1.0"
44
composeQrCode = "1.0.1"
5+
documentfile = "1.1.0"
56
firebaseBom = "34.3.0"
67
kotlin = "2.2.20"
78
coreKtx = "1.17.0"
@@ -35,6 +36,7 @@ firebaseCrashlytics = "3.0.6"
3536
android-driver = { module = "app.cash.sqldelight:android-driver", version.ref = "androidDriver" }
3637
androidx-compose-material-icons-extended = { module = "androidx.compose.material:material-icons-extended" }
3738
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
39+
androidx-documentfile = { module = "androidx.documentfile:documentfile", version.ref = "documentfile" }
3840
androidx-lifecycle-viewmodel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "lifecycleRuntimeKtx" }
3941
compose-qr-code = { module = "com.lightspark:compose-qr-code", version.ref = "composeQrCode" }
4042
coroutines-extensions = { module = "app.cash.sqldelight:coroutines-extensions", version.ref = "androidDriver" }

scripts/enableDisableFirebase.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
# Cross-platform sed -i handling
4+
sedi() {
5+
# Usage: sedi 's/foo/bar/' filename
6+
if [[ "$(uname)" == "Darwin" ]]; then
7+
sed -i '' "$@"
8+
else
9+
sed -i "$@"
10+
fi
11+
}
12+
13+
# Get the directory of this script
14+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
15+
PROJECT_ROOT="$SCRIPT_DIR/.."
16+
GRADLE_FILE="$PROJECT_ROOT/app/build.gradle.kts"
17+
18+
ENABLE_FIREBASE=${1:-true} # Default to true if not provided
19+
20+
# Check if the gradle file exists
21+
if [ ! -f "$GRADLE_FILE" ]; then
22+
echo "Error: $GRADLE_FILE not found. Please run this script from the project root or ensure the file exists."
23+
exit 1
24+
fi
25+
26+
# Handle Firebase plugin lines
27+
if [ "$ENABLE_FIREBASE" = false ]; then
28+
# Comment out the lines if not already commented
29+
sedi '/^[[:space:]]*id("com.google.gms.google-services")/s/^/\/\/ /' "$GRADLE_FILE"
30+
sedi '/^[[:space:]]*id("com.google.firebase.crashlytics")/s/^/\/\/ /' "$GRADLE_FILE"
31+
# Remove duplicate comment markers if any
32+
sedi 's/^\(\/\/ \)*\/\//\/\//g' "$GRADLE_FILE"
33+
else
34+
# Uncomment the lines if commented
35+
sedi 's/^[[:space:]]*\/\/[[:space:]]*\(id("com.google.gms.google-services")\)/\1/' "$GRADLE_FILE"
36+
sedi 's/^[[:space:]]*\/\/[[:space:]]*\(id("com.google.firebase.crashlytics")\)/\1/' "$GRADLE_FILE"
37+
fi
38+
39+
# Usage:
40+
# bash ./scripts/enableDisableFirebase.sh false # to comment out Firebase plugins
41+
# bash ./scripts/enableDisableFirebase.sh true # to uncomment Firebase plugins
42+
# Or make the script executable and run directly:
43+
# chmod +x ./scripts/enableDisableFirebase.sh
44+
# ./scripts/enableDisableFirebase.sh false

0 commit comments

Comments
 (0)