From 24a576f9dfd2b8d11f1e74dbd0ecd853180ee7bb Mon Sep 17 00:00:00 2001 From: Kyle Szklenski Date: Mon, 10 Jun 2024 06:31:23 -0400 Subject: [PATCH] Re-add fields2dict --- addons/godot-firebase/Utilities.gd | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) 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))