feat(ux): improve wifi, voice, and print feedback flows
This commit is contained in:
@@ -337,6 +337,21 @@
|
||||
status_connect_ok: '连接成功,正在关闭配网页面...',
|
||||
status_connect_failed: '连接失败:{error}。请重试。',
|
||||
status_request_failed: '请求失败,请重试。',
|
||||
error_invalid_payload: '提交内容无效',
|
||||
error_read_failed: '设备读取请求失败',
|
||||
error_ssid_required: 'SSID 不能为空',
|
||||
error_password_too_short: '密码至少需要 8 位',
|
||||
error_wrong_password: '密码错误',
|
||||
error_no_ap_found: '未找到该 Wi-Fi',
|
||||
error_signal_too_weak: '信号太弱,请靠近路由器',
|
||||
error_ap_not_responding: '路由器无响应',
|
||||
error_association_failed: '连接被路由器拒绝',
|
||||
error_ap_security_unsupported: '路由器加密方式暂不支持',
|
||||
error_connect_timeout: '连接超时',
|
||||
error_wifi_unavailable: '设备 Wi-Fi 暂不可用',
|
||||
error_save_failed: '连接成功但保存失败,请重试',
|
||||
error_connect_failed: '无法连接到该 Wi-Fi',
|
||||
error_unknown: '未知错误',
|
||||
signal_unit: 'dBm'
|
||||
},
|
||||
'en-US': {
|
||||
@@ -359,6 +374,21 @@
|
||||
status_connect_ok: 'Connected successfully. Closing this provisioning page...',
|
||||
status_connect_failed: 'Connection failed: {error}. Please try again.',
|
||||
status_request_failed: 'Request failed. Please try again.',
|
||||
error_invalid_payload: 'Invalid request payload',
|
||||
error_read_failed: 'Device failed to read request',
|
||||
error_ssid_required: 'SSID is required',
|
||||
error_password_too_short: 'Password must be at least 8 characters',
|
||||
error_wrong_password: 'Wrong password',
|
||||
error_no_ap_found: 'Wi-Fi network not found',
|
||||
error_signal_too_weak: 'Signal is too weak',
|
||||
error_ap_not_responding: 'Router is not responding',
|
||||
error_association_failed: 'Router rejected the connection',
|
||||
error_ap_security_unsupported: 'Wi-Fi security mode is unsupported',
|
||||
error_connect_timeout: 'Connection timed out',
|
||||
error_wifi_unavailable: 'Device Wi-Fi is unavailable',
|
||||
error_save_failed: 'Connected, but failed to save credentials',
|
||||
error_connect_failed: 'Unable to connect to this Wi-Fi',
|
||||
error_unknown: 'Unknown error',
|
||||
signal_unit: 'dBm'
|
||||
}
|
||||
};
|
||||
@@ -402,6 +432,18 @@
|
||||
setStatusText(trWithParams(key, params), type);
|
||||
}
|
||||
|
||||
function mapProvisionError(code) {
|
||||
if (!code) {
|
||||
return tr('error_unknown');
|
||||
}
|
||||
const key = 'error_' + String(code);
|
||||
const mapped = tr(key);
|
||||
if (mapped === key) {
|
||||
return tr('error_connect_failed');
|
||||
}
|
||||
return mapped;
|
||||
}
|
||||
|
||||
function decodeSsid(value) {
|
||||
try {
|
||||
return decodeURIComponent(value);
|
||||
@@ -562,7 +604,9 @@
|
||||
return;
|
||||
}
|
||||
|
||||
setStatusKey('status_connect_failed', 'err', { error: data.error || 'unknown' });
|
||||
setStatusKey('status_connect_failed', 'err', {
|
||||
error: mapProvisionError(data.error)
|
||||
});
|
||||
} catch (_err) {
|
||||
setStatusKey('status_request_failed', 'err');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user