/// <summary> /// Initializes a new instance of the <see cref="T:Charanke.ViewModels.LoginPageViewModel"/> class. /// </summary> public LoginPageViewModel() { _firebaseModel = new FirebaseModel(); Email = ReactiveProperty.FromObject( _firebaseModel, x => x.Email); Password = ReactiveProperty.FromObject( _firebaseModel, x => x.Password); AuthMessage = _firebaseModel.ObserveProperty(m => m.AuthMessage) .ToReadOnlyReactiveProperty(); SendSignInByEmailAndPassword = Email.ObserveHasErrors.CombineLatest( Password.ObserveHasErrors, (x, y) => !x && !y) .ToReactiveCommand(); SendSignUpByEmailAndPassword = Email.ObserveHasErrors.CombineLatest( Password.ObserveHasErrors, (x, y) => !x && !y) .ToReactiveCommand(); SendSignInByEmailAndPassword.Subscribe( async _ => await this.SignInByEmailAndPasswordAction()); SendSignUpByEmailAndPassword.Subscribe( async _ => await this.SignUpByEmailAndPasswordAction()); }
public void sendMessageTo(string tokenPerdedor, string nombreGanador) { UnityEngine.Debug.Log("---------------------------sendingMessage----------------------------"); UnityWebRequest request = new UnityWebRequest("https://fcm.googleapis.com/fcm/send", "POST"); request.SetRequestHeader("Authorization", "key=" + "AIzaSyDoicdxWevoAwew0Lky4Uv5laDBmsJEQeY"); request.SetRequestHeader("Content-Type", "application/json"); request.SetRequestHeader("Cache-Control", "no-cache"); NotificationModel notification = new NotificationModel(); notification.title = nombreGanador + " te ha superado fuertemente 👀"; notification.body = "Juega o seguirás siendo el último 🤡"; FirebaseModel firebaseModel = new FirebaseModel(); firebaseModel.to = tokenPerdedor; firebaseModel.notification = notification; string json = JsonUtility.ToJson(firebaseModel); byte[] bodyRaw = Encoding.UTF8.GetBytes(json); request.uploadHandler = (UploadHandler) new UploadHandlerRaw(bodyRaw); request.downloadHandler = (DownloadHandler) new DownloadHandlerBuffer(); request.SendWebRequest(); UnityEngine.Debug.Log("---------------------------sended----------------------------"); }
public async Task <IActionResult> Post([FromBody] FirebaseModel model) { var fcm = _sender.Create(SenderFactory.FCM); var options = new FCMOption { Priority = "high", JsonData = model.JsonData, TargetScreen = model.TargetScreen }; var response = await fcm.SendAsync(model.DeviceToken, model.Title, model.Message, options); if (response.Successful) { return(Ok(response.Message)); } else { return(BadRequest(response.Message)); } }