-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathOnboardingNotificationStepView.swift
More file actions
202 lines (175 loc) · 7.47 KB
/
OnboardingNotificationStepView.swift
File metadata and controls
202 lines (175 loc) · 7.47 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
import SwiftUI
/// Onboarding step that shows what proactive notifications look like.
/// Uses a static example tip — no Gemini call needed.
struct OnboardingNotificationStepView: View {
@ObservedObject var appState: AppState
@ObservedObject var chatProvider: ChatProvider
var onContinue: () -> Void
var onSkip: () -> Void
@State private var showNotification = false
@State private var notificationSent = false
@State private var pulseAnimation = false
private let tipHeadline = "Tip"
private let tipText = "I'll watch your screen and send you proactive tips like this"
var body: some View {
VStack(spacing: 0) {
// Header
HStack {
Text("Notifications")
.font(.system(size: 18, weight: .semibold))
.foregroundColor(OmiColors.textPrimary)
Spacer()
Button(action: onSkip) {
Text("Skip")
.font(.system(size: 13))
.foregroundColor(OmiColors.textTertiary)
}
.buttonStyle(.plain)
}
.padding(.horizontal, 24)
.padding(.vertical, 16)
Divider()
.background(OmiColors.backgroundTertiary)
Spacer()
// Content
VStack(spacing: 32) {
// Icon with glow
ZStack {
Circle()
.fill(OmiColors.purplePrimary.opacity(0.15))
.frame(width: 100, height: 100)
.blur(radius: 20)
.scaleEffect(pulseAnimation ? 1.2 : 1.0)
.animation(.easeInOut(duration: 2).repeatForever(autoreverses: true), value: pulseAnimation)
Image(systemName: "bell.badge.fill")
.font(.system(size: 44))
.foregroundStyle(
LinearGradient(
colors: [OmiColors.purplePrimary, OmiColors.purpleSecondary],
startPoint: .topLeading,
endPoint: .bottomTrailing
)
)
}
.onAppear { pulseAnimation = true }
VStack(spacing: 10) {
Text("Proactive Intelligence")
.font(.system(size: 24, weight: .bold))
.foregroundColor(OmiColors.textPrimary)
Text("omi watches your screen and catches things you'd miss —\nwrong recipients, stale data, hidden shortcuts.")
.font(.system(size: 14))
.foregroundColor(OmiColors.textSecondary)
.multilineTextAlignment(.center)
.lineSpacing(4)
}
// Static notification preview
if showNotification {
notificationPreview
.transition(.asymmetric(
insertion: .move(edge: .top).combined(with: .opacity).combined(with: .scale(scale: 0.95)),
removal: .opacity
))
}
}
.padding(.horizontal, 40)
Spacer()
// Bottom: confirmation + continue
if notificationSent {
VStack(spacing: 12) {
HStack(spacing: 6) {
Image(systemName: "bell.badge.fill")
.foregroundColor(OmiColors.purplePrimary)
.font(.system(size: 12))
Text("Notification shown below Ask omi")
.font(.system(size: 12))
.foregroundColor(OmiColors.textTertiary)
}
Button(action: onContinue) {
Text("Continue")
.font(.system(size: 15, weight: .semibold))
.foregroundColor(.white)
.frame(maxWidth: 280)
.padding(.vertical, 12)
.background(OmiColors.purplePrimary)
.cornerRadius(12)
}
.buttonStyle(.plain)
}
.padding(.bottom, 32)
.transition(.move(edge: .bottom).combined(with: .opacity))
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(OmiColors.backgroundPrimary)
.onAppear {
FloatingControlBarManager.shared.setup(appState: appState, chatProvider: chatProvider)
FloatingControlBarManager.shared.showTemporarily()
// Show the notification preview after a brief delay
DispatchQueue.main.asyncAfter(deadline: .now() + 0.6) {
withAnimation(.spring(response: 0.5, dampingFraction: 0.8)) {
showNotification = true
}
// Send a real macOS notification
NotificationService.shared.sendNotification(
title: tipHeadline,
message: tipText,
assistantId: "onboarding"
)
// Show "notification sent" + continue after a beat
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
withAnimation(.easeInOut(duration: 0.3)) {
notificationSent = true
}
}
}
}
}
// MARK: - macOS Notification Preview
private var notificationPreview: some View {
HStack(spacing: 12) {
// App icon
ZStack {
RoundedRectangle(cornerRadius: 8)
.fill(
LinearGradient(
colors: [OmiColors.purplePrimary, OmiColors.purpleAccent],
startPoint: .topLeading,
endPoint: .bottomTrailing
)
)
.frame(width: 36, height: 36)
Text("omi")
.font(.system(size: 11, weight: .bold, design: .rounded))
.foregroundColor(.white)
}
VStack(alignment: .leading, spacing: 3) {
HStack {
Text("omi")
.font(.system(size: 13, weight: .semibold))
.foregroundColor(.black)
Spacer()
Text("now")
.font(.system(size: 11))
.foregroundColor(.gray)
}
Text(tipHeadline)
.font(.system(size: 12, weight: .medium))
.foregroundColor(.black.opacity(0.85))
.lineLimit(1)
Text(tipText)
.font(.system(size: 12))
.foregroundColor(.black.opacity(0.7))
.lineLimit(2)
.lineSpacing(1)
}
}
.padding(12)
.frame(maxWidth: 380, alignment: .leading)
.background(
RoundedRectangle(cornerRadius: 14)
.fill(.white)
.shadow(color: .black.opacity(0.15), radius: 12, x: 0, y: 4)
.shadow(color: .black.opacity(0.05), radius: 1, x: 0, y: 1)
)
}
}