Skip to content

Commit

Permalink
chore: kickoff release
Browse files Browse the repository at this point in the history
  • Loading branch information
lawmicha authored Jun 10, 2024
2 parents fa6ca64 + 53d0fff commit 2b9ed60
Show file tree
Hide file tree
Showing 62 changed files with 350 additions and 326 deletions.
68 changes: 0 additions & 68 deletions .swiftpm/xcode/xcshareddata/xcschemes/Amplify-Package.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -482,34 +482,6 @@
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AWSPluginsSDKCore"
BuildableName = "AWSPluginsSDKCore"
BlueprintName = "AWSPluginsSDKCore"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AmplifyCredentials"
BuildableName = "AmplifyCredentials"
BlueprintName = "AmplifyCredentials"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
Expand Down Expand Up @@ -783,46 +755,6 @@
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AmplifyNetworkUnitTests"
BuildableName = "AmplifyNetworkUnitTests"
BlueprintName = "AmplifyNetworkUnitTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "InternalAmplifyNetworkUnitTests"
BuildableName = "InternalAmplifyNetworkUnitTests"
BlueprintName = "InternalAmplifyNetworkUnitTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AWSPluginsSDKCoreTests"
BuildableName = "AWSPluginsSDKCoreTests"
BlueprintName = "AWSPluginsSDKCoreTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AmplifyCredentialsTests"
BuildableName = "AmplifyCredentialsTests"
BlueprintName = "AmplifyCredentialsTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
Expand Down
1 change: 1 addition & 0 deletions Amplify/Core/Support/DeviceInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import AppKit
/// ```
///
/// - Tag: DeviceInfo
@MainActor
public struct DeviceInfo {

private init() {}
Expand Down
1 change: 1 addition & 0 deletions Amplify/DevMenu/Data/DeviceInfoHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Foundation
import UIKit

/// Helper class to fetch information for Device Information Screen
@MainActor
struct DeviceInfoHelper {

static func getDeviceInformation() -> [DeviceInfoItem] {
Expand Down
1 change: 1 addition & 0 deletions Amplify/DevMenu/Data/IssueInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import Foundation

/// Struct consisting of information required to report an issue
@MainActor
struct IssueInfo {

private var includeEnvironmentInfo: Bool
Expand Down
1 change: 1 addition & 0 deletions Amplify/DevMenu/Data/IssueInfoHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import Foundation

/// Helper class to generate markdown text for issue reporting
@MainActor
struct IssueInfoHelper {

private static let issueDescTitle = "Issue Description"
Expand Down
8 changes: 0 additions & 8 deletions Amplify/DevMenu/Trigger/LongPressGestureRecognizer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,5 @@ class LongPressGestureRecognizer: NSObject, TriggerRecognizer, UIGestureRecogniz
uiWindow?.addGestureRecognizer(recognizer)
recognizer.delegate = self
}

deinit {
if let window = uiWindow {
window.removeGestureRecognizer(recognizer)
}
uiWindow = nil
triggerDelegate = nil
}
}
#endif
55 changes: 31 additions & 24 deletions Amplify/DevMenu/View/IssueReporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,36 +95,42 @@ struct IssueReporter: View {

/// Open Amplify iOS issue logging screen on Github
private func reportToGithub() {
let issueDescriptionMarkdown =
IssueInfoHelper.generateMarkdownForIssue(
issue: IssueInfo(issueDescription: issueDescription,
includeEnvInfo: includeEnvInfo,
includeDeviceInfo: includeDeviceInfo))

let urlString = amplifyIosNewIssueUrl + issueDescriptionMarkdown
guard let url = urlString.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) else {
showAlertIfInvalidURL = true
return
}
guard let urlToOpen = URL(string: url) else {
showAlertIfInvalidURL = true
return
Task {
let issue = await IssueInfo(issueDescription: issueDescription,
includeEnvInfo: includeEnvInfo,
includeDeviceInfo: includeDeviceInfo)
let issueDescriptionMarkdown =
await IssueInfoHelper.generateMarkdownForIssue(
issue: issue)

let urlString = amplifyIosNewIssueUrl + issueDescriptionMarkdown
guard let url = urlString.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) else {
showAlertIfInvalidURL = true
return
}
guard let urlToOpen = URL(string: url) else {
showAlertIfInvalidURL = true
return
}

await UIApplication.shared.open(urlToOpen)
}

UIApplication.shared.open(urlToOpen)
}

/// Copy issue as a markdown string to clipboard
private func copyToClipboard() {
let issue = IssueInfo(issueDescription: issueDescription,
includeEnvInfo: includeEnvInfo,
includeDeviceInfo: includeDeviceInfo)
let value = IssueInfoHelper.generateMarkdownForIssue(issue: issue)
#if os(iOS)
UIPasteboard.general.string = value
#elseif canImport(AppKit)
NSPasteboard.general.setString(value, forType: .string)
#endif
Task {
let issue = await IssueInfo(issueDescription: issueDescription,
includeEnvInfo: includeEnvInfo,
includeDeviceInfo: includeDeviceInfo)
let value = await IssueInfoHelper.generateMarkdownForIssue(issue: issue)
#if os(iOS)
UIPasteboard.general.string = value
#elseif canImport(AppKit)
NSPasteboard.general.setString(value, forType: .string)
#endif
}
}
}

Expand Down Expand Up @@ -166,6 +172,7 @@ final class MultilineTextField: UIViewRepresentable {
return view
}

@MainActor
@objc func dismissKeyboard() {
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder),
to: nil, from: nil, for: nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import Foundation
import Amplify

@MainActor
struct ASFDeviceInfo: ASFDeviceBehavior {

let id: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ protocol AdvancedSecurityBehavior {
configuration: UserPoolConfigurationData) throws -> String
}

protocol ASFDeviceBehavior {
protocol ASFDeviceBehavior: Sendable {

var id: String { get }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ extension CognitoUserPoolASF {
static func encodedContext(username: String,
asfDeviceId: String,
asfClient: AdvancedSecurityBehavior,
userPoolConfiguration: UserPoolConfigurationData) -> String? {
let deviceInfo: ASFDeviceBehavior = ASFDeviceInfo(id: asfDeviceId)
userPoolConfiguration: UserPoolConfigurationData) async -> String? {
let deviceInfo: ASFDeviceBehavior = await ASFDeviceInfo(id: asfDeviceId)
let appInfo: ASFAppInfoBehavior = ASFAppInfo()

do {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct RefreshUserPoolTokens: Action {
for: existingSignedIndata.username,
credentialStoreClient: authEnv.credentialsClient)

let input = InitiateAuthInput.refreshAuthInput(
let input = await InitiateAuthInput.refreshAuthInput(
username: existingSignedIndata.username,
refreshToken: existingTokens.refreshToken,
clientMetadata: [:],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct ConfirmDevice: Action {
deviceKey: deviceMetadata.deviceKey,
password: deviceMetadata.deviceSecret)

let deviceName = DeviceInfo.current.name
let deviceName = await DeviceInfo.current.name

let base64EncodedVerifier = passwordVerifier.passwordVerifier.base64EncodedString()
let base64EncodedSalt = passwordVerifier.salt.base64EncodedString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct InitiateCustomAuth: Action {
let asfDeviceId = try await CognitoUserPoolASF.asfDeviceID(
for: username,
credentialStoreClient: authEnv.credentialsClient)
let request = InitiateAuthInput.customAuth(
let request = await InitiateAuthInput.customAuth(
username: username,
clientMetadata: clientMetadata,
asfDeviceId: asfDeviceId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct InitiateAuthDeviceSRP: Action {
srpKeyPair: srpKeyPair,
clientTimestamp: Date())

let request = RespondToAuthChallengeInput.deviceSRP(
let request = await RespondToAuthChallengeInput.deviceSRP(
username: username,
environment: userPoolEnv,
deviceMetadata: deviceMetadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct VerifyDevicePasswordSRP: Action {
serverPublicBHexString: serverPublicB,
srpClient: srpClient)

let request = RespondToAuthChallengeInput.devicePasswordVerifier(
let request = await RespondToAuthChallengeInput.devicePasswordVerifier(
username: username,
stateData: stateData,
session: authResponse.session,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct InitializeHostedUISignIn: Action {
let asfDeviceId = try await CognitoUserPoolASF.asfDeviceID(
for: username,
credentialStoreClient: environment.credentialsClient)
let encodedData = CognitoUserPoolASF.encodedContext(
let encodedData = await CognitoUserPoolASF.encodedContext(
username: username,
asfDeviceId: asfDeviceId,
asfClient: environment.cognitoUserPoolASFFactory(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct InitiateMigrateAuth: Action {
let asfDeviceId = try await CognitoUserPoolASF.asfDeviceID(
for: username,
credentialStoreClient: authEnv.credentialsClient)
let request = InitiateAuthInput.migrateAuth(
let request = await InitiateAuthInput.migrateAuth(
username: username,
password: password,
clientMetadata: clientMetadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct InitiateAuthSRP: Action {
for: username,
credentialStoreClient: authEnv.credentialsClient)

let request = InitiateAuthInput.srpInput(
let request = await InitiateAuthInput.srpInput(
username: username,
publicSRPAHexValue: srpKeyPair.publicKeyHexValue,
authFlowType: authFlowType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct VerifyPasswordSRP: Action {
serverPublicBHexString: serverPublicB,
srpClient: srpClient,
poolId: userPoolEnv.userPoolConfiguration.poolId)
let request = RespondToAuthChallengeInput.passwordVerifier(
let request = await RespondToAuthChallengeInput.passwordVerifier(
username: username,
stateData: stateData,
session: authResponse.session,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct CompleteTOTPSetup: Action {
credentialStoreClient: authEnv.credentialsClient)

var userContextData: CognitoIdentityProviderClientTypes.UserContextDataType?
if let encodedData = CognitoUserPoolASF.encodedContext(
if let encodedData = await CognitoUserPoolASF.encodedContext(
username: username,
asfDeviceId: asfDeviceId,
asfClient: userpoolEnv.cognitoUserPoolASFFactory(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct VerifySignInChallenge: Action {
for: username,
with: environment)

let input = RespondToAuthChallengeInput.verifyChallenge(
let input = await RespondToAuthChallengeInput.verifyChallenge(
username: username,
challengeType: challengeType,
session: session,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class HostedUIASWebAuthenticationSession: NSObject, HostedUISessionBehavior {
#if os(iOS) || os(macOS)
extension HostedUIASWebAuthenticationSession: ASWebAuthenticationPresentationContextProviding {

@MainActor
func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor {
return webPresentation ?? ASPresentationAnchor()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ extension ConfirmSignUpInput {
asfDeviceId: String?,
forceAliasCreation: Bool?,
environment: UserPoolEnvironment
) {
) async {

let configuration = environment.userPoolConfiguration
let secretHash = ClientSecretHelper.calculateSecretHash(
username: username,
userPoolConfiguration: configuration)
var userContextData: CognitoIdentityProviderClientTypes.UserContextDataType?
if let asfDeviceId = asfDeviceId,
let encodedData = CognitoUserPoolASF.encodedContext(
let encodedData = await CognitoUserPoolASF.encodedContext(
username: username,
asfDeviceId: asfDeviceId,
asfClient: environment.cognitoUserPoolASFFactory(),
Expand Down
Loading

0 comments on commit 2b9ed60

Please sign in to comment.