Skip to content

Commit

Permalink
Merge pull request #404 from GodotNuts/fix-utilities-issue
Browse files Browse the repository at this point in the history
Fix utilities issue
  • Loading branch information
WolfgangSenff authored Jun 10, 2024
2 parents 40e7b5c + c27bf9e commit c7f33ad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
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"

0 comments on commit c7f33ad

Please sign in to comment.