Files
Commilitia-Drop/ios/CDrop/MacApp/MacLoginView.swift
T

56 lines
1.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.
#if os(macOS)
import SwiftUI
// macOS Commilitia Auth BrokerASWebAuthenticationSession
// commilitia-drop:// app BrokerLogin /
// AuthManager.startBrokerLogin
// iOS LoginView / UIImage iOS Mac Mac
struct MacLoginView: View
{
@Environment(AuthManager.self) private var auth
@State private var busy = false
var body: some View
{
VStack(spacing: 20)
{
Image(systemName: "paperplane.fill")
.font(.system(size: 52))
.foregroundStyle(.tint)
Text("Commilitia Drop")
.font(.largeTitle.weight(.semibold))
Text("跨设备直连传输与云剪贴板")
.font(.callout)
.foregroundStyle(.secondary)
Button
{
busy = true
Task
{
await auth.startBrokerLogin()
busy = false
}
}
label:
{
Text(busy ? "登录中…" : "使用 Commilitia 账户登录")
.frame(maxWidth: 260)
}
.controlSize(.large)
.buttonStyle(.borderedProminent)
.disabled(busy)
if !auth.statusText.isEmpty
{
Text(auth.statusText)
.font(.caption)
.foregroundStyle(.secondary)
}
}
.padding(40)
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}
#endif