mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 18:38:27 +03:00
Cleared About information about push registration, just left it in DEBUG mode (#1742)
This commit is contained in:
parent
d0ffb108b1
commit
a183861b87
2 changed files with 13 additions and 0 deletions
|
@ -133,6 +133,8 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
var debugText = string.Format("{0}: {1} ({2})", AppResources.Version,
|
var debugText = string.Format("{0}: {1} ({2})", AppResources.Version,
|
||||||
_platformUtilsService.GetApplicationVersion(), _deviceActionService.GetBuildNumber());
|
_platformUtilsService.GetApplicationVersion(), _deviceActionService.GetBuildNumber());
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
var pushNotificationsRegistered = ServiceContainer.Resolve<IPushNotificationService>("pushNotificationService").IsRegisteredForPush;
|
var pushNotificationsRegistered = ServiceContainer.Resolve<IPushNotificationService>("pushNotificationService").IsRegisteredForPush;
|
||||||
var pnServerRegDate = await _storageService.GetAsync<DateTime>(Constants.PushLastRegistrationDateKey);
|
var pnServerRegDate = await _storageService.GetAsync<DateTime>(Constants.PushLastRegistrationDateKey);
|
||||||
var pnServerError = await _storageService.GetAsync<string>(Constants.PushInstallationRegistrationError);
|
var pnServerError = await _storageService.GetAsync<string>(Constants.PushInstallationRegistrationError);
|
||||||
|
@ -141,6 +143,9 @@ namespace Bit.App.Pages
|
||||||
var errorMessage = string.IsNullOrEmpty(pnServerError) ? string.Empty : $"Push Notifications Server Registration error: {pnServerError}";
|
var errorMessage = string.IsNullOrEmpty(pnServerError) ? string.Empty : $"Push Notifications Server Registration error: {pnServerError}";
|
||||||
|
|
||||||
var text = string.Format("© Bitwarden Inc. 2015-{0}\n\n{1}\nPush Notifications registered:{2}\nPush Notifications Server Last Date :{3}\n{4}", DateTime.Now.Year, debugText, pushNotificationsRegistered, pnServerRegDateMessage, errorMessage);
|
var text = string.Format("© Bitwarden Inc. 2015-{0}\n\n{1}\nPush Notifications registered:{2}\nPush Notifications Server Last Date :{3}\n{4}", DateTime.Now.Year, debugText, pushNotificationsRegistered, pnServerRegDateMessage, errorMessage);
|
||||||
|
#else
|
||||||
|
var text = string.Format("© Bitwarden Inc. 2015-{0}\n\n{1}", DateTime.Now.Year, debugText);
|
||||||
|
#endif
|
||||||
|
|
||||||
var copy = await _platformUtilsService.ShowDialogAsync(text, AppResources.Bitwarden, AppResources.Copy,
|
var copy = await _platformUtilsService.ShowDialogAsync(text, AppResources.Bitwarden, AppResources.Copy,
|
||||||
AppResources.Close);
|
AppResources.Close);
|
||||||
|
|
|
@ -145,7 +145,9 @@ namespace Bit.App.Services
|
||||||
var appId = await _appIdService.GetAppIdAsync();
|
var appId = await _appIdService.GetAppIdAsync();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
#if DEBUG
|
||||||
await _storageService.RemoveAsync(Constants.PushInstallationRegistrationError);
|
await _storageService.RemoveAsync(Constants.PushInstallationRegistrationError);
|
||||||
|
#endif
|
||||||
|
|
||||||
await _apiService.PutDeviceTokenAsync(appId,
|
await _apiService.PutDeviceTokenAsync(appId,
|
||||||
new Core.Models.Request.DeviceTokenRequest { PushToken = token });
|
new Core.Models.Request.DeviceTokenRequest { PushToken = token });
|
||||||
|
@ -158,6 +160,7 @@ namespace Bit.App.Services
|
||||||
await _storageService.SaveAsync(Constants.PushCurrentTokenKey, token);
|
await _storageService.SaveAsync(Constants.PushCurrentTokenKey, token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if DEBUG
|
||||||
catch (ApiException apiEx)
|
catch (ApiException apiEx)
|
||||||
{
|
{
|
||||||
Debug.WriteLine($"{TAG} Failed to register device.");
|
Debug.WriteLine($"{TAG} Failed to register device.");
|
||||||
|
@ -169,6 +172,11 @@ namespace Bit.App.Services
|
||||||
await _storageService.SaveAsync(Constants.PushInstallationRegistrationError, e.Message);
|
await _storageService.SaveAsync(Constants.PushInstallationRegistrationError, e.Message);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
catch (ApiException)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnUnregistered(string deviceType)
|
public void OnUnregistered(string deviceType)
|
||||||
|
|
Loading…
Reference in a new issue