Skip to content

Commit d6704dc

Browse files
committed
chore: update routers struct
1 parent 5547d04 commit d6704dc

File tree

18 files changed

+525
-129
lines changed

18 files changed

+525
-129
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tongfang-utility-ng",
3-
"version": "4.0.5",
3+
"version": "4.0.6",
44
"main": "index.js",
55
"author": "kirainmoe <[email protected]>",
66
"license": "MIT",

src-tauri/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cargo-features = ["resolver"]
22

33
[package]
44
name = "tongfang-utility"
5-
version = "4.0.5"
5+
version = "4.0.6"
66
description = "A Utility built for hackintoshing Tongfang Laptops"
77
authors = ["Yume Akiyama"]
88
license = ""

src-tauri/src/main.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,24 @@ use resource::memory::get_memory_utilization;
2525
use resource::disk::get_disk_utilization;
2626
use macserial::{get_model_name, get_smbios, generate_sn_mlb};
2727
use ziputil::{list_zip_contents, read_zip_file_content, extract_to};
28-
use tauri::{Menu, MenuItem, CustomMenuItem};
28+
use tauri::{Menu, MenuItem, Submenu};
2929

3030
fn main() {
31-
let menu = Menu::new()
31+
let edit_menu = Menu::new()
32+
.add_native_item(MenuItem::SelectAll)
33+
.add_native_item(MenuItem::Undo)
34+
.add_native_item(MenuItem::Redo)
3235
.add_native_item(MenuItem::Copy)
3336
.add_native_item(MenuItem::Paste)
34-
.add_native_item(MenuItem::Cut)
37+
.add_native_item(MenuItem::Cut);
38+
39+
let window_menu = Menu::new()
3540
.add_native_item(MenuItem::Quit)
36-
.add_item(CustomMenuItem::new("hide", "Hide"));
41+
.add_native_item(MenuItem::Hide);
42+
43+
let menu = Menu::new()
44+
.add_submenu(Submenu::new("Window", window_menu))
45+
.add_submenu(Submenu::new("Edit", edit_menu));
3746

3847
tauri::Builder::default()
3948
.invoke_handler(tauri::generate_handler![

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"package": {
33
"productName": "Tongfang Utility",
4-
"version": "4.0.5"
4+
"version": "4.0.6"
55
},
66
"build": {
77
"distDir": "../dist",

src/common/appconfig.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const appConfig = {
22
appName: 'Tongfang Utility',
3-
version: '4.0.5',
4-
build: 2112030,
3+
version: '4.0.6',
4+
build: 2112080,
55
};
66

77
export default appConfig;

src/components/config-page/customize.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,24 +72,28 @@ function Customize() {
7272
<CustomizeGroup>
7373
<CustomizeOption
7474
label={t('CUSTOMIZE_WIRELESS_APPLE')}
75+
description={t('CUSTOMIZE_DESC_APPLE_WIRELESS')}
7576
icon={config.wirelessAdapterType === WirelessAdapterType.Apple ? <AppleIcon /> : <AppleBlackIcon />}
7677
active={config.wirelessAdapterType === WirelessAdapterType.Apple}
7778
onChange={() => config.setWirelessAdapterType(WirelessAdapterType.Apple)}
7879
/>
7980
<CustomizeOption
8081
label={t('CUSTOMIZE_WIRELESS_BROADCOM')}
82+
description={t('CUSTOMIZE_DESC_BROADCOM_WIRELESS')}
8183
icon={<BroadcomIcon />}
8284
active={config.wirelessAdapterType === WirelessAdapterType.Broadcom}
8385
onChange={() => config.setWirelessAdapterType(WirelessAdapterType.Broadcom)}
8486
/>
8587
<CustomizeOption
8688
label={t('CUSTOMIZE_WIRELESS_INTEL')}
89+
description={t('CUSTOMIZE_DESC_INTEL_WIRELESS')}
8790
icon={config.wirelessAdapterType === WirelessAdapterType.Intel ? <IntelWhiteIcon /> : <IntelIcon />}
8891
active={config.wirelessAdapterType === WirelessAdapterType.Intel}
8992
onChange={() => config.setWirelessAdapterType(WirelessAdapterType.Intel)}
9093
/>
9194
<CustomizeOption
9295
label={t('CUSTOMIZE_ANDROID_TETHERING')}
96+
description={t('CUSTOMIZE_DESC_ANDROID_HORNDIS')}
9397
icon={config.usbTetheringSupport ? <USBIcon /> : <USBBlackIcon />}
9498
active={config.usbTetheringSupport}
9599
onChange={() => config.toggleUSBTetheringSupport()}
@@ -100,26 +104,30 @@ function Customize() {
100104
<CustomizeGroup>
101105
<CustomizeOption
102106
label="1920 × 1080 (60Hz)"
107+
description={t('CUSTOMIZE_DESC_1080P')}
103108
icon={<FHDIcon />}
104109
active={config.internalMonitorType === InternalMonitorType.FHD}
105110
onChange={() => config.setInternalMonitorType(InternalMonitorType.FHD)}
106111
/>
107112
<CustomizeOption
108113
label="1920 × 1080 (144Hz)"
114+
description={t('CUSTOMIZE_DESC_1080P144')}
109115
icon={<FHDHighRefreshIcon />}
110116
active={config.internalMonitorType === InternalMonitorType.FHDHighRefresh}
111117
onChange={() => config.setInternalMonitorType(InternalMonitorType.FHDHighRefresh)}
112118
/>
113-
{config.product === 'Z2 Air-G' && (
119+
{(config.product === 'Z2 Air-G' || config.product?.includes('Z2-G')) && (
114120
<CustomizeOption
115121
label={`1920 × 1080 (144Hz, ${t('CUSTOMIZE_SCHEME_2')})`}
122+
description={t('CUSTOMIZE_DESC_1080P144_SCHEME2')}
116123
icon={<UHDIcon />}
117124
active={config.internalMonitorType === InternalMonitorType.FHDHighRefreshSolution2}
118125
onChange={() => config.setInternalMonitorType(InternalMonitorType.FHDHighRefreshSolution2)}
119126
/>
120127
)}
121128
<CustomizeOption
122129
label="3840 × 2160 (UHD)"
130+
description={t('CUSTOMIZE_DESC_4K')}
123131
icon={<UHDIcon />}
124132
active={config.internalMonitorType === InternalMonitorType.UHD}
125133
onChange={() => config.setInternalMonitorType(InternalMonitorType.UHD)}
@@ -130,24 +138,28 @@ function Customize() {
130138
<CustomizeGroup>
131139
<CustomizeOption
132140
label={t('CUSTOMIZE_DISABLE_NVME')}
141+
description={t('CUSTOMIZE_DESC_DISABLE_NVME')}
133142
icon={<DisableSSDIcon />}
134143
active={config.disableIncompatibleNVMe > 0}
135144
onChange={() => config.setDisableIncompatibleNVMe(config.disableIncompatibleNVMe ? 0 : 1)}
136145
/>
137146
<CustomizeOption
138147
label={t('CUSTOMIZE_ENABLE_NVMEFIX')}
148+
description={t('CUSTOMIZE_DESC_ENABLE_NVMEFIX')}
139149
icon={<SSDIcon />}
140150
active={config.enableNVMeFix}
141151
onChange={() => config.toggleNVMeFix()}
142152
/>
143153
<CustomizeOption
144154
label={t('CUSTOMIZE_LOAD_APPLEGUC')}
155+
description={t('CUSTOMIZE_DESC_ENABLE_APPLEGUC')}
145156
icon={<GPUIcon />}
146157
active={config.enableAppleGuC}
147158
onChange={() => config.toggleAppleGuC()}
148159
/>
149160
<CustomizeOption
150161
label={t('CUSTOMIZE_CPU_BEST_PERFORMANCE')}
162+
description={t('CUSTOMIZE_DESC_CPU_BEST_PERFORMACE')}
151163
icon={<CPUIcon />}
152164
active={config.cpuPerformanceMode}
153165
onChange={() => config.toggleCPUPerformaceMode()}
@@ -164,6 +176,7 @@ function Customize() {
164176
/>
165177
<CustomizeOption
166178
label={t('CUSTOMIZE_SIMPLIFY_CONFIG')}
179+
description={t('CUSTOMIZE_DESC_SIMPLIFY')}
167180
icon={<ScissorIcon />}
168181
active={config.simplifyConfig}
169182
onChange={() => config.toggleSimplifyConfig()}

src/components/config-page/generate.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ function Generate() {
124124
title={t('GENERATE_NETWORK_METHOD')}
125125
value={getNetworkMethod()}
126126
/>
127-
{!config.useAirportItlwm && (
127+
{config.wirelessAdapterType === WirelessAdapterType.Intel && !config.useAirportItlwm && (
128128
<ListItem
129129
value={t('GENERATE_NOT_USE_AIRPORTITLWM')}
130130
type="warning"

src/components/config-page/model-selector.tsx

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,28 +28,37 @@ import readNVRAM from 'utils/read-nvram';
2828
const { TabPane } = Tabs;
2929

3030
function ModelSelector() {
31-
const { config } = useContext(RootStoreContext);
31+
const { app, config } = useContext(RootStoreContext);
3232
const [condition, setConndition] = useState<string>('');
3333
const models = config.yamlInfo?.['support-models'];
3434
const list = toJS(models)!;
3535

3636
useEffect(() => {
3737
(async() => {
38-
if (!list || !list.length) {
39-
return;
38+
if (!config.restoreConfigFromLocalStorage()) {
39+
config.determineBestChoice();
4040
}
41-
const vendor = await readNVRAM('laptop_vendor');
42-
const product = await readNVRAM('laptop_product');
43-
if (vendor && product) {
44-
for (let idx = 0; idx < list.length; idx++) {
45-
if (list[idx].vendor === vendor && list[idx].product === product) {
46-
config.setModelIndex(idx);
47-
break;
41+
42+
if (app.platform === 'macos') {
43+
const vendor = await readNVRAM('laptop-vendor');
44+
const product = await readNVRAM('laptop-product');
45+
const models = config.yamlInfo?.['support-models'];
46+
const list = toJS(models) || [];
47+
if (vendor && product) {
48+
for (let idx = 0; idx < list.length; idx++) {
49+
if (list[idx].vendor === vendor && list[idx].product === product) {
50+
config.setModelIndex(idx);
51+
break;
52+
}
4853
}
4954
}
5055
}
5156
})();
52-
}, [list, config]);
57+
}, [app, config]);
58+
59+
useEffect(() => {
60+
61+
}, [list, app, config]);
5362

5463
const modelsGroupByVendor = useMemo(() => {
5564
if (!list?.length) {

0 commit comments

Comments
 (0)