diff --git a/GMCabsDriverAssistantSolution/Views/AppPermissiontSetDialogPage.xaml b/GMCabsDriverAssistantSolution/Views/AppPermissiontSetDialogPage.xaml
index da358a7..f29a138 100644
--- a/GMCabsDriverAssistantSolution/Views/AppPermissiontSetDialogPage.xaml
+++ b/GMCabsDriverAssistantSolution/Views/AppPermissiontSetDialogPage.xaml
@@ -3,11 +3,66 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="GMCabsDriverAssistantSolution.Views.AppPermissiontSetDialogPage"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
- Size="300,300">
-
-
-
+ Size="380,380"
+ Color="Transparent">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GMCabsDriverAssistantSolution/Views/AppPermissiontSetDialogPage.xaml.cs b/GMCabsDriverAssistantSolution/Views/AppPermissiontSetDialogPage.xaml.cs
index a65f60b..d5281a6 100644
--- a/GMCabsDriverAssistantSolution/Views/AppPermissiontSetDialogPage.xaml.cs
+++ b/GMCabsDriverAssistantSolution/Views/AppPermissiontSetDialogPage.xaml.cs
@@ -1,11 +1,149 @@
using CommunityToolkit.Maui.Views;
+using GMCabsDriverAssistant.Services;
+using GMCabsDriverAssistant.Utils;
namespace GMCabsDriverAssistantSolution.Views;
+[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class AppPermissiontSetDialogPage : Popup
{
- public AppPermissiontSetDialogPage(Page page, string flag)
- {
- InitializeComponent();
- }
+ #region Fields
+ bool isLocationPermitted, isBatteryOptimizationDisabled;
+ string flag;
+ #endregion
+ #region Constructor
+ public AppPermissiontSetDialogPage(Page page, string flag)
+ {
+ InitializeComponent();
+ this.flag = flag;
+ isLocationPermitted = Preferences.Get(SecureStorageData.IsLocationPermitted, false);
+ isBatteryOptimizationDisabled = Preferences.Get(SecureStorageData.IsBatteryOptimizationDisabled, false);
+ PermissionAllocationLayout.IsVisible = true;
+ PermissionLayout.IsVisible = false;
+ LocationWarningLayout.IsVisible = false;
+ }
+ #endregion
+
+ #region Events
+
+ private async void Ignore_Clicked(object sender, EventArgs e)
+ {
+ if (isLocationPermitted)
+ {
+ if (flag == Constant.FROM_PERMISSION_PAGE)
+ {
+ //Dismiss(null);
+ Close();
+ await ShowSplashScreen();
+ }
+ else
+ {
+ //Dismiss(null);
+ Close();
+ }
+ }
+ else
+ {
+ if (LocationWarningLayout.IsVisible)
+ {
+ if (flag == Constant.FROM_PERMISSION_PAGE)
+ {
+ //Dismiss(null);
+ Close();
+ await ShowSplashScreen();
+ }
+ else
+ {
+ //Dismiss(null);
+ Close();
+ }
+ }
+ else
+ {
+ PermissionAllocationLayout.IsVisible = false;
+ PermissionLayout.IsVisible = false;
+ LocationWarningLayout.IsVisible = true;
+ }
+ }
+ }
+
+ [Obsolete]
+ private void Permission_Clicked(object sender, EventArgs e)
+ {
+ PermissionAllocationLayout.IsVisible = false;
+ PermissionLayout.IsVisible = true;
+ LocationWarningLayout.IsVisible = false;
+ if (Device.RuntimePlatform == Device.iOS)
+ {
+ BatteyOptimisedLayout.IsVisible = false;
+ }
+ else
+ {
+ if (isLocationPermitted)
+ {
+ PermissionLayout.IsVisible = true;
+ LocationLayout.IsVisible = false;
+ }
+ if (isBatteryOptimizationDisabled)
+ {
+ PermissionLayout.IsVisible = true;
+ BatteyOptimisedLayout.IsVisible = false;
+ }
+ }
+ }
+
+ private async void Location_Clicked(object sender, EventArgs e)
+ {
+ //Dismiss(null);
+ Close();
+ await Permissions.RequestAsync();
+ var status = await OnLocationCheck();
+ }
+
+ private void Batteryoptimisation_Clicked(object sender, EventArgs e)
+ {
+ //Dismiss(null);
+ Close();
+ if (!DependencyService.Get().CheckIsIgnoringBatteryOptimizations())
+ {
+ DependencyService.Get().StartSetting();
+ }
+ }
+
+ private async void ChangeLocation_Clicked(object sender, EventArgs e)
+ {
+ //Dismiss(null);
+ Close();
+ await Permissions.RequestAsync();
+ var status = await OnLocationCheck();
+ }
+ #endregion
+
+ #region Methods
+ private async Task ShowSplashScreen()
+ {
+ await Shell.Current.GoToAsync($"//{nameof(SplashPage)}");
+ }
+
+ public async Task OnLocationCheck()
+ {
+
+ var status = await Permissions.CheckStatusAsync();
+ if (status == PermissionStatus.Granted)
+ return status;
+
+ try
+ {
+ if ((DeviceInfo.Platform == DevicePlatform.Android && int.Parse(DeviceInfo.VersionString) >= 12) || DeviceInfo.Platform == DevicePlatform.iOS)
+ {
+ AppInfo.ShowSettingsUI();
+ }
+ }
+ catch (Exception ex)
+ {
+
+ }
+ return status;
+ }
+ #endregion
}
\ No newline at end of file