Phase 4 剩余三项: - 首次引导向导(setup/first_run + ui/setup_wizard):服务自检(含 C# 助手共存 提示)→ 打印机检测与 HiTi 驱动安装指引(官网链接/重新检测,mac 与 win 文案 分支,允许无打印机完成)→ 开机自启开关 + scheme 注册;侧栏底部常驻设置区 (自启开关 + 重新运行引导) - 开机自启(setup/autostart):mac 写 LaunchAgent(RunAtLoad 一次性,不用 KeepAlive——托盘退出不能被拉回);Windows 走 HKCU Run(reg 命令免 win32 依赖) - URL scheme 闭环:单实例唤醒端口 38210(setup/single_instance)——zaxprint:// 唤起或重复双击启动第二进程时通知常驻实例弹窗后自退,跨平台一致(弃用 app_links 的 mac 事件转发不确定性);Windows 启动时幂等注册 HKCU scheme; 前端 cardPrinter.ts 加 launchAgent()(zaxprint://open),开卡抽屉离线时显示 "启动打印助手"按钮,点击唤起后 1s×6 轮询自动上线(biz 前端改动待用户提交) Phase 5: - tool/package_macos.sh:构建 → ad-hoc 就地签名(--deep,勿加 --options=runtime: hardened runtime 库校验会因 ad-hoc 无 Team ID 拒载 framework,实测踩坑)→ hdiutil dmg;实测产出 22MB dmg + 签名后冒烟通过 - windows/installer.iss:Inno Setup 安装包脚本(快捷方式/桌面图标/开机自启 Tasks/zaxprint scheme 注册与卸载清理/HiTi SDK DLL 随 Release 目录打包) 依赖 +url_launcher +shared_preferences;13 测试全过、analyze 零问题。
23 lines
662 B
Dart
23 lines
662 B
Dart
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
/// 首次引导向导完成标记(shared_preferences 持久化)。
|
|
class FirstRun {
|
|
static const _key = 'first_run_done';
|
|
|
|
static Future<bool> isDone() async {
|
|
final prefs = await SharedPreferences.getInstance();
|
|
return prefs.getBool(_key) ?? false;
|
|
}
|
|
|
|
static Future<void> complete() async {
|
|
final prefs = await SharedPreferences.getInstance();
|
|
await prefs.setBool(_key, true);
|
|
}
|
|
|
|
/// 重新运行向导(设置入口用)。
|
|
static Future<void> reset() async {
|
|
final prefs = await SharedPreferences.getInstance();
|
|
await prefs.setBool(_key, false);
|
|
}
|
|
}
|