You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

123 lines
4.0 KiB

//using GMCabsDriverAssistantSolutions.Models;
using GMCabsDriverAssistantSolution.Views;
using System;
using System.Collections.Generic;
using System.Text;
//using Xamarin.CommunityToolkit.Extensions;
using Microsoft.Maui;
using Microsoft.Maui.Controls;
using GMCabsDriverAssistantSolution.ViewModels;
using GMCabsDriverAssistant.Models;
namespace GMCabsDriverAssistant.ViewModels
{
public class AppShellViewModel : BaseViewModel
{
#region Fields
private string VERSION_NUMBER = VersionTracking.CurrentVersion;
private string driverName;
private string driverMobileNumber;
private bool isVisibleDrivingLicenceScan;
private bool isVisibleVoucherScan;
private bool isVisibleRydo;
private bool isVisibleCoupons = true;
private bool isVisibleSettings = true;
private bool isCanViewHome = true;
private bool isVisibleJobHistory = false;
private bool isVisibleMyAccount = false;
private bool isVisibleMyShifts = false;
#endregion
#region Properties
public bool IsVisibleDrivingLicenceScan
{
get => isVisibleDrivingLicenceScan;
set => SetProperty(ref isVisibleDrivingLicenceScan, value);
}
public bool IsVisibleVoucherScan
{
get => isVisibleVoucherScan;
set => SetProperty(ref isVisibleVoucherScan, value);
}
public bool IsVisibleRydo
{
get => isVisibleRydo;
set => SetProperty(ref isVisibleRydo, value);
}
public string VersionNumber
{
get => VERSION_NUMBER;
set => SetProperty(ref VERSION_NUMBER, value);
}
public string DriverName
{
get => driverName;
set => SetProperty(ref driverName, value);
}
public string DriverMobileNumber
{
get => driverMobileNumber;
set => SetProperty(ref driverMobileNumber, value);
}
public bool IsVisibleSettings
{
get => isVisibleSettings;
set => SetProperty(ref isVisibleSettings, value);
}
public bool IsVisibleCoupons
{
get => isVisibleCoupons;
set => SetProperty(ref isVisibleCoupons, value);
}
public bool IsCanViewHome
{
get => isCanViewHome;
set => SetProperty(ref isCanViewHome, value);
}
public bool IsVisibleJobHistory
{
get => isVisibleJobHistory;
set => SetProperty(ref isVisibleJobHistory, value);
}
public bool IsVisibleMyAccount
{
get => isVisibleMyAccount;
set => SetProperty(ref isVisibleMyAccount, value);
}
public bool IsVisibleMyShifts
{
get => isVisibleMyShifts;
set => SetProperty(ref isVisibleMyShifts, value);
}
public Command PrivacyPolicyClickCommand { get; }
Page _page;
#endregion
#region Constructor
public AppShellViewModel(Page page)
{
PrivacyPolicyClickCommand = new Command(OnPrivacyPolicyClicked);
MessagingCenter.Unsubscribe<LoginViewModel, LoginResponseDto>(this, "LoginSuccessful");
MessagingCenter.Subscribe<LoginViewModel, LoginResponseDto>(this, "LoginSuccessful", (sender, loginResponse) =>
{
DriverName = loginResponse.DriverName;
DriverMobileNumber = loginResponse.DriverMobileNumber;
IsVisibleDrivingLicenceScan = loginResponse.CanUpdateLicence;
IsVisibleVoucherScan = loginResponse.CanScanVouchers;
IsVisibleRydo = loginResponse.CanAcceptBookings;
});
_page = page;
}
#endregion
#region Methods
private void OnPrivacyPolicyClicked(object obj)
{
Shell.Current.FlyoutIsPresented = false;
// _page.Navigation.ShowPopup(new PrivacyPolicyDialogPage());
}
#endregion
}
}