You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ReactiveUI.Maui On IOS and Android we are not able receive the command or Binding getting executed.
Below is the code Sinpet when i press login Button the command is not getting trigged once we port from xamarin to MAUI.
publicpartialclassLoginPage:ContentPage,IViewFor<LoginViewModel>{/// <inheritdoc/>publicLoginViewModelViewModel{get;set;}/// <inheritdoc/>object IViewFor.ViewModel{get=>this.ViewModel;set{this.ViewModel =(LoginViewModel)value;}}List<string>backimage=newList<string>();intpickedIndex=0;/// <summary>/// Initializes a new instance of the <see cref="LoginPage"/> class./// </summary>publicLoginPage(){
backimage.Add("portalui_1");
backimage.Add("portalui_2_v2");
backimage.Add("portalui_3_v2");
backimage.Add("portalui_4_v2");
backimage.Add("portalui_5_v2");
backimage.Add("portalui_6_v2");
backimage.Add("portalui_7");
backimage.Add("portalui_8");Randomrandom=new Random();pickedIndex= random.Next(backimage.Count);this.InitializeComponent();this.BindingContext =ViewModel;if(pickedIndex >= 0)this.BackgroundImageSource = backimage[pickedIndex];if(Device.RuntimePlatform == Device.Android)
FaceID.Source ="fingerprint.svg";this.WhenActivated(disposables =>{this.BindCommand(this.ViewModel,vm => vm.LoginCommand,v => v.LoginButton, nameof(this.LoginButton.Clicked)).DisposeWith(disposables);this.Bind(this.ViewModel,vm => vm.EmailAddress,v => v.EmailAddress.Text).DisposeWith(disposables);this.Bind(this.ViewModel,vm => vm.Versionumber,v => v.version.Text).DisposeWith(disposables);this.Bind(this.ViewModel,vm => vm.IsFaceEnabledChecked,v => v.FaceEnableChecked.IsToggled).DisposeWith(disposables);this.Bind(this.ViewModel,vm => vm.IsFaceSaved,v => v.FaceID.IsVisible).DisposeWith(disposables);this.BindCommand(this.ViewModel,vm => vm.FaceClickCommand,v => v.FaceGesture).DisposeWith(disposables);this.BindCommand(this.ViewModel,vm => vm.RestPasswordClickCommand,v => v.RestPasswordGesture).DisposeWith(disposables);this.BindCommand(this.ViewModel,vm => vm.ConcatusClickCommand,v => v.ContactUsGesture).DisposeWith(disposables);this.BindCommand(this.ViewModel,vm => vm.ForgotUsernameClickCommand,v => v.ForgotUsernameGesture).DisposeWith(disposables);this.Bind(this.ViewModel,vm => vm.Enablefacemess,v => v.EnbaleFace.Text).DisposeWith(disposables);this.Bind(this.ViewModel,vm => vm.Password,v => v.Password.Text).DisposeWith(disposables);});}/// <inheritdoc/>protectedoverrideasyncvoidOnAppearing(){base.OnAppearing();if(this.Logo.IsVisible ==false){this.Logo.Opacity =0;this.Logo.IsVisible =true;this.FormContainer.Opacity =0;this.FormContainer.IsVisible =true;this.Logo.TranslationY =this.Logo.TranslationY +200;awaitthis.Logo.FadeTo(1,700, Easing.CubicInOut);awaitthis.Logo.TranslateTo(this.Logo.TranslationX,this.Logo.TranslationY -200,500, Easing.CubicInOut);awaitthis.FormContainer.FadeTo(1,700, Easing.CubicInOut);}try{if(this.ViewModel !=null&& Device.RuntimePlatform == Device.iOS){awaitthis.ViewModel.CheckForFingerprintAuthentication();}
#if TODOMAUI
stringlatestVersionNumber=await CrossLatestVersion.Current.GetLatestVersionNumber();stringinstalledVersionNumber= CrossLatestVersion.Current.InstalledVersionNumber;boolisupgradereq=false;if(Device.RuntimePlatform == Device.iOS){if(Convert.ToInt32(installedVersionNumber)< Convert.ToInt32(latestVersionNumber)){isupgradereq=true;}}else{if(Convert.ToDecimal(installedVersionNumber)< Convert.ToDecimal(latestVersionNumber)){isupgradereq=true;}}if(isupgradereq==true){await DisplayAlert("New Version","There is a new version of this app available. Would you like to update now?","Update");await CrossLatestVersion.Current.OpenAppInStore();}
#endif
}catch(Exceptionex){}}voidFaceEnableChecked_Toggled(System.Object sender,ToggledEventArgse){try{if(e.Value ==false){
Preferences.Set("IsFaceEnabledChecked", e.Value.ToString());}}catch(Exceptionex){}}}publicclassLoginViewModel:ReactiveObject,IEnableLogger,IRoutableViewModel{/// <inheritdoc/>publicstringUrlPathSegment=>"Login";/// <inheritdoc/>publicIScreenHostScreen{get;}privateIAuthenticationServiceService{get;}privatestringemailAddress;publicstringEmailAddress{get=> emailAddress;set=>this.RaiseAndSetIfChanged(ref emailAddress, value);}privatestringpassword;publicstringPassword{get=> password;set=>this.RaiseAndSetIfChanged(ref password, value);}privatestringenablefacemess;publicstringEnablefacemess{get=> enablefacemess;set=>this.RaiseAndSetIfChanged(ref enablefacemess, value);}privatestringversionumber;publicstringVersionumber{get=> versionumber;set=>this.RaiseAndSetIfChanged(ref versionumber, value);}privateboolisFaceEnabledChecked=true;publicboolIsFaceEnabledChecked{get=> isFaceEnabledChecked;set=>this.RaiseAndSetIfChanged(ref isFaceEnabledChecked, value);}privateboolisFaceSaved;publicboolIsFaceSaved{get=> isFaceSaved;set=>this.RaiseAndSetIfChanged(ref isFaceSaved, value);}publicReactiveCommand<Unit,Unit> LoginCommand {get;}publicICommandRestPasswordClickCommand{get;set;}publicICommandFaceClickCommand{get;set;}publicICommandConcatusClickCommand{get;set;}publicICommandForgotUsernameClickCommand{get;set;}/// <summary>/// Initializes a new instance of the <see cref="LoginViewModel"/> class./// </summary>/// <param name="hostScreen"></param>/// <param name="service"></param>publicLoginViewModel(IScreenhostScreen,IAuthenticationServiceservice=null){this.HostScreen =hostScreen;this.Service =service?? Locator.Current.GetService<IAuthenticationService>();Versionumber="Version "+ VersionTracking.CurrentVersion;if(Preferences.ContainsKey("IsFaceEnabledChecked")){stringIsFaceEnabled= Preferences.Get("IsFaceEnabledChecked",string.Empty);this.IsFaceEnabledChecked = Convert.ToBoolean(Preferences.Get("IsFaceEnabledChecked",string.Empty));}stringEmailAdd= Preferences.Get("EmailAddress",string.Empty);stringPasswd= Preferences.Get("Password",string.Empty);boolIsFaceChecked=false;if(Preferences.ContainsKey("IsFaceEnabledChecked"))IsFaceChecked= Convert.ToBoolean(Preferences.Get("IsFaceEnabledChecked",string.Empty));if(IsFaceChecked==true&&!string.IsNullOrEmpty(EmailAdd)&&!string.IsNullOrEmpty(Passwd))IsFaceSaved=true;this.RestPasswordClickCommand = ReactiveCommand.Create(()=>this.RestPassword());this.ConcatusClickCommand = ReactiveCommand.Create(()=>this.ConcatUS());this.ForgotUsernameClickCommand = ReactiveCommand.Create(()=>this.ForgotUsername());this.FaceClickCommand = ReactiveCommand.Create(()=>this.CheckForFingerprintAuthentication());varcanLogin=this.WhenAnyValue(vm => vm.EmailAddress,vm => vm.Password,(emailAddress,password)=>!string.IsNullOrEmpty(emailAddress)&&!string.IsNullOrEmpty(password));this.LoginCommand = ReactiveCommand
.Create(()=>{ Loginasync(this.EmailAddress,this.Password,true);}, canLogin);this.LoginCommand
.ThrownExceptions
.Subscribe(ex =>{ UserDialogs.Instance.Alert(ex.Message,"Error");});if(Device.RuntimePlatform == Device.Android){
CheckForFingerprintAuthentication();}}privateasync Task Loginasync(stringemailid,stringpassword,boolisFirsttime=false){try{varpayload=new SignInPayload();
payload.RememberMe =true;
payload.UserName =emailid;
payload.Password =password;
UserDialogs.Instance.ShowLoading();this.Service
.SignIn(payload).SubscribeOn(RxApp.TaskpoolScheduler).ObserveOn(RxApp.MainThreadScheduler).Finally(()=> UserDialogs.Instance.HideLoading()).Subscribe(content =>{ Observable.FromAsync<string>(()=> content.Content.ReadAsStringAsync()).SubscribeOn(RxApp.TaskpoolScheduler).ObserveOn(RxApp.MainThreadScheduler).Subscribe(async stringContent =>{if(content.IsSuccessStatusCode){IEnumerable<string>values;if(content.Headers.TryGetValues("Set-Cookie",out values)){ App.cookiestring.Add(values);} Preferences.Set("EmailAddress",this.EmailAddress); Preferences.Set("Password", password); Preferences.Set("IsFaceEnabledChecked",this.IsFaceEnabledChecked.ToString());if(isFirsttime==true)await EnableFingerprintAuthentication();#if TODOMAUIthis.HostScreen.Router.NavigateAndReset.Execute(new HomeViewModel(this.HostScreen)).Subscribe();#endif}else{ UserDialogs.Instance.Alert(stringContent,"Error");}},e =>{varapiException=(ApiException)e; UserDialogs.Instance.Alert(apiException.Content,"Error");});},e =>{if(e is ApiException){varapiException=(ApiException)e; UserDialogs.Instance.Alert(apiException.Content,"Error");}else{ UserDialogs.Instance.Alert(e.Message,"Error");}});}catch(Exceptionex){}}privateasync Task EnableFingerprintAuthentication(){if(this.IsFaceEnabledChecked ==true){varisFingerprintAvailable=await CrossFingerprint.Current.IsAvailableAsync(true);varauthenticationType=await CrossFingerprint.Current.GetAuthenticationTypeAsync();stringauthenticationFailureMessage=authenticationType== Plugin.Fingerprint.Abstractions.AuthenticationType.Face ?"No Face ID Recognized.":"There are no fingerprints available.";if(isFingerprintAvailable){AuthenticationRequestConfigurationconf=new AuthenticationRequestConfiguration("Authentication","Authenticate access to your personal data");varresult=await CrossFingerprint.Current.AuthenticateAsync(conf);if(result.Authenticated ==false){}}}}/// <summary>/// Checks for Finger Print Authentication/// </summary>/// <returns></returns>publicasync Task CheckForFingerprintAuthentication(){this.EmailAddress = Preferences.Get("EmailAddress",string.Empty);stringPwd= Preferences.Get("Password",string.Empty);varauthenticationType=await CrossFingerprint.Current.GetAuthenticationTypeAsync();this.Enablefacemess ="Biometric ";this.IsFaceEnabledChecked = Convert.ToBoolean(Preferences.Get("IsFaceEnabledChecked",string.Empty));if(IsFaceEnabledChecked==true&&!string.IsNullOrEmpty(this.EmailAddress)&&!string.IsNullOrEmpty(Pwd)){varisFingerprintAvailable=await CrossFingerprint.Current.IsAvailableAsync(true);stringauthenticationFailureMessage=authenticationType== Plugin.Fingerprint.Abstractions.AuthenticationType.Face ?"No Face ID Recognized.":"There are no fingerprints available.";try{if(isFingerprintAvailable){AuthenticationRequestConfigurationconf=new AuthenticationRequestConfiguration("Authentication","Authenticate access to your personal data");varresult=await CrossFingerprint.Current.AuthenticateAsync(conf);if(result.Authenticated){this.EmailAddress = Preferences.Get("EmailAddress",string.Empty);Pwd= Preferences.Get("Password",string.Empty);if(!string.IsNullOrEmpty(this.EmailAddress)&&!string.IsNullOrEmpty(Pwd)){await Loginasync(this.EmailAddress, Pwd,false);;}}else{
UserDialogs.Instance.Alert("Unable to Access Biometric","Error");}}else{
UserDialogs.Instance.Alert("Biometric is Not Supported","Error");}}catch(Exceptionexception){
Debug.WriteLine("FingerPrint Exception"+exception);}}}privatevoidForgotUsername(){
#if TODOMAUI
this.HostScreen.Router.NavigateAndReset.Execute(new ForgotusernameViewModel(this.HostScreen)).Subscribe();
#endif
}privatevoidRestPassword(){
#if TODOMAUI
this.HostScreen.Router.NavigateAndReset.Execute(new ResetPasswordViewModel(this.HostScreen)).Subscribe();
#endif
}privatevoidConcatUS(){//Webview//this.HostScreen.Router.NavigateAndReset.Execute(new ContactUSViewModel(this.HostScreen,false)).Subscribe();
PhoneDialer.Open("8665903550");}}
@RAMESHKUMAR502 Is this still an issue in the latest release 19.4.1?
Could it have been caused by the Navigation issues crashing the process in other areas?
Describe the bug 🐞
ReactiveUI.Maui On IOS and Android we are not able receive the command or Binding getting executed.
Below is the code Sinpet when i press login Button the command is not getting trigged once we port from xamarin to MAUI.
Step to reproduce
Reproduction repository
https://github.com/reactiveui/ReactiveUI
Expected behavior
This should happen...
Screenshots 🖼️
No response
IDE
No response
Operating system
Apple
Version
No response
Device
IOS
ReactiveUI Version
18.4.26
Additional information ℹ️
No response
The text was updated successfully, but these errors were encountered: