()
| 10 | const {appKey} = _updateConfig.android; |
| 11 | |
| 12 | function Home() { |
| 13 | const { |
| 14 | client, |
| 15 | checkUpdate, |
| 16 | downloadUpdate, |
| 17 | switchVersionLater, |
| 18 | switchVersion, |
| 19 | updateInfo, |
| 20 | packageVersion, |
| 21 | currentHash, |
| 22 | progress: {received, total} = {}, |
| 23 | } = usePushy(); |
| 24 | const [useDefaultAlert, setUseDefaultAlert] = useState(false); |
| 25 | const [showTestConsole, setShowTestConsole] = useState(false); |
| 26 | const [showUpdateBanner, setShowUpdateBanner] = useState(false); |
| 27 | const [showUpdateSnackbar, setShowUpdateSnackbar] = useState(false); |
| 28 | // if (updateInfo) { |
| 29 | // updateInfo!.name = 'name'; |
| 30 | // updateInfo!.update = true; |
| 31 | // } |
| 32 | const snackbarVisible = |
| 33 | !useDefaultAlert && showUpdateSnackbar && updateInfo?.update; |
| 34 | |
| 35 | if (showTestConsole) { |
| 36 | return ( |
| 37 | <TestConsole visible={true} onClose={() => setShowTestConsole(false)} /> |
| 38 | ); |
| 39 | } |
| 40 | |
| 41 | return ( |
| 42 | <View style={styles.container}> |
| 43 | <Text style={styles.welcome}>欢迎使用Pushy热更新服务</Text> |
| 44 | {/* <Text style={styles.welcome}>😁hdiffFromAPP更新成功!!!</Text> */} |
| 45 | {/* <Text style={styles.welcome}>😁hdiffFromPPk更新成功!!!</Text> */} |
| 46 | <View style={{flexDirection: 'row'}}> |
| 47 | <TouchableOpacity |
| 48 | onPress={() => { |
| 49 | client?.setOptions({ |
| 50 | updateStrategy: !useDefaultAlert ? null : 'alwaysAlert', |
| 51 | }); |
| 52 | setShowUpdateSnackbar(useDefaultAlert); |
| 53 | setUseDefaultAlert(!useDefaultAlert); |
| 54 | }} |
| 55 | style={{ |
| 56 | flexDirection: 'row', |
| 57 | alignItems: 'center', |
| 58 | }}> |
| 59 | <View |
| 60 | style={{ |
| 61 | width: 20, |
| 62 | height: 20, |
| 63 | borderWidth: 1, |
| 64 | borderColor: '#999', |
| 65 | backgroundColor: useDefaultAlert ? 'blue' : 'white', |
| 66 | justifyContent: 'center', |
| 67 | alignItems: 'center', |
| 68 | }}> |
| 69 | {useDefaultAlert && <Text style={{color: 'white'}}>✓</Text>} |
nothing calls this directly
no outgoing calls
no test coverage detected