@@ -98,6 +98,7 @@ internal class LoggerImpl(
9898 internal val webViewConfiguration: WebViewConfiguration ? = configuration.webViewConfiguration
9999
100100 private val metadataProvider: MetadataProvider
101+ private val sdkDirectory: String
101102 private val batteryMonitor = BatteryMonitor (context)
102103 private val powerMonitor = PowerMonitor (context)
103104 private val diskUsageMonitor: DiskUsageMonitor
@@ -162,7 +163,7 @@ internal class LoggerImpl(
162163 okHttpClient = sharedOkHttpClient,
163164 )
164165
165- val sdkDirectory = SdkDirectory .getPath(context)
166+ sdkDirectory = SdkDirectory .getPath(context)
166167
167168 val localErrorReporter =
168169 errorReporter ? : ErrorReporterService (
@@ -286,14 +287,6 @@ internal class LoggerImpl(
286287
287288 previousRunInfoResolver.initLegacyWatcher(sdkDirectory)
288289
289- // issue reporter needs to be initialized after appExitLogger and the jniLogger
290- issueReporter?.init (
291- activityManager = activityManager,
292- sdkDirectory = sdkDirectory,
293- clientAttributes = clientAttributes,
294- completedReportsProcessor = this ,
295- )
296-
297290 startDebugOperationsAsNeeded(context)
298291 }
299292
@@ -684,6 +677,19 @@ internal class LoggerImpl(
684677
685678 internal fun getPreviousRunInfo (): PreviousRunInfo ? = previousRunInfoResolver.get(activityManager)
686679
680+ /* *
681+ * Initializes the issue reporter. Must be called immediately right after the LoggerImpl is created
682+ * so we can guarantee that any calls to Capture.Logger.* are valid within `onBeforeReportSend`
683+ */
684+ internal fun initIssueReporter () {
685+ issueReporter?.init (
686+ activityManager = activityManager,
687+ sdkDirectory = sdkDirectory,
688+ clientAttributes = clientAttributes,
689+ completedReportsProcessor = this ,
690+ )
691+ }
692+
687693 private fun startDebugOperationsAsNeeded (context : Context ) {
688694 if (! BuildTypeChecker .isDebuggable(context)) {
689695 return
0 commit comments