()
| 55 | }); |
| 56 | |
| 57 | function App() { |
| 58 | const { |
| 59 | client, |
| 60 | checkUpdate, |
| 61 | downloadUpdate, |
| 62 | switchVersionLater, |
| 63 | switchVersion, |
| 64 | updateInfo, |
| 65 | packageVersion, |
| 66 | currentHash, |
| 67 | parseTestQrCode, |
| 68 | progress: { received, total } = {}, |
| 69 | currentVersionInfo, |
| 70 | } = useUpdate(); |
| 71 | const [useDefaultAlert, setUseDefaultAlert] = useState(true); |
| 72 | const [showTestConsole, setShowTestConsole] = useState(false); |
| 73 | const [showUpdateBanner, setShowUpdateBanner] = useState(false); |
| 74 | const [showUpdateSnackbar, setShowUpdateSnackbar] = useState(false); |
| 75 | const snackbarVisible = |
| 76 | !useDefaultAlert && showUpdateSnackbar && updateInfo?.update; |
| 77 | const [showCamera, setShowCamera] = useState(false); |
| 78 | const lastParsedCode = useRef(""); |
| 79 | const bundleLabel = |
| 80 | (global as any).__RNU_E2E_BUNDLE_LABEL || LOCAL_UPDATE_LABELS.base; |
| 81 | |
| 82 | return ( |
| 83 | <View style={styles.container}> |
| 84 | <Text style={styles.welcome}>欢迎使用Pushy热更新服务</Text> |
| 85 | <View style={{ flexDirection: "row" }}> |
| 86 | <Text> |
| 87 | {useDefaultAlert ? "当前使用" : "当前不使用"}默认的alert更新提示 |
| 88 | </Text> |
| 89 | <Switch |
| 90 | value={useDefaultAlert} |
| 91 | onValueChange={(v) => { |
| 92 | setUseDefaultAlert(v); |
| 93 | client?.setOptions({ |
| 94 | updateStrategy: v ? null : "alwaysAlert", |
| 95 | }); |
| 96 | setShowUpdateSnackbar(!v); |
| 97 | }} |
| 98 | /> |
| 99 | <Button |
| 100 | onPress={() => { |
| 101 | Sentry.captureException( |
| 102 | new Error(`test error ${new Date().toISOString()}`), |
| 103 | ); |
| 104 | }} |
| 105 | > |
| 106 | Try Sentry event |
| 107 | </Button> |
| 108 | </View> |
| 109 | <Button onPress={() => setShowCamera(true)}>打开相机</Button> |
| 110 | <Portal> |
| 111 | <Modal visible={showCamera} onDismiss={() => setShowCamera(false)}> |
| 112 | <Camera |
| 113 | style={{ minHeight: 320 }} |
| 114 | scanBarcode={true} |
nothing calls this directly
no outgoing calls
no test coverage detected