expo-dev-launcher 58.0.18 → 58.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/android/build.gradle +2 -2
- package/ios/SwiftUI/AccountSheet.swift +36 -40
- package/ios/SwiftUI/CrashReportView.swift +11 -11
- package/ios/SwiftUI/Data.swift +4 -9
- package/ios/SwiftUI/DevLauncherViewController.swift +38 -4
- package/ios/SwiftUI/DevLauncherViewModel.swift +22 -8
- package/ios/SwiftUI/DevLauncherViews.swift +20 -35
- package/ios/SwiftUI/DevServerFiltersView.swift +4 -4
- package/ios/SwiftUI/DevServerInfoModal.swift +2 -2
- package/ios/SwiftUI/DevServersView.swift +20 -20
- package/ios/SwiftUI/ErrorView.swift +11 -11
- package/ios/SwiftUI/HomeTabView.swift +110 -47
- package/ios/SwiftUI/LocalNetworkPermissionView.swift +13 -13
- package/ios/SwiftUI/Navigation/DevLauncherTab.swift +50 -0
- package/ios/SwiftUI/Navigation/DevLauncherToolbar.swift +114 -0
- package/ios/SwiftUI/Navigation/Navigation.swift +0 -134
- package/ios/SwiftUI/SettingsTabView.swift +23 -35
- package/ios/SwiftUI/StackFrameView.swift +2 -2
- package/ios/SwiftUI/UpdatesTab/NotSignedInView.swift +4 -4
- package/ios/SwiftUI/UpdatesTab/NotUsingUpdatesView.swift +18 -22
- package/ios/SwiftUI/UpdatesTab/UpdateRow.swift +1 -1
- package/ios/SwiftUI/UpdatesTab/UpdatesListView.swift +21 -13
- package/ios/SwiftUI/UpdatesTab/UpdatesTabView.swift +5 -4
- package/ios/SwiftUI/Utils/Utils.swift +12 -2
- package/package.json +2 -2
|
@@ -54,7 +54,7 @@ struct DevServersView: View {
|
|
|
54
54
|
if viewModel.hiddenDevServerCount == 0 && viewModel.permissionStatus != .denied {
|
|
55
55
|
HStack {
|
|
56
56
|
Text("Searching for development servers...")
|
|
57
|
-
.
|
|
57
|
+
.foregroundStyle(Color.secondary)
|
|
58
58
|
Spacer()
|
|
59
59
|
ProgressView()
|
|
60
60
|
.controlSize(.small)
|
|
@@ -63,7 +63,7 @@ struct DevServersView: View {
|
|
|
63
63
|
Divider()
|
|
64
64
|
}
|
|
65
65
|
} else {
|
|
66
|
-
ForEach(viewModel.devServers, id: \.
|
|
66
|
+
ForEach(viewModel.devServers, id: \.url) { server in
|
|
67
67
|
DevServerRow(server: server) {
|
|
68
68
|
viewModel.openApp(url: server.url)
|
|
69
69
|
}
|
|
@@ -100,7 +100,7 @@ struct DevServersView: View {
|
|
|
100
100
|
.font(.system(size: 14))
|
|
101
101
|
#endif
|
|
102
102
|
Spacer()
|
|
103
|
-
if viewModel.
|
|
103
|
+
if viewModel.loadingServerURL != nil && viewModel.devServers.isEmpty {
|
|
104
104
|
ProgressView()
|
|
105
105
|
}
|
|
106
106
|
}
|
|
@@ -114,9 +114,9 @@ struct DevServersView: View {
|
|
|
114
114
|
.submitLabel(.go)
|
|
115
115
|
#if !os(macOS)
|
|
116
116
|
.keyboardType(.URL)
|
|
117
|
-
.
|
|
117
|
+
.textInputAutocapitalization(.never)
|
|
118
118
|
#endif
|
|
119
|
-
.
|
|
119
|
+
.autocorrectionDisabled()
|
|
120
120
|
.toolbar {
|
|
121
121
|
#if os(tvOS)
|
|
122
122
|
ToolbarItemGroup(placement: .automatic) {
|
|
@@ -142,7 +142,7 @@ struct DevServersView: View {
|
|
|
142
142
|
}
|
|
143
143
|
.padding(.horizontal, 16)
|
|
144
144
|
.padding(.vertical, 12)
|
|
145
|
-
.
|
|
145
|
+
.foregroundStyle(Color.primary)
|
|
146
146
|
#if !os(tvOS)
|
|
147
147
|
.overlay(
|
|
148
148
|
RoundedRectangle(cornerRadius: 5)
|
|
@@ -168,10 +168,10 @@ struct DevServersView: View {
|
|
|
168
168
|
} label: {
|
|
169
169
|
HStack {
|
|
170
170
|
Image(systemName: "doc.fill")
|
|
171
|
-
.
|
|
171
|
+
.foregroundStyle(Color.blue)
|
|
172
172
|
.frame(width: 12)
|
|
173
173
|
Text("Load embedded bundle")
|
|
174
|
-
.
|
|
174
|
+
.foregroundStyle(Color.primary)
|
|
175
175
|
Spacer()
|
|
176
176
|
Group {
|
|
177
177
|
if viewModel.isLoadingLocalBundle {
|
|
@@ -180,7 +180,7 @@ struct DevServersView: View {
|
|
|
180
180
|
} else {
|
|
181
181
|
Image(systemName: "chevron.right")
|
|
182
182
|
.font(.caption)
|
|
183
|
-
.
|
|
183
|
+
.foregroundStyle(Color.secondary)
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
.frame(width: 20, height: 20)
|
|
@@ -196,7 +196,7 @@ struct DevServersView: View {
|
|
|
196
196
|
HStack {
|
|
197
197
|
Text("development servers".uppercased())
|
|
198
198
|
.font(.caption)
|
|
199
|
-
.
|
|
199
|
+
.foregroundStyle(Color.primary.opacity(0.6))
|
|
200
200
|
|
|
201
201
|
Spacer()
|
|
202
202
|
|
|
@@ -205,7 +205,7 @@ struct DevServersView: View {
|
|
|
205
205
|
} label: {
|
|
206
206
|
Text("info".uppercased())
|
|
207
207
|
#if os(tvOS)
|
|
208
|
-
.
|
|
208
|
+
.foregroundStyle(Color.primary)
|
|
209
209
|
.font(.system(size: 24))
|
|
210
210
|
#else
|
|
211
211
|
.font(.system(size: 12))
|
|
@@ -221,10 +221,10 @@ struct DevServersView: View {
|
|
|
221
221
|
} label: {
|
|
222
222
|
Text("Connect")
|
|
223
223
|
.font(.headline)
|
|
224
|
-
.
|
|
224
|
+
.foregroundStyle(Color.expoSystemBackground)
|
|
225
225
|
.frame(maxWidth: .infinity)
|
|
226
226
|
.padding()
|
|
227
|
-
.background(urlText.isEmpty ? Color.gray : Color.
|
|
227
|
+
.background(urlText.isEmpty ? Color.gray : Color.primary)
|
|
228
228
|
.clipShape(RoundedRectangle(cornerRadius: 8))
|
|
229
229
|
}
|
|
230
230
|
.disabled(urlText.isEmpty)
|
|
@@ -243,10 +243,10 @@ struct HiddenDevServersNotice: View {
|
|
|
243
243
|
var body: some View {
|
|
244
244
|
HStack(spacing: 6) {
|
|
245
245
|
Image(systemName: "line.3.horizontal.decrease.circle")
|
|
246
|
-
.
|
|
246
|
+
.foregroundStyle(Color.secondary)
|
|
247
247
|
Text(message)
|
|
248
248
|
.font(.system(size: 13))
|
|
249
|
-
.
|
|
249
|
+
.foregroundStyle(Color.secondary)
|
|
250
250
|
Spacer()
|
|
251
251
|
}
|
|
252
252
|
.padding(.horizontal)
|
|
@@ -271,17 +271,17 @@ struct DevServerRow: View {
|
|
|
271
271
|
|
|
272
272
|
if server.description == server.url {
|
|
273
273
|
Text(server.description)
|
|
274
|
-
.
|
|
274
|
+
.foregroundStyle(Color.primary)
|
|
275
275
|
.lineLimit(1)
|
|
276
276
|
} else {
|
|
277
277
|
VStack(alignment: .leading) {
|
|
278
278
|
Text(server.description)
|
|
279
279
|
.font(.headline)
|
|
280
|
-
.
|
|
280
|
+
.foregroundStyle(Color.primary)
|
|
281
281
|
.lineLimit(1)
|
|
282
282
|
Text(server.url)
|
|
283
283
|
.font(.caption)
|
|
284
|
-
.
|
|
284
|
+
.foregroundStyle(Color.secondary)
|
|
285
285
|
.lineLimit(1)
|
|
286
286
|
}
|
|
287
287
|
}
|
|
@@ -289,13 +289,13 @@ struct DevServerRow: View {
|
|
|
289
289
|
Spacer()
|
|
290
290
|
|
|
291
291
|
Group {
|
|
292
|
-
if viewModel.
|
|
292
|
+
if viewModel.loadingServerURL == server.url {
|
|
293
293
|
ProgressView()
|
|
294
294
|
.controlSize(.small)
|
|
295
295
|
} else {
|
|
296
296
|
Image(systemName: "chevron.right")
|
|
297
297
|
.font(.caption)
|
|
298
|
-
.
|
|
298
|
+
.foregroundStyle(Color.secondary)
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
301
|
.frame(width: 20, height: 20)
|
|
@@ -19,7 +19,7 @@ struct ErrorView: View {
|
|
|
19
19
|
|
|
20
20
|
Text("This development build encountered the following error:")
|
|
21
21
|
.font(.body)
|
|
22
|
-
.
|
|
22
|
+
.foregroundStyle(Color.secondary)
|
|
23
23
|
.multilineTextAlignment(.leading)
|
|
24
24
|
}
|
|
25
25
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
@@ -32,7 +32,7 @@ struct ErrorView: View {
|
|
|
32
32
|
}
|
|
33
33
|
.background(Color.expoSystemBackground)
|
|
34
34
|
#if !os(macOS)
|
|
35
|
-
.
|
|
35
|
+
.toolbar(.hidden, for: .navigationBar)
|
|
36
36
|
#endif
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -47,14 +47,14 @@ struct ErrorView: View {
|
|
|
47
47
|
} else {
|
|
48
48
|
Text(error.message)
|
|
49
49
|
.font(.system(.caption, design: .monospaced))
|
|
50
|
-
.
|
|
50
|
+
.foregroundStyle(Color.primary)
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
.padding()
|
|
54
54
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
55
55
|
}
|
|
56
56
|
.background(Color.expoSystemGray6)
|
|
57
|
-
.cornerRadius
|
|
57
|
+
.clipShape(RoundedRectangle(cornerRadius: 8))
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
private var errorText: String {
|
|
@@ -76,22 +76,22 @@ struct ErrorView: View {
|
|
|
76
76
|
Button(action: onReload) {
|
|
77
77
|
Text("Reload")
|
|
78
78
|
.font(.headline)
|
|
79
|
-
.
|
|
79
|
+
.foregroundStyle(Color.expoSystemBackground)
|
|
80
80
|
.frame(maxWidth: .infinity)
|
|
81
81
|
.padding()
|
|
82
|
-
.background(Color.
|
|
83
|
-
.cornerRadius
|
|
82
|
+
.background(Color.primary)
|
|
83
|
+
.clipShape(RoundedRectangle(cornerRadius: 8))
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
HStack(spacing: 6) {
|
|
87
87
|
Button(action: onGoHome) {
|
|
88
88
|
Text("Go home")
|
|
89
89
|
.font(.headline)
|
|
90
|
-
.
|
|
90
|
+
.foregroundStyle(Color.primary)
|
|
91
91
|
.frame(maxWidth: .infinity)
|
|
92
92
|
.padding()
|
|
93
93
|
.background(Color.expoSystemGray5)
|
|
94
|
-
.cornerRadius
|
|
94
|
+
.clipShape(RoundedRectangle(cornerRadius: 8))
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
#if !os(tvOS)
|
|
@@ -109,11 +109,11 @@ struct ErrorView: View {
|
|
|
109
109
|
}) {
|
|
110
110
|
Text(copied ? "Copied!" : "Copy")
|
|
111
111
|
.font(.headline)
|
|
112
|
-
.
|
|
112
|
+
.foregroundStyle(Color.primary)
|
|
113
113
|
.frame(maxWidth: .infinity)
|
|
114
114
|
.padding()
|
|
115
115
|
.background(Color.expoSystemGray5)
|
|
116
|
-
.cornerRadius
|
|
116
|
+
.clipShape(RoundedRectangle(cornerRadius: 8))
|
|
117
117
|
}
|
|
118
118
|
#endif
|
|
119
119
|
}
|
|
@@ -2,68 +2,78 @@
|
|
|
2
2
|
// swiftlint:disable closure_body_length
|
|
3
3
|
|
|
4
4
|
import SwiftUI
|
|
5
|
+
import ExpoModulesCore
|
|
5
6
|
|
|
6
7
|
struct HomeTabView: View {
|
|
7
8
|
@EnvironmentObject var viewModel: DevLauncherViewModel
|
|
8
9
|
@State private var showingInfoDialog = false
|
|
9
10
|
|
|
10
11
|
var body: some View {
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
ScrollView {
|
|
13
|
+
VStack(spacing: 20) {
|
|
14
|
+
DevelopmentBuildCaption()
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
crashReportBanner
|
|
18
|
-
}
|
|
16
|
+
if viewModel.hasStoredCrash {
|
|
17
|
+
crashReportBanner
|
|
18
|
+
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
#if !targetEnvironment(simulator)
|
|
21
|
+
if viewModel.permissionStatus == .denied {
|
|
22
|
+
NetworkPermissionsBanner()
|
|
23
|
+
}
|
|
24
|
+
#endif
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
DevServersView(showingInfoDialog: $showingInfoDialog)
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
#if os(tvOS)
|
|
39
|
-
.font(.system(size: 24))
|
|
40
|
-
#else
|
|
41
|
-
.font(.system(size: 12))
|
|
42
|
-
#endif
|
|
28
|
+
if !viewModel.recentlyOpenedApps.isEmpty {
|
|
29
|
+
VStack(alignment: .leading, spacing: 0) {
|
|
30
|
+
HStack {
|
|
31
|
+
Text("recently opened".uppercased())
|
|
32
|
+
.font(.caption)
|
|
33
|
+
.foregroundStyle(Color.primary.opacity(0.6))
|
|
34
|
+
Spacer()
|
|
35
|
+
Button("reset".uppercased()) {
|
|
36
|
+
viewModel.clearRecentlyOpenedApps()
|
|
43
37
|
}
|
|
38
|
+
#if os(tvOS)
|
|
39
|
+
.font(.system(size: 24))
|
|
40
|
+
#else
|
|
41
|
+
.font(.system(size: 12))
|
|
42
|
+
#endif
|
|
43
|
+
}
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
45
|
+
LazyVStack(spacing: 6) {
|
|
46
|
+
ForEach(viewModel.recentlyOpenedApps) { app in
|
|
47
|
+
RecentlyOpenedAppRow(app: app) {
|
|
48
|
+
viewModel.openApp(url: app.url)
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
|
-
.padding(.top)
|
|
53
51
|
}
|
|
52
|
+
.padding(.top)
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
|
-
.padding()
|
|
57
55
|
}
|
|
58
|
-
|
|
59
|
-
.
|
|
60
|
-
await viewModel.refreshDevServers()
|
|
61
|
-
}
|
|
62
|
-
#endif
|
|
56
|
+
.padding()
|
|
57
|
+
.maxContentWidth()
|
|
63
58
|
}
|
|
59
|
+
#if !os(tvOS)
|
|
60
|
+
.refreshable {
|
|
61
|
+
await viewModel.refreshDevServers()
|
|
62
|
+
}
|
|
63
|
+
#endif
|
|
64
64
|
#if os(tvOS)
|
|
65
65
|
.background()
|
|
66
66
|
#endif
|
|
67
|
+
.devLauncherToolbar()
|
|
68
|
+
.toolbar {
|
|
69
|
+
if let appIcon = viewModel.appIcon {
|
|
70
|
+
ToolbarItem(placement: .navigation) {
|
|
71
|
+
AppIconImage(image: appIcon)
|
|
72
|
+
}
|
|
73
|
+
.sharedBackgroundHidden()
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
.modifier(DevelopmentBuildSubtitle())
|
|
67
77
|
.onAppear {
|
|
68
78
|
viewModel.loadRecentlyOpenedApps()
|
|
69
79
|
}
|
|
@@ -79,14 +89,67 @@ struct HomeTabView: View {
|
|
|
79
89
|
label: {
|
|
80
90
|
Text("The last time you tried to open an app the development build crashed. Tap to get more information.")
|
|
81
91
|
.font(.body)
|
|
82
|
-
.
|
|
92
|
+
.foregroundStyle(Color.primary)
|
|
83
93
|
.multilineTextAlignment(.leading)
|
|
84
94
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
85
95
|
.padding()
|
|
86
96
|
}
|
|
87
97
|
.buttonStyle(PlainButtonStyle())
|
|
88
98
|
.background(Color.expoSecondarySystemGroupedBackground)
|
|
89
|
-
.cornerRadius
|
|
99
|
+
.clipShape(RoundedRectangle(cornerRadius: 18))
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
private struct AppIconImage: View {
|
|
104
|
+
let image: UIImage
|
|
105
|
+
|
|
106
|
+
var body: some View {
|
|
107
|
+
Image(uiImage: image)
|
|
108
|
+
.resizable()
|
|
109
|
+
.scaledToFit()
|
|
110
|
+
.frame(width: 28, height: 28)
|
|
111
|
+
.clipShape(RoundedRectangle(cornerRadius: 6, style: .continuous))
|
|
112
|
+
.accessibilityHidden(true)
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
private struct DevelopmentBuildSubtitle: ViewModifier {
|
|
117
|
+
func body(content: Content) -> some View {
|
|
118
|
+
#if os(iOS)
|
|
119
|
+
if #available(iOS 26.0, *) {
|
|
120
|
+
content.navigationSubtitle("Development Build")
|
|
121
|
+
} else {
|
|
122
|
+
content
|
|
123
|
+
}
|
|
124
|
+
#elseif os(macOS)
|
|
125
|
+
content.navigationSubtitle("Development Build")
|
|
126
|
+
#else
|
|
127
|
+
content
|
|
128
|
+
#endif
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
private struct DevelopmentBuildCaption: View {
|
|
133
|
+
var body: some View {
|
|
134
|
+
if showsCaption {
|
|
135
|
+
Text("Development Build")
|
|
136
|
+
.font(.subheadline)
|
|
137
|
+
.foregroundStyle(Color.secondary)
|
|
138
|
+
.frame(maxWidth: .infinity, alignment: .leading)
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
private var showsCaption: Bool {
|
|
143
|
+
#if os(iOS)
|
|
144
|
+
if #available(iOS 26.0, *) {
|
|
145
|
+
return false
|
|
146
|
+
}
|
|
147
|
+
return true
|
|
148
|
+
#elseif os(tvOS)
|
|
149
|
+
return true
|
|
150
|
+
#else
|
|
151
|
+
return false
|
|
152
|
+
#endif
|
|
90
153
|
}
|
|
91
154
|
}
|
|
92
155
|
|
|
@@ -102,26 +165,26 @@ struct NetworkPermissionsBanner: View {
|
|
|
102
165
|
HStack {
|
|
103
166
|
Image(systemName: "wifi.exclamationmark")
|
|
104
167
|
.font(.title2)
|
|
105
|
-
.
|
|
168
|
+
.foregroundStyle(Color.orange)
|
|
106
169
|
VStack(alignment: .leading, spacing: 4) {
|
|
107
170
|
Text("Local Network Access Disabled")
|
|
108
171
|
.font(.subheadline)
|
|
109
172
|
.fontWeight(.semibold)
|
|
110
|
-
.
|
|
173
|
+
.foregroundStyle(Color.primary)
|
|
111
174
|
Text("Dev servers can't be discovered. Tap to open Settings and enable Local Network access.")
|
|
112
175
|
.font(.footnote)
|
|
113
|
-
.
|
|
176
|
+
.foregroundStyle(Color.secondary)
|
|
114
177
|
.multilineTextAlignment(.leading)
|
|
115
178
|
}
|
|
116
179
|
Spacer()
|
|
117
180
|
Image(systemName: "gear")
|
|
118
|
-
.
|
|
181
|
+
.foregroundStyle(Color.secondary)
|
|
119
182
|
}
|
|
120
183
|
.padding()
|
|
121
184
|
}
|
|
122
185
|
.buttonStyle(PlainButtonStyle())
|
|
123
186
|
.background(Color.expoSecondarySystemGroupedBackground)
|
|
124
|
-
.cornerRadius
|
|
187
|
+
.clipShape(RoundedRectangle(cornerRadius: 18))
|
|
125
188
|
}
|
|
126
189
|
}
|
|
127
190
|
// swiftlint:enable closure_body_length
|
|
@@ -37,7 +37,7 @@ struct LocalNetworkPermissionView: View {
|
|
|
37
37
|
|
|
38
38
|
Text("Expo Dev Launcher needs to access your local network to discover development servers running on your computer.")
|
|
39
39
|
.font(.body)
|
|
40
|
-
.
|
|
40
|
+
.foregroundStyle(Color.secondary)
|
|
41
41
|
.multilineTextAlignment(.center)
|
|
42
42
|
.fixedSize(horizontal: false, vertical: true)
|
|
43
43
|
|
|
@@ -100,12 +100,12 @@ struct LocalNetworkPermissionView: View {
|
|
|
100
100
|
.padding()
|
|
101
101
|
}
|
|
102
102
|
.background(Color.accentColor)
|
|
103
|
-
.
|
|
104
|
-
.cornerRadius
|
|
103
|
+
.foregroundStyle(Color.white)
|
|
104
|
+
.clipShape(RoundedRectangle(cornerRadius: 12))
|
|
105
105
|
|
|
106
106
|
Text("When the system prompt pops up, tap \"Allow\" to continue.")
|
|
107
107
|
.font(.footnote)
|
|
108
|
-
.
|
|
108
|
+
.foregroundStyle(Color.secondary)
|
|
109
109
|
.multilineTextAlignment(.center)
|
|
110
110
|
.fixedSize(horizontal: false, vertical: true)
|
|
111
111
|
}
|
|
@@ -122,8 +122,8 @@ struct LocalNetworkPermissionView: View {
|
|
|
122
122
|
.padding()
|
|
123
123
|
}
|
|
124
124
|
.background(Color.accentColor)
|
|
125
|
-
.
|
|
126
|
-
.cornerRadius
|
|
125
|
+
.foregroundStyle(Color.white)
|
|
126
|
+
.clipShape(RoundedRectangle(cornerRadius: 12))
|
|
127
127
|
|
|
128
128
|
checkAccessButton(label: "I was not prompted") { verdict in
|
|
129
129
|
handleCheckVerdict(verdict, onGranted: { showAlreadyGrantedAlert = true })
|
|
@@ -135,7 +135,7 @@ struct LocalNetworkPermissionView: View {
|
|
|
135
135
|
Group {
|
|
136
136
|
Text("Local network permission was not granted. Enable it in Settings \u{2192} Privacy & Security \u{2192} Local Network.")
|
|
137
137
|
.font(.footnote)
|
|
138
|
-
.
|
|
138
|
+
.foregroundStyle(Color.secondary)
|
|
139
139
|
.multilineTextAlignment(.center)
|
|
140
140
|
.fixedSize(horizontal: false, vertical: true)
|
|
141
141
|
|
|
@@ -152,8 +152,8 @@ struct LocalNetworkPermissionView: View {
|
|
|
152
152
|
.padding()
|
|
153
153
|
}
|
|
154
154
|
.background(Color.expoSecondarySystemBackground)
|
|
155
|
-
.
|
|
156
|
-
.cornerRadius
|
|
155
|
+
.foregroundStyle(Color.primary)
|
|
156
|
+
.clipShape(RoundedRectangle(cornerRadius: 12))
|
|
157
157
|
|
|
158
158
|
checkAccessButton(label: "Try Again") { verdict in
|
|
159
159
|
handleCheckVerdict(verdict, onGranted: {
|
|
@@ -171,8 +171,8 @@ struct LocalNetworkPermissionView: View {
|
|
|
171
171
|
.padding()
|
|
172
172
|
}
|
|
173
173
|
.background(Color.expoSecondarySystemBackground)
|
|
174
|
-
.
|
|
175
|
-
.cornerRadius
|
|
174
|
+
.foregroundStyle(Color.secondary)
|
|
175
|
+
.clipShape(RoundedRectangle(cornerRadius: 12))
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
|
|
@@ -219,8 +219,8 @@ struct LocalNetworkPermissionView: View {
|
|
|
219
219
|
}
|
|
220
220
|
.disabled(isCheckingAccess)
|
|
221
221
|
.background(Color.expoSecondarySystemBackground)
|
|
222
|
-
.
|
|
223
|
-
.cornerRadius
|
|
222
|
+
.foregroundStyle(Color.secondary)
|
|
223
|
+
.clipShape(RoundedRectangle(cornerRadius: 12))
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Copyright 2015-present 650 Industries. All rights reserved.
|
|
2
|
+
|
|
3
|
+
import SwiftUI
|
|
4
|
+
|
|
5
|
+
enum DevLauncherTab {
|
|
6
|
+
case home
|
|
7
|
+
case updates
|
|
8
|
+
case settings
|
|
9
|
+
|
|
10
|
+
var title: String {
|
|
11
|
+
switch self {
|
|
12
|
+
case .home: return "Home"
|
|
13
|
+
case .updates: return "Updates"
|
|
14
|
+
case .settings: return "Settings"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
var systemImage: String {
|
|
19
|
+
switch self {
|
|
20
|
+
case .home: return "house.fill"
|
|
21
|
+
case .updates: return "arrow.2.circlepath"
|
|
22
|
+
case .settings: return "gearshape"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
struct TabNavigation<Content: View>: View {
|
|
28
|
+
let tab: DevLauncherTab
|
|
29
|
+
let title: String?
|
|
30
|
+
let content: Content
|
|
31
|
+
|
|
32
|
+
init(_ tab: DevLauncherTab, title: String? = nil, @ViewBuilder content: () -> Content) {
|
|
33
|
+
self.tab = tab
|
|
34
|
+
self.title = title
|
|
35
|
+
self.content = content()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
var body: some View {
|
|
39
|
+
NavigationStack {
|
|
40
|
+
content
|
|
41
|
+
.navigationTitle(title ?? tab.title)
|
|
42
|
+
#if os(iOS)
|
|
43
|
+
.navigationBarTitleDisplayMode(.large)
|
|
44
|
+
#endif
|
|
45
|
+
}
|
|
46
|
+
.tabItem {
|
|
47
|
+
Label(tab.title, systemImage: tab.systemImage)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// Copyright 2015-present 650 Industries. All rights reserved.
|
|
2
|
+
|
|
3
|
+
import SwiftUI
|
|
4
|
+
|
|
5
|
+
extension View {
|
|
6
|
+
func devLauncherToolbar() -> some View {
|
|
7
|
+
toolbar {
|
|
8
|
+
ToolbarItem(placement: .primaryAction) {
|
|
9
|
+
AccountButton()
|
|
10
|
+
}
|
|
11
|
+
.verticalBarPreferred()
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
extension ToolbarContent {
|
|
17
|
+
@ToolbarContentBuilder
|
|
18
|
+
func verticalBarPreferred() -> some ToolbarContent {
|
|
19
|
+
#if os(iOS) && compiler(>=6.4)
|
|
20
|
+
if #available(iOS 27.1, *) {
|
|
21
|
+
axisBehavior(.verticalPreferred)
|
|
22
|
+
} else {
|
|
23
|
+
self
|
|
24
|
+
}
|
|
25
|
+
#else
|
|
26
|
+
self
|
|
27
|
+
#endif
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@ToolbarContentBuilder
|
|
31
|
+
func sharedBackgroundHidden() -> some ToolbarContent {
|
|
32
|
+
#if os(iOS) || os(macOS)
|
|
33
|
+
if #available(iOS 26.0, macOS 26.0, *) {
|
|
34
|
+
sharedBackgroundVisibility(.hidden)
|
|
35
|
+
} else {
|
|
36
|
+
self
|
|
37
|
+
}
|
|
38
|
+
#else
|
|
39
|
+
self
|
|
40
|
+
#endif
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
private struct AccountButton: View {
|
|
45
|
+
@EnvironmentObject var viewModel: DevLauncherViewModel
|
|
46
|
+
@EnvironmentObject var navigation: DevLauncherNavigation
|
|
47
|
+
|
|
48
|
+
var body: some View {
|
|
49
|
+
Button {
|
|
50
|
+
navigation.showUserProfile()
|
|
51
|
+
} label: {
|
|
52
|
+
if viewModel.isAuthenticated, let account = viewModel.selectedAccount {
|
|
53
|
+
AccountAvatar(account: account)
|
|
54
|
+
} else {
|
|
55
|
+
Image(systemName: "person.crop.circle")
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
.accessibilityLabel("Account")
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private struct AccountAvatar: View {
|
|
63
|
+
let account: UserAccount
|
|
64
|
+
|
|
65
|
+
var body: some View {
|
|
66
|
+
let isOrganization = account.ownerUserActor == nil
|
|
67
|
+
let profilePhoto = account.ownerUserActor?.profilePhoto
|
|
68
|
+
let name = account.ownerUserActor?.fullName ?? account.name
|
|
69
|
+
|
|
70
|
+
if isOrganization {
|
|
71
|
+
let color = getAvatarColor(for: String(name.first ?? "o"))
|
|
72
|
+
|
|
73
|
+
Circle()
|
|
74
|
+
.fill(color.background)
|
|
75
|
+
.frame(width: 28, height: 28)
|
|
76
|
+
.overlay(
|
|
77
|
+
Image(systemName: "building.2")
|
|
78
|
+
.font(.system(size: 12))
|
|
79
|
+
.foregroundStyle(color.foreground)
|
|
80
|
+
)
|
|
81
|
+
} else if let profilePhoto,
|
|
82
|
+
!profilePhoto.isEmpty,
|
|
83
|
+
let url = URL(string: profilePhoto) {
|
|
84
|
+
Avatar(url: url) { image in
|
|
85
|
+
image
|
|
86
|
+
.resizable()
|
|
87
|
+
.scaledToFill()
|
|
88
|
+
} placeholder: {
|
|
89
|
+
Circle()
|
|
90
|
+
.fill(Color.expoSystemGray5)
|
|
91
|
+
.overlay(
|
|
92
|
+
Image(systemName: "person")
|
|
93
|
+
.font(.system(size: 14))
|
|
94
|
+
.foregroundStyle(Color.secondary)
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
.frame(width: 28, height: 28)
|
|
98
|
+
.clipShape(Circle())
|
|
99
|
+
.id("\(account.id)-\(profilePhoto)")
|
|
100
|
+
} else {
|
|
101
|
+
let firstLetter = (account.ownerUserActor?.username ?? account.name).prefix(1).uppercased()
|
|
102
|
+
let color = getAvatarColor(for: String(firstLetter))
|
|
103
|
+
|
|
104
|
+
Circle()
|
|
105
|
+
.fill(color.background)
|
|
106
|
+
.frame(width: 28, height: 28)
|
|
107
|
+
.overlay(
|
|
108
|
+
Text(firstLetter)
|
|
109
|
+
.font(.system(size: 12, weight: .medium))
|
|
110
|
+
.foregroundStyle(color.foreground)
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|