From a183861b8736341eba6f4a97a29b55fd9e33439e Mon Sep 17 00:00:00 2001 From: Federico Maccaroni Date: Mon, 31 Jan 2022 14:48:35 -0300 Subject: [PATCH] Cleared About information about push registration, just left it in DEBUG mode (#1742) --- .../Pages/Settings/SettingsPage/SettingsPageViewModel.cs | 5 +++++ src/App/Services/PushNotificationListenerService.cs | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs b/src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs index 66ed6acd5..ec9121fc5 100644 --- a/src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs +++ b/src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs @@ -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("pushNotificationService").IsRegisteredForPush; var pnServerRegDate = await _storageService.GetAsync(Constants.PushLastRegistrationDateKey); var pnServerError = await _storageService.GetAsync(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); diff --git a/src/App/Services/PushNotificationListenerService.cs b/src/App/Services/PushNotificationListenerService.cs index 7051b9978..e0d34e197 100644 --- a/src/App/Services/PushNotificationListenerService.cs +++ b/src/App/Services/PushNotificationListenerService.cs @@ -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)