diff --git a/salesbook.Maui/Core/RestClient/IntegryApi/IntegryNotificationRestClient.cs b/salesbook.Maui/Core/RestClient/IntegryApi/IntegryNotificationRestClient.cs index d18ff4c..021fc6c 100644 --- a/salesbook.Maui/Core/RestClient/IntegryApi/IntegryNotificationRestClient.cs +++ b/salesbook.Maui/Core/RestClient/IntegryApi/IntegryNotificationRestClient.cs @@ -2,7 +2,7 @@ using IntegryApiClient.Core.Domain.RestClient.Contacts; using Microsoft.Extensions.Logging; using salesbook.Maui.Core.RestClient.IntegryApi.Dto; -using salesbook.Shared.Core.Interface; +using salesbook.Shared.Core.Interface.IntegryApi; namespace salesbook.Maui.Core.RestClient.IntegryApi; diff --git a/salesbook.Maui/Core/Services/ManageDataService.cs b/salesbook.Maui/Core/Services/ManageDataService.cs index 9b6dc26..9031c83 100644 --- a/salesbook.Maui/Core/Services/ManageDataService.cs +++ b/salesbook.Maui/Core/Services/ManageDataService.cs @@ -7,6 +7,8 @@ using salesbook.Shared.Core.Helpers.Enum; using salesbook.Shared.Core.Interface; using Sentry.Protocol; using System.Linq.Expressions; +using salesbook.Shared.Core.Interface.IntegryApi; +using salesbook.Shared.Core.Interface.System.Network; namespace salesbook.Maui.Core.Services; diff --git a/salesbook.Maui/Core/Services/SyncDbService.cs b/salesbook.Maui/Core/Services/SyncDbService.cs index d5c55bb..795f99a 100644 --- a/salesbook.Maui/Core/Services/SyncDbService.cs +++ b/salesbook.Maui/Core/Services/SyncDbService.cs @@ -1,5 +1,6 @@ using salesbook.Shared.Core.Helpers; using salesbook.Shared.Core.Interface; +using salesbook.Shared.Core.Interface.IntegryApi; namespace salesbook.Maui.Core.Services; diff --git a/salesbook.Maui/Core/System/Network/NetworkService.cs b/salesbook.Maui/Core/System/Network/NetworkService.cs index 124578a..af1da33 100644 --- a/salesbook.Maui/Core/System/Network/NetworkService.cs +++ b/salesbook.Maui/Core/System/Network/NetworkService.cs @@ -1,4 +1,5 @@ using salesbook.Shared.Core.Interface; +using salesbook.Shared.Core.Interface.System.Network; namespace salesbook.Maui.Core.System.Network; diff --git a/salesbook.Maui/Core/System/Notification/FirebaseNotificationService.cs b/salesbook.Maui/Core/System/Notification/FirebaseNotificationService.cs index e0b7c28..2f766eb 100644 --- a/salesbook.Maui/Core/System/Notification/FirebaseNotificationService.cs +++ b/salesbook.Maui/Core/System/Notification/FirebaseNotificationService.cs @@ -1,16 +1,37 @@ using salesbook.Shared.Core.Interface; +using salesbook.Shared.Core.Interface.IntegryApi; using Shiny; +using Shiny.Notifications; using Shiny.Push; namespace salesbook.Maui.Core.System.Notification; -public class FirebaseNotificationService(IPushManager pushManager, IIntegryNotificationRestClient integryNotificationRestClient) : IFirebaseNotificationService +public class FirebaseNotificationService( + IPushManager pushManager, + IIntegryNotificationRestClient integryNotificationRestClient, + INotificationManager notificationManager +) : IFirebaseNotificationService { public async Task InitFirebase() { - var (accessState, token) = await pushManager.RequestAccess(); + CreateNotificationChannel(); + var (accessState, token) = await pushManager.RequestAccess(); + if (accessState == AccessState.Denied || token is null) return; await integryNotificationRestClient.Register(token); } + + private void CreateNotificationChannel() + { + var channel = new Channel + { + Identifier = "salesbook_push", + Description = "Notifiche push di SalesBook", + Importance = ChannelImportance.High, + Actions = [] + }; + + notificationManager.AddChannel(channel); + } } \ No newline at end of file diff --git a/salesbook.Maui/Core/System/Notification/ShinyNotificationManager.cs b/salesbook.Maui/Core/System/Notification/ShinyNotificationManager.cs new file mode 100644 index 0000000..ab1ce6b --- /dev/null +++ b/salesbook.Maui/Core/System/Notification/ShinyNotificationManager.cs @@ -0,0 +1,9 @@ +using salesbook.Shared.Core.Interface.System.Notification; +using Shiny.Notifications; + +namespace salesbook.Maui.Core.System.Notification; + +public class ShinyNotificationManager(INotificationManager notificationManager) : IShinyNotificationManager +{ + public Task RequestAccess() => notificationManager.RequestAccess(); +} \ No newline at end of file diff --git a/salesbook.Maui/MauiProgram.cs b/salesbook.Maui/MauiProgram.cs index d565c99..1743cbf 100644 --- a/salesbook.Maui/MauiProgram.cs +++ b/salesbook.Maui/MauiProgram.cs @@ -1,4 +1,3 @@ -using AutoMapper; using CommunityToolkit.Maui; using CommunityToolkit.Mvvm.Messaging; using IntegryApiClient.MAUI; @@ -16,6 +15,9 @@ using salesbook.Shared.Core.Dto; using salesbook.Shared.Core.Dto.PageState; using salesbook.Shared.Core.Helpers; using salesbook.Shared.Core.Interface; +using salesbook.Shared.Core.Interface.IntegryApi; +using salesbook.Shared.Core.Interface.System.Network; +using salesbook.Shared.Core.Interface.System.Notification; using salesbook.Shared.Core.Messages.Activity.Copy; using salesbook.Shared.Core.Messages.Activity.New; using salesbook.Shared.Core.Messages.Back; @@ -29,7 +31,7 @@ namespace salesbook.Maui { private const string AppToken = "f0484398-1f8b-42f5-ab79-5282c164e1d8"; - public static MauiApp CreateMauiApp() + public static MauiAppBuilder CreateMauiAppBuilder() { InteractiveRenderSettings.ConfigureBlazorHybridRenderModes(); @@ -38,6 +40,7 @@ namespace salesbook.Maui .UseMauiApp() .UseIntegry(appToken: AppToken, useLoginAzienda: true) .UseMauiCommunityToolkit() + .UseShiny() .UseSentry(options => { options.Dsn = "https://453b6b38f94fd67e40e0d5306d6caff8@o4508499810254848.ingest.de.sentry.io/4509605099667536"; @@ -82,6 +85,7 @@ namespace salesbook.Maui builder.Services.AddPush(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); + builder.Services.AddSingleton(); #if DEBUG builder.Services.AddBlazorWebViewDeveloperTools(); @@ -93,7 +97,7 @@ namespace salesbook.Maui builder.Services.AddSingleton(); builder.Services.AddSingleton(); - return builder.Build(); + return builder; } } } \ No newline at end of file diff --git a/salesbook.Maui/Platforms/Android/AndroidManifest.xml b/salesbook.Maui/Platforms/Android/AndroidManifest.xml index a8b23a0..e38ccd8 100644 --- a/salesbook.Maui/Platforms/Android/AndroidManifest.xml +++ b/salesbook.Maui/Platforms/Android/AndroidManifest.xml @@ -1,5 +1,5 @@  - + @@ -15,4 +15,10 @@ + + + + + + \ No newline at end of file diff --git a/salesbook.Maui/Platforms/Android/AndroidModule.cs b/salesbook.Maui/Platforms/Android/AndroidModule.cs new file mode 100644 index 0000000..19ab9b1 --- /dev/null +++ b/salesbook.Maui/Platforms/Android/AndroidModule.cs @@ -0,0 +1,13 @@ +using salesbook.Maui.Core; +using salesbook.Shared.Core.Interface.System.Battery; + +namespace salesbook.Maui; + +public static class AndroidModule +{ + public static MauiAppBuilder RegisterAndroidAppServices(this MauiAppBuilder mauiAppBuilder) + { + mauiAppBuilder.Services.AddSingleton(); + return mauiAppBuilder; + } +} \ No newline at end of file diff --git a/salesbook.Maui/Platforms/Android/Core/BatteryOptimizationManagerService.cs b/salesbook.Maui/Platforms/Android/Core/BatteryOptimizationManagerService.cs new file mode 100644 index 0000000..4e1f3ff --- /dev/null +++ b/salesbook.Maui/Platforms/Android/Core/BatteryOptimizationManagerService.cs @@ -0,0 +1,28 @@ +using Android.App; +using Android.Content; +using Android.OS; +using Android.Provider; +using salesbook.Shared.Core.Interface.System.Battery; +using Application = Android.App.Application; + +namespace salesbook.Maui.Core; + +public class BatteryOptimizationManagerService : IBatteryOptimizationManagerService +{ + public bool IsBatteryOptimizationEnabled() + { + var packageName = AppInfo.PackageName; + + var pm = (PowerManager)Application.Context.GetSystemService(Context.PowerService)!; + return !pm.IsIgnoringBatteryOptimizations(packageName); + } + + public void OpenBatteryOptimizationSettings(Action onCompleted) + { + var packageName = AppInfo.PackageName; + + var intent = new Intent(Settings.ActionRequestIgnoreBatteryOptimizations); + intent.SetData(Android.Net.Uri.Parse("package:" + packageName)); + ((MainActivity)Platform.CurrentActivity!).StartActivityForResult(intent, (result, _) => { onCompleted(result == Result.Ok); }); + } +} \ No newline at end of file diff --git a/salesbook.Maui/Platforms/Android/MainActivity.cs b/salesbook.Maui/Platforms/Android/MainActivity.cs index 75ed53c..dbc05ea 100644 --- a/salesbook.Maui/Platforms/Android/MainActivity.cs +++ b/salesbook.Maui/Platforms/Android/MainActivity.cs @@ -1,19 +1,42 @@ using Android.App; +using Android.Content; using Android.Content.PM; namespace salesbook.Maui { - [Activity(Theme = "@style/Maui.SplashTheme", + [Activity( + Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)] - [IntentFilter([Shiny.ShinyPushIntents.NotificationClickAction], - Categories = new[] - { + + [IntentFilter( + [ + Shiny.ShinyPushIntents.NotificationClickAction + ], + Categories = + [ "android.intent.category.DEFAULT" - } + ] )] public class MainActivity : MauiAppCompatActivity { + private readonly IDictionary> _onActivityResultSubscriber = + new Dictionary>(); + + public void StartActivityForResult(Intent intent, Action onResultAction) + { + var requestCode = new Random(DateTime.Now.Millisecond).Next(); + _onActivityResultSubscriber.Add(requestCode, onResultAction); + StartActivityForResult(intent, requestCode); + } + + protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) + { + if (_onActivityResultSubscriber.TryGetValue(requestCode, out var value)) + value(resultCode, data); + + base.OnActivityResult(requestCode, resultCode, data); + } } } \ No newline at end of file diff --git a/salesbook.Maui/Platforms/Android/MainApplication.cs b/salesbook.Maui/Platforms/Android/MainApplication.cs index 2820e44..ff3db19 100644 --- a/salesbook.Maui/Platforms/Android/MainApplication.cs +++ b/salesbook.Maui/Platforms/Android/MainApplication.cs @@ -1,16 +1,16 @@ using Android.App; using Android.Runtime; -namespace salesbook.Maui -{ - [Application(HardwareAccelerated = true)] - public class MainApplication : MauiApplication - { - public MainApplication(IntPtr handle, JniHandleOwnership ownership) - : base(handle, ownership) - { - } +namespace salesbook.Maui; - protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); +[Application(HardwareAccelerated = true)] +public class MainApplication : MauiApplication +{ + public MainApplication(IntPtr handle, JniHandleOwnership ownership) + : base(handle, ownership) + { } -} + + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiAppBuilder() + .RegisterAndroidAppServices().Build(); +} \ No newline at end of file diff --git a/salesbook.Maui/Platforms/iOS/AppDelegate.cs b/salesbook.Maui/Platforms/iOS/AppDelegate.cs index 57062da..0728e77 100644 --- a/salesbook.Maui/Platforms/iOS/AppDelegate.cs +++ b/salesbook.Maui/Platforms/iOS/AppDelegate.cs @@ -1,10 +1,24 @@ using Foundation; +using UIKit; namespace salesbook.Maui { [Register("AppDelegate")] public class AppDelegate : MauiUIApplicationDelegate { - protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); + protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiAppBuilder() + .RegisterIosAppServices().Build(); + + [Export("application:didRegisterForRemoteNotificationsWithDeviceToken:")] + public void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken) + => global::Shiny.Hosting.Host.Lifecycle.OnRegisteredForRemoteNotifications(deviceToken); + + [Export("application:didFailToRegisterForRemoteNotificationsWithError:")] + public void FailedToRegisterForRemoteNotifications(UIApplication application, NSError error) + => global::Shiny.Hosting.Host.Lifecycle.OnFailedToRegisterForRemoteNotifications(error); + + [Export("application:didReceiveRemoteNotification:fetchCompletionHandler:")] + public void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action completionHandler) + => global::Shiny.Hosting.Host.Lifecycle.OnDidReceiveRemoteNotification(userInfo, completionHandler); } } diff --git a/salesbook.Maui/Platforms/iOS/Core/BatteryOptimizationManagerService.cs b/salesbook.Maui/Platforms/iOS/Core/BatteryOptimizationManagerService.cs new file mode 100644 index 0000000..3f9400d --- /dev/null +++ b/salesbook.Maui/Platforms/iOS/Core/BatteryOptimizationManagerService.cs @@ -0,0 +1,12 @@ +using salesbook.Shared.Core.Interface.System.Battery; + +namespace salesbook.Maui.Core; + +public class BatteryOptimizationManagerService : IBatteryOptimizationManagerService +{ + public bool IsBatteryOptimizationEnabled() => true; + + public void OpenBatteryOptimizationSettings(Action onCompleted) + { + } +} \ No newline at end of file diff --git a/salesbook.Maui/Platforms/iOS/PrivacyInfo.xcprivacy b/salesbook.Maui/Platforms/iOS/PrivacyInfo.xcprivacy new file mode 100644 index 0000000..fcd26e7 --- /dev/null +++ b/salesbook.Maui/Platforms/iOS/PrivacyInfo.xcprivacy @@ -0,0 +1,110 @@ + + + + + + NSPrivacyAccessedAPITypes + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryFileTimestamp + NSPrivacyAccessedAPITypeReasons + + C617.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategorySystemBootTime + NSPrivacyAccessedAPITypeReasons + + 35F9.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryDiskSpace + NSPrivacyAccessedAPITypeReasons + + E174.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryUserDefaults + NSPrivacyAccessedAPITypeReasons + + CA92.1 + + + + NSPrivacyCollectedDataTypes + + + + NSPrivacyCollectedDataTypeUserID + NSPrivacyCollectedDataTypeLocation + NSPrivacyCollectedDataTypeLinked + + NSPrivacyCollectedDataTypeTracking + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeAppFunctionality + + + + NSPrivacyCollectedDataTypeEmailAddress + NSPrivacyCollectedDataTypeLocation + NSPrivacyCollectedDataTypeLinked + + NSPrivacyCollectedDataTypeTracking + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeAppFunctionality + + + + NSPrivacyCollectedDataTypePhoneNumber + NSPrivacyCollectedDataTypeLocation + NSPrivacyCollectedDataTypeLinked + + NSPrivacyCollectedDataTypeTracking + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeAppFunctionality + + + + + + NSPrivacyCollectedDataType + NSPrivacyCollectedDataTypeOtherDiagnosticData + NSPrivacyCollectedDataTypeLinked + + NSPrivacyCollectedDataTypeTracking + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeAppFunctionality + + + + NSPrivacyCollectedDataType + NSPrivacyCollectedDataTypeCrashData + NSPrivacyCollectedDataTypeLinked + + NSPrivacyCollectedDataTypeTracking + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeAppFunctionality + + + + + + + diff --git a/salesbook.Maui/Platforms/iOS/iOSModule.cs b/salesbook.Maui/Platforms/iOS/iOSModule.cs new file mode 100644 index 0000000..071675e --- /dev/null +++ b/salesbook.Maui/Platforms/iOS/iOSModule.cs @@ -0,0 +1,13 @@ +using salesbook.Maui.Core; +using salesbook.Shared.Core.Interface.System.Battery; + +namespace salesbook.Maui; + +public static class iOSModule +{ + public static MauiAppBuilder RegisterIosAppServices(this MauiAppBuilder mauiAppBuilder) + { + mauiAppBuilder.Services.AddSingleton(); + return mauiAppBuilder; + } +} \ No newline at end of file diff --git a/salesbook.Maui/salesbook.Maui.csproj b/salesbook.Maui/salesbook.Maui.csproj index 3120900..fb9eb60 100644 --- a/salesbook.Maui/salesbook.Maui.csproj +++ b/salesbook.Maui/salesbook.Maui.csproj @@ -83,14 +83,16 @@ manual - + - --> + + + @@ -138,6 +140,7 @@ + diff --git a/salesbook.Shared/Components/Layout/MainLayout.razor b/salesbook.Shared/Components/Layout/MainLayout.razor index dc8d62b..514030f 100644 --- a/salesbook.Shared/Components/Layout/MainLayout.razor +++ b/salesbook.Shared/Components/Layout/MainLayout.razor @@ -1,5 +1,7 @@ @using System.Globalization @using salesbook.Shared.Core.Interface +@using salesbook.Shared.Core.Interface.IntegryApi +@using salesbook.Shared.Core.Interface.System.Network @using salesbook.Shared.Core.Messages.Back @inherits LayoutComponentBase @inject IJSRuntime JS @@ -55,7 +57,7 @@ private bool _showWarning; private DateTime _lastApiCheck = DateTime.MinValue; - private const int DelaySeconds = 60; + private const int DelaySeconds = 180; private CancellationTokenSource? _cts; diff --git a/salesbook.Shared/Components/Pages/Commessa.razor b/salesbook.Shared/Components/Pages/Commessa.razor index 24d8b14..829abce 100644 --- a/salesbook.Shared/Components/Pages/Commessa.razor +++ b/salesbook.Shared/Components/Pages/Commessa.razor @@ -11,6 +11,7 @@ @using salesbook.Shared.Core.Dto.PageState @using salesbook.Shared.Core.Entity @using salesbook.Shared.Core.Interface +@using salesbook.Shared.Core.Interface.IntegryApi @inject JobSteps JobSteps @inject IManageDataService ManageData @inject IIntegryApiService IntegryApiService diff --git a/salesbook.Shared/Components/Pages/Home.razor b/salesbook.Shared/Components/Pages/Home.razor index c39cdd5..aadb903 100644 --- a/salesbook.Shared/Components/Pages/Home.razor +++ b/salesbook.Shared/Components/Pages/Home.razor @@ -2,10 +2,13 @@ @attribute [Authorize] @using salesbook.Shared.Core.Interface @using salesbook.Shared.Components.Layout.Spinner +@using salesbook.Shared.Core.Interface.System.Network +@using salesbook.Shared.Core.Interface.System.Notification @using salesbook.Shared.Core.Services @inject IFormFactor FormFactor @inject INetworkService NetworkService @inject IFirebaseNotificationService FirebaseNotificationService +@inject IShinyNotificationManager NotificationManager @inject PreloadService PreloadService @@ -14,6 +17,8 @@ { protected override async Task OnInitializedAsync() { + await CheckAndRequestPermissions(); + try { await FirebaseNotificationService.InitFirebase(); @@ -35,6 +40,14 @@ NavigationManager.NavigateTo("/Calendar"); } + private async Task CheckAndRequestPermissions() + { + await NotificationManager.RequestAccess(); + + // if (BatteryOptimizationManagerService.IsBatteryOptimizationEnabled()) + // BatteryOptimizationManagerService.OpenBatteryOptimizationSettings(_ => { }); + } + private Task StartSyncUser() { return Task.Run(() => diff --git a/salesbook.Shared/Components/Pages/Login.razor b/salesbook.Shared/Components/Pages/Login.razor index baafd52..bbf2048 100644 --- a/salesbook.Shared/Components/Pages/Login.razor +++ b/salesbook.Shared/Components/Pages/Login.razor @@ -1,6 +1,7 @@ @page "/login" @using salesbook.Shared.Components.Layout.Spinner @using salesbook.Shared.Core.Interface +@using salesbook.Shared.Core.Interface.System.Network @using salesbook.Shared.Core.Services @inject IUserAccountService UserAccountService @inject AppAuthenticationStateProvider AuthenticationStateProvider diff --git a/salesbook.Shared/Components/Pages/PersonalInfo.razor b/salesbook.Shared/Components/Pages/PersonalInfo.razor index 036fcbf..8ac584b 100644 --- a/salesbook.Shared/Components/Pages/PersonalInfo.razor +++ b/salesbook.Shared/Components/Pages/PersonalInfo.razor @@ -3,6 +3,7 @@ @using salesbook.Shared.Components.Layout @using salesbook.Shared.Core.Authorization.Enum @using salesbook.Shared.Core.Interface +@using salesbook.Shared.Core.Interface.System.Network @using salesbook.Shared.Core.Services @inject AppAuthenticationStateProvider AuthenticationStateProvider @inject INetworkService NetworkService diff --git a/salesbook.Shared/Components/Pages/User.razor b/salesbook.Shared/Components/Pages/User.razor index 0da73a8..aff2c4d 100644 --- a/salesbook.Shared/Components/Pages/User.razor +++ b/salesbook.Shared/Components/Pages/User.razor @@ -10,6 +10,7 @@ @using salesbook.Shared.Core.Dto.Activity @using salesbook.Shared.Core.Dto.JobProgress @using salesbook.Shared.Core.Dto.PageState +@using salesbook.Shared.Core.Interface.IntegryApi @implements IAsyncDisposable @inject IManageDataService ManageData @inject IMapper Mapper diff --git a/salesbook.Shared/Components/SingleElements/BottomSheet/SearchAddress.razor b/salesbook.Shared/Components/SingleElements/BottomSheet/SearchAddress.razor index 44a29f7..c6f0b7b 100644 --- a/salesbook.Shared/Components/SingleElements/BottomSheet/SearchAddress.razor +++ b/salesbook.Shared/Components/SingleElements/BottomSheet/SearchAddress.razor @@ -2,6 +2,7 @@ @using salesbook.Shared.Core.Dto @using salesbook.Shared.Core.Interface @using salesbook.Shared.Components.Layout.Overlay +@using salesbook.Shared.Core.Interface.IntegryApi @inject IIntegryApiService IntegryApiService
diff --git a/salesbook.Shared/Components/SingleElements/Card/AttachCard.razor b/salesbook.Shared/Components/SingleElements/Card/AttachCard.razor index 26d27a8..3d0d085 100644 --- a/salesbook.Shared/Components/SingleElements/Card/AttachCard.razor +++ b/salesbook.Shared/Components/SingleElements/Card/AttachCard.razor @@ -1,5 +1,6 @@ @using salesbook.Shared.Core.Dto @using salesbook.Shared.Core.Interface +@using salesbook.Shared.Core.Interface.IntegryApi @inject IIntegryApiService IntegryApiService @inject IAttachedService AttachedService diff --git a/salesbook.Shared/Components/SingleElements/Modal/ActivityForm.razor b/salesbook.Shared/Components/SingleElements/Modal/ActivityForm.razor index 352cdc7..7e5a8af 100644 --- a/salesbook.Shared/Components/SingleElements/Modal/ActivityForm.razor +++ b/salesbook.Shared/Components/SingleElements/Modal/ActivityForm.razor @@ -9,6 +9,8 @@ @using salesbook.Shared.Core.Dto.Contact @using salesbook.Shared.Core.Entity @using salesbook.Shared.Core.Interface +@using salesbook.Shared.Core.Interface.IntegryApi +@using salesbook.Shared.Core.Interface.System.Network @using salesbook.Shared.Core.Messages.Activity.Copy @inject IManageDataService ManageData @inject INetworkService NetworkService diff --git a/salesbook.Shared/Components/SingleElements/Modal/ContactForm.razor b/salesbook.Shared/Components/SingleElements/Modal/ContactForm.razor index 8b6ffbd..46f9fa9 100644 --- a/salesbook.Shared/Components/SingleElements/Modal/ContactForm.razor +++ b/salesbook.Shared/Components/SingleElements/Modal/ContactForm.razor @@ -5,6 +5,8 @@ @using salesbook.Shared.Core.Entity @using salesbook.Shared.Components.SingleElements.BottomSheet @using salesbook.Shared.Core.Dto.Contact +@using salesbook.Shared.Core.Interface.IntegryApi +@using salesbook.Shared.Core.Interface.System.Network @inject IManageDataService ManageData @inject INetworkService NetworkService @inject IIntegryApiService IntegryApiService diff --git a/salesbook.Shared/Components/SingleElements/Modal/PersRifForm.razor b/salesbook.Shared/Components/SingleElements/Modal/PersRifForm.razor index 3e107ae..c3813b2 100644 --- a/salesbook.Shared/Components/SingleElements/Modal/PersRifForm.razor +++ b/salesbook.Shared/Components/SingleElements/Modal/PersRifForm.razor @@ -2,6 +2,8 @@ @using salesbook.Shared.Components.Layout @using salesbook.Shared.Core.Interface @using salesbook.Shared.Components.Layout.Overlay +@using salesbook.Shared.Core.Interface.IntegryApi +@using salesbook.Shared.Core.Interface.System.Network @inject IManageDataService ManageData @inject INetworkService NetworkService @inject IIntegryApiService IntegryApiService diff --git a/salesbook.Shared/Core/Interface/IIntegryApiService.cs b/salesbook.Shared/Core/Interface/IntegryApi/IIntegryApiService.cs similarity index 97% rename from salesbook.Shared/Core/Interface/IIntegryApiService.cs rename to salesbook.Shared/Core/Interface/IntegryApi/IIntegryApiService.cs index a8fdc7d..1cd51af 100644 --- a/salesbook.Shared/Core/Interface/IIntegryApiService.cs +++ b/salesbook.Shared/Core/Interface/IntegryApi/IIntegryApiService.cs @@ -4,7 +4,7 @@ using salesbook.Shared.Core.Dto.Contact; using salesbook.Shared.Core.Dto.JobProgress; using salesbook.Shared.Core.Entity; -namespace salesbook.Shared.Core.Interface; +namespace salesbook.Shared.Core.Interface.IntegryApi; public interface IIntegryApiService { diff --git a/salesbook.Shared/Core/Interface/IIntegryNotificationRestClient.cs b/salesbook.Shared/Core/Interface/IntegryApi/IIntegryNotificationRestClient.cs similarity index 73% rename from salesbook.Shared/Core/Interface/IIntegryNotificationRestClient.cs rename to salesbook.Shared/Core/Interface/IntegryApi/IIntegryNotificationRestClient.cs index 7eef3df..27de9c7 100644 --- a/salesbook.Shared/Core/Interface/IIntegryNotificationRestClient.cs +++ b/salesbook.Shared/Core/Interface/IntegryApi/IIntegryNotificationRestClient.cs @@ -1,6 +1,6 @@ using Microsoft.Extensions.Logging; -namespace salesbook.Shared.Core.Interface; +namespace salesbook.Shared.Core.Interface.IntegryApi; public interface IIntegryNotificationRestClient { diff --git a/salesbook.Shared/Core/Interface/System/Battery/IBatteryOptimizationManagerService.cs b/salesbook.Shared/Core/Interface/System/Battery/IBatteryOptimizationManagerService.cs new file mode 100644 index 0000000..179f1ac --- /dev/null +++ b/salesbook.Shared/Core/Interface/System/Battery/IBatteryOptimizationManagerService.cs @@ -0,0 +1,8 @@ +namespace salesbook.Shared.Core.Interface.System.Battery; + +public interface IBatteryOptimizationManagerService +{ + bool IsBatteryOptimizationEnabled(); + + void OpenBatteryOptimizationSettings(Action onCompleted); +} \ No newline at end of file diff --git a/salesbook.Shared/Core/Interface/INetworkService.cs b/salesbook.Shared/Core/Interface/System/Network/INetworkService.cs similarity index 67% rename from salesbook.Shared/Core/Interface/INetworkService.cs rename to salesbook.Shared/Core/Interface/System/Network/INetworkService.cs index 1bec94c..43b6acc 100644 --- a/salesbook.Shared/Core/Interface/INetworkService.cs +++ b/salesbook.Shared/Core/Interface/System/Network/INetworkService.cs @@ -1,4 +1,4 @@ -namespace salesbook.Shared.Core.Interface; +namespace salesbook.Shared.Core.Interface.System.Network; public interface INetworkService { diff --git a/salesbook.Shared/Core/Interface/System/Notification/IShinyNotificationManager.cs b/salesbook.Shared/Core/Interface/System/Notification/IShinyNotificationManager.cs new file mode 100644 index 0000000..ec8454b --- /dev/null +++ b/salesbook.Shared/Core/Interface/System/Notification/IShinyNotificationManager.cs @@ -0,0 +1,6 @@ +namespace salesbook.Shared.Core.Interface.System.Notification; + +public interface IShinyNotificationManager +{ + Task RequestAccess(); +} \ No newline at end of file diff --git a/salesbook.Shared/Core/Services/IntegryApiService.cs b/salesbook.Shared/Core/Services/IntegryApiService.cs index c138b68..4a3d943 100644 --- a/salesbook.Shared/Core/Services/IntegryApiService.cs +++ b/salesbook.Shared/Core/Services/IntegryApiService.cs @@ -7,6 +7,7 @@ using salesbook.Shared.Core.Entity; using salesbook.Shared.Core.Interface; using System.Net.Http.Headers; using salesbook.Shared.Core.Dto.Contact; +using salesbook.Shared.Core.Interface.IntegryApi; namespace salesbook.Shared.Core.Services; diff --git a/salesbook.Web/Core/Services/NetworkService.cs b/salesbook.Web/Core/Services/NetworkService.cs index 64b4044..16d9938 100644 --- a/salesbook.Web/Core/Services/NetworkService.cs +++ b/salesbook.Web/Core/Services/NetworkService.cs @@ -1,4 +1,5 @@ using salesbook.Shared.Core.Interface; +using salesbook.Shared.Core.Interface.System.Network; namespace salesbook.Web.Core.Services; diff --git a/salesbook.Web/Program.cs b/salesbook.Web/Program.cs index cbb65dc..fc2b24a 100644 --- a/salesbook.Web/Program.cs +++ b/salesbook.Web/Program.cs @@ -5,6 +5,8 @@ using Microsoft.AspNetCore.Components.WebAssembly.Hosting; using MudBlazor.Services; using salesbook.Shared.Components; using salesbook.Shared.Core.Interface; +using salesbook.Shared.Core.Interface.IntegryApi; +using salesbook.Shared.Core.Interface.System.Network; using salesbook.Shared.Core.Services; using salesbook.Web.Core.Services;