public FirebaseAuther auth() { if (initCB.isDone()) { return(this); } FirebaseAuth auth = Firebase.Auth.FirebaseAuth.DefaultInstance; auth.SignInWithEmailAndPasswordAsync(email, pass).ContinueWith(task => { if (task.IsCanceled) { Debug.LogError("CreateUserWithEmailAndPasswordAsync was canceled."); return; } if (task.IsFaulted) { Debug.LogError("CreateUserWithEmailAndPasswordAsync encountered an error: " + task.Exception); return; } user = task.Result; UnityMainThreadDispatcher.uniRxRun(() => { initCB.done(); Debug.Log("auth.done"); }); Debug.LogFormat("Firebase user login successfully: {0} ({1})", user.DisplayName, user.UserId); }); return(this); }
public void upload(byte[] custom_bytes, string fbPath, Action <string> cb) { authDoneCB.add(() => { StorageReference rivers_ref = getByPath(fbPath); // Upload the file to the path "images/rivers.jpg" rivers_ref.PutBytesAsync(custom_bytes) .ContinueWith((Task <StorageMetadata> task) => { if (task.IsFaulted || task.IsCanceled) { Debug.Log(task.Exception.ToString()); // Uh-oh, an error occurred! } else { // Metadata contains file metadata such as size, content-type, and download URL. Firebase.Storage.StorageMetadata metadata = task.Result; string download_url = metadata.Path; UnityMainThreadDispatcher.uniRxRun(() => { cb(metadata.Path); Debug.Log("Finished uploading..."); }); } }); }); }
public void childAddHandler(object sender, ChildChangedEventArgs e) { UnityMainThreadDispatcher.uniRxRun(() => { ChildCB childCB = (ChildCB)cb; childCB(e.Snapshot.Key, e.Snapshot.GetRawJsonValue()); }); }
public void valueHandler(object sender, ValueChangedEventArgs e) { UnityMainThreadDispatcher.uniRxRun(() => { Action <string> _cb = (Action <string>)cb; _cb(e.Snapshot.GetRawJsonValue()); }); }
public void getDownloadUrl(string fbPath, Action <Uri> cb) { authDoneCB.add(() => { StorageReference reference = getByPath(fbPath); reference.GetDownloadUrlAsync().ContinueWith(tk => UnityMainThreadDispatcher.uniRxRun(() => { cb(tk.Result); }) ); }); }