feat(core): 优化隐私协议管理并添加日志功能

- 重构 PrivacyManager 类,增加隐私协议版本检查和用户同意状态管理
- 在主窗口初始化时获取云端配置,提高效率
- 添加日志功能,记录应用启动、隐私协议加载等关键事件
- 优化错误处理和用户提示信息
This commit is contained in:
hyb-oyqq
2025-07-31 14:38:12 +08:00
parent 5ad4062346
commit c941c03446
8 changed files with 367 additions and 65 deletions

View File

@@ -152,6 +152,7 @@ class MainWindow(QMainWindow):
self.animator.animation_finished.connect(self.on_animations_finished)
self.animator.start_animations()
# 在动画开始时获取云端配置
self.fetch_cloud_config()
def on_animations_finished(self):
@@ -186,7 +187,7 @@ class MainWindow(QMainWindow):
self.install_button_enabled = enabled
def fetch_cloud_config(self):
"""获取云端配置"""
"""获取云端配置(异步方式)"""
self.config_manager.fetch_cloud_config(
lambda url, headers, debug_mode, parent=None: ConfigFetchThread(url, headers, debug_mode, self),
self.on_config_fetched
@@ -223,6 +224,9 @@ class MainWindow(QMainWindow):
self.cloud_config = self.config_manager.get_cloud_config()
self.config_valid = self.config_manager.is_config_valid()
self.last_error_message = self.config_manager.get_last_error()
# 重新启用窗口,恢复用户交互
self.setEnabled(True)
def toggle_debug_mode(self, checked):
"""切换调试模式