diff --git a/.github/workflows/buildAndTest.yml b/.github/workflows/buildAndTest.yml index eb762f0..f62d8c9 100644 --- a/.github/workflows/buildAndTest.yml +++ b/.github/workflows/buildAndTest.yml @@ -79,6 +79,9 @@ jobs: do cd ${{ github.workspace }} cd "$file" + if [[ ${{ vars.SPM_NAME }} == "SparkCommon" ]]; then + sed -i '' 's|../spark-ios-common|../../../../|g' '.sourcery.yml' + fi echo "Dependencies: $file" sourcery done diff --git a/.github/workflows/buildDemoApp.yml b/.github/workflows/buildDemoApp.yml index a72a9cb..2e346c8 100644 --- a/.github/workflows/buildDemoApp.yml +++ b/.github/workflows/buildDemoApp.yml @@ -32,8 +32,9 @@ jobs: uses: actions/checkout@v4 - name: Clone the demo project from a specific branch + env: + PR_COMMENT: ${{ github.event.comment.body }} run: | - PR_COMMENT="${{ github.event.comment.body }}" SPARK_IOS_BRANCH=${PR_COMMENT#'/buildDemo'} SPARK_IOS_BRANCH=${SPARK_IOS_BRANCH// /} if [ -z $SPARK_IOS_BRANCH ];then @@ -85,9 +86,9 @@ jobs: [SparkDemo.app](${{ steps.artifact-upload-step.outputs.artifact-url }}) is available. Process: - 1. Download the app - 2. Download if needed the [SparkConfiguration](https://github.com/adevinta/spark-ios-configuration) mac os app. - 3. Launch SparkConfiguration, on the testing entry on the sidebar, select the simulator you want and add the SparkDemo.app file. + 1. Download the app with the link above. + 2. Download if needed the [Sparkans](https://github.com/adevinta/spark-ios-configuration/releases/latest) mac os app. + 3. Launch Sparkans, on the **Simulators** entry on the sidebar, select the simulator you want and add the SparkDemo.app file. 4. Envoy ;) with: script: | diff --git a/.sourcery.yml b/.sourcery.yml index 63116ff..648c758 100644 --- a/.sourcery.yml +++ b/.sourcery.yml @@ -6,7 +6,7 @@ configurations: - Sources/Testing/ - Sources/SnapshotTesting/ templates: - - ../spark-ios-common/.sourcery/template/ + - .sourcery/template output: Sources/Testing/Generated/Sourcery.generated.swift args: autoMockableImports: [Combine, SparkTheming] diff --git a/Sources/Core/UIKit/Accessibility/AccessibilityLabelManager.swift b/Sources/Core/UIKit/Accessibility/AccessibilityLabelManager.swift deleted file mode 100644 index 9005b6b..0000000 --- a/Sources/Core/UIKit/Accessibility/AccessibilityLabelManager.swift +++ /dev/null @@ -1,63 +0,0 @@ -// -// AccessibilityLabelManager.swift -// SparkCommon -// -// Created by robin.lemaire on 24/01/2024. -// Copyright © 2024 Adevinta. All rights reserved. -// - -import Foundation - -/// This struct can be implemented in the components that contain at least one subview (label, ...) -/// -/// The goal of this struct is to manage the accessibilityLabel of the UIKit component. -/// There is two possibilities. -/// The default one, using the subviews accessibilityLabel, concatenate them to create one accessibilityLabel using by the component. -/// In this case, the accessibilityLabel can change if the subview accessibilityLabel changes. -/// Or, -/// The consumer set a value. In this case, In this case, the accessibilityLabel will always be the one set by the consumer -@_spi(SI_SPI) public struct AccessibilityLabelManager { - - // MARK: - Private Properties - - /// A Boolean value indicating whether the consumer set an accessibilityLabel. - private var isSetExternally = false - - /// A String value indicating the current accessibilityLabel of the component. - private var _accessibilityLabel: String? - - // MARK: - Initialization - - public init() { } - - // MARK: - Properties - - /// A String value indicating whether **the component** set an accessibilityLabel. - /// When the value changes, the accessibilityLabel can be updated. - public var internalValue: String? { - didSet { - self.value = self.internalValue - } - } - - /// A String value indicating the current accessibilityLabel of the component. - public var value: String? { - get { - return self._accessibilityLabel - } - set { - // If the value is set by the consumer OR if the default value (given by the internalValue) is nil or empty - if newValue != self.internalValue || self.internalValue.isEmptyOrNil { - if !newValue.isEmptyOrNil, newValue != self._accessibilityLabel { - self._accessibilityLabel = newValue - } else if newValue != self.internalValue { // Set the value with the internal value - self._accessibilityLabel = self.internalValue - } - self.isSetExternally = !newValue.isEmptyOrNil - - } else if !self.isSetExternally, newValue != self._accessibilityLabel { // If the value isn't set by the consumer - self._accessibilityLabel = newValue - } - } - } -} diff --git a/Tests/UnitTests/UIKit/Accessibility/AccessibilityLabelManagerTests.swift b/Tests/UnitTests/UIKit/Accessibility/AccessibilityLabelManagerTests.swift deleted file mode 100644 index 83ce533..0000000 --- a/Tests/UnitTests/UIKit/Accessibility/AccessibilityLabelManagerTests.swift +++ /dev/null @@ -1,105 +0,0 @@ -// -// AccessibilityLabelManagerTests.swift -// SparkCoreUnitTests -// -// Created by robin.lemaire on 24/01/2024. -// Copyright © 2024 Adevinta. All rights reserved. -// - -import XCTest -@_spi(SI_SPI) @testable import SparkCommon - -final class AccessibilityLabelManagerTests: XCTestCase { - - // MARK: - Tests - - func test_default_value() { - // GIVEN / WHEN - let manager = AccessibilityLabelManager() - - // THEN - XCTAssertNil(manager.value) - } - - func test_value_after_set_internalValue() { - // GIVEN - let expectedValue = "My value" - - var manager = AccessibilityLabelManager() - - // WHEN - manager.internalValue = expectedValue - - // THEN - XCTAssertEqual(manager.value, expectedValue) - } - - func test_value_after_set_value_without_set_internaValue() { - // GIVEN - let expectedValue = "My value" - - var manager = AccessibilityLabelManager() - - // WHEN - manager.value = expectedValue - - // THEN - XCTAssertEqual(manager.value, expectedValue) - } - - func test_value_after_set_internalValue_then_set_value() { - // GIVEN - let expectedValue = "My value" - - var manager = AccessibilityLabelManager() - - // WHEN - manager.internalValue = "My other value" - manager.value = expectedValue - - // THEN - XCTAssertEqual(manager.value, expectedValue) - } - - func test_value_after_set_value_then_set_internalValue() { - // GIVEN - let expectedValue = "My value" - - var manager = AccessibilityLabelManager() - - // WHEN - manager.value = expectedValue - manager.internalValue = "My other value" - - // THEN - XCTAssertEqual(manager.value, expectedValue) - } - - func test_value_after_set_internalValue_then_set_nil_value() { - // GIVEN - let expectedValue = "My value" - - var manager = AccessibilityLabelManager() - - // WHEN - manager.internalValue = expectedValue - manager.value = nil - - // THEN - XCTAssertEqual(manager.value, expectedValue) - } - - func test_value_after_set_nil_value_then_set_internalValue() { - // GIVEN - let expectedValue = "My value" - - var manager = AccessibilityLabelManager() - - // WHEN - manager.value = nil - manager.internalValue = expectedValue - - // THEN - XCTAssertEqual(manager.value, expectedValue) - } -}