11import { StyleSheet , Button , TextInput } from "react-native" ;
22import { Text , View } from "@/components/Themed" ;
3- import { useState } from "react" ;
3+ import { useEffect , useState } from "react" ;
44import { responseTestService } from "@/services/ResponseTest.service" ;
55import { downloadTestService } from "@/services/DownloadTest.service" ;
66import { TableHeader } from "@/components/Table/TableHeader" ;
@@ -9,7 +9,7 @@ import { useTableData } from "../hooks/useTableData";
99import { useTestIpCount } from "../hooks/useTestIpCount" ;
1010import { TableRows } from "@/components/Table/TableRows" ;
1111import { initialTestPageTableHeaderCols , MyTableHeaderColumn } from "../model" ;
12- import { RequestStatus } from "@/typings " ;
12+ import { useTestRunningStatus } from "../hooks/useTestRunningStatus " ;
1313
1414export default function TestPage ( { path } : { path : string } ) {
1515 const { testIpCount, setTestIpCount, getIpList } = useTestIpCount ( ) ;
@@ -37,13 +37,32 @@ export default function TestPage({ path }: { path: string }) {
3737 changeTableHeadersSortType,
3838 } = useTableHeader < MyTableHeaderColumn > ( initialTestPageTableHeaderCols ) ;
3939
40+ const { testRunningStatus, nextTestRunningStatus } = useTestRunningStatus ( ) ;
41+
4042 function onReset ( ) {
4143 responseTestService . stop ( ) ;
4244 downloadTestService . stop ( ) ;
4345 resetTableData ( ) ;
4446 resetTableHeader ( ) ;
45- initTableData ( getIpList ( ) ) ;
47+ const newIpList = getIpList ( ) ;
48+ initTableData ( newIpList ) ;
49+ nextTestRunningStatus ( ) ;
4650 }
51+
52+ useEffect ( ( ) => {
53+ // in the future may need to add a status check
54+ startResponseSpeedTest (
55+ getSelectedIpList ( ) ,
56+ Number ( testIpCoCurrentCount ) ,
57+ testUrl
58+ ) ;
59+ startDownloadSpeedTest (
60+ getSelectedIpList ( ) ,
61+ Number ( testIpCoCurrentCount ) ,
62+ testUrl
63+ ) ;
64+ } , [ testRunningStatus ] ) ;
65+
4766 function onSort (
4867 colId : MyTableHeaderColumn [ "id" ] ,
4968 sortType : MyTableHeaderColumn [ "sort" ]
0 commit comments