private void BtnRegister_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(InputEmail.Text) && string.IsNullOrWhiteSpace(InputEmail.Text)) { InputEmail.Error = "Please provide your email";//, ToastLength.Long).Show(); return; } BtnRegister.Enabled = false; loadingDialog = new IonAlert(context, IonAlert.ProgressType); loadingDialog.SetSpinKit("WanderingCubes") .SetSpinColor("#008D91") .ShowCancelButton(false) .Show(); auth = FirebaseAuth.Instance; auth.SendPasswordResetEmail(InputEmail.Text.Trim()) .AddOnFailureListener(this) .AddOnSuccessListener(this) .AddOnCompleteListener(this); }
private async void SubmitAwareness_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(AwarenessInput.Text) && !string.IsNullOrWhiteSpace(AwarenessInput.Text)) { Dictionary <string, object> data = new Dictionary <string, object> { { "Uid", FirebaseAuth.Instance.CurrentUser.Uid }, { "Dates", FieldValue.ServerTimestamp }, { "Message", AwarenessInput.Text }, { "ImageUrl", null }, }; loadingDialog = new IonAlert(context, IonAlert.ProgressType); loadingDialog.SetSpinKit("WanderingCubes") .SetSpinColor("#008D91") .ShowCancelButton(false) .Show(); query = await CrossCloudFirestore.Current .Instance .Collection("AWARENESS") .AddAsync(data); //dbRef = FirebaseDatabase.Instance.GetReference("Awareness").Push(); //dbRef.SetValue(data); if (imageArray != null) { //storageRef = FirebaseStorage.Instance.GetReference("AWARENESS"); //storageRef.PutBytes(imageArray) // .AddOnSuccessListener(this) // .AddOnCompleteListener(this) // .AddOnFailureListener(this); var storage_ref = Plugin.FirebaseStorage.CrossFirebaseStorage .Current .Instance .RootReference .Child("AWARENESS") .Child(query.Id); await storage_ref.PutStreamAsync(upload_file); var url = await storage_ref.GetDownloadUrlAsync(); // .PutStreamAsync(file.GetStream()); await CrossCloudFirestore .Current .Instance .Collection("AWARENESS") .Document(query.Id) .UpdateAsync("ImageUrl", url.ToString()); } else { loadingDialog.Dismiss(); } } else { AwarenessInput.Error = "Type a message"; } AwarenessInput.Text = string.Empty; Dismiss(); }