Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Jason <[email protected]>
  • Loading branch information
fractalwrench and lemnik committed Jun 29, 2021
1 parent c733178 commit f1190ac
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public void onLowMemoryEvent() {
when(context.getApplicationContext()).thenReturn(context);
Client client = new Client(context, BugsnagTestUtils.generateConfiguration());

// block until observer is registered
client.bgTaskService.shutdown();

// capture the registered ComponentCallbacks
verify(context, times(1)).registerComponentCallbacks(componentCallbacksCaptor.capture());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,6 @@ public Unit invoke(String activity, Map<String, ?> metadata) {
exceptionHandler.install();
}

// register listeners for system events in the background.
systemBroadcastReceiver = new SystemBroadcastReceiver(this, logger);
registerComponentCallbacks();
registerListenersInBackground();

// load last run info
lastRunInfoStore = new LastRunInfoStore(immutableConfig);
lastRunInfo = loadLastRunInfo();
Expand All @@ -237,6 +232,11 @@ public Unit invoke(String activity, Map<String, ?> metadata) {
eventStore.flushAsync();
sessionTracker.flushAsync();

// register listeners for system events in the background.
systemBroadcastReceiver = new SystemBroadcastReceiver(this, logger);
registerComponentCallbacks();
registerListenersInBackground();

// leave auto breadcrumb
Map<String, Object> data = Collections.emptyMap();
leaveAutoBreadcrumb("Bugsnag loaded", BreadcrumbType.STATE, data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ internal class SystemBroadcastReceiver(

fun shortenActionNameIfNeeded(action: String): String {
return if (isAndroidKey(action)) {
action.substring(action.lastIndexOf(".") + 1)
action.substringAfterLast('.')
} else {
action
}
Expand Down

0 comments on commit f1190ac

Please sign in to comment.