Skip to content

Commit babf5a6

Browse files
authored
Merge pull request #22 from xianshenglu/dev
fix #21, close #17
2 parents facfba5 + e0c1b96 commit babf5a6

21 files changed

Lines changed: 210 additions & 68 deletions

File tree

.github/workflows/android_build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
appName: xianshenglu/cloudflare-ip-tester-app
7474
token: ${{secrets.APP_CENTER_TOKEN}}
7575
group: Collaborators
76-
file: android/app/build/outputs/apk/release/app-universal-release.apk
76+
file: android/app/build/outputs/apk/release/app-universal-release-signed.apk
7777
notifyTesters: true
7878
debug: false
7979

App.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@ import { Provider as PaperProvider } from "react-native-paper";
55
import useCachedResources from "./hooks/useCachedResources";
66
import useColorScheme from "./hooks/useColorScheme";
77
import Navigation from "./navigation";
8-
import { APP_THEME } from './theme';
8+
import { getAppTheme } from './theme';
9+
import useIsDarkMode from './hooks/userIsDarkMode';
910

1011
export default function App() {
1112
const isLoadingComplete = useCachedResources();
1213
const colorScheme = useColorScheme();
13-
14+
const isDark = useIsDarkMode()
1415
if (!isLoadingComplete) {
1516
return null;
1617
} else {
1718
return (
18-
<PaperProvider theme={APP_THEME}>
19+
<PaperProvider theme={getAppTheme(isDark)}>
1920
<SafeAreaProvider>
2021
<Navigation colorScheme={colorScheme} />
2122
<StatusBar />

README-ZH.MD

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
### 功能
66

77
- 测试本地网络到 cloudflare 节点的速度
8-
98
- 根据你的测试结果,生成统计数据,可以排序,得到最好的结果
9+
- 自定义 Cloudflare Ipv4 列表。(如果你想一直用自定义的数据,需要开启"保存数据到设备"。) 你也许可以用它来测试其他 CDN 厂商的节点速度,如果你再修改测试地址的话。
1010

1111
<div style="display: flex;flex-flow:row wrap;">
1212
<img src="./assets/images/test-run-min-zh.jpg" height="600">
1313
<img src="./assets/images/test-statistics-min-zh.jpg" height="600">
14+
<img src="./assets/images/test-config-min-zh.jpg" height="600">
1415
</div>
1516

1617
### 灵感来源于

README.MD

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44

55
### Functions
66

7-
- test cloudflare-ip as many as you want
8-
- generate a history statistics based on your test results.
7+
- Test cloudflare-ip as many as you want
8+
- Generate a history statistics based on your test results.
9+
- Customize Cloudflare Ipv4 list. (Need to enable "Save all data to device" if you want to keep the customization all the time.) You might be able to test other cdn vendors' nodes by changing the Ipv4 list and testUrl.
910

1011
<div style="display: flex;flex-flow:row wrap;">
1112
<img src="./assets/images/test-run-min.jpg" height="600">
1213
<img src="./assets/images/test-statistics-min.jpg" height="600">
14+
<img src="./assets/images/test-config-min.jpg" height="600">
1315
</div>
1416

1517
### Inspired by

apis/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { userSettingsStore } from '@/store/UserSettings';
12
import { getInitialCfIpResponse } from "./../screens/TestRunScreen/utils/index";
23
import { RequestStatus } from "@/typings/index";
34
import { getCfIpV4List, getRandomItems } from "@/utils/index";
@@ -148,6 +149,6 @@ export const getCfNodesDownloadTestTime = (
148149
);
149150
};
150151
export const getRandomCfIpList = (totalCount: number) => {
151-
const ipList = getRandomItems(getCfIpV4List(), totalCount);
152+
const ipList = getRandomItems(getCfIpV4List(userSettingsStore.getCurIpv4ListText()), totalCount);
152153
return ipList;
153154
};
40.9 KB
Loading

assets/images/test-config-min.jpg

40.4 KB
Loading

components/Table/TableHeader/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function TableHeader(props: {
3939
};
4040

4141
return (
42-
<View style={{ ...tableSharedStyles.tableHeader }}>
42+
<View style={{ ...tableSharedStyles.tableHeader }} lightColor="#e6f6fa">
4343
{cols.map((column) => {
4444
return (
4545
<Pressable
@@ -76,7 +76,6 @@ export const styles = StyleSheet.create({
7676
alignSelf: "stretch",
7777
alignItems: "center",
7878
justifyContent: "center",
79-
backgroundColor: "#e6f6fa",
8079
},
8180
tableHeaderCellText: {
8281
lineHeight: 18,

components/Themed.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* https://docs.expo.io/guides/color-schemes/
44
*/
55

6-
import { Text as DefaultText, View as DefaultView } from 'react-native';
6+
import { Text as DefaultText, View as DefaultView, TextInput as DefaultTextInput } from 'react-native';
77

88
import Colors from '../constants/Colors';
99
import useColorScheme from '../hooks/useColorScheme';
@@ -29,6 +29,7 @@ type ThemeProps = {
2929

3030
export type TextProps = ThemeProps & DefaultText['props'];
3131
export type ViewProps = ThemeProps & DefaultView['props'];
32+
export type TextInputProps = ThemeProps & DefaultTextInput['props'];
3233

3334
export function Text(props: TextProps) {
3435
const { style, lightColor, darkColor, ...otherProps } = props;
@@ -43,3 +44,11 @@ export function View(props: ViewProps) {
4344

4445
return <DefaultView style={[{ backgroundColor }, style]} {...otherProps} />;
4546
}
47+
48+
export function TextInput(props: TextInputProps) {
49+
const { style, lightColor, darkColor, ...otherProps } = props;
50+
const backgroundColor = useThemeColor({ light: lightColor, dark: darkColor }, 'background');
51+
const color = useThemeColor({ light: lightColor, dark: darkColor }, 'text');
52+
const borderColor = color;
53+
return <DefaultTextInput style={[{ backgroundColor,color,borderColor }, style]} {...otherProps} />;
54+
}

hooks/userIsDarkMode.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import useColorScheme from "./useColorScheme";
2+
3+
export default function useIsDarkMode() {
4+
return useColorScheme() === "dark";
5+
}

0 commit comments

Comments
 (0)