Skip to content

Commit 97fd6a4

Browse files
committed
Merge branch 'v.next' into Caleb/Fix-SampleIssues
2 parents c4f82e8 + c0e0121 commit 97fd6a4

File tree

52 files changed

+295
-110
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+295
-110
lines changed

Samples.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@
577577
D7AE861F2AC39E7F0049B626 /* DisplayAnnotationView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D7AE861D2AC39DC50049B626 /* DisplayAnnotationView.swift */; };
578578
D7AE86202AC3A1050049B626 /* AddCustomDynamicEntityDataSourceView.Vessel.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = 7900C5F52A83FC3F002D430F /* AddCustomDynamicEntityDataSourceView.Vessel.swift */; };
579579
D7AE86212AC3A10A0049B626 /* GroupLayersTogetherView.GroupLayerListView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D75C35662AB50338003CD55F /* GroupLayersTogetherView.GroupLayerListView.swift */; };
580+
D7AECFDD2E31448100FD312A /* View+OnTeardown.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7AECFDC2E31448100FD312A /* View+OnTeardown.swift */; };
580581
D7AECFE72E31699400FD312A /* ControlAnnotationSublayerVisibilityView.Model.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = 1C8438FA2DDCFCA9005CCBC7 /* ControlAnnotationSublayerVisibilityView.Model.swift */; };
581582
D7AECFE82E31699A00FD312A /* GenerateGeodatabaseReplicaFromFeatureServiceView.Model.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = 1C17E1CB2DE6456B00A012CB /* GenerateGeodatabaseReplicaFromFeatureServiceView.Model.swift */; };
582583
D7B759B32B1FFBE300017FDD /* FavoritesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7B759B22B1FFBE300017FDD /* FavoritesView.swift */; };
@@ -1346,6 +1347,7 @@
13461347
D7ABA2F82A32579C0021822B /* MeasureDistanceInSceneView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MeasureDistanceInSceneView.swift; sourceTree = "<group>"; };
13471348
D7ABA2FE2A32881C0021822B /* ShowViewshedFromGeoelementInSceneView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShowViewshedFromGeoelementInSceneView.swift; sourceTree = "<group>"; };
13481349
D7AE861D2AC39DC50049B626 /* DisplayAnnotationView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DisplayAnnotationView.swift; sourceTree = "<group>"; };
1350+
D7AECFDC2E31448100FD312A /* View+OnTeardown.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+OnTeardown.swift"; sourceTree = "<group>"; };
13491351
D7B759B22B1FFBE300017FDD /* FavoritesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoritesView.swift; sourceTree = "<group>"; };
13501352
D7BA38902BFBC476009954F5 /* EditFeaturesWithFeatureLinkedAnnotationView.Model.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EditFeaturesWithFeatureLinkedAnnotationView.Model.swift; sourceTree = "<group>"; };
13511353
D7BA38932BFBFC0F009954F5 /* QueryRelatedFeaturesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QueryRelatedFeaturesView.swift; sourceTree = "<group>"; };
@@ -1468,6 +1470,7 @@
14681470
D7A670D42DADB9630060E327 /* Bundle.swift */,
14691471
D7A670D62DADBC770060E327 /* EnvironmentValues+RequestReviewModel.swift */,
14701472
00181B452846AD7100654571 /* View+ErrorAlert.swift */,
1473+
D7AECFDC2E31448100FD312A /* View+OnTeardown.swift */,
14711474
D7142BC32DB71082004F87B7 /* View+PagePresentation.swift */,
14721475
);
14731476
path = Extensions;
@@ -4653,6 +4656,7 @@
46534656
00A7A14A2A2FC5B700F035F7 /* DisplayContentOfUtilityNetworkContainerView.Model.swift in Sources */,
46544657
E004A6F0284E4B9B002A1FE6 /* DownloadVectorTilesToLocalCacheView.swift in Sources */,
46554658
00ABA94E2BF6721700C0488C /* ShowGridView.swift in Sources */,
4659+
D7AECFDD2E31448100FD312A /* View+OnTeardown.swift in Sources */,
46564660
1CAB8D4E2A3CEAB0002AA649 /* RunValveIsolationTraceView.swift in Sources */,
46574661
D7A737E02BABB9FE00B7C7FC /* AugmentRealityToShowHiddenInfrastructureView.swift in Sources */,
46584662
4D2ADC4329C26D05003B367F /* AddDynamicEntityLayerView.swift in Sources */,

Scripts/CI/common.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ def __init__(self, folder_path: str):
275275

276276
# A list of ArcGIS Portal Item IDs.
277277
self.offline_data = [] # Default to empty list.
278+
self.has_teardown = False # Only applies to samples that require async tear down (e.g., authentication).
278279

279280
self.folder_path = folder_path
280281
self.folder_name = get_folder_name_from_path(folder_path)
@@ -372,6 +373,9 @@ def flush_to_json_string(self) -> str:
372373
data["relevant_apis"] = self.relevant_apis
373374
data["snippets"] = self.snippets
374375
data["title"] = self.title
376+
if self.has_teardown:
377+
# Only write has_teardown when it is True.
378+
data["has_teardown"] = self.has_teardown
375379
if self.offline_data:
376380
# Only write offline_data when it is not empty.
377381
data["offline_data"] = self.offline_data

