Skip to content
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

feat: adding vision os preview #3898

Merged
merged 14 commits into from
Oct 21, 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
27 changes: 18 additions & 9 deletions .github/composite_actions/get_platform_parameters/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ runs:
run: |
INPUT_PLATFORM=${{ inputs.platform }}
case $INPUT_PLATFORM in
iOS|tvOS|watchOS|macOS) ;;
iOS|tvOS|watchOS|macOS|visionOS) ;;
*) echo "Unsupported platform: $INPUT_PLATFORM"; exit 1 ;;
esac
shell: bash

- id: get-xcode-version
run: |
LATEST_XCODE_VERSION=15.3.0
LATEST_XCODE_VERSION=16.0.0
MINIMUM_XCODE_VERSION=15.0.1

INPUT_XCODE_VERSION=${{ inputs.xcode_version }}
Expand All @@ -66,35 +66,44 @@ runs:

case $INPUT_PLATFORM/$INPUT_XCODE_VERSION in
iOS/latest)
DEVICE="iPhone 15"
OS_VERSION="17.4"
DEVICE="iPhone 16"
OS_VERSION="18.0"
;;
iOS/*)
DEVICE="iPhone 14"
OS_VERSION="17.0.1"
;;
tvOS/latest)
DEVICE="Apple TV 4K (3rd generation)"
OS_VERSION="17.4"
OS_VERSION="18.0"
;;
tvOS/*)
DEVICE="Apple TV 4K (3rd generation)"
OS_VERSION="17.0"
;;
watchOS/latest)
DEVICE="Apple Watch Series 9 (45mm)"
OS_VERSION="10.4"
DEVICE="Apple Watch Series 10 (46mm)"
OS_VERSION="11.0"
;;
watchOS/*)
DEVICE="Apple Watch Series 8 (45mm)"
OS_VERSION="10.0"
;;
visionOS/latest)
DEVICE="Apple Vision Pro"
OS_VERSION="2.0"
;;
visionOS/*)
DEVICE="Apple Vision Pro"
OS_VERSION="1.0"
;;
esac

DESTINATION_MAPPING="{
\"iOS\": \"platform=iOS Simulator,name=$DEVICE,OS=$OS_VERSION\",
\"tvOS\": \"platform=tvOS Simulator,name=$DEVICE,OS=$OS_VERSION\",
\"watchOS\": \"platform=watchOS Simulator,name=$DEVICE,OS=$OS_VERSION\",
\"visionOS\": \"platform=visionOS Simulator,name=$DEVICE,OS=$OS_VERSION\",
\"macOS\": \"platform=macOS,arch=arm64\"
}"

Expand All @@ -119,8 +128,8 @@ runs:
"iOS": "iphonesimulator",
"tvOS": "appletvsimulator",
"watchOS": "watchsimulator",
"visionOS": "xrsimulator",
"macOS": "macosx"
}'
echo "sdk=$(echo $SDK_MAPPING | jq -r .$INPUT_PLATFORM)" >> $GITHUB_OUTPUT
shell: bash

shell: bash
9 changes: 8 additions & 1 deletion .github/workflows/build_amplify_swift_platforms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ on:
required: true
default: true
type: boolean
visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

push:
branches-ignore:
- main
Expand All @@ -46,12 +52,13 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [iOS, macOS, tvOS, watchOS]
platform: [iOS, macOS, tvOS, watchOS, visionOS]
exclude:
- platform: ${{ github.event.inputs.ios == 'false' && 'iOS' || 'None' }}
- platform: ${{ github.event.inputs.macos == 'false' && 'macOS' || 'None' }}
- platform: ${{ github.event.inputs.tvos == 'false' && 'tvOS' || 'None' }}
- platform: ${{ github.event.inputs.watchos == 'false' && 'watchOS' || 'None' }}
- platform: ${{ github.event.inputs.visionos == 'false' && 'visionOS' || 'None' }}
uses: ./.github/workflows/build_scheme.yml
with:
scheme: Amplify-Package
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_scheme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:

os-runner:
type: string
default: 'macos-latest'
default: 'macos-15'

save_build_cache:
type: boolean
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
inputs:
os-runner:
type: string
default: 'macos-latest'
default: 'macos-15'
scheme:
description: 'The scheme to run the tests'
required: true
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/run_unit_tests_platforms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
os-runner:
description: 'runs-on input'
type: string
default: 'macos-latest'
default: 'macos-15'

permissions:
contents: read
Expand All @@ -35,12 +35,13 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [iOS, macOS, tvOS, watchOS]
platform: [iOS, macOS, tvOS, watchOS, visionOS]
exclude:
- platform: ${{ github.event.inputs.ios == 'false' && 'iOS' || 'None' }}
- platform: ${{ github.event.inputs.macos == 'false' && 'macOS' || 'None' }}
- platform: ${{ github.event.inputs.tvos == 'false' && 'tvOS' || 'None' }}
- platform: ${{ github.event.inputs.watchos == 'false' && 'watchOS' || 'None' }}
- platform: ${{ github.event.inputs.visionos == 'false' && 'visionOS' || 'None' }}
uses: ./.github/workflows/run_unit_tests.yml
with:
scheme: ${{ inputs.scheme }}
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ on:
required: true
default: true
type: boolean
visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

push:
branches-ignore:
- main
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/unit_test_amplify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ on:
required: true
default: true
type: boolean
visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

permissions:
contents: read
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/unit_test_analytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ on:
required: true
default: true
type: boolean

visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

permissions:
contents: read

Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/unit_test_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ on:
required: true
default: true
type: boolean
visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

permissions:
contents: read
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/unit_test_auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ on:
required: true
default: true
type: boolean

visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

permissions:
contents: read

Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/unit_test_core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ on:
required: true
default: true
type: boolean

visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

permissions:
contents: read

Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/unit_test_datastore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ on:
required: true
default: true
type: boolean

visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

permissions:
contents: read

Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/unit_test_geo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ on:
required: true
default: true
type: boolean
visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

permissions:
contents: read
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/unit_test_internal_pinpoint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ on:
required: true
default: true
type: boolean
visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

permissions:
contents: read
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/unit_test_logging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ on:
required: true
default: true
type: boolean

visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

permissions:
contents: read

Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/unit_test_predictions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ on:
required: true
default: true
type: boolean

visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

permissions:
contents: read

Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/unit_test_push_notifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ on:
required: true
default: true
type: boolean

visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

permissions:
contents: read

Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/unit_test_storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ on:
required: true
default: true
type: boolean

visionos:
description: 'ᯅ visionOS'
required: true
default: true
type: boolean

permissions:
contents: read

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ extension AuthCategory: AuthCategoryBehavior {
return try await plugin.signIn(username: username, password: password, options: options)
}

#if os(iOS) || os(macOS)
#if os(iOS) || os(macOS) || os(visionOS)
public func signInWithWebUI(
presentationAnchor: AuthUIPresentationAnchor? = nil,
options: AuthWebUISignInRequest.Options? = nil) async throws -> AuthSignInResult {
Expand Down
4 changes: 2 additions & 2 deletions Amplify/Categories/Auth/AuthCategoryBehavior.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import Foundation
#if os(iOS) || os(macOS)
#if os(iOS) || os(macOS) || os(visionOS)
import AuthenticationServices
public typealias AuthUIPresentationAnchor = ASPresentationAnchor
#endif
Expand Down Expand Up @@ -66,7 +66,7 @@ public protocol AuthCategoryBehavior: AuthCategoryUserBehavior, AuthCategoryDevi
password: String?,
options: AuthSignInRequest.Options?) async throws -> AuthSignInResult

#if os(iOS) || os(macOS)
#if os(iOS) || os(macOS) || os(visionOS)
/// SignIn using pre configured web UI.
///
/// Calling this method will always launch the Auth plugin's default web user interface
Expand Down
4 changes: 2 additions & 2 deletions Amplify/Categories/Auth/Request/AuthSignOutRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public extension AuthSignOutRequest {
/// SignOut the user from all devices. Check the plugin specific definition on what global signOut means.
public let globalSignOut: Bool

#if os(iOS) || os(macOS)
#if os(iOS) || os(macOS) || os(visionOS)
/// Provide a presentation anchor if you have signedIn using `signInWithWebUI`. The signOut webUI will be presented
/// in the presentation anchor provided.
public let presentationAnchorForWebUI: AuthUIPresentationAnchor?
Expand All @@ -54,7 +54,7 @@ public extension AuthSignOutRequest {

}

#if os(iOS) || os(macOS)
#if os(iOS) || os(macOS) || os(visionOS)
extension AuthSignOutRequest.Options {
public static func presentationAnchor(_ anchor: AuthUIPresentationAnchor) -> AuthSignOutRequest.Options {
return AuthSignOutRequest.Options(presentationAnchor: anchor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// SPDX-License-Identifier: Apache-2.0
//

#if os(iOS) || os(macOS)
#if os(iOS) || os(macOS) || os(visionOS)
import Foundation

/// Request to initiate sign in using a web UI.
Expand Down
4 changes: 2 additions & 2 deletions Amplify/Core/Configuration/Internal/Amplify+Reset.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

// swiftlint:disable cyclomatic_complexity

Check warning on line 10 in Amplify/Core/Configuration/Internal/Amplify+Reset.swift

View workflow job for this annotation

GitHub Actions / run-swiftlint

The disabled 'cyclomatic_complexity' rule should be re-enabled before the end of the file (blanket_disable_command)
extension Amplify {

/// Resets the state of the Amplify framework.
Expand Down Expand Up @@ -51,8 +51,8 @@
ModelListDecoderRegistry.reset()
ModelProviderRegistry.reset()
log.verbose("Resetting ModelRegistry, ModelListDecoderRegistry, ModelProviderRegistry finished")

#if os(iOS)

Check warning on line 54 in Amplify/Core/Configuration/Internal/Amplify+Reset.swift

View workflow job for this annotation

GitHub Actions / run-swiftlint

Lines should not have trailing whitespace (trailing_whitespace)
#if os(iOS) && !os(visionOS)
await MainActor.run {
devMenu = nil
}
Expand Down
4 changes: 3 additions & 1 deletion Amplify/Core/Support/DeviceInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ public struct DeviceInfo {
///
/// - Tag: DeviceInfo.screenBounds
public var screenBounds: CGRect {
#if canImport(WatchKit)
#if os(visionOS)
.zero
#elseif canImport(WatchKit)
.zero
#elseif canImport(UIKit)
UIScreen.main.nativeBounds
Expand Down
Loading
Loading