Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = (opts) => {
// handle very simple use case where user supplies just the api key as a string
if (typeof opts === 'string') opts = { apiKey: opts }
// ensure opts is actually an object (at this point it
// could be null, undefined, a number, a boolean etc.)
opts = { ...opts }
// attempt to fetch apiKey from app.json if we didn't get one explicitly passed
if (!opts.apiKey &&
Constants.manifest &&
Constants.manifest.extra &&
Constants.manifest.extra.bugsnag &&
Constants.manifest.extra.bugsnag.apiKey) {
opts.apiKey = Constants.manifest.extra.bugsnag.apiKey
}
const bugsnag = new Client({ name, version, url })
bugsnag.delivery(delivery)
bugsnag.setOptions(opts)
bugsnag.configure(schema)
plugins.forEach(pl => {
switch (pl.name) {
case 'networkBreadcrumbs':
bugsnag.use(pl, () => [
bugsnag.config.endpoints.notify,
bugsnag.config.endpoints.sessions,
// get the initial orientation
updateOrientation()
client.device = {
...client.device,
id: Constants.installationId,
manufacturer: Constants.platform.ios ? 'Apple' : undefined,
modelName: Constants.platform.ios ? Constants.platform.ios.model : undefined,
modelNumber: Constants.platform.ios ? Constants.platform.ios.platform : undefined,
osName: Platform.OS,
osVersion: Constants.platform.ios ? Constants.platform.ios.systemVersion : Constants.systemVersion,
runtimeVersions: {
reactNative: rnVersion,
expoApp: Constants.expoVersion,
expoSdk: Constants.manifest.sdkVersion,
androidApiLevel: Constants.platform.android ? String(Platform.Version) : undefined
}
}
client.config.beforeSend.unshift(report => {
report.device = {
...report.device,
time: isoDate(),
orientation
}
report.updateMetaData('device', {
isDevice: Constants.isDevice,
appOwnership: Constants.appOwnership
})
})
}
module.exports = (opts) => {
// handle very simple use case where user supplies just the api key as a string
if (typeof opts === 'string') opts = { apiKey: opts }
// ensure opts is actually an object (at this point it
// could be null, undefined, a number, a boolean etc.)
opts = { ...opts }
// attempt to fetch apiKey from app.json if we didn't get one explicitly passed
if (!opts.apiKey &&
Constants.manifest &&
Constants.manifest.extra &&
Constants.manifest.extra.bugsnag &&
Constants.manifest.extra.bugsnag.apiKey) {
opts.apiKey = Constants.manifest.extra.bugsnag.apiKey
}
const bugsnag = new Client({ name, version, url })
bugsnag.delivery(delivery)
bugsnag.setOptions(opts)
bugsnag.configure(schema)
plugins.forEach(pl => {
switch (pl.name) {
case 'networkBreadcrumbs':
bugsnag.use(pl, () => [
bugsnag.config.endpoints.notify,
bugsnag.config.endpoints.sessions,
Constants.manifest.logUrl,
NET_INFO_REACHABILITY_URL
/* global __DEV__ */
const { schema } = require('@bugsnag/core/config')
const { reduce } = require('@bugsnag/core/lib/es-utils')
const Constants = require('expo-constants').default
// If the developer property is not present in the manifest, it means the app is
// not connected to a development tool and is either a published app running in
// the Expo client, or a standalone app (we also assume production for a missing
// manifest, but that should never happen)
const IS_PRODUCTION = !Constants.manifest || !Constants.manifest.developer
// The app can still run in production "mode" in development environments, in which
// cases the global boolean __DEV__ will be set to true
const IS_PRODUCTION_MODE = typeof __DEV__ === 'undefined' || __DEV__ !== true
module.exports = {
logger: {
...schema.logger,
defaultValue: () => getPrefixedConsole()
},
releaseStage: {
...schema.releaseStage,
defaultValue: () => {
if (IS_PRODUCTION) return 'production'
if (IS_PRODUCTION_MODE) return 'local-prod'
return 'local-dev'
module.exports = (opts) => {
// handle very simple use case where user supplies just the api key as a string
if (typeof opts === 'string') opts = { apiKey: opts }
// ensure opts is actually an object (at this point it
// could be null, undefined, a number, a boolean etc.)
opts = { ...opts }
// attempt to fetch apiKey from app.json if we didn't get one explicitly passed
if (!opts.apiKey &&
Constants.manifest &&
Constants.manifest.extra &&
Constants.manifest.extra.bugsnag &&
Constants.manifest.extra.bugsnag.apiKey) {
opts.apiKey = Constants.manifest.extra.bugsnag.apiKey
}
const bugsnag = new Client({ name, version, url })
bugsnag.delivery(delivery)
bugsnag.setOptions(opts)
bugsnag.configure(schema)
plugins.forEach(pl => {
switch (pl.name) {
case 'networkBreadcrumbs':
bugsnag.use(pl, () => [
}
}
client.config.beforeSend.unshift(report => {
const now = new Date()
const inForeground = AppState.currentState === 'active'
report.app.inForeground = inForeground
report.app.duration = now - appStart
if (inForeground) {
report.app.durationInForeground = now - lastEnteredForeground
}
report.updateMetaData('app', { nativeBundleVersion, nativeVersionCode })
})
if (!client.app.version && Constants.manifest.version) {
client.app.version = Constants.manifest.version
}
if (Constants.manifest.revisionId) {
client.app.codeBundleId = Constants.manifest.revisionId
}
}
}
nativeVersionCode = Constants.platform.android.versionCode
}
}
client.config.beforeSend.unshift(report => {
const now = new Date()
const inForeground = AppState.currentState === 'active'
report.app.inForeground = inForeground
report.app.duration = now - appStart
if (inForeground) {
report.app.durationInForeground = now - lastEnteredForeground
}
report.updateMetaData('app', { nativeBundleVersion, nativeVersionCode })
})
if (!client.app.version && Constants.manifest.version) {
client.app.version = Constants.manifest.version
}
if (Constants.manifest.revisionId) {
client.app.codeBundleId = Constants.manifest.revisionId
}
}
}