Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
bb9baf5
Update Godot SDK dependency to 4.6.1
DiplomaticRobot Mar 14, 2026
68ecce2
Run Godot's Project > Tools > Upgrade Project files
DiplomaticRobot Mar 14, 2026
4cd52f1
Update authentication.gd
DiplomaticRobot Mar 14, 2026
d7a7778
Update export_presets.cfg
DiplomaticRobot Mar 14, 2026
ee7c815
Merge feature/godot-4.6.1-update: Update Godot SDK dependency to 4.6.1
DiplomaticRobot Mar 14, 2026
6dd0bbe
Add scrollable content and timestamped log panel to demo scenes
DiplomaticRobot Mar 14, 2026
8b3f1bc
Resave scene files with Godot 4.6.1 updated UIDs
DiplomaticRobot Mar 14, 2026
4ddfc0e
Merge feature/demo-improvements: Add scrollable content and timestamp…
DiplomaticRobot Mar 14, 2026
d316585
Add Firestore query support and GDScript API
DiplomaticRobot Mar 14, 2026
7e69623
Merge feature/firestore-query-documents: Add queryDocuments method fo…
DiplomaticRobot Mar 14, 2026
221fd2f
Add basic Analytics module with event logging and user properties
DiplomaticRobot Mar 14, 2026
90b6938
Merge feature/analytics: Add basic Analytics module with event loggin…
DiplomaticRobot Mar 14, 2026
a8aca43
Add Remote Config module with fetch, activate, and typed getters
DiplomaticRobot Mar 14, 2026
c4306d2
Merge feature/remote-config: Add Remote Config module with fetch, act…
DiplomaticRobot Mar 14, 2026
24dccb7
Add Remote Config and Analytics demo scenes
DiplomaticRobot Mar 14, 2026
85988ad
Add Firebase Analytics/Config deps and update UIDs
DiplomaticRobot Mar 14, 2026
4889d26
SDK parity: Auth, Firestore, Analytics, Remote Config (#1)
DiplomaticRobot Mar 15, 2026
e48c092
Add CI build and release workflows
DiplomaticRobot Mar 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build

on:
pull_request:
branches: [main]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'

- name: Cache Gradle dependencies
uses: actions/cache@v5
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Build plugin
run: ./gradlew build
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Release
run-name: Release ${{ inputs.version }}

on:
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g. 1.0.1)'
required: true
type: string

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v5

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'

- name: Cache Gradle dependencies
uses: actions/cache@v5
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Build plugin
run: ./gradlew build

- name: Package addon zip
run: |
cd demo
zip -r "../GodotFirebaseAndroid-${{ inputs.version }}.zip" addons/GodotFirebaseAndroid

- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${{ inputs.version }}" \
--title "GodotFirebaseAndroid ${{ inputs.version }}" \
--generate-notes \
"GodotFirebaseAndroid-${{ inputs.version }}.zip"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ google-services.json

# Android Profiling
*.hprof

# Claude Code
.claude/settings.local.json
64 changes: 64 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

GodotFirebaseAndroid is an Android plugin for Godot Engine (4.2+) that bridges GDScript and the native Android Firebase SDK. It follows a dual-layer architecture: Kotlin classes handle Firebase SDK interaction and async operations on the Android side, while thin GDScript wrappers in `firebase/export_scripts_template/` provide the developer-facing API via signals.

**Communication flow:** GDScript → Module .gd wrapper → Kotlin plugin singleton → Firebase SDK → Firebase Backend. All long-running operations use Godot signals (not blocking calls).

## Build Commands

```bash
./gradlew assemble # Build debug+release AARs, copy to demo/addons/
./gradlew build # Build AARs without copying
./gradlew clean # Clean build outputs and demo addons
```

The build produces `firebase-debug.aar` and `firebase-release.aar`, copies them to `demo/addons/GodotFirebaseAndroid/bin/`, and copies `export_scripts_template/` into the demo addon directory.

There are no tests or linters configured.

## Architecture

### Kotlin layer (`firebase/src/main/java/org/godotengine/plugin/firebase/`)

- **FirebasePlugin.kt** — Main Godot plugin class. Registers all signals and delegates calls to module classes. All module classes are instantiated here and receive the plugin reference.
- **Authentication.kt** — Anonymous, email/password, Google Sign-In, email verification, password reset, account linking.
- **Firestore.kt** — CRUD operations, collection queries, real-time listeners.
- **RealtimeDatabase.kt** — Path-based CRUD, real-time listeners.
- **CloudStorage.kt** — Upload/download, metadata, file listing.
- **Analytics.kt** — Event logging, user properties/ID.
- **RemoteConfig.kt** — Fetch, activate, typed getters.

Each Kotlin module emits signals back to Godot via `emitSignal()` for async results.

### GDScript layer (`firebase/export_scripts_template/`)

