Skip to content

Commit f81c1ac

Browse files
committed
chore: fix build warnings in amplify package
1 parent a5c3faf commit f81c1ac

File tree

42 files changed

+81
-82
lines changed

Some content is hidden

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

42 files changed

+81
-82
lines changed

Amplify/Categories/DataStore/Model/ModelIdentifiable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public extension DefaultModelIdentifier {
121121
// MARK: - Persistable + stringValue
122122
private extension Persistable {
123123
var stringValue: String {
124-
var value: String = switch self {
124+
let value: String = switch self {
125125
case let self as Temporal.Date:
126126
self.iso8601String
127127

Amplify/Core/Support/ChildTask.swift

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,28 @@ actor ChildTask<InProcess, Success, Failure: Error>: BufferingSequence {
3535

3636
var value: Success {
3737
get async throws {
38-
try await withTaskCancellationHandler(handler: {
39-
Task {
40-
await cancel()
41-
}
42-
}, operation: {
43-
try await withCheckedThrowingContinuation { continuation in
44-
if isCancelled {
45-
// immediately cancel is already cancelled
46-
continuation.resume(throwing: CancellationError())
47-
} else if let result = storedResult {
48-
// immediately send result if it is available
49-
valueContinuations.append(continuation)
50-
send(result)
51-
} else {
52-
// capture contination to use later
53-
valueContinuations.append(continuation)
38+
try await withTaskCancellationHandler(
39+
operation: {
40+
try await withCheckedThrowingContinuation { continuation in
41+
if isCancelled {
42+
// immediately cancel is already cancelled
43+
continuation.resume(throwing: CancellationError())
44+
} else if let result = storedResult {
45+
// immediately send result if it is available
46+
valueContinuations.append(continuation)
47+
send(result)
48+
} else {
49+
// capture contination to use later
50+
valueContinuations.append(continuation)
51+
}
52+
}
53+
},
54+
onCancel: {
55+
Task {
56+
await cancel()
5457
}
5558
}
56-
})
59+
)
5760
}
5861
}
5962

Amplify/DevMenu/Trigger/LongPressGestureRecognizer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010
import UIKit
1111

1212
/// A class for recognizing long press gesture which notifies a `TriggerDelegate` of the event
13-
class LongPressGestureRecognizer: NSObject, @preconcurrency TriggerRecognizer, UIGestureRecognizerDelegate {
13+
class LongPressGestureRecognizer: NSObject, TriggerRecognizer, UIGestureRecognizerDelegate {
1414

1515
weak var triggerDelegate: TriggerDelegate?
1616
weak var uiWindow: UIWindow?

AmplifyPlugins/API/Tests/AWSAPIPluginTests/AppSyncRealTimeClient/AppSyncRealTimeClientTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class AppSyncRealTimeClientTests: XCTestCase {
5858
}
5959
Task {
6060
try await Task.sleep(nanoseconds: 80 * 1_000)
61-
await appSyncClient.subject.send(.success(.init(id: nil, payload: nil, type: .connectionAck)))
61+
appSyncClient.subject.send(.success(.init(id: nil, payload: nil, type: .connectionAck)))
6262
}
6363
await fulfillment(of: [finishExpectation], timeout: timeout + 1)
6464
}
@@ -90,7 +90,7 @@ class AppSyncRealTimeClientTests: XCTestCase {
9090
}
9191
Task {
9292
try await Task.sleep(nanoseconds: 80 * 1_000)
93-
await appSyncClient.subject.send(.success(.init(
93+
appSyncClient.subject.send(.success(.init(
9494
id: id,
9595
payload: .object([
9696
"errors": .array([
@@ -133,7 +133,7 @@ class AppSyncRealTimeClientTests: XCTestCase {
133133

134134
Task {
135135
try await Task.sleep(nanoseconds: 80 * 1_000)
136-
await appSyncClient.subject.send(.success(.init(
136+
appSyncClient.subject.send(.success(.init(
137137
id: id,
138138
payload: .object([
139139
"errors": .array([
@@ -180,7 +180,7 @@ class AppSyncRealTimeClientTests: XCTestCase {
180180

181181
Task {
182182
try await Task.sleep(nanoseconds: 80 * 1_000)
183-
await appSyncClient.subject.send(.success(.init(
183+
appSyncClient.subject.send(.success(.init(
184184
id: id,
185185
payload: .object([
186186
"errors": .array([

AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/AWSCognitoAuthPlugin+AppSyncSigner.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ extension AWSCognitoAuthPlugin {
111111
return nil
112112
}
113113

114-
var headers = urlRequest.allHTTPHeaderFields ?? [:]
114+
let headers = urlRequest.allHTTPHeaderFields ?? [:]
115115
let httpMethod = (urlRequest.httpMethod?.uppercased())
116116
.flatMap(HTTPMethodType.init(rawValue:)) ?? .get
117117

AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/Configuration/InitializeAuthorizationConfiguration.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct InitializeAuthorizationConfiguration: Action {
1919
) async {
2020
// ATM this is a no-op action
2121
logVerbose("\(#fileID) Starting execution", environment: environment)
22-
var event = switch storedCredentials {
22+
let event = switch storedCredentials {
2323
case .noCredentials:
2424
AuthorizationEvent(eventType: .configure)
2525
default:

AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/FetchAuthorizationSession/InformSessionError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct InformSessionError: Action {
1919
func execute(withDispatcher dispatcher: EventDispatcher, environment: Environment) async {
2020

2121
logVerbose("\(#fileID) Starting execution", environment: environment)
22-
var event: AuthorizationEvent = switch error {
22+
let event: AuthorizationEvent = switch error {
2323
case .service(let serviceError):
2424
if isNotAuthorizedError(serviceError) {
2525
.init(eventType: .throwError(

AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Models/AuthChallengeType.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ enum AuthChallengeType {
3434

3535
}
3636

37-
extension CognitoIdentityProviderClientTypes.ChallengeNameType: Codable {
37+
extension CognitoIdentityProviderClientTypes.ChallengeNameType: @retroactive Decodable, @retroactive Encodable {
3838
var authChallengeType: AuthChallengeType {
3939
switch self {
4040
case .customChallenge:

AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Operations/Helpers/FetchAuthSessionOperationHelper.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class FetchAuthSessionOperationHelper {
7575
) async throws -> AuthSession {
7676

7777
if forceRefresh || !credentials.areValid() {
78-
var event = switch credentials {
78+
let event = switch credentials {
7979
case .identityPoolWithFederation(let federatedToken, let identityId, _):
8080
AuthorizationEvent(eventType: .startFederationToIdentityPool(federatedToken, identityId))
8181
case .noCredentials:

AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Service/ErrorMapping/AuthErrorConvertible.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,3 @@ extension AuthError: AuthErrorConvertible {
1919
return self
2020
}
2121
}
22-
23-
extension AuthError: @unchecked Sendable { }

0 commit comments

Comments
 (0)