expo-dev-launcher 58.0.19 → 58.0.21

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/android/build.gradle +2 -2
  3. package/android/src/debug/java/expo/modules/devlauncher/compose/models/ProfileViewModel.kt +1 -1
  4. package/android/src/debug/java/expo/modules/devlauncher/compose/ui/AppHeader.kt +1 -1
  5. package/android/src/debug/java/expo/modules/devlauncher/services/GraphQLService.kt +15 -7
  6. package/ios/DevLauncherNetworkInterceptor.swift +1 -1
  7. package/ios/SwiftUI/AccountSheet.swift +37 -41
  8. package/ios/SwiftUI/CrashReportView.swift +11 -11
  9. package/ios/SwiftUI/Data.swift +4 -9
  10. package/ios/SwiftUI/DevLauncherViewController.swift +38 -4
  11. package/ios/SwiftUI/DevLauncherViewModel.swift +22 -8
  12. package/ios/SwiftUI/DevLauncherViews.swift +20 -35
  13. package/ios/SwiftUI/DevServerFiltersView.swift +4 -4
  14. package/ios/SwiftUI/DevServerInfoModal.swift +2 -2
  15. package/ios/SwiftUI/DevServersView.swift +20 -20
  16. package/ios/SwiftUI/ErrorView.swift +11 -11
  17. package/ios/SwiftUI/GraphQL/Models.swift +10 -3
  18. package/ios/SwiftUI/GraphQL/Queries.swift +4 -3
  19. package/ios/SwiftUI/HomeTabView.swift +110 -47
  20. package/ios/SwiftUI/LocalNetworkPermissionView.swift +13 -13
  21. package/ios/SwiftUI/Navigation/DevLauncherTab.swift +50 -0
  22. package/ios/SwiftUI/Navigation/DevLauncherToolbar.swift +114 -0
  23. package/ios/SwiftUI/Navigation/Navigation.swift +0 -134
  24. package/ios/SwiftUI/SettingsTabView.swift +23 -35
  25. package/ios/SwiftUI/StackFrameView.swift +2 -2
  26. package/ios/SwiftUI/UpdatesTab/NotSignedInView.swift +4 -4
  27. package/ios/SwiftUI/UpdatesTab/NotUsingUpdatesView.swift +18 -22
  28. package/ios/SwiftUI/UpdatesTab/UpdateRow.swift +1 -1
  29. package/ios/SwiftUI/UpdatesTab/UpdatesListView.swift +21 -13
  30. package/ios/SwiftUI/UpdatesTab/UpdatesTabView.swift +5 -4
  31. package/ios/SwiftUI/Utils/Utils.swift +12 -2
  32. package/package.json +1 -1
@@ -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?.primaryAccountProfileImageUrl
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
+ }
@@ -1,17 +1,4 @@
1
- // swiftlint:disable closure_body_length
2
1
  import SwiftUI
3
- import ExpoModulesCore
4
-
5
- struct SafeAreaTopPadding: View {
6
- let manualInset: CGFloat
7
-
8
- var body: some View {
9
- if manualInset > 0 {
10
- Color.expoSystemBackground
11
- .frame(height: manualInset)
12
- }
13
- }
14
- }
15
2
 
16
3
  class DevLauncherNavigation: ObservableObject {
17
4
  @Binding var showingUserProfile: Bool
@@ -24,124 +11,3 @@ class DevLauncherNavigation: ObservableObject {
24
11
  showingUserProfile = true
25
12
  }
26
13
  }
