mirror of
https://github.com/bitwarden/mobile.git
synced 2024-11-29 12:45:20 +01:00
register android push on my vault page too
This commit is contained in:
parent
582e6ee322
commit
c34376820a
@ -28,6 +28,10 @@ namespace Bit.Android.Services
|
||||
{
|
||||
_pushNotificationListener.OnRegistered(registeredToken, Device.Android);
|
||||
}
|
||||
else
|
||||
{
|
||||
_settings.AddOrUpdateValue(Constants.PushLastRegistrationDate, DateTime.UtcNow);
|
||||
}
|
||||
}
|
||||
|
||||
public void Unregister()
|
||||
|
@ -136,34 +136,44 @@ namespace Bit.App.Pages
|
||||
|
||||
_filterResultsCancellationTokenSource = FetchAndLoadVault();
|
||||
|
||||
if(_connectivity.IsConnected && Device.RuntimePlatform == Device.iOS)
|
||||
// Push registration
|
||||
if(_connectivity.IsConnected)
|
||||
{
|
||||
var pushPromptShow = _settings.GetValueOrDefault(Constants.PushInitialPromptShown, false);
|
||||
Action registerAction = () =>
|
||||
{
|
||||
var lastPushRegistration =
|
||||
_settings.GetValueOrDefault(Constants.PushLastRegistrationDate, DateTime.MinValue);
|
||||
if(!pushPromptShow || DateTime.UtcNow - lastPushRegistration > TimeSpan.FromDays(1))
|
||||
{
|
||||
_pushNotification.Register();
|
||||
}
|
||||
};
|
||||
var lastPushRegistration = _settings.GetValueOrDefault(Constants.PushLastRegistrationDate,
|
||||
DateTime.MinValue);
|
||||
|
||||
if(!pushPromptShow)
|
||||
if(Device.RuntimePlatform == Device.iOS)
|
||||
{
|
||||
_settings.AddOrUpdateValue(Constants.PushInitialPromptShown, true);
|
||||
_userDialogs.Alert(new AlertConfig
|
||||
var pushPromptShow = _settings.GetValueOrDefault(Constants.PushInitialPromptShown, false);
|
||||
Action registerAction = () =>
|
||||
{
|
||||
Message = AppResources.PushNotificationAlert,
|
||||
Title = AppResources.EnableAutomaticSyncing,
|
||||
OnAction = registerAction,
|
||||
OkText = AppResources.OkGotIt
|
||||
});
|
||||
if(!pushPromptShow || DateTime.UtcNow - lastPushRegistration > TimeSpan.FromDays(1))
|
||||
{
|
||||
_pushNotification.Register();
|
||||
}
|
||||
};
|
||||
|
||||
if(!pushPromptShow)
|
||||
{
|
||||
_settings.AddOrUpdateValue(Constants.PushInitialPromptShown, true);
|
||||
_userDialogs.Alert(new AlertConfig
|
||||
{
|
||||
Message = AppResources.PushNotificationAlert,
|
||||
Title = AppResources.EnableAutomaticSyncing,
|
||||
OnAction = registerAction,
|
||||
OkText = AppResources.OkGotIt
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check push registration once per day
|
||||
registerAction();
|
||||
}
|
||||
}
|
||||
else
|
||||
else if(Device.RuntimePlatform == Device.Android &&
|
||||
DateTime.UtcNow - lastPushRegistration > TimeSpan.FromDays(1))
|
||||
{
|
||||
// Check push registration once per day
|
||||
registerAction();
|
||||
_pushNotification.Register();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -230,7 +240,7 @@ namespace Bit.App.Pages
|
||||
|
||||
if(collections.Any())
|
||||
{
|
||||
folderGroupings.Add(new GroupingOrCipher(new Grouping(AppResources.FolderNone,
|
||||
folderGroupings.Add(new GroupingOrCipher(new Grouping(AppResources.FolderNone,
|
||||
noFolderCipherGroupings.Count)));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user