test: Storage PT

This commit is contained in:
Michel Roux 2024-01-27 23:47:06 +01:00
parent 9da2198871
commit e6a8387a82

View File

@ -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<GameManager>();
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<StorageMetadata> task) =>
{