Implementate notifiche
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
<SpinnerLayout FullScreen="true" />
|
||||
@@ -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(() =>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
<div class="bottom-sheet-backdrop @(IsSheetVisible ? "show" : "")" @onclick="CloseBottomSheet"></div>
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace salesbook.Shared.Core.Interface;
|
||||
namespace salesbook.Shared.Core.Interface.IntegryApi;
|
||||
|
||||
public interface IIntegryNotificationRestClient
|
||||
{
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace salesbook.Shared.Core.Interface.System.Battery;
|
||||
|
||||
public interface IBatteryOptimizationManagerService
|
||||
{
|
||||
bool IsBatteryOptimizationEnabled();
|
||||
|
||||
void OpenBatteryOptimizationSettings(Action<bool> onCompleted);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace salesbook.Shared.Core.Interface;
|
||||
namespace salesbook.Shared.Core.Interface.System.Network;
|
||||
|
||||
public interface INetworkService
|
||||
{
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace salesbook.Shared.Core.Interface.System.Notification;
|
||||
|
||||
public interface IShinyNotificationManager
|
||||
{
|
||||
Task RequestAccess();
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user