Skip to content

Commit

Permalink
chore: kickoff release
Browse files Browse the repository at this point in the history
  • Loading branch information
harsh62 authored Jul 13, 2023
2 parents 5268948 + 27278f7 commit c5655b1
Show file tree
Hide file tree
Showing 59 changed files with 386 additions and 212 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ orbs:
parameters:
xcode-version:
type: string
default: 13.4.1
default: 14.3.0
simulator-device:
type: string
default: iPhone 13
Expand Down Expand Up @@ -102,7 +102,7 @@ orbs:

defaults: &defaults
macos:
xcode: '14.0.0'
xcode: '14.3.0'
resource_class: macos.x86.medium.gen2
environment:
BUNDLE_JOBS: 4
Expand Down Expand Up @@ -184,7 +184,7 @@ jobs:
parameters:
xcode-version:
type: string
default: 14.0.0
default: 14.3.0
scheme:
type: string
sdk:
Expand Down
38 changes: 21 additions & 17 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ body:
id: amplify-version
attributes:
label: Amplify Framework Version
placeholder: e.g. 1.5.3
placeholder: e.g. 2.12.0
validations:
required: true
- type: dropdown
Expand Down Expand Up @@ -65,25 +65,21 @@ body:
id: swift
attributes:
label: Swift version
placeholder: e.g. 5.0
placeholder: e.g. 5.8
validations:
required: true
- type: input
id: cli
attributes:
label: CLI version
placeholder: |
- e.g. 4.41.2
- Run `amplify version`
placeholder: e.g. 12.1.1 -- run `amplify version`
validations:
required: true
- type: input
id: xcode
attributes:
label: Xcode version
placeholder: |
- e.g. 12.4 (12D4e)
- Run `xcodebuild -version`
placeholder: e.g. 14.3.1 (14E300c) -- run `xcodebuild -version`
validations:
required: true
- type: textarea
Expand Down Expand Up @@ -117,21 +113,29 @@ body:
attributes:
label: Regression additional context
placeholder: If it was a regression provide the versions used before and after the upgrade.

- type: dropdown
id: platforms
attributes:
label: Platforms
multiple: true
options:
- iOS
- macOS
- tvOS
- watchOS
- visionOS (Preview)
- type: input
id: device
id: os-version
attributes:
label: Device
placeholder: |
- e.g. iPhone6
- Simulator
label: OS Version
placeholder: e.g. iOS 15.3 / macOS 11.0
validations:
required: true
- type: input
id: ios-version
id: device
attributes:
label: iOS Version
placeholder: e.g. iOS 11
label: Device
placeholder: e.g. iPhone6
validations:
required: true
- type: input
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/integ_test_storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ permissions:

jobs:
storage-integration-test-iOS:
runs-on: macos-12
runs-on: macos-13
environment: IntegrationTest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
Expand All @@ -32,6 +32,8 @@ jobs:
with:
project_path: ./AmplifyPlugins/Storage/Tests/StorageHostApp/
scheme: AWSS3StoragePluginIntegrationTests
destination: 'platform=iOS Simulator,name=iPhone 14,OS=latest'
xcode_path: '/Applications/Xcode_14.3.app'