27
-
28
- func loadAppIcon(from path: String) -> UIImage? {
29
- if let url = URL(string: path), url.isFileURL, let image = UIImage(contentsOfFile: url.path) {
30
- return image
31
- }
32
-
33
- return nil
34
- }
35
-
36
- struct DevLauncherNavigationHeader: View {
37
- @EnvironmentObject var viewModel: DevLauncherViewModel
38
- @EnvironmentObject var navigation: DevLauncherNavigation
39
-
40
- var body: some View {
41
- VStack(spacing: 0) {
42
- SafeAreaTopPadding(manualInset: viewModel.topSafeAreaInset)
43
- headerContent
44
- }
45
- }
46
-
47
- private var headerContent: some View {
48
- HStack {
49
- HStack(spacing: 12) {
50
- if let path = viewModel.buildInfo["appIcon"] as? String,
51
- let appIcon = loadAppIcon(from: path) {
52
- Image(uiImage: appIcon)
53
- .resizable()
54
- .scaledToFit()
55
- .frame(width: 32, height: 32)
56
- .clipShape(RoundedRectangle(cornerRadius: 8))
57
- }
58
-
59
- VStack(alignment: .leading, spacing: 2) {
60
- Text(viewModel.buildInfo["appName"] as? String ?? "")
61
- .font(.headline)
62
- .fontWeight(.semibold)
63
-
64
- Text("Development Build")
65
- .font(.caption)
66
- .foregroundColor(.secondary)
67
- }
68
- }
69
-
70
- Spacer()
71
-
72
- Button {
73
- navigation.showUserProfile()
74
- } label: {
75
- if viewModel.isAuthenticated, let selectedAccount = viewModel.selectedAccount {
76
- createAccountAvatar(account: selectedAccount)
77
- } else {
78
- ZStack {
79
- Circle()
80
- .fill(Color.expoSystemGray6)
81
- .frame(width: 36, height: 36)
82
-
83
- Image("user-icon", bundle: getDevLauncherBundle())
84
- .font(.headline)
85
- .tint(.gray.opacity(0.6))
86
- }
87
- }
88
- }
89
- }
90
- .padding(.horizontal)
91
- .padding(.vertical, 8)
92
- .background(Color.expoSystemBackground)
93
- }
94
-
95
- @ViewBuilder
96
- private func createAccountAvatar(account: UserAccount) -> some View {
97
- let isOrganization = account.ownerUserActor == nil
98
- let profilePhoto = account.ownerUserActor?.profilePhoto
99
- let name = account.ownerUserActor?.fullName ?? account.name
100
-
101
- if isOrganization {
102
- let color = getAvatarColor(for: String(name.first ?? "o"))
103
-
104
- Circle()
105
- .fill(color.background)
106
- .frame(width: 32, height: 32)
107
- .overlay(
108
- Image(systemName: "building.2")
109
- .font(.system(size: 14))
110
- .foregroundColor(color.foreground)
111
- )
112
- } else if let profilePhoto,
113
- !profilePhoto.isEmpty,
114
- let url = URL(string: profilePhoto) {
115
- Avatar(url: url) { image in
116
- image
117
- .resizable()
118
- .scaledToFill()
119
- } placeholder: {
120
- Circle()
121
- .fill(Color.expoSystemGray5)
122
- .overlay(
123
- Image(systemName: "person")
124
- .font(.system(size: 16))
125
- .foregroundColor(.secondary)
126
- )
127
- }
128
- .frame(width: 32, height: 32)
129
- .clipShape(Circle())
130
- .id("\(account.id)-\(profilePhoto)")
131
- } else {
132
- let firstLetter = (account.ownerUserActor?.username ?? account.name).prefix(1).uppercased()
133
- let color = getAvatarColor(for: String(firstLetter))
134
-
135
- Circle()
136
- .fill(color.background)
137
- .frame(width: 32, height: 32)
138
- .overlay(
139
- Text(firstLetter)
140
- .font(.system(size: 14, weight: .medium))
141
- .foregroundColor(color.foreground)
142
- )
143
- }
144
- }
145
- }
146
-
147
- // swiftlint:enable closure_body_length
@@ -9,7 +9,6 @@ private let selectedGesturesInfoMessage = "Selected gestures will toggle the dev
9
9
  struct SettingsTabView: View {
10
10
  @EnvironmentObject var viewModel: DevLauncherViewModel
11
11
  @State private var showCopiedMessage = false
12
- @State private var defaultPageSize: Int = 10
13
12
  @State private var showCacheClearedMessage = false
14
13
 
15
14
  private func createBuildInfoJSON() -> String {
@@ -32,8 +31,6 @@ struct SettingsTabView: View {
32
31
  var body: some View {
33
32
  ScrollView {
34
33
  VStack(alignment: .leading, spacing: 24) {
35
- SafeAreaTopPadding(manualInset: viewModel.topSafeAreaInset)
36
- titleSection
37
34
  launchBehaviour
38
35
  gestures
39
36
 
@@ -55,14 +52,12 @@ struct SettingsTabView: View {
55
52
  }
56
53
  }
57
54
  .padding()
55
+ .maxContentWidth()
58
56
  }
59
57
  .frame(maxWidth: .infinity, maxHeight: .infinity)
60
58
  #if os(tvOS)
61
59
  .background()
62
60
  #endif
63
- #if !os(macOS)
64
- .navigationBarHidden(true)
65
- #endif
66
61
  #if os(iOS) && !targetEnvironment(simulator)
67
62
  .task {
68
63
  viewModel.refreshPermissionStatus()
@@ -77,7 +72,7 @@ struct SettingsTabView: View {
77
72
  VStack(alignment: .leading) {
78
73
  Text("Launch behaviour".uppercased())
79
74
  .font(.caption)
80
- .foregroundColor(.primary.opacity(0.6))
75
+ .foregroundStyle(Color.primary.opacity(0.6))
81
76
 
82
77
  VStack(spacing: 0) {
83
78
  HStack {
@@ -105,22 +100,15 @@ struct SettingsTabView: View {
105
100
  .padding(.vertical, 12)
106
101
  }
107
102
  .background(Color.expoSecondarySystemBackground)
108
- .cornerRadius(12)
103
+ .clipShape(RoundedRectangle(cornerRadius: 12))
109
104
  }
110
105
  }
111
106
 
112
- private var titleSection: some View {
113
- Text("Settings")
114
- .font(.largeTitle)
115
- .fontWeight(.bold)
116
- .frame(maxWidth: .infinity, alignment: .leading)
117
- }
118
-
119
107
  private var gestures: some View {
120
108
  VStack(alignment: .leading) {
121
109
  Text("Menu Gestures".uppercased())
122
110
  .font(.caption)
123
- .foregroundColor(.primary.opacity(0.6))
111
+ .foregroundStyle(Color.primary.opacity(0.6))
124
112
 
125
113
  VStack(spacing: 0) {
126
114
  HStack {
@@ -146,7 +134,7 @@ struct SettingsTabView: View {
146
134
  .padding(.vertical, 12)
147
135
  }
148
136
  .background(Color.expoSecondarySystemBackground)
149
- .cornerRadius(12)
137
+ .clipShape(RoundedRectangle(cornerRadius: 12))
150
138
  }
151
139
  }
152
140
 
@@ -154,7 +142,7 @@ struct SettingsTabView: View {
154
142
  VStack(alignment: .leading, spacing: 8) {
155
143
  Text("system".uppercased())
156
144
  .font(.caption)
157
- .foregroundColor(.primary.opacity(0.6))
145
+ .foregroundStyle(Color.primary.opacity(0.6))
158
146
 
159
147
  VStack(spacing: 0) {
160
148
  version
@@ -166,7 +154,7 @@ struct SettingsTabView: View {
166
154
  copyToClipboardButton
167
155
  }
168
156
  .background(Color.expoSecondarySystemBackground)
169
- .cornerRadius(12)
157
+ .clipShape(RoundedRectangle(cornerRadius: 12))
170
158
  }
171
159
  }
172
160
 
@@ -175,7 +163,7 @@ struct SettingsTabView: View {
175
163
  Text("Version")
176
164
  Spacer()
177
165
  Text(viewModel.buildInfo["appVersion"] as? String ?? "")
178
- .foregroundColor(.secondary)
166
+ .foregroundStyle(Color.secondary)
179
167
  }
180
168
  .padding(.horizontal)
181
169
  .padding(.vertical, 12)
@@ -186,7 +174,7 @@ struct SettingsTabView: View {
186
174
  Text("Expires in")
187
175
  Spacer()
188
176
  Text(text)
189
- .foregroundColor(.secondary)
177
+ .foregroundStyle(Color.secondary)
190
178
  }
191
179
  .padding(.horizontal)
192
180
  .padding(.vertical, 12)
@@ -210,12 +198,12 @@ struct SettingsTabView: View {
210
198
  Text(showCopiedMessage ? "Copied to clipboard!" : "Copy system info")
211
199
  Spacer()
212
200
  Image(systemName: showCopiedMessage ? "checkmark" : "clipboard")
213
- .foregroundColor(.secondary)
201
+ .foregroundStyle(Color.secondary)
214
202
  }
215
203
  .contentShape(Rectangle())
216
204
  }
217
205
  .buttonStyle(.plain)
218
- .foregroundColor(showCopiedMessage ? .green : .primary)
206
+ .foregroundStyle(showCopiedMessage ? Color.green : Color.primary)
219
207
  .padding(.horizontal)
220
208
  .padding(.vertical, 12)
221
209
  #endif
@@ -229,7 +217,7 @@ struct SettingsTabView: View {
229
217
  VStack(alignment: .leading, spacing: 8) {
230
218
  Text("Debug Settings".uppercased())
231
219
  .font(.caption)
232
- .foregroundColor(.primary.opacity(0.6))
220
+ .foregroundStyle(Color.primary.opacity(0.6))
233
221
 
234
222
  VStack(spacing: 0) {
235
223
  clearNetworkCacheRow
@@ -237,7 +225,7 @@ struct SettingsTabView: View {
237
225
  defaultPageSizeRow
238
226
  }
239
227
  .background(Color.expoSecondarySystemBackground)
240
- .cornerRadius(12)
228
+ .clipShape(RoundedRectangle(cornerRadius: 12))
241
229
  }
242
230
  }
243
231
 
@@ -249,12 +237,12 @@ struct SettingsTabView: View {
249
237
  Text(showCacheClearedMessage ? "Network cache cleared!" : "Clear network cache")
250
238
  Spacer()
251
239
  Image(systemName: showCacheClearedMessage ? "checkmark" : "trash")
252
- .foregroundColor(showCacheClearedMessage ? .green : .secondary)
240
+ .foregroundStyle(showCacheClearedMessage ? Color.green : Color.secondary)
253
241
  }
254
242
  .contentShape(Rectangle())
255
243
  }
256
244
  .buttonStyle(.plain)
257
- .foregroundColor(showCacheClearedMessage ? .green : .primary)
245
+ .foregroundStyle(showCacheClearedMessage ? Color.green : Color.primary)
258
246
  .padding(.horizontal)
259
247
  .padding(.vertical, 12)
260
248
  }
@@ -265,7 +253,7 @@ struct SettingsTabView: View {
265
253
  Text("Sets the number of items fetched for branches and updates")
266
254
  .foregroundStyle(.secondary)
267
255
  .font(.footnote)
268
- Picker("", selection: $defaultPageSize) {
256
+ Picker("", selection: $viewModel.updatesPageSize) {
269
257
  Text("1").tag(1)
270
258
  Text("5").tag(5)
271
259
  Text("10").tag(10)
@@ -280,7 +268,7 @@ struct SettingsTabView: View {
280
268
  VStack(alignment: .leading, spacing: 8) {
281
269
  Text("EAS Update Configuration".uppercased())
282
270
  .font(.caption)
283
- .foregroundColor(.primary.opacity(0.6))
271
+ .foregroundStyle(Color.primary.opacity(0.6))
284
272
 
285
273
  VStack(alignment: .leading, spacing: 8) {
286
274
  Text(createEASConfigJSON())
@@ -293,7 +281,7 @@ struct SettingsTabView: View {
293
281
  .padding(.horizontal)
294
282
  .padding(.vertical, 12)
295
283
  .background(Color.expoSecondarySystemBackground)
296
- .cornerRadius(12)
284
+ .clipShape(RoundedRectangle(cornerRadius: 12))
297
285
  }
298
286
  }
299
287
 
@@ -347,7 +335,7 @@ struct SettingsTabView: View {
347
335
  }
348
336
  }
349
337
  .background(Color.expoSecondarySystemBackground)
350
- .cornerRadius(12)
338
+ .clipShape(RoundedRectangle(cornerRadius: 12))
351
339
  }
352
340
  }
353
341
 
@@ -357,9 +345,9 @@ struct SettingsTabView: View {
357
345
  Spacer()
358
346
  if let status = localNetworkStatus {
359
347
  Text(status.text)
360
- .foregroundColor(.secondary)
348
+ .foregroundStyle(Color.secondary)
361
349
  Image(systemName: status.icon)
362
- .foregroundColor(status.color)
350
+ .foregroundStyle(status.color)
363
351
  } else {
364
352
  ProgressView()
365
353
  }
@@ -380,12 +368,12 @@ struct SettingsTabView: View {
380
368
  Text("Open App Settings")
381
369
  Spacer()
382
370
  Image(systemName: "gear")
383
- .foregroundColor(.secondary)
371
+ .foregroundStyle(Color.secondary)
384
372
  }
385
373
  .contentShape(Rectangle())
386
374
  }
387
375
  .buttonStyle(.plain)
388
- .foregroundColor(.primary)
376
+ .foregroundStyle(Color.primary)
389
377
  .padding(.horizontal)
390
378
  .padding(.vertical, 12)
391
379
  #endif
@@ -11,7 +11,7 @@ struct StackFrameView: View {
11
11
  Text(frame.methodName ?? "Unknown method")
12
12
  .font(.system(.caption, design: .monospaced))
13
13
  .fontWeight(.medium)
14
- .foregroundColor(.primary)
14
+ .foregroundStyle(Color.primary)
15
15
 
16
16
  if let file = frame.file {
17
17
  VStack(alignment: .leading, spacing: 2) {
@@ -20,7 +20,7 @@ struct StackFrameView: View {
20
20
 
21
21
  Text("Line \(frame.lineNumber), Column \(frame.column)")
22
22
  .font(.system(.caption2, design: .monospaced))
23
- .foregroundColor(.secondary)
23
+ .foregroundStyle(Color.secondary)
24
24
  }
25
25
  }
26
26
  }
@@ -10,7 +10,7 @@ struct NotSignedInView: View {
10
10
  .scaledToFit()
11
11
  .frame(width: 44, height: 44)
12
12
  .rotationEffect(.degrees(-90))
13
- .foregroundColor(.blue)
13
+ .foregroundStyle(Color.blue)
14
14
 
15
15
  VStack(spacing: 8) {
16
16
  Text("Log in to view updates")
@@ -30,9 +30,9 @@ struct NotSignedInView: View {
30
30
  Text("Log in")
31
31
  .padding(.horizontal, 16)
32
32
  .padding(.vertical, 8)
33
- .background(Color.black)
34
- .cornerRadius(16)
35
- .foregroundColor(.white)
33
+ .background(Color.primary)
34
+ .clipShape(RoundedRectangle(cornerRadius: 16))
35
+ .foregroundStyle(Color.expoSystemBackground)
36
36
  .font(.system(size: 16, weight: .semibold))
37
37
  }
38
38
  }
@@ -2,31 +2,27 @@ import SwiftUI
2
2
 
3
3
  struct NotUsingUpdatesView: View {
4
4
  var body: some View {
5
- List {
6
- Section {
7
- VStack(spacing: 16) {
8
- Image(systemName: "exclamationmark.triangle")
9
- .resizable()
10
- .scaledToFit()
11
- .frame(width: 44, height: 44)
12
- .foregroundColor(.orange)
5
+ VStack(spacing: 16) {
6
+ Image(systemName: "exclamationmark.triangle")
7
+ .resizable()
8
+ .scaledToFit()
9
+ .frame(width: 44, height: 44)
10
+ .foregroundStyle(Color.orange)
13
11
 
14
- VStack(spacing: 8) {
15
- Text("EAS Update not configured")
16
- .font(.headline)
17
- .multilineTextAlignment(.center)
12
+ VStack(spacing: 8) {
13
+ Text("EAS Update not configured")
14
+ .font(.headline)
15
+ .multilineTextAlignment(.center)
18
16
 
19
- Text("This project is not configured to use EAS Update. Configure EAS Update to see available updates here.")
20
- .font(.system(size: 14))
21
- .multilineTextAlignment(.center)
22
- .foregroundStyle(.secondary)
17
+ Text("This project is not configured to use EAS Update. Configure EAS Update to see available updates here.")
18
+ .font(.system(size: 14))
19
+ .multilineTextAlignment(.center)
20
+ .foregroundStyle(.secondary)
23
21
 
24
- if let destination = URL(string: "https://docs.expo.dev/eas-update/getting-started/") {
25
- Link("Learn more about EAS Update", destination: destination)
26
- .font(.system(size: 14))
27
- .foregroundColor(.blue)
28
- }
29
- }
22
+ if let destination = URL(string: "https://docs.expo.dev/eas-update/getting-started/") {
23
+ Link("Learn more about EAS Update", destination: destination)
24
+ .font(.system(size: 14))
25
+ .foregroundStyle(Color.blue)
30
26
  }
31
27
  }
32
28
  }
@@ -24,7 +24,7 @@ struct UpdateRow: View {
24
24
  }
25
25
  .padding()
26
26
  .background(Color.expoSecondarySystemBackground)
27
- .cornerRadius(12)
27
+ .clipShape(RoundedRectangle(cornerRadius: 12))
28
28
  }
29
29
 
30
30
  private var openButton: some View {
@@ -1,6 +1,17 @@
1
1
  import SwiftUI
2
2
  // swiftlint:disable closure_body_length
3
3
 
4
+ private let isoFormatterWithFractionalSeconds: ISO8601DateFormatter = {
5
+ let formatter = ISO8601DateFormatter()
6
+ formatter.formatOptions = [.withInternetDateTime, .withFractionalSeconds]
7
+ return formatter
8
+ }()
9
+ private let isoFormatter = ISO8601DateFormatter()
10
+
11
+ private func createdAtDate(_ value: String) -> Date {
12
+ isoFormatterWithFractionalSeconds.date(from: value) ?? isoFormatter.date(from: value) ?? .distantPast
13
+ }
14
+
4
15
  struct UpdatesListView: View {
5
16
  @EnvironmentObject var viewModel: DevLauncherViewModel
6
17
  @State private var branches: [BranchWithUpdates] = []
@@ -21,11 +32,11 @@ struct UpdatesListView: View {
21
32
  applyFilters()
22
33
  }
23
34
  .font(.caption)
24
- .foregroundColor(.blue)
35
+ .foregroundStyle(Color.blue)
25
36
  }
26
37
  .padding()
27
38
  .background(Color.expoSecondarySystemBackground)
28
- .cornerRadius(12)
39
+ .clipShape(RoundedRectangle(cornerRadius: 12))
29
40
 
30
41
  if isLoading {
31
42
  loading
@@ -37,7 +48,7 @@ struct UpdatesListView: View {
37
48
  LazyVStack(alignment: .leading) {
38
49
  Text("Updates (\(filteredUpdates.count))".uppercased())
39
50
  .font(.caption)
40
- .foregroundColor(.primary.opacity(0.6))
51
+ .foregroundStyle(Color.primary.opacity(0.6))
41
52
  ForEach(filteredUpdates, id: \.update.id) { tuple in
42
53
  UpdateRow(update: tuple.update, branchName: tuple.branchName, isCompatible: viewModel.isCompatibleRuntime(tuple.update.runtimeVersion))
43
54
  }
@@ -78,7 +89,7 @@ struct UpdatesListView: View {
78
89
  appId: viewModel.structuredBuildInfo.appId,
79
90
  branchName: branch.name,
80
91
  page: 1,
81
- pageSize: 10
92
+ pageSize: viewModel.updatesPageSize
82
93
  )
83
94
 
84
95
  let branchWithUpdates = BranchWithUpdates(
@@ -126,16 +137,13 @@ struct UpdatesListView: View {
126
137
  }
127
138
 
128
139
  filtered.sort {
129
- let formatter = DateFormatter()
130
- formatter.dateFormat = "MMMM d, yyyy, h:mma"
131
-
132
- let date1 = formatter.date(from: $0.update.createdAt) ?? Date.distantPast
133
- let date2 = formatter.date(from: $1.update.createdAt) ?? Date.distantPast
140
+ let date1 = createdAtDate($0.update.createdAt)
141
+ let date2 = createdAtDate($1.update.createdAt)
134
142
 
135
143
  return sortByRecency ? date1 > date2 : date1 < date2
136
144
  }
137
145
 
138
- filteredUpdates = filtered
146
+ filteredUpdates = Array(filtered.prefix(viewModel.updatesPageSize))
139
147
  }
140
148
 
141
149
  private var loading: some View {
@@ -152,7 +160,7 @@ struct UpdatesListView: View {
152
160
  func createError(message: String) -> some View {
153
161
  VStack(spacing: 12) {
154
162
  Image(systemName: "exclamationmark.triangle")
155
- .foregroundColor(.red)
163
+ .foregroundStyle(Color.red)
156
164
  .font(.title2)
157
165
 
158
166
  Text("Error loading updates")
@@ -177,7 +185,7 @@ struct UpdatesListView: View {
177
185
  .resizable()
178
186
  .scaledToFit()
179
187
  .frame(width: 44, height: 44)
180
- .foregroundColor(.gray)
188
+ .foregroundStyle(Color.gray)
181
189
 
182
190
  if filterByCompatibility {
183
191
  VStack(spacing: 8) {
@@ -204,7 +212,7 @@ struct UpdatesListView: View {
204
212
  if let destination = URL(string: "https://docs.expo.dev/eas-update/getting-started/") {
205
213
  Link("Learn how to publish", destination: destination)
206
214
  .font(.system(size: 14))
207
- .foregroundColor(.blue)
215
+ .foregroundStyle(Color.blue)
208
216
  }
209
217
  }
210
218
  }
@@ -6,22 +6,23 @@ struct UpdatesTabView: View {
6
6
  @EnvironmentObject var viewModel: DevLauncherViewModel
7
7
 
8
8
  var body: some View {
9
- VStack(spacing: 0) {
10
- DevLauncherNavigationHeader()
11
-
12
- ScrollView {
9
+ ScrollView {
10
+ Group {
13
11
  if !viewModel.isLoggedIn {
14
12
  NotSignedInView()
15
13
  .padding()
16
14
  } else if !viewModel.structuredBuildInfo.usesEASUpdates {
17
15
  NotUsingUpdatesView()
16
+ .padding()
18
17
  } else {
19
18
  UpdatesListView()
20
19
  }
21
20
  }
21
+ .maxContentWidth()
22
22
  }
23
23
  #if os(tvOS)
24
24
  .background()
25
25
  #endif
26
+ .devLauncherToolbar()
26
27
  }
27
28
  }