|
1 | | -import { debug } from '@sentry/core'; |
2 | 1 | import * as React from 'react'; |
3 | 2 | import { Animated, Image, Modal, Platform, Pressable, Text, useColorScheme, View } from 'react-native'; |
4 | 3 |
|
5 | | -import { getDevServer } from '../integrations/debugsymbolicatorutils'; |
6 | | -import { isExpo, isExpoGo, isWeb } from '../utils/environment'; |
| 4 | +import { openURLInBrowser } from '../metro/openUrlInBrowser'; |
| 5 | +import { isExpoGo, isWeb } from '../utils/environment'; |
7 | 6 | import { bug as bugAnimation, hi as hiAnimation, thumbsup as thumbsupAnimation } from './animations'; |
8 | 7 | import { nativeCrashExample, tryCatchExample, uncaughtErrorExample } from './examples'; |
9 | 8 | import { bug as bugImage, hi as hiImage, thumbsup as thumbsupImage } from './images'; |
@@ -71,7 +70,6 @@ export const SentryPlayground = ({ |
71 | 70 | } |
72 | 71 | }; |
73 | 72 |
|
74 | | - const showOpenSentryButton = !isExpo(); |
75 | 73 | const isNativeCrashDisabled = isWeb() || isExpoGo() || __DEV__; |
76 | 74 |
|
77 | 75 | const animationContainerYPosition = React.useRef(new Animated.Value(0)).current; |
@@ -158,15 +156,13 @@ export const SentryPlayground = ({ |
158 | 156 | justifyContent: 'space-evenly', // Space between buttons |
159 | 157 | }} |
160 | 158 | > |
161 | | - {showOpenSentryButton && ( |
162 | | - <Button |
163 | | - secondary |
164 | | - title={'Open Sentry'} |
165 | | - onPress={() => { |
166 | | - openURLInBrowser(issuesStreamUrl); |
167 | | - }} |
168 | | - /> |
169 | | - )} |
| 159 | + <Button |
| 160 | + secondary |
| 161 | + title={'Open Sentry'} |
| 162 | + onPress={() => { |
| 163 | + openURLInBrowser(issuesStreamUrl); |
| 164 | + }} |
| 165 | + /> |
170 | 166 | <Button |
171 | 167 | title={'Go to my App'} |
172 | 168 | onPress={() => { |
@@ -269,19 +265,3 @@ const Button = ({ |
269 | 265 | </View> |
270 | 266 | ); |
271 | 267 | }; |
272 | | - |
273 | | -function openURLInBrowser(url: string): void { |
274 | | - const devServer = getDevServer(); |
275 | | - if (devServer?.url) { |
276 | | - // This doesn't work for Expo project with Web enabled |
277 | | - // oxlint-disable-next-line typescript-eslint(no-floating-promises) |
278 | | - fetch(`${devServer.url}open-url`, { |
279 | | - method: 'POST', |
280 | | - body: JSON.stringify({ url }), |
281 | | - }).catch(e => { |
282 | | - debug.error('Error opening URL:', e); |
283 | | - }); |
284 | | - } else { |
285 | | - debug.error('Dev server URL not available'); |
286 | | - } |
287 | | -} |
0 commit comments