Cleared About information about push registration, just left it in DEBUG mode (#1742)

This commit is contained in:
Federico Maccaroni 2022-01-31 14:48:35 -03:00 committed by GitHub
parent d0ffb108b1
commit a183861b87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -133,6 +133,8 @@ namespace Bit.App.Pages
{
var debugText = string.Format("{0}: {1} ({2})", AppResources.Version,
_platformUtilsService.GetApplicationVersion(), _deviceActionService.GetBuildNumber());
#if DEBUG
var pushNotificationsRegistered = ServiceContainer.Resolve<IPushNotificationService>("pushNotificationService").IsRegisteredForPush;
var pnServerRegDate = await _storageService.GetAsync<DateTime>(Constants.PushLastRegistrationDateKey);
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 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,
AppResources.Close);

View File

@ -145,7 +145,9 @@ namespace Bit.App.Services
var appId = await _appIdService.GetAppIdAsync();
try
{
#if DEBUG
await _storageService.RemoveAsync(Constants.PushInstallationRegistrationError);
#endif
await _apiService.PutDeviceTokenAsync(appId,
new Core.Models.Request.DeviceTokenRequest { PushToken = token });
@ -158,6 +160,7 @@ namespace Bit.App.Services
await _storageService.SaveAsync(Constants.PushCurrentTokenKey, token);
}
}
#if DEBUG
catch (ApiException apiEx)
{
Debug.WriteLine($"{TAG} Failed to register device.");
@ -169,6 +172,11 @@ namespace Bit.App.Services
await _storageService.SaveAsync(Constants.PushInstallationRegistrationError, e.Message);
throw;
}
#else
catch (ApiException)
{
}
#endif
}
public void OnUnregistered(string deviceType)