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

1 year ago
  1. //using GMCabsDriverAssistantSolutions.Models;
  2. using GMCabsDriverAssistantSolution.Views;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Text;
  6. //using Xamarin.CommunityToolkit.Extensions;
  7. using Microsoft.Maui;
  8. using Microsoft.Maui.Controls;
  9. using GMCabsDriverAssistantSolution.ViewModels;
  10. using GMCabsDriverAssistant.Models;
  11. namespace GMCabsDriverAssistant.ViewModels
  12. {
  13. public class AppShellViewModel : BaseViewModel
  14. {
  15. #region Fields
  16. private string VERSION_NUMBER = VersionTracking.CurrentVersion;
  17. private string driverName;
  18. private string driverMobileNumber;
  19. private bool isVisibleDrivingLicenceScan;
  20. private bool isVisibleVoucherScan;
  21. private bool isVisibleRydo;
  22. private bool isVisibleCoupons = true;
  23. private bool isVisibleSettings = true;
  24. private bool isCanViewHome = true;
  25. private bool isVisibleJobHistory = false;
  26. private bool isVisibleMyAccount = false;
  27. private bool isVisibleMyShifts = false;
  28. #endregion
  29. #region Properties
  30. public bool IsVisibleDrivingLicenceScan
  31. {
  32. get => isVisibleDrivingLicenceScan;
  33. set => SetProperty(ref isVisibleDrivingLicenceScan, value);
  34. }
  35. public bool IsVisibleVoucherScan
  36. {
  37. get => isVisibleVoucherScan;
  38. set => SetProperty(ref isVisibleVoucherScan, value);
  39. }
  40. public bool IsVisibleRydo
  41. {
  42. get => isVisibleRydo;
  43. set => SetProperty(ref isVisibleRydo, value);
  44. }
  45. public string VersionNumber
  46. {
  47. get => VERSION_NUMBER;
  48. set => SetProperty(ref VERSION_NUMBER, value);
  49. }
  50. public string DriverName
  51. {
  52. get => driverName;
  53. set => SetProperty(ref driverName, value);
  54. }
  55. public string DriverMobileNumber
  56. {
  57. get => driverMobileNumber;
  58. set => SetProperty(ref driverMobileNumber, value);
  59. }
  60. public bool IsVisibleSettings
  61. {
  62. get => isVisibleSettings;
  63. set => SetProperty(ref isVisibleSettings, value);
  64. }
  65. public bool IsVisibleCoupons
  66. {
  67. get => isVisibleCoupons;
  68. set => SetProperty(ref isVisibleCoupons, value);
  69. }
  70. public bool IsCanViewHome
  71. {
  72. get => isCanViewHome;
  73. set => SetProperty(ref isCanViewHome, value);
  74. }
  75. public bool IsVisibleJobHistory
  76. {
  77. get => isVisibleJobHistory;
  78. set => SetProperty(ref isVisibleJobHistory, value);
  79. }
  80. public bool IsVisibleMyAccount
  81. {
  82. get => isVisibleMyAccount;
  83. set => SetProperty(ref isVisibleMyAccount, value);
  84. }
  85. public bool IsVisibleMyShifts
  86. {
  87. get => isVisibleMyShifts;
  88. set => SetProperty(ref isVisibleMyShifts, value);
  89. }
  90. public Command PrivacyPolicyClickCommand { get; }
  91. Page _page;
  92. #endregion
  93. #region Constructor
  94. public AppShellViewModel(Page page)
  95. {
  96. PrivacyPolicyClickCommand = new Command(OnPrivacyPolicyClicked);
  97. MessagingCenter.Unsubscribe<LoginViewModel, LoginResponseDto>(this, "LoginSuccessful");
  98. MessagingCenter.Subscribe<LoginViewModel, LoginResponseDto>(this, "LoginSuccessful", (sender, loginResponse) =>
  99. {
  100. DriverName = loginResponse.DriverName;
  101. DriverMobileNumber = loginResponse.DriverMobileNumber;
  102. IsVisibleDrivingLicenceScan = loginResponse.CanUpdateLicence;
  103. IsVisibleVoucherScan = loginResponse.CanScanVouchers;
  104. IsVisibleRydo = loginResponse.CanAcceptBookings;
  105. });
  106. _page = page;
  107. }
  108. #endregion
  109. #region Methods
  110. private void OnPrivacyPolicyClicked(object obj)
  111. {
  112. Shell.Current.FlyoutIsPresented = false;
  113. // _page.Navigation.ShowPopup(new PrivacyPolicyDialogPage());
  114. }
  115. #endregion
  116. }
  117. }