/* eslint-disable react-native/no-inline-styles */ /* eslint-disable react/react-in-jsx-scope */ import {useCallback, useMemo, useState} from 'react'; import { ActivityIndicator, TextInput, Button, StyleSheet, SafeAreaView, Text, View, TouchableOpacity, } from 'react-native'; import {PushyModule} from 'react-native-update'; const Hash = '9D5CE6EBA420717BE7E7D308B11F8207681B066C951D68F3994D19828F342474'; const UUID = '00000000-0000-0000-0000-000000000000'; const DownloadUrl = 'https://localhost:3000/diff.ppk-patch'; const AppPatchDownloadUrl = 'https://github.com/bozaigao/test_pushy_server/raw/refs/heads/main/hdiff.app-patch'; const AppPatchHash = 'f5ba92c7c04250d4b8a446c8267ef459'; const PPKDownloadUrl = 'https://github.com/bozaigao/test_pushy_server/raw/refs/heads/main/hdiff.ppk-patch'; const PPKPatchHash = '6b3d26b7d868d1f67aedadb7f0b342d9'; const OriginHash = 'f5ba92c7c04250d4b8a446c8267ef459'; const CustomDialog = ({title, visible, onConfirm}) => { if (!visible) { return null; } return ( {title} 确认 ); }; export default function TestConsole({visible, onClose}) { const [text, setText] = useState(''); const [running, setRunning] = useState(false); const [options, setOptions] = useState(); const [alertVisible, setAlertVisible] = useState(false); const [alertMsg, setAlertMsg] = useState(''); const NativeTestMethod = useMemo(() => { return [ { name: 'setLocalHashInfo', invoke: () => { setText( `setLocalHashInfo\n${Hash}\n{\"version\":\"1.0.0\",\"size\":\"19M\"}`, ); }, }, { name: 'getLocalHashInfo', invoke: () => { setText(`getLocalHashInfo\n${Hash}`); }, }, { name: 'setUuid', invoke: () => { setText(`setUuid\n${UUID}`); }, }, { name: 'reloadUpdate', invoke: () => { setText('reloadUpdate'); setOptions({hash: Hash}); }, }, { name: 'setNeedUpdateForApp', invoke: () => { setText('setNeedUpdate'); setOptions({hash: AppPatchHash}); }, }, { name: 'setNeedUpdateForPPK', invoke: () => { setText('setNeedUpdate'); setOptions({hash: PPKPatchHash}); }, }, { name: 'markSuccess', invoke: () => { setText('markSuccess'); setOptions(undefined); }, }, { name: 'downloadPatchFromPpk', invoke: () => { setText('downloadPatchFromPpk'); setOptions({updateUrl: PPKDownloadUrl, hash: PPKPatchHash, originHash: OriginHash}); }, }, { name: 'downloadPatchFromPackage', invoke: () => { setText('downloadPatchFromPackage'); setOptions({updateUrl: AppPatchDownloadUrl, hash: AppPatchHash}); }, }, { name: 'downloadFullUpdate', invoke: () => { setText('downloadFullUpdate'); setOptions({updateUrl: DownloadUrl, hash: Hash}); }, }, { name: 'downloadAndInstallApk', invoke: () => { setText('downloadAndInstallApk'); setOptions({url: DownloadUrl, target: Hash, hash: Hash}); }, }, ]; }, []); const renderTestView = useCallback(() => { const views = []; for (let i = 0; i < NativeTestMethod.length; i++) { views.push( { NativeTestMethod[i].invoke(); }}> {NativeTestMethod[i].name} , ); } return {views}; }, [NativeTestMethod]); if (!visible) { return null; } return ( 调试Pushy方法(方法名,参数,值换行)