- **Firebase.gd** — Autoloaded singleton that initializes module wrappers.
- **modules/*.gd** — One wrapper per Firebase module. Each connects to the Kotlin plugin singleton's signals and exposes snake_case methods.
- **export_plugin.gd** — Godot export plugin that handles adding dependencies and `google-services.json` during Android export.
- **plugin.cfg** — Godot plugin descriptor.

### Demo project (`demo/`)

Contains a Godot project with one scene per module for manual testing. The demo's `addons/` directory is auto-populated by the build.

## Key Details

- **Godot version:** 4.6+ (uses Godot Android plugin v2 API)
- **Android:** minSdk 24, targetSdk 34
- **Kotlin DSL** for all Gradle files
- **No `google-services.json` in repo** — must be supplied per-project in `demo/android/build/`
- **Fork:** origin is SomniGameStudios, upstream is syntaxerror247/GodotFirebaseAndroid
- **PRs:** Always open pull requests against the fork repo (`SomniGameStudios/godot-firebase-android`), never against upstream

## Adding a New Firebase Module

1. Create Kotlin class in `firebase/src/main/java/.../firebase/` implementing the Firebase SDK calls with `emitSignal()` callbacks
2. Register signals and expose methods in `FirebasePlugin.kt`
3. Create GDScript wrapper in `firebase/export_scripts_template/modules/`
4. Initialize the module in `Firebase.gd`
5. Add Firebase dependency in `firebase/build.gradle.kts`
6. Add demo scene in `demo/scenes/`
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ It supports Godot 4.2+

## Features

- [x] Firebase Authentication (Anonymous, Email/Password, Google Sign-In)
- [x] Cloud Firestore
- [x] Firebase Authentication (Anonymous, Email/Password, Google Sign-In, reauthentication, profile management, auth state listener)
- [x] Cloud Firestore (CRUD, queries, real-time listeners, WriteBatch, transactions, FieldValue helpers)
- [x] Realtime Database
- [x] Cloud Storage
- [x] Firebase Analytics (event logging, user properties, consent management, session timeout)
- [x] Remote Config (fetch/activate, typed getters, real-time updates, value source tracking)
- [ ] Cloud Messaging (coming soon)

---
Expand Down
11 changes: 10 additions & 1 deletion demo/export_presets.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@
name="Android"
platform="Android"
runnable=true
advanced_options=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="../../../Desktop/GodotFirebaseAndroid.apk"
patches=PackedStringArray()
patch_delta_encoding=false
patch_delta_compression_level_zstd=19
patch_delta_min_reduction=0.1
patch_delta_include_filters="*"
patch_delta_exclude_filters=""
encryption_include_filters=""
encryption_exclude_filters=""
seed=0
Expand All @@ -29,6 +33,7 @@ gradle_build/compress_native_libraries=false
gradle_build/export_format=0
gradle_build/min_sdk=""
gradle_build/target_sdk=""
gradle_build/custom_theme_attributes={}
architectures/armeabi-v7a=false
architectures/arm64-v8a=true
architectures/x86=false
Expand All @@ -49,13 +54,16 @@ launcher_icons/adaptive_foreground_432x432=""
launcher_icons/adaptive_background_432x432=""
launcher_icons/adaptive_monochrome_432x432=""
graphics/opengl_debug=false
shader_baker/enabled=false
xr_features/xr_mode=0
gesture/swipe_to_dismiss=false
screen/immersive_mode=false
screen/edge_to_edge=false
screen/support_small=true
screen/support_normal=true
screen/support_large=true
screen/support_xlarge=true
screen/background_color=Color(0, 0, 0, 1)
user_data_backup/allow=false
command_line/extra_args=""
apk_expansion/enable=false
Expand Down Expand Up @@ -136,6 +144,7 @@ permissions/manage_accounts=false
permissions/manage_app_tokens=false
permissions/manage_documents=false
permissions/manage_external_storage=false
permissions/manage_media=false
permissions/master_clear=false
permissions/media_content_control=false
permissions/modify_audio_settings=false
Expand Down
10 changes: 10 additions & 0 deletions demo/main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ var auth = load("res://scenes/authentication.tscn")
var firestore = load("res://scenes/firestore.tscn")
var realtimeDB = load("res://scenes/realtime_db.tscn")
var storage = load("res://scenes/storage.tscn")
var remote_config = load("res://scenes/remote_config.tscn")
var analytics = load("res://scenes/analytics.tscn")

func _on_auth_pressed() -> void:
get_tree().change_scene_to_packed(auth)
Expand All @@ -19,3 +21,11 @@ func _on_realtime_db_pressed() -> void:

func _on_storage_pressed() -> void:
get_tree().change_scene_to_packed(storage)


func _on_remote_config_pressed() -> void:
get_tree().change_scene_to_packed(remote_config)


func _on_analytics_pressed() -> void:
get_tree().change_scene_to_packed(analytics)
Loading
Loading