diff --git a/Gemfile.lock b/Gemfile.lock index cffe7318ca..6671c6a572 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -86,8 +86,6 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2023.0218.1) multi_test (0.1.2) - nokogiri (1.14.2-arm64-darwin) - racc (~> 1.4) nokogiri (1.14.2-x86_64-darwin) racc (~> 1.4) optimist (3.0.1) @@ -121,7 +119,6 @@ GEM rexml PLATFORMS - arm64-darwin-22 x86_64-darwin-20 DEPENDENCIES diff --git a/bugsnag-android-core/src/main/java/com/bugsnag/android/PluginClient.kt b/bugsnag-android-core/src/main/java/com/bugsnag/android/PluginClient.kt index ef70bcc593..66ba454c3c 100644 --- a/bugsnag-android-core/src/main/java/com/bugsnag/android/PluginClient.kt +++ b/bugsnag-android-core/src/main/java/com/bugsnag/android/PluginClient.kt @@ -15,7 +15,6 @@ internal class PluginClient( } private val plugins: Set - private val ndkPlugin = instantiatePlugin(NDK_PLUGIN, immutableConfig.enabledErrorTypes.ndkCrashes) private val anrPlugin = instantiatePlugin(ANR_PLUGIN, immutableConfig.enabledErrorTypes.anrs) private val rnPlugin = instantiatePlugin(RN_PLUGIN, immutableConfig.enabledErrorTypes.unhandledRejections) @@ -41,61 +40,59 @@ internal class PluginClient( logger.d("Plugin '$clz' is not on the classpath - functionality will not be enabled.") } null - } catch (exc: Throwable) { logger.e("Failed to load plugin '$clz'", exc) null } } + fun getNdkPlugin(): Plugin? = ndkPlugin -fun getNdkPlugin(): Plugin? = ndkPlugin - -fun loadPlugins(client: Client) { - plugins.forEach { plugin -> - try { - loadPluginInternal(plugin, client) - } catch (exc: Throwable) { - logger.e("Failed to load plugin $plugin, continuing with initialisation.", exc) + fun loadPlugins(client: Client) { + plugins.forEach { plugin -> + try { + loadPluginInternal(plugin, client) + } catch (exc: Throwable) { + logger.e("Failed to load plugin $plugin, continuing with initialisation.", exc) + } } } -} -fun setAutoNotify(client: Client, autoNotify: Boolean) { - setAutoDetectAnrs(client, autoNotify) + fun setAutoNotify(client: Client, autoNotify: Boolean) { + setAutoDetectAnrs(client, autoNotify) - if (autoNotify) { - ndkPlugin?.load(client) - } else { - ndkPlugin?.unload() + if (autoNotify) { + ndkPlugin?.load(client) + } else { + ndkPlugin?.unload() + } } -} -fun setAutoDetectAnrs(client: Client, autoDetectAnrs: Boolean) { - if (autoDetectAnrs) { - anrPlugin?.load(client) - } else { - anrPlugin?.unload() + fun setAutoDetectAnrs(client: Client, autoDetectAnrs: Boolean) { + if (autoDetectAnrs) { + anrPlugin?.load(client) + } else { + anrPlugin?.unload() + } } -} -fun findPlugin(clz: Class<*>): Plugin? = plugins.find { it.javaClass == clz } + fun findPlugin(clz: Class<*>): Plugin? = plugins.find { it.javaClass == clz } -private fun loadPluginInternal(plugin: Plugin, client: Client) { - val name = plugin.javaClass.name - val errorTypes = immutableConfig.enabledErrorTypes + private fun loadPluginInternal(plugin: Plugin, client: Client) { + val name = plugin.javaClass.name + val errorTypes = immutableConfig.enabledErrorTypes - // only initialize NDK/ANR plugins if automatic detection enabled - if (name == NDK_PLUGIN) { - if (errorTypes.ndkCrashes) { - plugin.load(client) - } - } else if (name == ANR_PLUGIN) { - if (errorTypes.anrs) { + // only initialize NDK/ANR plugins if automatic detection enabled + if (name == NDK_PLUGIN) { + if (errorTypes.ndkCrashes) { + plugin.load(client) + } + } else if (name == ANR_PLUGIN) { + if (errorTypes.anrs) { + plugin.load(client) + } + } else { plugin.load(client) } - } else { - plugin.load(client) } } -} diff --git a/examples/sdk-app-example/app/src/main/java/com/example/bugsnag/android/BaseCrashyActivity.kt b/examples/sdk-app-example/app/src/main/java/com/example/bugsnag/android/BaseCrashyActivity.kt index 1e2b278857..55baa4afc2 100644 --- a/examples/sdk-app-example/app/src/main/java/com/example/bugsnag/android/BaseCrashyActivity.kt +++ b/examples/sdk-app-example/app/src/main/java/com/example/bugsnag/android/BaseCrashyActivity.kt @@ -51,7 +51,6 @@ open class BaseCrashyActivity : AppCompatActivity() { anrFromCXX() showSnackbar() } - } override fun onResume() {