优化图标

状态
各种接口
This commit is contained in:
844143714@qq,com 2026-05-06 21:07:17 +08:00
parent 7b2c578b47
commit c897368828
3 changed files with 19 additions and 10 deletions

View File

@ -1,5 +1,4 @@
(function() { (function() {
// 在页面上下文中注入桥接脚本,避免 cross-compartment 访问被拒
var code = [ var code = [
'(function() {', '(function() {',
' var _realAndroid = window.android;', ' var _realAndroid = window.android;',

View File

@ -1,10 +1,16 @@
{ {
"manifest_version": 2, "manifest_version": 2,
"browser_specific_settings": {
"gecko": {
"id": "standapp-bridge@standapp.local"
}
},
"name": "standapp-bridge", "name": "standapp-bridge",
"version": "1.0", "version": "1.0",
"type": "extension",
"description": "JS-Native bridge for StandAPP", "description": "JS-Native bridge for StandAPP",
"content_scripts": [{ "content_scripts": [{
"matches": ["*://*/*"], "matches": ["<all_urls>"],
"js": ["bridge.js"], "js": ["bridge.js"],
"run_at": "document_start", "run_at": "document_start",
"all_frames": true "all_frames": true

View File

@ -263,6 +263,15 @@
updatePrinterStatus(); updatePrinterStatus();
// 每 3 秒同步一次打印机状态 // 每 3 秒同步一次打印机状态
setInterval(updatePrinterStatus, 3000); setInterval(updatePrinterStatus, 3000);
// 确认接口可用后再加载历史
loadHistory();
// 通知 Android 页面加载完成
if (window.android.onPageFinished) {
window.android.onPageFinished();
}
} else {
// bridge 尚未注入200ms 后重试
setTimeout(checkApp, 200);
} }
} }
@ -568,12 +577,8 @@
} }
}, 500); }, 500);
// 告知 Android 页面加载完成 // 告知 Android 页面加载完成(已移至 checkApp 中,等 bridge 注入后再调用)
window.onload = function() { window.onload = function() {};
if (window.android && window.android.onPageFinished) {
window.android.onPageFinished();
}
};
// === WebSocket 逻辑 === // === WebSocket 逻辑 ===
var ws = null; var ws = null;
@ -724,11 +729,10 @@
addLog("系统: 终端暂无保存的记录", false); addLog("系统: 终端暂无保存的记录", false);
} }
} else { } else {
alert("未检测到安卓接口,无法同步"); // 不再弹窗checkApp 会在 bridge 就绪后调用 loadHistory
} }
} }
setTimeout(loadHistory, 500);
// === PTT 业务测试逻辑 === // === PTT 业务测试逻辑 ===
var pttBtn = document.getElementById('ptt-speak-btn'); var pttBtn = document.getElementById('ptt-speak-btn');