From e6a8387a82a0754e8e336e554ebd2b2c728d914a Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Sat, 27 Jan 2024 23:47:06 +0100 Subject: [PATCH] test: Storage PT --- Assets/Scripts/StorageManager.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/StorageManager.cs b/Assets/Scripts/StorageManager.cs index af1afe6..2fe0648 100644 --- a/Assets/Scripts/StorageManager.cs +++ b/Assets/Scripts/StorageManager.cs @@ -8,18 +8,20 @@ public class StorageManager : MonoBehaviour { public GameObject PicturePlayer; public GameObject Canvas; - private FirebaseStorage storage; + private StorageReference storage; private DatabaseReference realtimeDB; void Awake() { + Debug.Log("non"); FirebaseInitializer.Instance.onFirebaseReady += Initialize; } void Initialize() { + Debug.Log("oui"); FirebaseInitializer.Instance.onFirebaseReady -= Initialize; - storage = FirebaseStorage.DefaultInstance; + storage = FirebaseStorage.DefaultInstance.RootReference; realtimeDB = FirebaseDatabase.DefaultInstance.RootReference; } @@ -43,8 +45,7 @@ public void UploadPhoto() GameManager game = Canvas.GetComponent(); string imageUuid = Guid.NewGuid().ToString(); - StorageReference storageRef = storage.GetReferenceFromUrl("gs://ggj2024-5cb41.appspot.com"); - StorageReference imageRef = storageRef.Child(game.myRoom.code).Child(game.currentPlayer.id).Child($"{imageUuid}.jpg"); + StorageReference imageRef = storage.Child(game.myRoom.code).Child(game.currentPlayer.id).Child($"{imageUuid}.jpg"); imageRef.PutBytesAsync(photoBytes).ContinueWith((Task task) => {