Skip to content

Commit

Permalink
chore: update code to support Amplify 2.45.0 (#99)
Browse files Browse the repository at this point in the history
* chore: update code to support Amplify 2.45.0

* try latest os version for unit tests to avoid random failures
  • Loading branch information
harsh62 authored Nov 26, 2024
1 parent e763a80 commit a94155b
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ on:

jobs:
unit-test-ios:
runs-on: macos-latest
runs-on: macos-15
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: Unit test Authenticator on iOS
run: xcodebuild test -scheme Authenticator -sdk 'iphonesimulator' -destination 'platform=iOS Simulator,name=iPhone 14,OS=latest' -derivedDataPath Build/ -enableCodeCoverage YES -clonedSourcePackagesDirPath ~/Library/Developer/Xcode/DerivedData/Authenticator | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]}
run: xcodebuild test -scheme Authenticator -sdk 'iphonesimulator' -destination 'platform=iOS Simulator,name=iPhone 16,OS=latest' -derivedDataPath Build/ -enableCodeCoverage YES -clonedSourcePackagesDirPath ~/Library/Developer/Xcode/DerivedData/Authenticator | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]}
- name: Generate Coverage Report
continue-on-error: true
run: |
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 1.2.2 (2024-11-26)

### Misc. Updates
- Updating code to support Amplify 2.45+

## 1.2.1 (2024-11-21)

### Misc. Updates
Expand Down
16 changes: 8 additions & 8 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/aws-amplify/amplify-swift",
"state" : {
"revision" : "aef29d1665f9fad1c88fa6a781b8c847913dd7c6",
"version" : "2.44.0"
"revision" : "e43c65c2840c4b0a05d604125c8aedf97e16de89",
"version" : "2.45.0"
}
},
{
Expand All @@ -23,26 +23,26 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/awslabs/aws-crt-swift",
"state" : {
"revision" : "7b42e0343f28b3451aab20840dc670abd12790bd",
"version" : "0.36.0"
"revision" : "3f844bef042cc0a4c3381f7090414ce3f9a7e935",
"version" : "0.37.0"
}
},
{
"identity" : "aws-sdk-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/awslabs/aws-sdk-swift.git",
"state" : {
"revision" : "828358a2c39d138325b0f87a2d813f4b972e5f4f",
"version" : "1.0.0"
"revision" : "c6c1064da9bfccb119a7a8ab9ba636fb3bbfa6f5",
"version" : "1.0.47"
}
},
{
"identity" : "smithy-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/smithy-lang/smithy-swift",
"state" : {
"revision" : "0ed3440f8c41e27a0937364d5035d2d4fefb8aa3",
"version" : "0.71.0"
"revision" : "3cd9f181b3ba8ff71da43bf53c09f8de6790a4ad",
"version" : "0.96.0"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let package = Package(
targets: ["Authenticator"]),
],
dependencies: [
.package(url: "https://github.com/aws-amplify/amplify-swift", "2.44.0"..<"2.45.0")
.package(url: "https://github.com/aws-amplify/amplify-swift", from: "2.45.0")
],
targets: [
.target(
Expand Down
2 changes: 1 addition & 1 deletion Sources/Authenticator/Constants/ComponentInformation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
import Foundation

public class ComponentInformation {
public static let version = "1.2.1"
public static let version = "1.2.2"
public static let name = "amplify-ui-swift-authenticator"
}
2 changes: 2 additions & 0 deletions Sources/Authenticator/States/AuthenticatorBaseState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ public class AuthenticatorBaseState: ObservableObject {
credentials.message = self.error(for: error)
return .signIn
}
default:
throw AuthError.unknown("Unsupported next step: \(result.nextStep)", nil)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ class MockAuthenticationService: AuthenticationService {
throw AuthenticatorError.error(message: "Unable to confirm sign in")
}

func autoSignIn() async throws -> AuthSignInResult {
fatalError("Unsupported operation in Authenticator")
}

var mockedCurrentUser: AuthUser?
func getCurrentUser() async throws -> AuthUser {
if let mockedCurrentUser = mockedCurrentUser {
Expand Down Expand Up @@ -195,6 +199,20 @@ class MockAuthenticationService: AuthenticationService {
func verifyTOTPSetup(code: String, options: VerifyTOTPSetupRequest.Options?) async throws {

}

// MARK: - WebAuthn

func associateWebAuthnCredential(presentationAnchor: AuthUIPresentationAnchor?, options: AuthAssociateWebAuthnCredentialRequest.Options?) async throws {
fatalError("Unsupported operation in Authenticator")
}

func listWebAuthnCredentials(options: AuthListWebAuthnCredentialsRequest.Options?) async throws -> AuthListWebAuthnCredentialsResult {
fatalError("Unsupported operation in Authenticator")
}

func deleteWebAuthnCredential(credentialId: String, options: AuthDeleteWebAuthnCredentialRequest.Options?) async throws {
fatalError("Unsupported operation in Authenticator")
}
}

extension MockAuthenticationService {
Expand Down
26 changes: 22 additions & 4 deletions Tests/AuthenticatorTests/Mocks/MockAuthenticationService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ class MockAuthenticationService: AuthenticationService {
throw AuthenticatorError.error(message: "Unable to confirm sign in")
}

func autoSignIn() async throws -> AuthSignInResult {
fatalError("Unsupported operation in Authenticator")
}

var mockedCurrentUser: AuthUser?
func getCurrentUser() async throws -> AuthUser {
if let mockedCurrentUser = mockedCurrentUser {
Expand Down Expand Up @@ -74,7 +78,7 @@ class MockAuthenticationService: AuthenticationService {
func signUp(username: String, password: String?, options: AuthSignUpRequest.Options?) async throws -> AuthSignUpResult {
signUpCount += 1
signUpParams = (username, password)

if let mockedSignUpResult = mockedSignUpResult {
return mockedSignUpResult
}
Expand Down Expand Up @@ -188,14 +192,28 @@ class MockAuthenticationService: AuthenticationService {
func forgetDevice(_ device: AuthDevice?, options: AuthForgetDeviceRequest.Options?) async throws {}

func rememberDevice(options: AuthRememberDeviceRequest.Options?) async throws {}

// MARK: - TOTP

func setUpTOTP() async throws -> TOTPSetupDetails {
return .init(sharedSecret: "", username: "")
}

func verifyTOTPSetup(code: String, options: VerifyTOTPSetupRequest.Options?) async throws {}

// MARK: - WebAuthn

func associateWebAuthnCredential(presentationAnchor: AuthUIPresentationAnchor?, options: AuthAssociateWebAuthnCredentialRequest.Options?) async throws {
fatalError("Unsupported operation in Authenticator")
}

func listWebAuthnCredentials(options: AuthListWebAuthnCredentialsRequest.Options?) async throws -> AuthListWebAuthnCredentialsResult {
fatalError("Unsupported operation in Authenticator")
}

func deleteWebAuthnCredential(credentialId: String, options: AuthDeleteWebAuthnCredentialRequest.Options?) async throws {
fatalError("Unsupported operation in Authenticator")
}
}

extension MockAuthenticationService {
Expand Down

0 comments on commit a94155b

Please sign in to comment.