Files
Commilitia-Drop/ios/CDrop/Sources/CDropApp.swift
T
admin 7f6e35908c iOS 界面字体回退系统原生 + iPad 适配 + 登录列宽
- 移除自定义 UI 字体,界面统一系统原生:删 BrandFonts.swift(Orbit/Maple woff2 运行期 CTFontManager 注册 + UIKit 外观代理)+ AppDelegate 的 register 调用 + CDropApp 全局 .environment(\.font, .oBody);9 视图 .font(.o语义) → .font(.语义) 系统语义(日志 LogView 消息行本就 .caption.monospaced() 原生等宽);删 Sources/Fonts/(Orbit/Maple woff2 ~20MB)。仅留品牌字标 Fredoka(logo Wordmark),Justfile ios-fonts 改 Fredoka-only、.gitignore 收窄、新增 Shared/Fonts/README.md
- iPad 适配:RootView TabView 加 .tabViewStyle(.sidebarAdaptable)(iPad 常规宽度侧边栏 / iPhone 底部标签栏)+ ConversationView 消息线程 maxWidth 680 居中;project.yml 补方向键 UISupportedInterfaceOrientations(iPhone 竖 + 横)/ ~ipad(全 4 向),消除 iPad 多任务方向构建告警
- 登录页内容约束 maxWidth 420 居中,避免 iPad 宽屏主登录按钮 / 二维码区横向拉满(iPhone 不受影响)
- 文档:ios/PLAN.md §11.2 改系统原生字体 + 新增 §13 iPad;ios/PARITY.md 字体分叉条目回退 + 导航条目加 iPad + 2026-07-07 漂移行
- 已装 iPhone 15 Pro C + iPad Pro 13" M4 双端、用户确认
2026-07-07 20:49:06 +08:00

90 lines
3.7 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import SwiftUI
// cdrop iOS arch A ios/PLAN.md SwiftUI +
// WKWebView EngineController AuthManager
@main
struct CDropApp: App
{
@UIApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate
@Environment(\.scenePhase) private var scenePhase
@State private var auth = AuthManager()
@State private var engine = EngineController()
var body: some Scene
{
WindowGroup
{
AppRoot(auth: auth, engine: engine)
}
.onChange(of: scenePhase)
{ _, phase in
guard phase == .active else { return }
// App Group iOS share 宿 app
// app
// app onAppear
//
engine.loadPendingShares()
// / ready
//
if auth.session != nil
{
engine.provisionWidgetSessionIfNeeded()
}
}
}
}
//
struct AppRoot: View
{
let auth: AuthManager
let engine: EngineController
var body: some View
{
Group
{
if auth.session != nil
{
RootView()
.environment(engine)
.environment(auth)
}
else
{
LoginView()
.environment(auth)
}
}
.onAppear
{
engine.auth = auth
if ProcessInfo.processInfo.environment["CDROP_DEBUG_SESSION"] == "1"
{
auth.debugSession()
}
// userId reset()
// authExpired / #3
if let uid = auth.session?.user.id { engine.activateRecords(userId: uid) }
}
// session nil authExpired /
.onChange(of: auth.session?.user.id)
{ _, uid in
if let uid { engine.activateRecords(userId: uid) }
}
// Share Extension cdrop://share RootView
// AppRoot 便 / onAppear
.onOpenURL
{ url in
guard url.scheme == "cdrop", url.host == "share" else { return }
engine.loadPendingShares()
}
// AppDelegate +
.onReceive(NotificationCenter.default.publisher(for: .cdropSessionRevoked))
{ _ in
engine.reset()
auth.logout()
}
}
}