sentry-java icon indicating copy to clipboard operation
sentry-java copied to clipboard

Suggestions for internals refactoring

Open marandaneto opened this issue 3 years ago • 6 comments

Description

Some places use System.currentTimeMillis() directly (such as AndroidMemoryCollector) instead of CurrentDateProvider which makes it untestable.

DefaultAndroidEventProcessor already reads memory data, but now we also have AndroidMemoryCollector, maybe we could refactor DefaultAndroidEventProcessor to use AndroidMemoryCollector.

CurrentActivityHolder holds the current activity thru the CurrentActivityIntegration, maybe we could refactor other integrations such as ActivityLifecycleIntegration to use the holder as well.

marandaneto avatar Feb 03 '23 13:02 marandaneto

Looper.getMainLooper() Also being used directly instead of MainLooperHandler for testability.

marandaneto avatar Apr 06 '23 06:04 marandaneto

@romtsn @markushi added to milestone v7, let me know if that's fine. I am afraid that we will keep using the static methods making the code difficult to be tested.

marandaneto avatar May 17 '23 13:05 marandaneto

Change activity.runOnUiThread to using MainLooperHandler as well.

marandaneto avatar May 22 '23 08:05 marandaneto

Let's remove the milestone and re-priortize this.

markushi avatar Aug 02 '23 14:08 markushi

Let's check if there are any breaking API changes due to the mentioned refactorings.

markushi avatar Aug 09 '23 14:08 markushi

Let's call each other out when we review PRs and try to fix this as we go

romtsn avatar Aug 16 '23 14:08 romtsn