feat: 更新Podfile和Podfile.lock,移除Alamofire依赖并添加API认证机制文档

- 注释掉Podfile中的Alamofire依赖,更新Podfile.lock以反映更改。
- 在yana/APIs/API-README.md中新增自动认证Header机制的详细文档,描述其工作原理、实现细节及最佳实践。
- 在yana/yanaApp.swift中将print语句替换为debugInfo以增强调试信息的输出。
- 在API相关文件中实现用户认证状态检查和相关header的自动添加逻辑,提升API请求的安全性和用户体验。
- 更新多个文件中的日志输出,确保在DEBUG模式下提供详细的调试信息。
This commit is contained in:
edwinQQQ
2025-07-11 16:53:46 +08:00
parent 750eecf6ff
commit f9f3dec53f
30 changed files with 537 additions and 219 deletions

View File

@@ -1,6 +1,7 @@
import SwiftUI
struct MeView: View {
@State private var showLogoutConfirmation = false
var body: some View {
GeometryReader { geometry in
ScrollView {
@@ -48,7 +49,9 @@ struct MeView: View {
.padding(.top, 40)
// 退
Button(action: {}) {
Button(action: {
showLogoutConfirmation = true
}) {
HStack {
Image(systemName: "rectangle.portrait.and.arrow.right")
.font(.system(size: 16))
@@ -72,6 +75,27 @@ struct MeView: View {
}
}
.ignoresSafeArea(.container, edges: .top)
.alert("确认退出", isPresented: $showLogoutConfirmation) {
Button("取消", role: .cancel) { }
Button("退出", role: .destructive) {
performLogout()
}
} message: {
Text("确定要退出登录吗?")
}
}
// MARK: - 退
private func performLogout() {
debugInfo("🔓 开始执行退出登录...")
// keychain
UserInfoManager.clearAllAuthenticationData()
// window root login view
NotificationCenter.default.post(name: .homeLogout, object: nil)
debugInfo("✅ 退出登录完成")
}
}
@@ -111,4 +135,4 @@ struct MenuItemView: View {
#Preview {
MeView()
}
}