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.

125 lines
4.1 KiB

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