Skip to content

Fix utilities issue #404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 2 additions & 13 deletions addons/godot-firebase/Utilities.gd
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,13 @@ static func from_firebase_type(value : Variant) -> Variant:
return null

if value.has("mapValue"):
value = _from_firebase_type_recursive(value.values()[0].fields)
value = fields2dict(value.values()[0])
elif value.has("timestampValue"):
value = Time.get_datetime_dict_from_datetime_string(value.values()[0], false)
else:
value = value.values()[0]

return value

static func _from_firebase_type_recursive(value : Variant) -> Variant:
if value == null:
return null

if value.has("mapValue") or value.has("timestampValue"):
value = _from_firebase_type_recursive(value.value()[0].fields)
else:
value = value.values()[0]

return value

static func to_firebase_type(value : Variant) -> Dictionary:
var var_type : String = ""
Expand Down Expand Up @@ -103,7 +92,7 @@ static func fields2dict(doc) -> Dictionary:
var dict = {}
if doc.has("fields"):
var fields = doc["fields"]
print(fields)

for field in fields.keys():
if fields[field].has("mapValue"):
dict[field] = (fields2dict(fields[field].mapValue))
Expand Down
2 changes: 1 addition & 1 deletion addons/godot-firebase/plugin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
name="GodotFirebase"
description="Google Firebase SDK written in GDScript for use in Godot Engine 4.0 projects."
author="GodotNutsOrg"
version="1.1"
version="2.0"
script="plugin.gd"
Loading