Skip to content

Commit a37fc6b

Browse files
authored
Merge pull request #1695 from bugsnag/fix-eas-update
Improve support for EAS Update
2 parents 8bbaa05 + c937344 commit a37fc6b

File tree

5 files changed

+34
-16
lines changed

5 files changed

+34
-16
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
### TBD
44

5+
### Fixed
6+
7+
- (expo): preliminary support for the Expo EAS Update. Please send us feedback on how we can improve our support! [kennethlynne](https://github.com/kennethlynne) [#1686](https://github.com/bugsnag/bugsnag-js/pull/1686) [#1695](https://github.com/bugsnag/bugsnag-js/pull/1695)
8+
59
### Changed
610

711
- (plugin-react-navigation): Allow React Navigation v6 as a peer dependency [#1691](https://github.com/bugsnag/bugsnag-js/pull/1691)

packages/expo/src/config.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@ const Constants = require('expo-constants').default
55

66
// If the developer property is not present in the manifest, it means the app is
77
// not connected to a development tool and is either a published app running in
8-
// the Expo client, or a standalone app (we also assume production for a missing
9-
// manifest, but that should never happen)
10-
const IS_PRODUCTION = !Constants.manifest || !Constants.manifest.developer
8+
// the Expo client, or a standalone app
9+
let IS_PRODUCTION = true
10+
11+
if (Constants.manifest) {
12+
IS_PRODUCTION = !Constants.manifest.developer
13+
} else if (Constants.manifest2) {
14+
IS_PRODUCTION = !Constants.manifest2?.extra?.expoGo?.developer
15+
}
1116

1217
// The app can still run in production "mode" in development environments, in which
1318
// cases the global boolean __DEV__ will be set to true

packages/expo/src/notifier.js

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const internalPlugins = [
2828
require('@bugsnag/plugin-expo-device'),
2929
require('@bugsnag/plugin-expo-app'),
3030
require('@bugsnag/plugin-console-breadcrumbs'),
31-
require('@bugsnag/plugin-network-breadcrumbs')([NET_INFO_REACHABILITY_URL, Constants.manifest.logUrl]),
31+
require('@bugsnag/plugin-network-breadcrumbs')([NET_INFO_REACHABILITY_URL, Constants.manifest?.logUrl || Constants.manifest2?.extra?.expoGo?.logUrl]),
3232
require('@bugsnag/plugin-react-native-app-state-breadcrumbs'),
3333
require('@bugsnag/plugin-react-native-connectivity-breadcrumbs'),
3434
require('@bugsnag/plugin-react-native-orientation-breadcrumbs'),
@@ -43,17 +43,22 @@ const Bugsnag = {
4343
if (typeof opts === 'string') opts = { apiKey: opts }
4444
if (!opts) opts = {}
4545

46-
// attempt to fetch apiKey from app.json if we didn't get one explicitly passed
47-
if (!opts.apiKey &&
48-
Constants.manifest &&
49-
Constants.manifest.extra &&
50-
Constants.manifest.extra.bugsnag &&
51-
Constants.manifest.extra.bugsnag.apiKey) {
52-
opts.apiKey = Constants.manifest.extra.bugsnag.apiKey
46+
// read the api key from app.json if one is not explicitly passed
47+
if (!opts.apiKey) {
48+
if (Constants.manifest?.extra?.bugsnag?.apiKey) {
49+
opts.apiKey = Constants.manifest.extra.bugsnag.apiKey
50+
} else if (Constants.manifest2?.extra?.expoClient?.extra?.bugsnag?.apiKey) {
51+
opts.apiKey = Constants.manifest2.extra.expoClient.extra.bugsnag.apiKey
52+
}
5353
}
5454

55-
if (!opts.appVersion && Constants.manifest && Constants.manifest.version) {
56-
opts.appVersion = Constants.manifest.version
55+
// read the version from app.json if one is not explicitly passed
56+
if (!opts.appVersion) {
57+
if (Constants.manifest?.version) {
58+
opts.appVersion = Constants.manifest.version
59+
} else if (Constants.manifest2?.extra?.expoClient?.version) {
60+
opts.appVersion = Constants.manifest2.extra.expoClient.version
61+
}
5762
}
5863

5964
const bugsnag = new Client(opts, schema, internalPlugins, { name, version, url })

packages/plugin-expo-app/app.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ module.exports = {
2929
}
3030

3131
client.addOnSession(session => {
32-
if (Constants.manifest.revisionId) {
32+
if (Constants.manifest?.revisionId) {
3333
session.app.codeBundleId = Constants.manifest.revisionId
34+
} else if (Constants.manifest2?.extra?.expoClient?.revisionId) {
35+
session.app.codeBundleId = Constants.manifest2.extra.expoClient.revisionId
3436
}
3537
})
3638

@@ -47,8 +49,10 @@ module.exports = {
4749

4850
event.addMetadata('app', { nativeBundleVersion, nativeVersionCode })
4951

50-
if (Constants.manifest.revisionId) {
52+
if (Constants.manifest?.revisionId) {
5153
event.app.codeBundleId = Constants.manifest.revisionId
54+
} else if (Constants.manifest2?.extra?.expoClient?.revisionId) {
55+
event.app.codeBundleId = Constants.manifest2.extra.expoClient.revisionId
5256
}
5357
}, true)
5458
}

packages/plugin-expo-device/device.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module.exports = {
3131
runtimeVersions: {
3232
reactNative: rnVersion,
3333
expoApp: Constants.expoVersion,
34-
expoSdk: Constants.manifest.sdkVersion,
34+
expoSdk: Constants.manifest?.sdkVersion || Constants.manifest2?.extra?.expoClient?.sdkVersion,
3535
androidApiLevel: Constants.platform.android ? String(Platform.Version) : undefined
3636
},
3737
totalMemory: Device.totalMemory

0 commit comments

Comments
 (0)