Scripts/CI/metadata_checker.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ def run_check(path: str) -> None:
5252
# The special rule not to compare the redirect_from.
5353
checker.redirect_from = json_data['redirect_from']
5454

55+
# The special rule not to compare has_teardown.
56+
if 'has_teardown' in json_data:
57+
checker.has_teardown = json_data['has_teardown']
58+
5559
# The special rule not to compare offline_data.
5660
if 'offline_data' in json_data:
5761
checker.offline_data = json_data['offline_data']

Scripts/GenerateSampleViewSourceCode.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ private struct SampleMetadata: Decodable {
4343
let keywords: [String]
4444
/// The relevant APIs of the sample.
4545
let relevantApis: [String]
46+
/// A Boolean value indicating whether a sample has an action that needs to
47+
/// be performed when its view disappears.
48+
let hasTeardown: Bool? // swiftlint:disable:this discouraged_optional_boolean
4649
}
4750

4851
extension SampleMetadata {
@@ -130,6 +133,7 @@ private let sampleStructs = sampleMetadata
130133
var snippets: [String] { \(sample.snippets) }
131134
var tags: Set<String> { \(sample.tags) }
132135
\(portalItemIDs.isEmpty ? "" : "var hasDependencies: Bool { true }\n")
136+
var hasTeardown: Bool { \(sample.hasTeardown ?? false) }
133137
func makeBody() -> AnyView { .init(\(sample.viewName)()) }
134138
}
135139
"""

Scripts/create-metadata-from-README.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ def flush_to_json_file(self, path_to_json: str) -> None:
4949
data["relevant_apis"] = self.relevant_apis
5050
data["snippets"] = self.snippets
5151
data["title"] = self.title
52+
if self.has_teardown:
53+
# Only write has_teardown when it is True.
54+
data["has_teardown"] = self.has_teardown
5255
if self.offline_data:
5356
# Only write offline_data when it is not empty.
5457
data["offline_data"] = self.offline_data

Shared/Samples/Add KML layer/AddKMLLayerView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ private extension AddKMLLayerView {
7676

7777
/// A KML layer created from a web URL.
7878
let urlLayer: KMLLayer = {
79-
let url = URL(string: "https://www.wpc.ncep.noaa.gov/kml/noaa_chart/WPC_Day1_SigWx.kml")!
79+
let url = URL(string: "https://www.spc.noaa.gov/products/outlook/SPC_outlooks.kml")!
8080
let kmlDataset = KMLDataset(url: url)
8181
return KMLLayer(dataset: kmlDataset)
8282
}()

Shared/Samples/Add KML layer/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ This sample uses the [US State Capitals](https://www.arcgis.com/home/item.html?i
3232

3333
This sample displays three different KML files:
3434

35-
* From URL: This is a map of the significant weather outlook produced by NOAA/NWS. It uses KML network links to always show the latest data.
35+
* From URL: This is a map of the convective outlook produced by NOAA/NWS Storm Prediction Center. It uses KML network links to always show the latest data.
3636
* From local file: This is a map of U.S. state capitals. It doesn't define an icon, so the default pushpin is used for the points.
3737
* From portal item: This is a map of U.S. states.
3838

Shared/Samples/Add feature layers/AddFeatureLayersView.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,11 @@ struct AddFeatureLayersView: View {
5353
// specified credentials and tokens for any challenges.
5454
ArcGISEnvironment.authenticationManager.arcGISAuthenticationChallengeHandler = ChallengeHandler()
5555
}
56-
.onDisappear {
57-
// Resets the URL session challenge handler to use default handling.
56+
.onTeardown {
57+
// Resets the URL session challenge handler to use default handling
58+
// and removes all credentials.
5859
ArcGISEnvironment.authenticationManager.arcGISAuthenticationChallengeHandler = nil
60+
ArcGISEnvironment.authenticationManager.arcGISCredentialStore.removeAll()
5961
}
6062
}
6163
}

Shared/Samples/Add feature layers/README.metadata.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"category": "Layers",
33
"description": "Display feature layers from various data sources.",
4+
"has_teardown": true,
45
"ignore": false,
56
"images": [
67
"add-feature-layers.png"

Shared/Samples/Add items to portal/AddItemsToPortalView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ struct AddItemsToPortalView: View {
9292
apiKey = ArcGISEnvironment.apiKey
9393
ArcGISEnvironment.apiKey = nil
9494
}
95-
.onDisappear {
95+
.onTeardown {
9696
// Resetting the challenge handlers and clearing credentials here in
9797
// `onDisappear` so user is prompted to enter credentials every time
9898
// trying the sample. In real world applications, do these from
@@ -103,7 +103,7 @@ struct AddItemsToPortalView: View {
103103

104104
// Sets the API key back to the original value.
105105
ArcGISEnvironment.apiKey = apiKey
106-
Task { await signOut() }
106+
await signOut()
107107
}
108108
}
109109

0 commit comments

Comments
 (0)