1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-05 23:53:33 +00:00

PM-3350 Commented event collection upload on the timer and when sending the app to background to see if that prevents the app from crashing on release mode.

This commit is contained in:
Federico Maccaroni
2024-01-25 13:22:42 -03:00
parent 05677f93c5
commit c74636ffa5

View File

@@ -462,20 +462,21 @@ namespace Bit.iOS
_eventTimer?.Invalidate(); _eventTimer?.Invalidate();
_eventTimer?.Dispose(); _eventTimer?.Dispose();
_eventTimer = null; _eventTimer = null;
MainThread.BeginInvokeOnMainThread(() => // TODO: Uncomment, this is just a test to see if this is causing the background crash on release when sending the app to background
{ //MainThread.BeginInvokeOnMainThread(() =>
try //{
{ // try
_eventTimer = NSTimer.CreateScheduledTimer(60, true, timer => // {
{ // _eventTimer = NSTimer.CreateScheduledTimer(60, true, timer =>
_eventService?.UploadEventsAsync().FireAndForget(); // {
}); // _eventService?.UploadEventsAsync().FireAndForget();
} // });
catch (Exception ex) // }
{ // catch (Exception ex)
LoggerHelper.LogEvenIfCantBeResolved(ex); // {
} // LoggerHelper.LogEvenIfCantBeResolved(ex);
}); // }
//});
} }
private async Task StopEventTimerAsync() private async Task StopEventTimerAsync()
@@ -485,19 +486,20 @@ namespace Bit.iOS
_eventTimer?.Invalidate(); _eventTimer?.Invalidate();
_eventTimer?.Dispose(); _eventTimer?.Dispose();
_eventTimer = null; _eventTimer = null;
if (_eventBackgroundTaskId > 0) // TODO: Uncomment, this is just a test to see if this is causing the background crash on release when sending the app to background
{ //if (_eventBackgroundTaskId > 0)
UIApplication.SharedApplication.EndBackgroundTask(_eventBackgroundTaskId); //{
_eventBackgroundTaskId = 0; // UIApplication.SharedApplication.EndBackgroundTask(_eventBackgroundTaskId);
} // _eventBackgroundTaskId = 0;
_eventBackgroundTaskId = UIApplication.SharedApplication.BeginBackgroundTask(() => //}
{ //_eventBackgroundTaskId = UIApplication.SharedApplication.BeginBackgroundTask(() =>
UIApplication.SharedApplication.EndBackgroundTask(_eventBackgroundTaskId); //{
_eventBackgroundTaskId = 0; // UIApplication.SharedApplication.EndBackgroundTask(_eventBackgroundTaskId);
}); // _eventBackgroundTaskId = 0;
await _eventService.UploadEventsAsync(); //});
UIApplication.SharedApplication.EndBackgroundTask(_eventBackgroundTaskId); //await _eventService.UploadEventsAsync();
_eventBackgroundTaskId = 0; //UIApplication.SharedApplication.EndBackgroundTask(_eventBackgroundTaskId);
//_eventBackgroundTaskId = 0;
} }
catch (Exception ex) catch (Exception ex)
{ {