Skip to content

Commit c5ccd54

Browse files
authored
Merge pull request #14 from xianshenglu/dev
feat: add save data to device, clear statistics function
2 parents dd24cee + ec4dc95 commit c5ccd54

23 files changed

Lines changed: 2756 additions & 129 deletions

File tree

App.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
import { StatusBar } from 'expo-status-bar';
22
import { SafeAreaProvider } from 'react-native-safe-area-context';
3-
import { DefaultTheme, Provider as PaperProvider } from "react-native-paper";
3+
import { Provider as PaperProvider } from "react-native-paper";
44

55
import useCachedResources from "./hooks/useCachedResources";
66
import useColorScheme from "./hooks/useColorScheme";
77
import Navigation from "./navigation";
8-
const theme = {
9-
...DefaultTheme,
10-
colors: {
11-
...DefaultTheme.colors,
12-
primary: "#2196f3",
13-
},
14-
};
8+
import { APP_THEME } from './theme';
159

1610
export default function App() {
1711
const isLoadingComplete = useCachedResources();
@@ -21,7 +15,7 @@ export default function App() {
2115
return null;
2216
} else {
2317
return (
24-
<PaperProvider theme={theme}>
18+
<PaperProvider theme={APP_THEME}>
2519
<SafeAreaProvider>
2620
<Navigation colorScheme={colorScheme} />
2721
<StatusBar />

android/app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@
44
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
55
<uses-permission android:name="android.permission.VIBRATE"/>
66
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
7+
<!-- for android 11 -->
8+
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
9+
710
<queries>
811
<intent>
912
<action android:name="android.intent.action.VIEW"/>
1013
<category android:name="android.intent.category.BROWSABLE"/>
1114
<data android:scheme="https"/>
1215
</intent>
1316
</queries>
14-
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme" android:usesCleartextTraffic="true">
17+
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme" android:usesCleartextTraffic="true" android:requestLegacyExternalStorage="true">
1518
<meta-data android:name="expo.modules.updates.ENABLED" android:value="true"/>
1619
<meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="44.0.0"/>
1720
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>

lang/en-us.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"respondTime": "Respond Time",
88
"downloadSpeed": "Download Speed",
99
"showAllData": "Show All Data",
10-
"showSortedTop": "Show Sorted Top"
10+
"showSortedTop": "Show Sorted Top",
11+
"getPermFailed": "Get Permissions Failed"
1112
},
1213
"testRun": {
1314
"title": "Test Run",
@@ -29,6 +30,8 @@
2930
"hideSomeColumns": "Hide Some Columns"
3031
},
3132
"testConfig": {
32-
"title": "Test Config"
33+
"title": "Test Config",
34+
"clearHistoryStatistics": "Clear history statistics",
35+
"saveAllDataToDevice": "Save all data to device"
3336
}
3437
}

lang/zh-cn.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"respondTime": "响应时长",
88
"downloadSpeed": "下载速度",
99
"showAllData": "展示所有数据",
10-
"showSortedTop": "展示排序后的前"
10+
"showSortedTop": "展示排序后的前",
11+
"getPermFailed": "获取权限失败"
1112
},
1213
"testRun": {
1314
"title": "运行测试",
@@ -29,6 +30,8 @@
2930
"hideSomeColumns": "隐藏某些列"
3031
},
3132
"testConfig": {
32-
"title": "测试配置"
33+
"title": "测试配置",
34+
"clearHistoryStatistics": "清除历史统计数据",
35+
"saveAllDataToDevice": "保存数据到设备"
3336
}
3437
}

localize/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ I18n.translations = {
2323
en,
2424
};
2525

26-
export { I18n };
26+
export { I18n as AppI18n };

navigation/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ import useColorScheme from '../hooks/useColorScheme';
1515
import ModalScreen from '../screens/ModalScreen';
1616
import NotFoundScreen from '../screens/NotFoundScreen';
1717
import TestRunScreen from "../screens/TestRunScreen/index";
18-
import ConfigScreen from "../screens/TestConfigScreen";
18+
import TestConfigScreen from "../screens/TestConfigScreen/index";
1919
import {
2020
RootStackParamList,
2121
RootTabParamList,
2222
RootTabScreenProps,
2323
} from "../types";
2424
import LinkingConfiguration from "./LinkingConfiguration";
2525
import TestStatisticsScreen from "@/screens/TestStatisticsScreen";
26-
import { I18n } from "@/localize";
26+
import { AppI18n } from "@/localize";
2727

2828
export default function Navigation({
2929
colorScheme,
@@ -86,7 +86,7 @@ function BottomTabNavigator() {
8686
name="TestRun"
8787
component={TestRunScreen}
8888
options={({ navigation }: RootTabScreenProps<"TestRun">) => ({
89-
title: I18n.t("testRun.title"),
89+
title: AppI18n.t("testRun.title"),
9090
tabBarIcon: ({ color }) => <TabBarIcon name="code" color={color} />,
9191
headerRight: () => (
9292
<Pressable
@@ -109,7 +109,7 @@ function BottomTabNavigator() {
109109
name="TestStatistics"
110110
component={TestStatisticsScreen}
111111
options={({ navigation }: RootTabScreenProps<"TestStatistics">) => ({
112-
title: I18n.t("testStatistics.title"),
112+
title: AppI18n.t("testStatistics.title"),
113113
tabBarIcon: ({ color }) => <TabBarIcon name="code" color={color} />,
114114
headerRight: () => (
115115
<Pressable
@@ -130,9 +130,9 @@ function BottomTabNavigator() {
130130
/>
131131
<BottomTab.Screen
132132
name="TestConfig"
133-
component={ConfigScreen}
133+
component={TestConfigScreen}
134134
options={{
135-
title: I18n.t("testConfig.title"),
135+
title: AppI18n.t("testConfig.title"),
136136
tabBarIcon: ({ color }) => <TabBarIcon name="code" color={color} />,
137137
}}
138138
/>

0 commit comments

Comments
 (0)