diff --git a/addons/godot-firebase/Utilities.gd b/addons/godot-firebase/Utilities.gd index ed26a71..e828d2a 100644 --- a/addons/godot-firebase/Utilities.gd +++ b/addons/godot-firebase/Utilities.gd @@ -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 = "" @@ -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))