Ariver
2026-06-30 4c6f31c43a03ecb5a85ffb6a3ea3905a661af0f4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import SwiftUI
 
enum SmartStartNoticeMode {
    case autoApplied
    case suggestionOnly
    case manuallyApplied
}
 
struct SmartStartNotice: Identifiable {
    let id = UUID()
    let mode: SmartStartNoticeMode
    let title: String
    let message: String
    let summary: SmartStartSummary
}
 
struct SmartStartNoticeOverlay: View {
    let notice: SmartStartNotice?
    let onDismiss: () -> Void
    let onApply: () -> Void
    let onUndo: () -> Void
 
    var body: some View {
        GeometryReader { proxy in
            if let notice {
                let panelWidth = min(560, max(320, proxy.size.width - 64))
 
                ZStack {
                    Color.black.opacity(0.10)
                        .ignoresSafeArea()
 
                    VStack(spacing: 18) {
                        Image(systemName: notice.mode == .suggestionOnly ? "sparkles" : "checkmark.seal.fill")
                            .font(.system(size: 30, weight: .semibold))
                            .foregroundStyle(Color.accentColor)
                            .frame(width: 58, height: 58)
                            .background(
                                Circle()
                                    .fill(Color.accentColor.opacity(0.12))
                            )
 
                        VStack(spacing: 8) {
                            Text(notice.title)
                                .font(.system(size: 21, weight: .semibold))
                                .foregroundStyle(.primary)
                                .multilineTextAlignment(.center)
 
                            Text(notice.message)
                                .font(.system(size: 15, weight: .regular))
                                .foregroundStyle(.secondary)
                                .multilineTextAlignment(.center)
                                .lineLimit(4)
                                .fixedSize(horizontal: false, vertical: true)
                        }
 
                        HStack(spacing: 12) {
                            switch notice.mode {
                            case .suggestionOnly:
                                Button(tr("smartstart.later"), action: onDismiss)
                                    .buttonStyle(.bordered)
                                    .controlSize(.large)
 
                                Button(tr("smartstart.apply"), action: onApply)
                                    .buttonStyle(.borderedProminent)
                                    .controlSize(.large)
                            case .autoApplied, .manuallyApplied:
                                if notice.summary.backupPath != nil {
                                    Button(tr("smartstart.undo"), action: onUndo)
                                        .buttonStyle(.bordered)
                                        .controlSize(.large)
                                }
                                Button(tr("smartstart.ok"), action: onDismiss)
                                    .buttonStyle(.borderedProminent)
                                    .controlSize(.large)
                            }
                        }
                    }
                    .padding(.horizontal, 30)
                    .padding(.vertical, 26)
                    .frame(width: panelWidth)
                    .background(
                        RoundedRectangle(cornerRadius: 16)
                            .fill(.ultraThickMaterial)
                            .shadow(color: .black.opacity(0.26), radius: 28, y: 16)
                    )
                    .overlay(
                        RoundedRectangle(cornerRadius: 16)
                            .stroke(.white.opacity(0.16), lineWidth: 1)
                    )
                }
                .frame(width: proxy.size.width, height: proxy.size.height)
                .transition(.scale(scale: 0.96).combined(with: .opacity))
                .zIndex(650)
            }
        }
        .ignoresSafeArea()
        .allowsHitTesting(notice != nil)
    }
}