Skip to content

chore: update code to support Amplify 2.45.0 #99

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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
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
Loading