Skip to content

Commit 24a576f

Browse files
committed
Re-add fields2dict
1 parent 40e7b5c commit 24a576f

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

addons/godot-firebase/Utilities.gd

+2-13
Original file line numberDiff line numberDiff line change
@@ -57,24 +57,13 @@ static func from_firebase_type(value : Variant) -> Variant:
5757
return null
5858

5959
if value.has("mapValue"):
60-
value = _from_firebase_type_recursive(value.values()[0].fields)
60+
value = fields2dict(value.values()[0])
6161
elif value.has("timestampValue"):
6262
value = Time.get_datetime_dict_from_datetime_string(value.values()[0], false)
6363
else:
6464
value = value.values()[0]
6565

6666
return value
67-
68-
static func _from_firebase_type_recursive(value : Variant) -> Variant:
69-
if value == null:
70-
return null
71-
72-
if value.has("mapValue") or value.has("timestampValue"):
73-
value = _from_firebase_type_recursive(value.value()[0].fields)
74-
else:
75-
value = value.values()[0]
76-
77-
return value
7867

7968
static func to_firebase_type(value : Variant) -> Dictionary:
8069
var var_type : String = ""
@@ -103,7 +92,7 @@ static func fields2dict(doc) -> Dictionary:
10392
var dict = {}
10493
if doc.has("fields"):
10594
var fields = doc["fields"]
106-
print(fields)
95+
10796
for field in fields.keys():
10897
if fields[field].has("mapValue"):
10998
dict[field] = (fields2dict(fields[field].mapValue))

0 commit comments

Comments
 (0)