Update
This commit is contained in:
@@ -8,8 +8,35 @@ namespace Hallucinate.UI
|
||||
{
|
||||
public static class FirebaseService
|
||||
{
|
||||
// Thay link database của bạn vào đây
|
||||
private const string BASE_URL = "https://YOUR_FIREBASE_URL.firebaseio.com/users";
|
||||
private static string _baseUrl;
|
||||
|
||||
private static string BASE_URL
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(_baseUrl))
|
||||
{
|
||||
// Nó sẽ tìm file tên "FirebaseConfig" trong bất kỳ folder "Resources" nào
|
||||
var config = Resources.Load<FirebaseConfig>("FirebaseConfig");
|
||||
if (config != null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(config.baseUrl))
|
||||
{
|
||||
Debug.LogError("<color=red>[FirebaseService]</color> Base URL trong file FirebaseConfig đang trống!");
|
||||
return null;
|
||||
}
|
||||
_baseUrl = config.baseUrl.TrimEnd('/');
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("<color=red>[FirebaseService]</color> Không tìm thấy file 'FirebaseConfig' trong folder Resources! " +
|
||||
"Hãy đảm bảo bạn đã tạo file tại: Assets/.../Resources/FirebaseConfig");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return _baseUrl + "/users";
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<bool> IsUsernameTaken(string username)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user