storage-integration-test-tvOS:
runs-on: macos-13
Expand Down
11 changes: 6 additions & 5 deletions Amplify/Categories/DataStore/Model/Internal/Model+Codable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,12 @@ extension Model where Self: Codable {
/// application making any change to these `public` types should be backward compatible, otherwise it will be a
/// breaking change.
public func toJSON(encoder: JSONEncoder? = nil) throws -> String {
let resolvedEncoder: JSONEncoder
if let encoder = encoder {
resolvedEncoder = encoder
} else {
resolvedEncoder = JSONEncoder(dateEncodingStrategy: ModelDateFormatting.encodingStrategy)
var resolvedEncoder = encoder ?? JSONEncoder(
dateEncodingStrategy: ModelDateFormatting.encodingStrategy
)

if isKnownUniquelyReferenced(&resolvedEncoder) {
resolvedEncoder.outputFormatting = .sortedKeys
}

let data = try resolvedEncoder.encode(self)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ extension ModelValueConverter {
}

static var jsonEncoder: JSONEncoder {
JSONEncoder(dateEncodingStrategy: ModelDateFormatting.encodingStrategy)
let encoder = JSONEncoder(dateEncodingStrategy: ModelDateFormatting.encodingStrategy)
encoder.outputFormatting = .sortedKeys
return encoder
}

/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used
Expand Down
42 changes: 42 additions & 0 deletions Amplify/Core/Plugin/Internal/Plugin+Resettable.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//
// Copyright Amazon.com Inc. or its affiliates.
// All Rights Reserved.
//
// SPDX-License-Identifier: Apache-2.0
//

public extension Resettable where Self: Plugin {
/// A default conformance if the plugin has no reset logic
///
/// **Warning**
///
/// This conformance will take precedence over a non-async `reset` method in an async context. Thus, given a plugin like:
/// ```swift
/// class MyPlugin: Plugin {
/// // Not invoked during `await Amplify.reset()`
/// func reset() { ... }
/// }
/// ```
///
/// The `MyPlugin.reset()` method will never be called during an invocation of `await Amplify.reset()`. Ensure
/// plugin `reset()` methods are always declared `async`:
/// ```swift
/// class MyPlugin: Plugin {
/// // Invoked during `await Amplify.reset()`
/// func reset() async { ... }
/// }
/// ```
///
/// As a best practice, always invoke `reset` through the Resettable protocol existential, rather than the concrete conforming
/// type, especially in tests:
/// ```swift
/// func testReset() async {
/// let resettable = plugin as Resettable
/// await resettable.reset()
/// // ... assert that the plugin state has been cleared
/// }
/// ```
func reset() async {
// Do nothing
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ final public class AWSUnifiedLoggingPlugin: LoggingCategoryPlugin {
}

/// Removes listeners and empties the message queue
public func reset() {
public func reset() async {
concurrencyQueue.sync {
registeredLogs = [:]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ extension AWSAPIPlugin: Resettable {
authService = nil

reachabilityMapLock.execute {
reachabilityMap.removeAll()
reachabilityMap.removeAll()
}

subscriptionConnectionFactory = nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
// SPDX-License-Identifier: Apache-2.0
//

import Amplify
import XCTest
@testable import AWSAPIPlugin

class AWSAPICategoryPluginResetTests: AWSAPICategoryPluginTestBase {

func testReset() async {
await apiPlugin.reset()
let resettable = apiPlugin as Resettable
await resettable.reset()

XCTAssertNotNil(apiPlugin.mapper)
XCTAssertEqual(apiPlugin.mapper.operations.count, 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class GraphQLMutateCombineTests: OperationTestBase {
}
})

waitForExpectations(timeout: 0.05)
waitForExpectations(timeout: 1.0)
sink.cancel()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation

extension AWSPinpointAnalyticsPlugin {
/// Resets the state of the plugin
public func reset() {
public func reset() async {
if pinpoint != nil {
pinpoint = nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
// SPDX-License-Identifier: Apache-2.0
//

import Amplify
@_spi(InternalAWSPinpoint) import InternalAWSPinpoint
@testable import AWSPinpointAnalyticsPlugin
import XCTest

class AWSPinpointAnalyticsPluginResetTests: AWSPinpointAnalyticsPluginTestBase {
func testReset() {
analyticsPlugin.reset()
func testReset() async {
let resettable = analyticsPlugin as Resettable
await resettable.reset()

XCTAssertNil(analyticsPlugin.pinpoint)
XCTAssertNil(analyticsPlugin.globalProperties)
XCTAssertNil(analyticsPlugin.isEnabled)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class AWSPinpointAnalyticsPluginTestBase: XCTestCase {

override func tearDown() async throws {
await Amplify.reset()
analyticsPlugin.reset()
let resettable = analyticsPlugin as Resettable
await resettable.reset()
}
}

This file was deleted.

Loading

0 comments on commit c5655b1

Please sign in to comment.