diff --git a/.gitignore b/.gitignore index 271c06076..c740e6b3a 100644 --- a/.gitignore +++ b/.gitignore @@ -73,10 +73,15 @@ CoverageData/ bep.json xcui.json +#SPM +.build +.swiftpm +ios/Player.xcodeproj + # Bundles used by cocoapods for development ios/*/*/Resources/**/*.js # File used in CI to pass build number between iOS and release stage .ios-build-number -.bazelrc.local \ No newline at end of file +.bazelrc.local diff --git a/BUILD.bazel b/BUILD.bazel index d5b3a2859..5e72556fc 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,6 +1,7 @@ # load("@rules_player//cocoapods:cocoapod.bzl", "assemble_pod", "pod_push") # load("@rules_player//internal:stamp.bzl", "stamp") # load("//:generated.bzl", "PlayerUI", "PlayerUI_Demo", "ui_tests", "unit_tests") +load("//tools/ios:util.bzl", "assemble_pod") load("@npm//:defs.bzl", "npm_link_all_packages") load("@aspect_rules_js//js:defs.bzl", "js_library") @@ -97,36 +98,99 @@ js_library( # }, # ) -# assemble_pod( -# name = "PlayerUI_Pod", -# srcs = glob([ -# "ios/**/*.swift", -# "LICENSE", -# ]), -# data = { -# # Core -# "//core/player:Player_Bundles_bundle_prod": "ios/packages/core/Resources/", -# "//plugins/partial-match-fingerprint/core:PartialMatchFingerprintPlugin_Bundles_bundle_prod": "ios/packages/core/Resources/", -# "//core/partial-match-registry:Registry_Bundles_bundle_prod": "ios/packages/core/Resources/", - -# # Packages -# "//core/make-flow:MakeFlow_Bundles_bundle_prod": "ios/packages/test-utils/Resources/", -# "//plugins/reference-assets/core:ReferenceAssetsPlugin_Bundles_bundle_prod": "ios/packages/reference-assets/Resources/js/", -# # Plugins -# "//plugins/beacon/core:BeaconPlugin_Bundles_bundle_prod": "ios/plugins/BaseBeaconPlugin/Resources/", -# "//plugins/check-path/core:CheckPathPlugin_Bundles_bundle_prod": "ios/plugins/CheckPathPlugin/Resources/", -# "//plugins/common-types/core:CommonTypesPlugin_Bundles_bundle_prod": "ios/plugins/CommonTypesPlugin/Resources/", -# "//plugins/common-expressions/core:CommonExpressionsPlugin_Bundles_bundle_prod": "ios/plugins/CommonExpressionsPlugin/Resources/", -# "//plugins/computed-properties/core:ComputedPropertiesPlugin_Bundles_bundle_prod": "ios/plugins/ComputedPropertiesPlugin/Resources/", -# "//plugins/expression/core:ExpressionPlugin_Bundles_bundle_prod": "ios/plugins/ExpressionPlugin/Resources/", -# "//plugins/external-action/core:ExternalActionPlugin_Bundles_bundle_prod": "ios/plugins/ExternalActionPlugin/Resources/", -# "//plugins/metrics/core:MetricsPlugin_Bundles_bundle_prod": "ios/plugins/MetricsPlugin/Resources/", -# "//plugins/pubsub/core:PubSubPlugin_Bundles_bundle_prod": "ios/plugins/PubSubPlugin/Resources/", -# "//plugins/stage-revert-data/core:StageRevertDataPlugin_Bundles_bundle_prod": "ios/plugins/StageRevertDataPlugin/Resources/", -# "//plugins/types-provider/core:TypesProviderPlugin_Bundles_bundle_prod": "ios/plugins/TypesProviderPlugin/Resources/", -# }, -# podspec = ":PlayerUI_Podspec", -# ) +exports_files([ + "PlayerUI.podspec" +]) + +assemble_pod( + name = "PlayerUI_Pod", + srcs = glob([ + "LICENSE", + "Package.swift", + ]), + data = { + # Core + "//ios/core:PlayerUI_Sources": "ios/core/", + "//core/player:player_native_bundle": "ios/core/Resources/", + "//plugins/partial-match-fingerprint/core:core_native_bundle": "ios/core/Resources/", + "//core/partial-match-registry:partial-match-registry_native_bundle": "ios/core/Resources/", + + # SwiftUI + "//ios/swiftui:PlayerUISwiftUI_Sources": "ios/swiftui/", + + # Logger + "//ios/logger:PlayerUILogger_Sources": "ios/logger/", + + # Test Utilities + "//ios/test-utils-core:PlayerUITestUtilitiesCore_Sources": "ios/test-utils-core/", + "//ios/test-utils:PlayerUITestUtilities_Sources": "ios/test-utils/", + "//core/make-flow:make-flow_native_bundle": "ios/test-utils-core/Resources/", + + # Plugins # + + # Beacon + "//plugins/beacon/ios:PlayerUIBaseBeaconPlugin_Sources": "plugins/beacon/ios/", + "//plugins/beacon/swiftui:PlayerUIBeaconPlugin_Sources": "plugins/beacon/swiftui/", + "//plugins/beacon/core:core_native_bundle": "plugins/beacon/ios/Resources/", + + # Check Path + "//plugins/check-path/ios:PlayerUICheckPathPlugin_Sources": "plugins/check-path/ios/", + "//plugins/check-path/swiftui:PlayerUISwiftUICheckPathPlugin_Sources": "plugins/check-path/swiftui/", + "//plugins/check-path/core:core_native_bundle": "plugins/check-path/ios/Resources/", + + # Common Expressions + "//plugins/common-expressions/ios:PlayerUICommonExpressionsPlugin_Sources": "plugins/common-expressions/ios/", + "//plugins/common-expressions/core:core_native_bundle": "plugins/common-expressions/ios/Resources/", + + # Common Types + "//plugins/common-types/ios:PlayerUICommonTypesPlugin_Sources": "plugins/common-types/ios/", + "//plugins/common-types/core:core_native_bundle": "plugins/common-types/ios/Resources/", + + # Computed Properties + "//plugins/computed-properties/ios:PlayerUIComputedPropertiesPlugin_Sources": "plugins/computed-properties/ios/", + "//plugins/computed-properties/core:core_native_bundle": "plugins/computed-properties/ios/Resources/", + + # Console Logger (PrintLoggerPlugin) + "//plugins/console-logger/ios:PlayerUIPrintLoggerPlugin_Sources": "plugins/console-logger/ios/", + + # Expression + "//plugins/expression/ios:PlayerUIExpressionPlugin_Sources": "plugins/expression/ios/", + "//plugins/expression/core:core_native_bundle": "plugins/expression/ios/Resources/", + + # External Action + "//plugins/external-action/ios:PlayerUIExternalActionPlugin_Sources": "plugins/external-action/ios/", + "//plugins/external-action/swiftui:PlayerUIExternalActionViewModifierPlugin_Sources": "plugins/external-action/swiftui/", + "//plugins/external-action/core:core_native_bundle": "plugins/external-action/ios/Resources/", + + # Metrics + "//plugins/metrics/swiftui:PlayerUIMetricsPlugin_Sources": "plugins/metrics/swiftui/", + "//plugins/metrics/core:core_native_bundle": "plugins/metrics/swiftui/Resources/", + + # Pending Transaction + "//plugins/pending-transaction/swiftui:PlayerUISwiftUIPendingTransactionPlugin_Sources": "plugins/pending-transaction/swiftui/", + + # PubSub + "//plugins/pubsub/ios:PlayerUIPubSubPlugin_Sources": "plugins/pubsub/ios/", + "//plugins/pubsub/core:core_native_bundle": "plugins/pubsub/ios/Resources/", + + # Reference Assets + "//plugins/reference-assets/swiftui:PlayerUIReferenceAssets_Sources": "plugins/reference-assets/swiftui/", + "//plugins/reference-assets/swiftui/Resources:PlayerUIReferenceAssets_Resources": "plugins/reference-assets/swiftui/Resources/", + "//plugins/reference-assets/core:core_native_bundle": "plugins/reference-assets/swiftui/Resources/js/", + + # Stage Revert Data + "//plugins/stage-revert-data/ios:PlayerUIStageRevertDataPlugin_Sources": "plugins/stage-revert-data/ios/", + "//plugins/stage-revert-data/core:core_native_bundle": "plugins/stage-revert-data/ios/Resources/", + + # Transition + "//plugins/transition/swiftui:PlayerUITransitionPlugin_Sources": "plugins/transition/swiftui", + + # Types Provider + "//plugins/types-provider/ios:PlayerUITypesProviderPlugin_Sources": "plugins/types-provider/ios/", + "//plugins/types-provider/core:core_native_bundle": "plugins/types-provider/ios/Resources/", + }, + podspec = ":PlayerUI.podspec", +) # # Push podspec to specs repo # # tag must exist in github first @@ -141,3 +205,52 @@ js_library( # "--skip-tests", # ], # ) + +load("@bazel_gazelle//:def.bzl", "gazelle", "gazelle_binary") +load("@rules_swift_package_manager//swiftpkg:defs.bzl", "swift_update_packages") + +# Ignore the `.build` folder that is created by running Swift package manager +# commands. The Swift Gazelle plugin executes some Swift package manager +# commands to resolve external dependencies. This results in a `.build` file +# being created. +# NOTE: Swift package manager is not used to build any of the external packages. +# The `.build` directory should be ignored. Be sure to configure your source +# control to ignore it (i.e., add it to your `.gitignore`). +# gazelle:exclude .build + +# This declaration builds a Gazelle binary that incorporates all of the Gazelle +# plugins for the languages that you use in your workspace. In this example, we +# are only listing the Gazelle plugin for Swift from rules_swift_package_manager. +gazelle_binary( + name = "gazelle_bin", + languages = [ + "@rules_swift_package_manager//gazelle", + ], +) + +# This macro defines two targets: `swift_update_pkgs` and +# `swift_update_pkgs_to_latest`. +# +# The `swift_update_pkgs` target should be run whenever the list of external +# dependencies is updated in the `Package.swift`. Running this target will +# populate the `swift_deps.bzl` with `swift_package` declarations for all of +# the direct and transitive Swift packages that your project uses. +# +# The `swift_update_pkgs_to_latest` target should be run when you want to +# update your Swift dependencies to their latest eligible version. +swift_update_packages( + name = "swift_update_pkgs", + gazelle = ":gazelle_bin", + swift_deps = "swift_deps.bzl", + swift_deps_index = "swift_deps_index.json", + generate_swift_deps_for_workspace = True, + update_bzlmod_stanzas = False, + package_manifest = "./xcode/Package.swift" +) + +# This target updates the Bazel build files for your project. Run this target +# whenever you add or remove source files from your project. +gazelle( + name = "update_build_files", + gazelle = ":gazelle_bin", +) diff --git a/MODULE.bazel b/MODULE.bazel index c0e1dfa03..70ca38d95 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -4,7 +4,7 @@ bazel_dep(name = "rules_player") git_override( remote = "https://github.com/player-ui/rules_player.git", - commit = "d9c8d7c1802916dc6e4619b5da2ac0cab590944a", + commit = "a1626024afabb38b9aca9981cc0e76b704d4fd77", module_name = "rules_player", ) # local_path_override(module_name = "rules_player", path = "../rules_player") @@ -21,6 +21,34 @@ node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node") node.toolchain(node_version = "18.18.0") ################################# + +# iOS + +bazel_dep(name = "rules_swift", version = "1.13.0", repo_name = "build_bazel_rules_swift") +bazel_dep(name = "rules_apple", version = "3.1.1", repo_name = "build_bazel_rules_apple") +bazel_dep(name = "rules_ios", version = "3.1.4", repo_name = "build_bazel_rules_ios") +bazel_dep(name = "rules_xcodeproj", version = "1.13.0") + +bazel_dep(name = "gazelle", version = "0.34.0", repo_name = "bazel_gazelle") +bazel_dep(name = "rules_swift_package_manager", version = "0.22.0") + +# swift_deps START +swift_deps = use_extension( + "@rules_swift_package_manager//:extensions.bzl", + "swift_deps", +) +swift_deps.from_file( + deps_index = "//:swift_deps_index.json", +) + +use_repo( + swift_deps, + "swiftpkg_swift_hooks", + "swiftpkg_viewinspector", + "swiftpkg_eyes_xcui_swift_package" +) + +# end iOS npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm") npm.npm_translate_lock( diff --git a/Package.swift b/Package.swift new file mode 100644 index 000000000..57b33fa75 --- /dev/null +++ b/Package.swift @@ -0,0 +1,240 @@ +// swift-tools-version: 5.5 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +typealias PluginWithResources = (name: String, path: String) + +// Simple plugins that just rely on core + their own JS bundle +let pluginList: [String] = [ + (name: "BaseBeaconPlugin", path: "beacon"), + (name: "CheckPathPlugin", path: "check-path"), + (name: "CommonExpressionsPlugin", path: "common-expressions"), + (name: "CommonTypesPlugin", path: "common-types"), + (name: "ComputedPropertiesPlugin", path: "computed-properties"), + (name: "ExpressionPlugin", path: "expression"), + (name: "ExternalActionPlugin", path: "external-action"), + (name: "PubSubPlugin", path: "pubsub"), + (name: "StageRevertDataPlugin", path: "stage-revert-data"), + (name: "TypesProviderPlugin", path: "types-provider") +] + +let plugins: [(Target, Product)] = pluginList.map { + ( + Target.playerPlugin(plugin: $0), + Product.playerPlugin(name: $0.name) + ) +} + +let package = Package( + name: "PlayerUI", + platforms: [ + .iOS(.v14), + .macOS(.v11) + ], + products: [ + // Core + .library( + name: "PlayerUI", + targets: ["PlayerUI", "PlayerUISwiftUI"] + ), + + // Packages + .library( + name: "PlayerUIReferenceAssets", + targets: ["PlayerUIReferenceAssets"] + ), + .library( + name: "PlayerUILogger", + targets: ["PlayerUILogger"] + ), + .library( + name: "PlayerUITestUtilitiesCore", + targets: ["PlayerUITestUtilitiesCore"] + ), + .library( + name: "PlayerUITestUtilities", + targets: ["PlayerUITestUtilities"] + ), + + // Plugins + .library( + name: "PlayerUIBeaconPlugin", + targets: ["PlayerUIBeaconPlugin"] + ), + .library( + name: "PlayerUIExternalActionViewModifierPlugin", + targets: ["PlayerUIExternalActionViewModifierPlugin"] + ), + .library( + name: "PlayerUIMetricsPlugin", + targets: ["PlayerUIMetricsPlugin"] + ), + .library( + name: "PlayerUISwiftUICheckPathPlugin", + targets: ["PlayerUISwiftUICheckPathPlugin"] + ), + .library( + name: "PlayerUIPrintLoggerPlugin", + targets: ["PlayerUIPrintLoggerPlugin"] + ), + .library( + name: "PlayerUISwiftUIPendingTransactionPlugin", + targets: ["PlayerUISwiftUIPendingTransactionPlugin"] + ), + .library( + name: "PlayerUITransitionPlugin", + targets: ["PlayerUITransitionPlugin"] + ) + ] + plugins.map(\.1), + dependencies: [ + .package(url: "https://github.com/intuit/swift-hooks.git", .upToNextMajor(from: "0.1.0")), + ], + targets: [ + // Packages + .target( + name: "PlayerUI", + dependencies: [ + .product(name: "SwiftHooks", package: "swift-hooks"), + .target(name: "PlayerUILogger") + ], + path: "ios/core", + resources: [ + .process("Resources") + ] + ), + .target( + name: "PlayerUISwiftUI", + dependencies: [ + .product(name: "SwiftHooks", package: "swift-hooks"), + .target(name: "PlayerUI") + ], + path: "ios/swiftui" + ), + .target( + name: "PlayerUILogger", + dependencies: [ + .product(name: "SwiftHooks", package: "swift-hooks"), + ], + path: "ios/logger" + ), + .target( + name: "PlayerUIReferenceAssets", + dependencies: [ + .product(name: "SwiftHooks", package: "swift-hooks"), + .target(name: "PlayerUI"), + .target(name: "PlayerUIBeaconPlugin"), + .target(name: "PlayerUISwiftUIPendingTransactionPlugin") + ], + path: "plugins/reference-assets/swiftui", + resources: [ + .process("Resources") + ] + ), + .target( + name: "PlayerUITestUtilitiesCore", + dependencies: [ + .target(name: "PlayerUI"), + .target(name: "PlayerUISwiftUI") + ], + path: "ios/test-utils-core", + resources: [ + .process("Resources") + ] + ), + .target( + name: "PlayerUITestUtilities", + dependencies: [ + .target(name: "PlayerUI"), + .target(name: "PlayerUITestUtilitiesCore") + ], + path: "ios/test-utils", + linkerSettings: [.linkedFramework("XCTest")] + ), + + // Plugins with dependencies + .target( + name: "PlayerUIBeaconPlugin", + dependencies: [ + .target(name: "PlayerUI"), + .target(name: "PlayerUISwiftUI"), + .target(name: "PlayerUIBaseBeaconPlugin") + ], + path: "plugins/beacon/swiftui" + ), + .target( + name: "PlayerUIMetricsPlugin", + dependencies: [ + .target(name: "PlayerUI"), + .target(name: "PlayerUISwiftUI") + ], + path: "plugins/metrics/swiftui", + resources: [ + .process("Resources") + ] + ), + .target( + name: "PlayerUISwiftUICheckPathPlugin", + dependencies: [ + .target(name: "PlayerUI"), + .target(name: "PlayerUISwiftUI"), + .target(name: "PlayerUICheckPathPlugin") + ], + path: "plugins/check-path/swiftui" + ), + .target( + name: "PlayerUIExternalActionViewModifierPlugin", + dependencies: [ + .target(name: "PlayerUI"), + .target(name: "PlayerUISwiftUI"), + .target(name: "PlayerUIExternalActionPlugin") + ], + path: "plugins/external-action/swiftui" + ), + // Swift only plugins + .target( + name: "PlayerUIPrintLoggerPlugin", + dependencies: [ + .target(name: "PlayerUI") + ], + path: "plugins/console-logger/ios" + ), + .target( + name: "PlayerUISwiftUIPendingTransactionPlugin", + dependencies: [ + .target(name: "PlayerUI"), + .target(name: "PlayerUISwiftUI") + ], + path: "plugins/pending-transaction/swiftui" + ), + .target( + name: "PlayerUITransitionPlugin", + dependencies: [ + .target(name: "PlayerUI"), + .target(name: "PlayerUISwiftUI") + ], + path: "plugins/transition/swiftui" + ) + ] + plugins.map(\.0) +) + + +extension Product { + static func playerPlugin(name: String) -> Product { + .library(name: "PlayerUI\(name)", targets: ["PlayerUI\(name)"]) + } +} +extension Target { + static func playerPlugin(plugin: PluginWithResources) -> Target { + .target( + name: "PlayerUI\(plugin.name)", + dependencies: [ + .target(name: "PlayerUI") + ], + path: "plugins/\(plugin.path)/ios", + resources: [ + .process("Resources") + ] + ) + } +} \ No newline at end of file diff --git a/PlayerUI.podspec b/PlayerUI.podspec index dc52d0d3f..e5625d51f 100644 --- a/PlayerUI.podspec +++ b/PlayerUI.podspec @@ -28,154 +28,13 @@ and display it as a SwiftUI view comprised of registered assets. all.dependency 'PlayerUI/SwiftUI' end - # - s.app_spec 'Demo' do |demo| - demo.source_files = 'ios/packages/demo/Sources/**/*' - - demo.resources = [ - 'ios/packages/demo/Resources/Primary.storyboard', - 'ios/packages/demo/Resources/Launch.xib', - 'ios/packages/demo/Resources/**/*.xcassets' - ] - - demo.dependency 'PlayerUI/SwiftUI' - demo.dependency 'PlayerUI/BeaconPlugin' - demo.dependency 'PlayerUI/ReferenceAssets' - demo.dependency 'PlayerUI/MetricsPlugin' - demo.dependency 'PlayerUI/TransitionPlugin' - - demo.info_plist = { - 'UILaunchStoryboardName' => 'Launch', - 'CFBundleIdentifier' => 'com.intuit.ios.player', - 'UIApplicationSceneManifest' => { - 'UIApplicationSupportsMultipleScenes' => true, - 'UISceneConfigurations' => { - 'UIWindowSceneSessionRoleApplication' => [ - { - 'UISceneConfigurationName' => 'Default Configuration', - 'UISceneDelegateClassName' => 'PlayerUI_Demo.SceneDelegate' - } - ] - } - } - } - - demo.pod_target_xcconfig = { - 'PRODUCT_BUNDLE_IDENTIFIER': 'com.intuit.ios.player', - - 'CODE_SIGN_STYLE': 'Manual', - 'CODE_SIGN_IDENTITY': 'iPhone Distribution', - 'PROVISIONING_PROFILE_SPECIFIER': 'match InHouse com.intuit.ios.player', - 'DEVELOPMENT_TEAM': 'F6DWWXWEX6', - - 'SKIP_INSTALL': 'NO', - 'SKIP_INSTALLED_PRODUCT': 'YES' - } - - demo.script_phases = [ - { - :name => 'SwiftLint', - :execution_position => :before_compile, - :script => <<-SCRIPT - cd ${SRCROOT}/../.. - ${PODS_ROOT}/SwiftLint/swiftlint --config .swiftlint.yml --path ./ios/ - SCRIPT - }, - { - :name => 'Mock Generation', - :execution_position => :before_compile, - :shell_path => '/bin/zsh', - :script => <<-SCRIPT - cd ${SRCROOT}/../../ios/packages/demo/scripts - if test -f ~/.zshrc; then - source ~/.zshrc - fi - ./generateFlowSections.js - SCRIPT - } - ] - end - - s.subspec 'InternalUnitTestUtilities' do |utils| - utils.dependency 'PlayerUI/Core' - utils.source_files = 'ios/packages/internal-test-utils/Sources/**/*' - - utils.weak_framework = 'XCTest' - utils.pod_target_xcconfig = { - 'ENABLE_BITCODE' => 'NO', - 'ENABLE_TESTING_SEARCH_PATHS' => 'YES' - } - end - - s.test_spec 'Unit' do |tests| - tests.requires_app_host = true - tests.app_host_name = 'PlayerUI/Demo' - tests.dependency 'PlayerUI/InternalUnitTestUtilities' - tests.dependency 'PlayerUI/Demo' - tests.dependency 'PlayerUI/TestUtilities' - tests.source_files = [ - 'ios/packages/*/Tests/**/*.swift', - 'ios/plugins/*/Tests/**/*.swift' - ] - end - - s.test_spec 'ViewInspectorTests' do |tests| - tests.test_type = :ui - tests.requires_app_host = true - tests.app_host_name = 'PlayerUI/Demo' - tests.dependency 'PlayerUI/InternalUnitTestUtilities' - tests.dependency 'PlayerUI/Demo' - tests.dependency 'ViewInspector', '0.9.0' - tests.source_files = [ - 'ios/packages/*/ViewInspector/**/*', - 'ios/plugins/*/ViewInspector/**/*', - - # Mocks from demo app - 'ios/packages/demo/Sources/MockFlows.swift' - ] - # tests.resources = ['ios/packages/test-utils/viewinspector/ui-test/mocks'] - - tests.pod_target_xcconfig = { - 'PRODUCT_BUNDLE_IDENTIFIER': 'com.intuit.ios.PlayerUI-ExampleUITests', - - 'CODE_SIGN_STYLE': 'Manual', - 'CODE_SIGN_IDENTITY[sdk=iphoneos*]': 'iPhone Developer', - 'PROVISIONING_PROFILE_SPECIFIER': 'match Development com.intuit.ios.PlayerUI-ExampleUITests*', - 'DEVELOPMENT_TEAM': 'F6DWWXWEX6' - } - end - - s.test_spec 'XCUITests' do |tests| - tests.test_type = :ui - tests.requires_app_host = true - tests.app_host_name = 'PlayerUI/Demo' - tests.dependency 'PlayerUI/InternalUnitTestUtilities' - tests.dependency 'PlayerUI/Demo' - tests.dependency 'EyesXCUI', '8.8.8' - tests.source_files = [ - 'ios/packages/*/UITests/**/*', - 'ios/plugins/*/UITests/**/*' - ] - - tests.pod_target_xcconfig = { - 'PRODUCT_BUNDLE_IDENTIFIER': 'com.intuit.ios.PlayerUI-ExampleUITests', - - 'CODE_SIGN_STYLE': 'Manual', - 'CODE_SIGN_IDENTITY[sdk=iphoneos*]': 'iPhone Developer', - 'PROVISIONING_PROFILE_SPECIFIER': 'match Development com.intuit.ios.PlayerUI-ExampleUITests*', - 'DEVELOPMENT_TEAM': 'F6DWWXWEX6' - } - end - - # - # s.subspec 'Core' do |core| - core.source_files = 'ios/packages/core/Sources/**/*' + core.source_files = 'ios/core/Sources/**/*' core.dependency 'SwiftHooks', '~> 0', '>= 0.1.0' core.dependency 'PlayerUI/Logger' core.resource_bundles = { - 'PlayerUI' => ['ios/packages/core/Resources/**/*.js'] + 'PlayerUI' => ['ios/core/Resources/**/*.js'] } end @@ -183,9 +42,9 @@ and display it as a SwiftUI view comprised of registered assets. utils.dependency 'PlayerUI/Core' utils.dependency 'PlayerUI/SwiftUI' - utils.source_files = 'ios/packages/test-utils-core/Sources/**/*' + utils.source_files = 'ios/test-utils-core/Sources/**/*' utils.resource_bundles = { - 'TestUtilities' => ['ios/packages/test-utils/Resources/**/*.js'] + 'TestUtilities' => ['ios/test-utils-core/Resources/**/*.js'] } end @@ -194,7 +53,7 @@ and display it as a SwiftUI view comprised of registered assets. utils.dependency 'PlayerUI/SwiftUI' utils.dependency 'PlayerUI/TestUtilitiesCore' - utils.source_files = 'ios/packages/test-utils/Sources/**/*' + utils.source_files = 'ios/test-utils/Sources/**/*' utils.weak_framework = 'XCTest' utils.pod_target_xcconfig = { @@ -207,15 +66,14 @@ and display it as a SwiftUI view comprised of registered assets. assets.dependency 'PlayerUI/Core' assets.dependency 'PlayerUI/SwiftUI' assets.dependency 'PlayerUI/BeaconPlugin' + assets.dependency 'PlayerUI/SwiftUIPendingTransactionPlugin' - assets.source_files = 'ios/packages/reference-assets/Sources/**/*' + assets.source_files = 'plugins/reference-assets/swiftui/Sources/**/*' assets.resource_bundles = { 'ReferenceAssets' => [ - 'ios/packages/reference-assets/Resources/js/**/*.js', - 'ios/packages/reference-assets/Resources/svg/*.xcassets', - - # This should be generated by cocoapods-bazel in the build file, but isn't for some reason - 'ios/packages/reference-assets/Resources/svg/*.xcassets/**/*' + 'plugins/reference-assets/swiftui/Resources/js/**/*.js', + 'plugins/reference-assets/swiftui/Resources/svg/*.xcassets', + 'plugins/reference-assets/swiftui/Resources/svg/*.xcassets/**/*' ] } end @@ -223,32 +81,32 @@ and display it as a SwiftUI view comprised of registered assets. s.subspec 'SwiftUI' do |swiftui| swiftui.dependency 'PlayerUI/Core' - swiftui.source_files = 'ios/packages/swiftui/Sources/**/*' + swiftui.source_files = 'ios/swiftui/Sources/**/*' end s.subspec 'Logger' do |pkg| pkg.dependency 'SwiftHooks', '~> 0', '>= 0.1.0' - pkg.source_files = 'ios/packages/logger/Sources/**/*' + pkg.source_files = 'ios/logger/Sources/**/*' end # # s.subspec 'PrintLoggerPlugin' do |plugin| plugin.dependency 'PlayerUI/Core' - plugin.source_files = 'ios/plugins/PrintLoggerPlugin/Sources/**/*' + plugin.source_files = 'plugins/console-logger/ios/Sources/**/*' end s.subspec 'TransitionPlugin' do |plugin| plugin.dependency 'PlayerUI/Core' plugin.dependency 'PlayerUI/SwiftUI' - plugin.source_files = 'ios/plugins/TransitionPlugin/Sources/**/*' + plugin.source_files = 'plugins/transition/swiftui/Sources/**/*' end s.subspec 'BaseBeaconPlugin' do |plugin| plugin.dependency 'PlayerUI/Core' - plugin.source_files = 'ios/plugins/BaseBeaconPlugin/Sources/**/*' + plugin.source_files = 'plugins/beacon/ios/Sources/**/*' plugin.resource_bundles = { - 'BaseBeaconPlugin' => ['ios/plugins/BaseBeaconPlugin/Resources/**/*.js'] + 'BaseBeaconPlugin' => ['plugins/beacon/ios/Resources/**/*.js'] } end @@ -256,54 +114,54 @@ and display it as a SwiftUI view comprised of registered assets. plugin.dependency 'PlayerUI/Core' plugin.dependency 'PlayerUI/SwiftUI' plugin.dependency 'PlayerUI/BaseBeaconPlugin' - plugin.source_files = 'ios/plugins/BeaconPlugin/Sources/**/*' + plugin.source_files = 'plugins/beacon/swiftui/Sources/**/*' end s.subspec 'CheckPathPlugin' do |plugin| plugin.dependency 'PlayerUI/Core' - plugin.source_files = 'ios/plugins/CheckPathPlugin/Sources/**/*' + plugin.source_files = 'plugins/check-path/ios/Sources/**/*' plugin.resource_bundles = { - 'CheckPathPlugin' => ['ios/plugins/CheckPathPlugin/Resources/**/*.js'] + 'CheckPathPlugin' => ['plugins/check-path/ios/Resources/**/*.js'] } end s.subspec 'CommonTypesPlugin' do |plugin| plugin.dependency 'PlayerUI/Core' - plugin.source_files = 'ios/plugins/CommonTypesPlugin/Sources/**/*' + plugin.source_files = 'plugins/common-types/ios/Sources/**/*' plugin.resource_bundles = { - 'CommonTypesPlugin' => ['ios/plugins/CommonTypesPlugin/Resources/**/*.js'] + 'CommonTypesPlugin' => ['plugins/common-types/ios/Resources/**/*.js'] } end s.subspec 'ComputedPropertiesPlugin' do |plugin| plugin.dependency 'PlayerUI/Core' - plugin.source_files = 'ios/plugins/ComputedPropertiesPlugin/Sources/**/*' + plugin.source_files = 'plugins/computed-properties/ios/Sources/**/*' plugin.resource_bundles = { - 'ComputedPropertiesPlugin' => ['ios/plugins/ComputedPropertiesPlugin/Resources/**/*.js'] + 'ComputedPropertiesPlugin' => ['plugins/computed-properties/ios/Resources/**/*.js'] } end s.subspec 'CommonExpressionsPlugin' do |plugin| plugin.dependency 'PlayerUI/Core' - plugin.source_files = 'ios/plugins/CommonExpressionsPlugin/Sources/**/*' + plugin.source_files = 'plugins/common-expressions/ios/Sources/**/*' plugin.resource_bundles = { - 'CommonExpressionsPlugin' => ['ios/plugins/CommonExpressionsPlugin/Resources/**/*.js'] + 'CommonExpressionsPlugin' => ['plugins/common-expressions/ios/Resources/**/*.js'] } end s.subspec 'ExpressionPlugin' do |plugin| plugin.dependency 'PlayerUI/Core' - plugin.source_files = 'ios/plugins/ExpressionPlugin/Sources/**/*' + plugin.source_files = 'plugins/expression/ios/Sources/**/*' plugin.resource_bundles = { - 'ExpressionPlugin' => ['ios/plugins/ExpressionPlugin/Resources/**/*.js'] + 'ExpressionPlugin' => ['plugins/expression/ios/Resources/**/*.js'] } end s.subspec 'ExternalActionPlugin' do |plugin| plugin.dependency 'PlayerUI/Core' - plugin.source_files = 'ios/plugins/ExternalActionPlugin/Sources/**/*' + plugin.source_files = 'plugins/external-action/ios/Sources/**/*' plugin.resource_bundles = { - 'ExternalActionPlugin' => ['ios/plugins/ExternalActionPlugin/Resources/**/*.js'] + 'ExternalActionPlugin' => ['plugins/external-action/ios/Resources/**/*.js'] } end @@ -311,31 +169,31 @@ and display it as a SwiftUI view comprised of registered assets. plugin.dependency 'PlayerUI/Core' plugin.dependency 'PlayerUI/SwiftUI' plugin.dependency 'PlayerUI/ExternalActionPlugin' - plugin.source_files = 'ios/plugins/ExternalActionViewModifierPlugin/Sources/**/*' + plugin.source_files = 'plugins/external-action/swiftui/Sources/**/*' end s.subspec 'MetricsPlugin' do |plugin| plugin.dependency 'PlayerUI/Core' plugin.dependency 'PlayerUI/SwiftUI' - plugin.source_files = 'ios/plugins/MetricsPlugin/Sources/**/*' + plugin.source_files = 'plugins/metrics/swiftui/Sources/**/*' plugin.resource_bundles = { - 'MetricsPlugin' => ['ios/plugins/MetricsPlugin/Resources/**/*.js'] + 'MetricsPlugin' => ['plugins/metrics/swiftui/Resources/**/*.js'] } end s.subspec 'PubSubPlugin' do |plugin| plugin.dependency 'PlayerUI/Core' - plugin.source_files = 'ios/plugins/PubSubPlugin/Sources/**/*' + plugin.source_files = 'plugins/pubsub/ios/Sources/**/*' plugin.resource_bundles = { - 'PubSubPlugin' => ['ios/plugins/PubSubPlugin/Resources/**/*.js'] + 'PubSubPlugin' => ['plugins/pubsub/ios/Resources/**/*.js'] } end s.subspec 'StageRevertDataPlugin' do |plugin| plugin.dependency 'PlayerUI/Core' - plugin.source_files = 'ios/plugins/StageRevertDataPlugin/Sources/**/*' + plugin.source_files = 'plugins/stage-revert-data/ios/Sources/**/*' plugin.resource_bundles = { - 'StageRevertDataPlugin' => ['ios/plugins/StageRevertDataPlugin/Resources/**/*.js'] + 'StageRevertDataPlugin' => ['plugins/stage-revert-data/ios/Resources/**/*.js'] } end @@ -343,20 +201,20 @@ and display it as a SwiftUI view comprised of registered assets. plugin.dependency 'PlayerUI/Core' plugin.dependency 'PlayerUI/SwiftUI' plugin.dependency 'PlayerUI/CheckPathPlugin' - plugin.source_files = 'ios/plugins/SwiftUICheckPathPlugin/Sources/**/*' + plugin.source_files = 'plugins/check-path/swiftui/Sources/**/*' end s.subspec 'SwiftUIPendingTransactionPlugin' do |plugin| plugin.dependency 'PlayerUI/Core' plugin.dependency 'PlayerUI/SwiftUI' - plugin.source_files = 'ios/plugins/SwiftUIPendingTransactionPlugin/Sources/**/*' + plugin.source_files = 'plugins/pending-transaction/swiftui/Sources/**/*' end s.subspec 'TypesProviderPlugin' do |plugin| plugin.dependency 'PlayerUI/Core' - plugin.source_files = 'ios/plugins/TypesProviderPlugin/Sources/**/*' + plugin.source_files = 'plugins/types-provider/ios/Sources/**/*' plugin.resource_bundles = { - 'TypesProviderPlugin' => ['ios/plugins/TypesProviderPlugin/Resources/**/*.js'] + 'TypesProviderPlugin' => ['plugins/types-provider/ios/Resources/**/*.js'] } end # diff --git a/ios/BUILD.bazel b/ios/BUILD.bazel new file mode 100644 index 000000000..7ce9ac40e --- /dev/null +++ b/ios/BUILD.bazel @@ -0,0 +1,50 @@ +load( + "@rules_xcodeproj//xcodeproj:defs.bzl", + "top_level_target", + "xcodeproj", +) + +xcodeproj( + name = "xcodeproj", + project_name = "Player", + tags = ["manual"], + top_level_targets = [ + top_level_target("//ios/demo:PlayerUIDemo", target_environments = ["simulator"]), + "//ios/core:PlayerUITests", + "//ios/logger:PlayerUILoggerTests", + "//ios/swiftui:PlayerUISwiftUITests", + "//ios/swiftui:PlayerUISwiftUIViewInspectorTests", + + # plugins + "//plugins/beacon/ios:PlayerUIBaseBeaconPluginTests", + "//plugins/beacon/swiftui:PlayerUIBeaconPluginViewInspectorTests", + + "//plugins/check-path/ios:PlayerUICheckPathPluginTests", + "//plugins/check-path/swiftui:PlayerUISwiftUICheckPathPluginViewInspectorTests", + + "//plugins/common-expressions/ios:PlayerUICommonExpressionsPluginTests", + + "//plugins/common-types/ios:PlayerUICommonTypesPluginTests", + + "//plugins/computed-properties/ios:PlayerUIComputedPropertiesPluginTests", + + "//plugins/console-logger/ios:PlayerUIPrintLoggerPluginTests", + + "//plugins/expression/ios:PlayerUIExpressionPluginTests", + + "//plugins/external-action/ios:PlayerUIExternalActionPluginTests", + "//plugins/external-action/swiftui:PlayerUIExternalActionViewModifierPluginViewInspectorTests", + + "//plugins/metrics/swiftui:PlayerUIMetricsPluginViewInspectorTests", + + "//plugins/pending-transaction/swiftui:PlayerUISwiftUIPendingTransactionPluginViewInspectorTests", + + "//plugins/pubsub/ios:PlayerUIPubSubPluginTests", + + "//plugins/reference-assets/swiftui:PlayerUIReferenceAssetsViewInspectorTests", + "//plugins/reference-assets/swiftui:PlayerUIReferenceAssetsUITests", + + "//plugins/transition/swiftui:PlayerUITransitionPluginViewInspectorTests", + "//plugins/types-provider/ios:PlayerUITypesProviderPluginTests" + ], +) diff --git a/ios/core/BUILD.bazel b/ios/core/BUILD.bazel new file mode 100644 index 000000000..35b03168e --- /dev/null +++ b/ios/core/BUILD.bazel @@ -0,0 +1,45 @@ +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") +load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") + +load("@build_bazel_rules_ios//rules:test.bzl", "ios_unit_test") + +load("//tools/ios:util.bzl", "ios_bundle_module_shim") + +apple_resource_bundle( + name = "PlayerUIResourceBundle", + bundle_name = "PlayerUI", + bundle_id = "com.intuit.ios.player.resources.core", + resources = [ + "//core/player:player_native_bundle", + "//core/partial-match-registry:partial-match-registry_native_bundle", + "//plugins/partial-match-fingerprint/core:core_native_bundle" + ] +) + +ios_bundle_module_shim("PlayerUI") + +pkg_files( + name = "PlayerUI_Sources", + srcs = glob(["Sources/**/*.swift"]), + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//visibility:public"], +) + +swift_library( + name = "PlayerUI", + module_name = "PlayerUI", + srcs = [":PlayerUI_Sources", ":PlayerUIResourceShim"], + visibility = ["//visibility:public"], + deps = ["@swiftpkg_swift_hooks//:Sources_SwiftHooks", "//ios/logger:PlayerUILogger"], + data = [":PlayerUIResourceBundle"], + defines = ["BAZEL_TARGET"] +) + +ios_unit_test( + name = "PlayerUITests", + srcs = glob(["Tests/**/*.swift"]), + minimum_os_version = "14.0", + deps = [":PlayerUI", "//ios/internal-test-utils:PlayerUIInternalTestUtilities"], + visibility = ["//visibility:public"] +) \ No newline at end of file diff --git a/ios/packages/core/Sources/CorePlugins/JSBasePlugin.swift b/ios/core/Sources/CorePlugins/JSBasePlugin.swift similarity index 95% rename from ios/packages/core/Sources/CorePlugins/JSBasePlugin.swift rename to ios/core/Sources/CorePlugins/JSBasePlugin.swift index 86028f0bd..46eedce74 100644 --- a/ios/packages/core/Sources/CorePlugins/JSBasePlugin.swift +++ b/ios/core/Sources/CorePlugins/JSBasePlugin.swift @@ -64,7 +64,11 @@ open class JSBasePlugin { - returns: A URL to the file in the bundle if found */ open func getUrlForFile(fileName: String) -> URL? { + #if SWIFT_PACKAGE + ResourceUtilities.urlForFile(name: fileName, ext: "js", bundle: Bundle.module) + #else ResourceUtilities.urlForFile(name: fileName, ext: "js", bundle: Bundle(for: JSBasePlugin.self), pathComponent: "PlayerUI.bundle") + #endif } /** diff --git a/ios/packages/core/Sources/CorePlugins/NativePlugin.swift b/ios/core/Sources/CorePlugins/NativePlugin.swift similarity index 100% rename from ios/packages/core/Sources/CorePlugins/NativePlugin.swift rename to ios/core/Sources/CorePlugins/NativePlugin.swift diff --git a/ios/packages/core/Sources/CorePlugins/PartialMatchFingerprintPlugin.swift b/ios/core/Sources/CorePlugins/PartialMatchFingerprintPlugin.swift similarity index 94% rename from ios/packages/core/Sources/CorePlugins/PartialMatchFingerprintPlugin.swift rename to ios/core/Sources/CorePlugins/PartialMatchFingerprintPlugin.swift index 437a3a4c7..41902ba81 100644 --- a/ios/packages/core/Sources/CorePlugins/PartialMatchFingerprintPlugin.swift +++ b/ios/core/Sources/CorePlugins/PartialMatchFingerprintPlugin.swift @@ -17,7 +17,7 @@ public class PartialMatchFingerprintPlugin: JSBasePlugin, NativePlugin { */ public convenience init() { self.init( - fileName: "partial-match-fingerprint-plugin.prod", + fileName: "PartialMatchFingerprintPlugin.native", pluginName: "PartialMatchFingerprintPlugin.PartialMatchFingerprintPlugin" ) } @@ -77,6 +77,6 @@ class PartialMatchRegistry: JSBasePlugin { Constructs a PartialMatchRegistry JS object */ convenience init() { - self.init(fileName: "partial-match-registry.prod", pluginName: "Registry.Registry") + self.init(fileName: "Registry.native", pluginName: "Registry.Registry") } } diff --git a/ios/packages/core/Sources/Player/HeadlessPlayer.swift b/ios/core/Sources/Player/HeadlessPlayer.swift similarity index 96% rename from ios/packages/core/Sources/Player/HeadlessPlayer.swift rename to ios/core/Sources/Player/HeadlessPlayer.swift index 33dc4429b..f8857efa3 100644 --- a/ios/packages/core/Sources/Player/HeadlessPlayer.swift +++ b/ios/core/Sources/Player/HeadlessPlayer.swift @@ -7,6 +7,9 @@ import Foundation import JavaScriptCore +#if SWIFT_PACKAGE +import PlayerUILogger +#endif // MARK: PlayerError @@ -298,10 +301,17 @@ public protocol WithSymbol { internal class ResourceBundleShim {} internal extension JSContext { + var coreBundle: URL? { + #if SWIFT_PACKAGE + return ResourceUtilities.urlForFile(name: "Player.native", ext: "js", bundle: Bundle.module) + #else + return ResourceUtilities.urlForFile(name: "Player.native", ext: "js", bundle: Bundle(for: ResourceBundleShim.self), pathComponent: "PlayerUI.bundle") + #endif + } /// Loads the core player bundle into the give JSContext func loadCore() { guard - let url = ResourceUtilities.urlForFile(name: "player.prod", ext: "js", bundle: Bundle(for: ResourceBundleShim.self), pathComponent: "PlayerUI.bundle"), + let url = coreBundle, let jsString = try? String(contentsOf: url, encoding: String.Encoding.utf8) else { return } evaluateScript(jsString) diff --git a/ios/packages/core/Sources/Types/Assets/BaseAssetRegistry.swift b/ios/core/Sources/Types/Assets/BaseAssetRegistry.swift similarity index 98% rename from ios/packages/core/Sources/Types/Assets/BaseAssetRegistry.swift rename to ios/core/Sources/Types/Assets/BaseAssetRegistry.swift index d02f7c462..04eca9fe3 100644 --- a/ios/packages/core/Sources/Types/Assets/BaseAssetRegistry.swift +++ b/ios/core/Sources/Types/Assets/BaseAssetRegistry.swift @@ -7,6 +7,9 @@ import Foundation import JavaScriptCore +#if SWIFT_PACKAGE +import PlayerUILogger +#endif /** Represents the different errors that occur when decoding @@ -66,7 +69,7 @@ open class BaseAssetRegistry: PlayerRegistry where } } - let decoder = JSONDecoder() + public let decoder = JSONDecoder() /** Initializes an empty registry @@ -272,7 +275,7 @@ extension JSONDecoder { /// Attempts to decode an object of type T from the JSON data found in value. /// During decoding calls to `decoder.getJSValue()` will return the object subscripted in value /// at the current coding path. A decode function might use this to update RawValueBacked entities. - func decode(_ type: T.Type, from value: JSValue) throws -> T where T: Decodable { + public func decode(_ type: T.Type, from value: JSValue) throws -> T where T: Decodable { setRootJS(value) defer { setRootJS(nil) } diff --git a/ios/packages/core/Sources/Types/Assets/Wrappers.swift b/ios/core/Sources/Types/Assets/Wrappers.swift similarity index 94% rename from ios/packages/core/Sources/Types/Assets/Wrappers.swift rename to ios/core/Sources/Types/Assets/Wrappers.swift index b747004aa..e32fdfd37 100644 --- a/ios/packages/core/Sources/Types/Assets/Wrappers.swift +++ b/ios/core/Sources/Types/Assets/Wrappers.swift @@ -81,11 +81,6 @@ extension AssetData where Self: Equatable { } } -public struct DefaultAdditionalData: Decodable, Equatable { - /// MetaData associated with the asset in this wrapper - public var metaData: MetaData? -} - /** MetaData associated with an asset */ @@ -95,4 +90,9 @@ public struct MetaData: Codable, Hashable { /// The role of this asset public var role: String? + + public init(beacon: AnyType?, role: String? = nil) { + self.beacon = beacon + self.role = role + } } diff --git a/ios/packages/core/Sources/Types/Beacon.swift b/ios/core/Sources/Types/Beacon.swift similarity index 97% rename from ios/packages/core/Sources/Types/Beacon.swift rename to ios/core/Sources/Types/Beacon.swift index 2dda5e956..bc49c443f 100644 --- a/ios/packages/core/Sources/Types/Beacon.swift +++ b/ios/core/Sources/Types/Beacon.swift @@ -10,7 +10,7 @@ import Foundation /** An object representing a beacon fired from an `Asset` */ -public struct AssetBeacon: Codable { +public struct AssetBeacon: Codable, Equatable { /// The action that caused the beacon public var action: String @@ -49,7 +49,7 @@ public protocol BeaconableMetaData { } /// Container Object for matching the data type for the JS Beacon Plugin -public struct BeaconableAsset: Codable { +public struct BeaconableAsset: Codable, Equatable { /// The ID of the asset that fired the beacon public var id: String diff --git a/ios/packages/core/Sources/Types/Core/BindingParser.swift b/ios/core/Sources/Types/Core/BindingParser.swift similarity index 100% rename from ios/packages/core/Sources/Types/Core/BindingParser.swift rename to ios/core/Sources/Types/Core/BindingParser.swift diff --git a/ios/packages/core/Sources/Types/Core/CompletedState.swift b/ios/core/Sources/Types/Core/CompletedState.swift similarity index 99% rename from ios/packages/core/Sources/Types/Core/CompletedState.swift rename to ios/core/Sources/Types/Core/CompletedState.swift index 85c9d9231..b1b628585 100644 --- a/ios/packages/core/Sources/Types/Core/CompletedState.swift +++ b/ios/core/Sources/Types/Core/CompletedState.swift @@ -26,7 +26,7 @@ public class PlayerControllers { /// The ExpressionEvaluator for the current flow public let expression: ExpressionEvaluator - init?(from value: JSValue?) { + public init?(from value: JSValue?) { guard let controllers = value else { return nil } rawValue = controllers data = DataController.createInstance(value: rawValue.objectForKeyedSubscript("data")) diff --git a/ios/packages/core/Sources/Types/Core/DataController.swift b/ios/core/Sources/Types/Core/DataController.swift similarity index 100% rename from ios/packages/core/Sources/Types/Core/DataController.swift rename to ios/core/Sources/Types/Core/DataController.swift diff --git a/ios/packages/core/Sources/Types/Core/ExpressionEvaluator.swift b/ios/core/Sources/Types/Core/ExpressionEvaluator.swift similarity index 100% rename from ios/packages/core/Sources/Types/Core/ExpressionEvaluator.swift rename to ios/core/Sources/Types/Core/ExpressionEvaluator.swift diff --git a/ios/packages/core/Sources/Types/Core/Flow.swift b/ios/core/Sources/Types/Core/Flow.swift similarity index 100% rename from ios/packages/core/Sources/Types/Core/Flow.swift rename to ios/core/Sources/Types/Core/Flow.swift diff --git a/ios/packages/core/Sources/Types/Core/FlowController.swift b/ios/core/Sources/Types/Core/FlowController.swift similarity index 100% rename from ios/packages/core/Sources/Types/Core/FlowController.swift rename to ios/core/Sources/Types/Core/FlowController.swift diff --git a/ios/packages/core/Sources/Types/Core/Modifiers.swift b/ios/core/Sources/Types/Core/Modifiers.swift similarity index 100% rename from ios/packages/core/Sources/Types/Core/Modifiers.swift rename to ios/core/Sources/Types/Core/Modifiers.swift diff --git a/ios/packages/core/Sources/Types/Core/NavigationStates.swift b/ios/core/Sources/Types/Core/NavigationStates.swift similarity index 99% rename from ios/packages/core/Sources/Types/Core/NavigationStates.swift rename to ios/core/Sources/Types/Core/NavigationStates.swift index e1395c4a0..0e167a80d 100644 --- a/ios/packages/core/Sources/Types/Core/NavigationStates.swift +++ b/ios/core/Sources/Types/Core/NavigationStates.swift @@ -22,7 +22,7 @@ open class NavigationBaseState: CreatedFromJSValue { } } - init(_ value: JSValue) { + public init(_ value: JSValue) { rawValue = value stateType = value.objectForKeyedSubscript("state_type").toString() } diff --git a/ios/packages/core/Sources/Types/Core/PlayerView.swift b/ios/core/Sources/Types/Core/PlayerView.swift similarity index 100% rename from ios/packages/core/Sources/Types/Core/PlayerView.swift rename to ios/core/Sources/Types/Core/PlayerView.swift diff --git a/ios/packages/core/Sources/Types/Core/ViewController.swift b/ios/core/Sources/Types/Core/ViewController.swift similarity index 100% rename from ios/packages/core/Sources/Types/Core/ViewController.swift rename to ios/core/Sources/Types/Core/ViewController.swift diff --git a/ios/packages/core/Sources/Types/Generic/AnyType.swift b/ios/core/Sources/Types/Generic/AnyType.swift similarity index 100% rename from ios/packages/core/Sources/Types/Generic/AnyType.swift rename to ios/core/Sources/Types/Generic/AnyType.swift diff --git a/ios/packages/core/Sources/Types/Hooks/FlowControllerHooks.swift b/ios/core/Sources/Types/Hooks/FlowControllerHooks.swift similarity index 100% rename from ios/packages/core/Sources/Types/Hooks/FlowControllerHooks.swift rename to ios/core/Sources/Types/Hooks/FlowControllerHooks.swift diff --git a/ios/packages/core/Sources/Types/Hooks/Hook.swift b/ios/core/Sources/Types/Hooks/Hook.swift similarity index 100% rename from ios/packages/core/Sources/Types/Hooks/Hook.swift rename to ios/core/Sources/Types/Hooks/Hook.swift diff --git a/ios/packages/core/Sources/Types/Hooks/ViewControllerHooks.swift b/ios/core/Sources/Types/Hooks/ViewControllerHooks.swift similarity index 100% rename from ios/packages/core/Sources/Types/Hooks/ViewControllerHooks.swift rename to ios/core/Sources/Types/Hooks/ViewControllerHooks.swift diff --git a/ios/packages/core/Sources/Types/Hooks/ViewHooks.swift b/ios/core/Sources/Types/Hooks/ViewHooks.swift similarity index 100% rename from ios/packages/core/Sources/Types/Hooks/ViewHooks.swift rename to ios/core/Sources/Types/Hooks/ViewHooks.swift diff --git a/ios/packages/core/Sources/Types/JSLogger.swift b/ios/core/Sources/Types/JSLogger.swift similarity index 100% rename from ios/packages/core/Sources/Types/JSLogger.swift rename to ios/core/Sources/Types/JSLogger.swift diff --git a/ios/packages/core/Sources/utilities/DebugValue.swift b/ios/core/Sources/utilities/DebugValue.swift similarity index 100% rename from ios/packages/core/Sources/utilities/DebugValue.swift rename to ios/core/Sources/utilities/DebugValue.swift diff --git a/ios/packages/core/Sources/utilities/ErrorUtilites.swift b/ios/core/Sources/utilities/ErrorUtilites.swift similarity index 98% rename from ios/packages/core/Sources/utilities/ErrorUtilites.swift rename to ios/core/Sources/utilities/ErrorUtilites.swift index 4e0a70dc4..0690a09ff 100644 --- a/ios/packages/core/Sources/utilities/ErrorUtilites.swift +++ b/ios/core/Sources/utilities/ErrorUtilites.swift @@ -10,7 +10,7 @@ import Foundation extension Error { /// Creates error descriptions logged by Player. - var playerDescription: String { + public var playerDescription: String { if let decodingError = self as? Swift.DecodingError { return decodingError.prettyDescription } diff --git a/ios/packages/core/Sources/utilities/GenericInterfaces.swift b/ios/core/Sources/utilities/GenericInterfaces.swift similarity index 100% rename from ios/packages/core/Sources/utilities/GenericInterfaces.swift rename to ios/core/Sources/utilities/GenericInterfaces.swift diff --git a/ios/packages/core/Sources/utilities/JSUtilities.swift b/ios/core/Sources/utilities/JSUtilities.swift similarity index 100% rename from ios/packages/core/Sources/utilities/JSUtilities.swift rename to ios/core/Sources/utilities/JSUtilities.swift diff --git a/ios/packages/core/Sources/utilities/ResourceUtilities.swift b/ios/core/Sources/utilities/ResourceUtilities.swift similarity index 79% rename from ios/packages/core/Sources/utilities/ResourceUtilities.swift rename to ios/core/Sources/utilities/ResourceUtilities.swift index 0f6abcf27..6b97092ce 100644 --- a/ios/packages/core/Sources/utilities/ResourceUtilities.swift +++ b/ios/core/Sources/utilities/ResourceUtilities.swift @@ -26,8 +26,9 @@ public class ResourceUtilities { - returns: A URL to the file if the bundle can be loaded */ - public static func urlForFile(name: String, ext: String, bundle: Bundle, pathComponent: String) -> URL? { - guard let bundleURL = bundle.resourceURL?.appendingPathComponent(pathComponent) else { return nil } + public static func urlForFile(name: String, ext: String, bundle: Bundle, pathComponent: String? = nil) -> URL? { + let baseURL = pathComponent.map { bundle.resourceURL?.appendingPathComponent($0) } ?? bundle.resourceURL + guard let bundleURL = baseURL else { return nil } return Bundle(url: bundleURL)?.url(forResource: name, withExtension: ext) } } diff --git a/ios/packages/core/Tests/CorePlugins/PartialMatchFingerprintPluginTests.swift b/ios/core/Tests/CorePlugins/PartialMatchFingerprintPluginTests.swift similarity index 100% rename from ios/packages/core/Tests/CorePlugins/PartialMatchFingerprintPluginTests.swift rename to ios/core/Tests/CorePlugins/PartialMatchFingerprintPluginTests.swift diff --git a/ios/packages/core/Tests/FlowStateTests.swift b/ios/core/Tests/FlowStateTests.swift similarity index 98% rename from ios/packages/core/Tests/FlowStateTests.swift rename to ios/core/Tests/FlowStateTests.swift index 3ec183c1d..8f0f85917 100644 --- a/ios/packages/core/Tests/FlowStateTests.swift +++ b/ios/core/Tests/FlowStateTests.swift @@ -9,6 +9,7 @@ import Foundation import XCTest import JavaScriptCore @testable import PlayerUI +@testable import PlayerUIInternalTestUtilities class FlowStateTests: XCTestCase { func testViewFlowState() { diff --git a/ios/packages/core/Tests/HeadlessPlayerTests.swift b/ios/core/Tests/HeadlessPlayerTests.swift similarity index 95% rename from ios/packages/core/Tests/HeadlessPlayerTests.swift rename to ios/core/Tests/HeadlessPlayerTests.swift index 6cfe14783..224ca80c9 100644 --- a/ios/packages/core/Tests/HeadlessPlayerTests.swift +++ b/ios/core/Tests/HeadlessPlayerTests.swift @@ -10,6 +10,7 @@ import Foundation import XCTest import JavaScriptCore @testable import PlayerUI +@testable import PlayerUIInternalTestUtilities class HeadlessPlayerTests: XCTestCase { func testViewId() { @@ -23,17 +24,17 @@ class HeadlessPlayerTests: XCTestCase { player.start(flow: FlowData.COUNTER) { _ in} } - func testApplyTo() { - let player = HeadlessPlayerImpl(plugins: [MetricsPlugin()]) - let pluginExists = expectation(description: "Plugin Found") + // func testApplyTo() { + // let player = HeadlessPlayerImpl(plugins: [MetricsPlugin()]) + // let pluginExists = expectation(description: "Plugin Found") - player.applyTo(MetricsPlugin.self) { plugin in - guard !plugin.isUndefined else { return } - pluginExists.fulfill() - } + // player.applyTo(MetricsPlugin.self) { plugin in + // guard !plugin.isUndefined else { return } + // pluginExists.fulfill() + // } - wait(for: [pluginExists], timeout: 2) - } + // wait(for: [pluginExists], timeout: 2) + // } func testUpdateHook() { let player = HeadlessPlayerImpl(plugins: []) diff --git a/ios/packages/core/Tests/Types/Core/BindingParserTests.swift b/ios/core/Tests/Types/Core/BindingParserTests.swift similarity index 100% rename from ios/packages/core/Tests/Types/Core/BindingParserTests.swift rename to ios/core/Tests/Types/Core/BindingParserTests.swift diff --git a/ios/packages/core/Tests/Types/Core/ExpressionEvaluatorTests.swift b/ios/core/Tests/Types/Core/ExpressionEvaluatorTests.swift similarity index 94% rename from ios/packages/core/Tests/Types/Core/ExpressionEvaluatorTests.swift rename to ios/core/Tests/Types/Core/ExpressionEvaluatorTests.swift index ee9616b81..3984c989d 100644 --- a/ios/packages/core/Tests/Types/Core/ExpressionEvaluatorTests.swift +++ b/ios/core/Tests/Types/Core/ExpressionEvaluatorTests.swift @@ -10,6 +10,7 @@ import Foundation import XCTest @testable import PlayerUI +@testable import PlayerUIInternalTestUtilities class ExpressionEvaluatorTests: XCTestCase { func testExpressionEvaluator() { diff --git a/ios/packages/core/Tests/Types/Core/ModifierTests.swift b/ios/core/Tests/Types/Core/ModifierTests.swift similarity index 100% rename from ios/packages/core/Tests/Types/Core/ModifierTests.swift rename to ios/core/Tests/Types/Core/ModifierTests.swift diff --git a/ios/packages/core/Tests/Types/Core/StateTests.swift b/ios/core/Tests/Types/Core/StateTests.swift similarity index 100% rename from ios/packages/core/Tests/Types/Core/StateTests.swift rename to ios/core/Tests/Types/Core/StateTests.swift diff --git a/ios/packages/core/Tests/Types/Generic/AnyTypeTests.swift b/ios/core/Tests/Types/Generic/AnyTypeTests.swift similarity index 100% rename from ios/packages/core/Tests/Types/Generic/AnyTypeTests.swift rename to ios/core/Tests/Types/Generic/AnyTypeTests.swift diff --git a/ios/packages/core/Tests/Types/Generic/DebugValueTests.swift b/ios/core/Tests/Types/Generic/DebugValueTests.swift similarity index 100% rename from ios/packages/core/Tests/Types/Generic/DebugValueTests.swift rename to ios/core/Tests/Types/Generic/DebugValueTests.swift diff --git a/ios/packages/core/Tests/utilities/ErrorUtilitiesTests.swift b/ios/core/Tests/utilities/ErrorUtilitiesTests.swift similarity index 100% rename from ios/packages/core/Tests/utilities/ErrorUtilitiesTests.swift rename to ios/core/Tests/utilities/ErrorUtilitiesTests.swift diff --git a/ios/packages/core/Tests/utilities/JSLoggerTests.swift b/ios/core/Tests/utilities/JSLoggerTests.swift similarity index 97% rename from ios/packages/core/Tests/utilities/JSLoggerTests.swift rename to ios/core/Tests/utilities/JSLoggerTests.swift index d3ac64fec..78fff0111 100644 --- a/ios/packages/core/Tests/utilities/JSLoggerTests.swift +++ b/ios/core/Tests/utilities/JSLoggerTests.swift @@ -10,6 +10,7 @@ import Foundation import XCTest @testable import PlayerUI +@testable import PlayerUIInternalTestUtilities class JSLoggerTests: XCTestCase { func testJSLogger() { diff --git a/ios/packages/core/Tests/utilities/JSUtilitiesTests.swift b/ios/core/Tests/utilities/JSUtilitiesTests.swift similarity index 100% rename from ios/packages/core/Tests/utilities/JSUtilitiesTests.swift rename to ios/core/Tests/utilities/JSUtilitiesTests.swift diff --git a/ios/demo/BUILD.bazel b/ios/demo/BUILD.bazel new file mode 100644 index 000000000..53b6bcc72 --- /dev/null +++ b/ios/demo/BUILD.bazel @@ -0,0 +1,47 @@ +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") +load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application") + +swift_library( + name = "PlayerUIDemoSources", + srcs = glob(["Sources/**/*.swift"]), + deps = [ + "//ios/core:PlayerUI", + "//ios/swiftui:PlayerUISwiftUI", + "//ios/logger:PlayerUILogger", + + "//ios/test-utils-core:PlayerUITestUtilitiesCore", + + "//plugins/reference-assets/swiftui:PlayerUIReferenceAssets", + + "//plugins/beacon/swiftui:PlayerUIBeaconPlugin", + "//plugins/common-types/ios:PlayerUICommonTypesPlugin", + "//plugins/common-expressions/ios:PlayerUICommonExpressionsPlugin", + "//plugins/expression/ios:PlayerUIExpressionPlugin", + "//plugins/external-action/ios:PlayerUIExternalActionPlugin", + "//plugins/metrics/swiftui:PlayerUIMetricsPlugin", + "//plugins/console-logger/ios:PlayerUIPrintLoggerPlugin", + "//plugins/pending-transaction/swiftui:PlayerUISwiftUIPendingTransactionPlugin", + "//plugins/pubsub/ios:PlayerUIPubSubPlugin", + "//plugins/transition/swiftui:PlayerUITransitionPlugin", + "//plugins/types-provider/ios:PlayerUITypesProviderPlugin", + ] +) + +ios_application( + name = "PlayerUIDemo", + bundle_id = "com.intuit.ios.player", + families = [ + "iphone", + "ipad", + ], + infoplists = [":InfoPlist"], + minimum_os_version = "14.0", + visibility = ["//visibility:public"], + deps = [":PlayerUIDemoSources"], +) + +filegroup( + name = "InfoPlist", + srcs = ["Resources/Info.plist"], + visibility = ["//visibility:public"], +) \ No newline at end of file diff --git a/xcode/PlayerUI/Info.plist b/ios/demo/Resources/Info.plist similarity index 71% rename from xcode/PlayerUI/Info.plist rename to ios/demo/Resources/Info.plist index a5b731c88..66fe88c07 100644 --- a/xcode/PlayerUI/Info.plist +++ b/ios/demo/Resources/Info.plist @@ -2,6 +2,11 @@ + UILaunchScreen + + UIColorName + red + CFBundleDevelopmentRegion en CFBundleExecutable @@ -13,36 +18,21 @@ CFBundleName $(PRODUCT_NAME) CFBundlePackageType - APPL + $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString 1.0 - CFBundleSignature - ???? CFBundleVersion - 235 - ITSAppUsesNonExemptEncryption - - LSRequiresIPhoneOS - - UIApplicationSceneManifest - - UIApplicationSupportsMultipleScenes - - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main + 1 UIRequiredDeviceCapabilities armv7 UISupportedInterfaceOrientations + UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight - UIInterfaceOrientationPortraitUpsideDown diff --git a/ios/demo/Sources/App.swift b/ios/demo/Sources/App.swift new file mode 100644 index 000000000..000f3fbc6 --- /dev/null +++ b/ios/demo/Sources/App.swift @@ -0,0 +1,92 @@ +import SwiftUI +import PlayerUI +import PlayerUILogger +import PlayerUISwiftUI +import PlayerUIReferenceAssets + +import PlayerUIBaseBeaconPlugin +import PlayerUIBeaconPlugin +import PlayerUICommonExpressionsPlugin +import PlayerUICommonTypesPlugin +import PlayerUIExpressionPlugin +import PlayerUIExternalActionPlugin +import PlayerUIMetricsPlugin +import PlayerUIPrintLoggerPlugin +import PlayerUIPubSubPlugin +import PlayerUISwiftUIPendingTransactionPlugin +import PlayerUITransitionPlugin +import PlayerUITypesProviderPlugin + +@main +struct BazelApp: App { + var body: some Scene { + WindowGroup { + NavigationView { + MainView() + } + } + } +} + +struct MainView: View { + @State var result: Result? = nil + + var showAlert: Binding { + Binding(get: { result != nil }) { newValue in + guard !newValue else { return } + result = nil + } + } + + let plugins: [NativePlugin] = [ + PrintLoggerPlugin(level: .trace), + ReferenceAssetsPlugin(), + CommonTypesPlugin(), + ExpressionPlugin(), + CommonExpressionsPlugin(), + ExternalActionPlugin(handler: { _, _, _ in + print("external state") + }), + MetricsPlugin { timing, render, flow in + print(timing as Any) + print(render as Any) + print(flow as Any) + }, + RequestTimePlugin { 5 }, + PubSubPlugin([]), + TypesProviderPlugin(types: [], validators: [], formats: []), + TransitionPlugin(popTransition: .pop), + BeaconPlugin { print(String(describing: $0)) }, + SwiftUIPendingTransactionPlugin() + ] + var body: some View { + SegmentControlView( + plugins: plugins, + assetSections: MockFlows.assetSections, + pluginSections: MockFlows.pluginSections, + result: $result + ) + .navigationBarTitleDisplayMode(.inline) + .alert(isPresented: showAlert, content: { + return Alert( + title: Text("Flow Finished"), + message: Text(result?.message ?? "No Result"), + dismissButton: .default(Text("Done")) + ) + }) + } +} + +extension Result where Success == CompletedState, Failure == PlayerError { + var message: String { + switch self { + case .success(let success): + return success.endState?.outcome ?? "No Outcome" + case .failure(let failure): + guard case let .promiseRejected(error) = failure else { + return failure.playerDescription + } + return error.error + } + } +} diff --git a/ios/demo/Sources/FlowManagerView.swift b/ios/demo/Sources/FlowManagerView.swift new file mode 100644 index 000000000..470fbdcdb --- /dev/null +++ b/ios/demo/Sources/FlowManagerView.swift @@ -0,0 +1,74 @@ +// +// FlowManagerView.swift +// Pods +// +// Created by Zhao Xia Wu on 2023-11-01. +// + +import SwiftUI +import PlayerUI +import PlayerUISwiftUI +import PlayerUIReferenceAssets +import PlayerUIMetricsPlugin + +/** + SwiftUI View to wrap the `ManagedPlayer` and handle the result + for use in UI testing + */ +public struct FlowManagerView: View { + let flowSequence: [String] + let navTitle: String + @State private var complete = false + + public var body: some View { + VStack { + if complete { + VStack { + Text("Flow Completed").font(.title) + Button(action: {complete = false}, label: { Text("Start Over " )}) + } + } else { + VStack { + ManagedPlayer( + plugins: [ + ReferenceAssetsPlugin(), + MetricsPlugin { (render, _, flow) in + print("Render: \(render?.duration ?? 0 )ms | Request \(flow?.flow.requestTime ?? 0)ms") + } + ], + flowManager: ConstantFlowManager(flowSequence), + onComplete: { _ in + complete = true + }, + fallback: { (context) in + VStack { + Text(context.error.localizedDescription) + + switch context.error as? PlayerError { + case .promiseRejected(error: let errorState) : + Text(errorState.error) + default: + EmptyView() + } + + Button(action: context.retry, label: { + Text("Retry") + }) + Button(action: context.reset, label: { + Text("Reset") + }) + }.accessibility(identifier: "FallbackView") + }, + loading: { + Text("Loading Flow") + } + ) + + Button(action: { complete = true }) { + Text("Terminate Flow") + } + } + } + }.navigationBarTitle(Text(navTitle)) + } +} diff --git a/ios/packages/demo/Sources/MockFlows.swift b/ios/demo/Sources/MockFlows.swift similarity index 84% rename from ios/packages/demo/Sources/MockFlows.swift rename to ios/demo/Sources/MockFlows.swift index 3d9edb5fe..378721d24 100644 --- a/ios/packages/demo/Sources/MockFlows.swift +++ b/ios/demo/Sources/MockFlows.swift @@ -1,5 +1,5 @@ // swiftlint:disable all -import PlayerUI +import PlayerUITestUtilitiesCore public struct MockFlows { static let actionCounter: String = """ @@ -1188,7 +1188,218 @@ static let textWithLink: String = """ } } """ - public static let sections: [FlowLoader.FlowSection] = [ +static let beaconAction: String = """ +{ + "id": "generated-flow", + "views": [ + { + "id": "action", + "type": "action", + "exp": [ + "{{count}} = {{count}} + 1", + "beacon('action', 'some-data')" + ], + "metaData": { + "beacon": "Click count: {{count}}" + }, + "label": { + "asset": { + "id": "action-label-text", + "type": "text", + "value": "Clicked {{count}} times" + } + } + } + ], + "data": { + "count": 0 + }, + "navigation": { + "BEGIN": "FLOW_1", + "FLOW_1": { + "startState": "VIEW_1", + "VIEW_1": { + "state_type": "VIEW", + "ref": "action", + "transitions": { + "*": "END_Done" + } + }, + "END_Done": { + "state_type": "END", + "outcome": "done" + } + } + } +} +""" +static let externalAction: String = """ +{ + "id": "test-flow", + "data": { + "transitionValue": "Next" + }, + "navigation": { + "BEGIN": "FLOW_1", + "FLOW_1": { + "startState": "EXT_1", + "EXT_1": { + "state_type": "EXTERNAL", + "ref": "test-1", + "transitions": { + "Next": "END_FWD", + "Prev": "END_BCK" + } + }, + "END_FWD": { + "state_type": "END", + "outcome": "FWD" + }, + "END_BCK": { + "state_type": "END", + "outcome": "BCK" + } + } + } +} +""" +static let pubSubBasic: String = """ +{ + "id": "generated-flow", + "views": [ + { + "id": "action", + "type": "action", + "exp": "@[ publish('some-event', 'event published message') ]@", + "label": { + "asset": { + "id": "action-label", + "type": "text", + "value": "Clicked to publish event" + } + } + } + ], + "data": { + "count": 0 + }, + "navigation": { + "BEGIN": "FLOW_1", + "FLOW_1": { + "startState": "VIEW_1", + "VIEW_1": { + "state_type": "VIEW", + "ref": "action", + "transitions": { + "*": "END_Done" + } + }, + "END_Done": { + "state_type": "END", + "outcome": "done" + } + } + } +} +""" + + +static let inputAssetPendingTransaction: String = """ +{ + "id": "input-validation-flow", + "views": [ + { + "id": "view-1", + "type": "collection", + "values": [ + { + "asset": { + "id": "input-required", + "type": "input", + "binding": "foo.requiredInput", + "label": { + "asset": { + "id": "input-required-label", + "type": "text", + "value": "This input is required and must be greater than 0" + } + } + } + }, + { + "asset": { + "id": "action-1", + "type": "action", + "value": "Next", + "label": { + "asset": { + "id": "action-1-label", + "type": "text", + "value": "Continue" + } + } + } + } + ] + }, + { + "id": "view-2", + "type": "info", + "title": { + "asset": { + "id": "view-2-title", + "type": "text", + "value": "You made it!" + } + } + } + ], + "schema": { + "ROOT": { + "foo": { + "type": "FooType" + } + }, + "FooType": { + "requiredInput": { + "type": "IntegerPosType", + "validation": [ + { + "type": "required" + } + ] + } + } + }, + "data": {}, + "navigation": { + "BEGIN": "FLOW_1", + "FLOW_1": { + "startState": "VIEW_1", + "VIEW_1": { + "state_type": "VIEW", + "ref": "view-1", + "transitions": { + "*": "VIEW_2" + } + }, + "VIEW_2": { + "state_type": "VIEW", + "ref": "view-2", + "transitions": { + "*": "END_Done" + } + }, + "END_Done": { + "state_type": "END", + "outcome": "done" + } + } + } +} +""" + + public static let assetSections: [FlowLoader.FlowSection] = [ (title: "action", flows: [ (name: "counter", flow: MockFlows.actionCounter), (name: "transition to end", flow: MockFlows.actionTransitionToEnd), @@ -1220,4 +1431,20 @@ static let textWithLink: String = """ (name: "with link", flow: MockFlows.textWithLink) ]) ] + + public static let pluginSections: [FlowLoader.FlowSection] = [ + (title: "beacon", flows: [ + (name: "action", flow: MockFlows.beaconAction) + ]), + (title: "external-action", flows: [ + (name: "external-action", flow: MockFlows.externalAction) + ]), + (title: "pubsub", flows: [ + (name: "pub sub basic", flow: MockFlows.pubSubBasic) + ]) + , + (title: "pending-transaction", flows: [ + (name: "input asset pending transaction", flow: MockFlows.inputAssetPendingTransaction) + ]) + ] } diff --git a/ios/demo/Sources/PluginsAndPlayerCollection.swift b/ios/demo/Sources/PluginsAndPlayerCollection.swift new file mode 100644 index 000000000..af144268e --- /dev/null +++ b/ios/demo/Sources/PluginsAndPlayerCollection.swift @@ -0,0 +1,161 @@ +// +// PluginsAndPlayerCollection.swift +// PlayerUI +// +// Created by Zhao Xia Wu on 2023-11-09. +// + +import Foundation +import SwiftUI +import Combine +import PlayerUI +import PlayerUITestUtilitiesCore +import PlayerUIBaseBeaconPlugin +import PlayerUIBeaconPlugin +import PlayerUIExternalActionPlugin +import PlayerUIPubSubPlugin + +/** + A SwiftUI View to load flows for Plugin and ManagedPlayer for ease of UITesting + */ +public struct PluginsAndPlayerCollection: View { + let plugins: [NativePlugin] + let sections: [FlowLoader.FlowSection] + let padding: CGFloat + + /** + Initializes and loads flows + - parameters: + - plugins: Plugins to add to Player instance that is created + - sections: The `[FlowSection]` to display + - padding: Padding around the AssetFlowView + */ + public init( + plugins: [NativePlugin], + sections: [FlowLoader.FlowSection], + padding: CGFloat = 16 + ) { + self.plugins = plugins + self.padding = padding + self.sections = sections + } + + @State var beaconAndPubsubInfo = "" + @State var completionMessage = "" + @State var alertPresented = false + + public var body: some View { + + List { + // Plugin flows + pluginFlows + + // Managed Player flows + Section { + NavigationLink("Simple Flows") { + FlowManagerView(flowSequence: [.firstFlow, .secondFlow], navTitle: "Simple Flows") + .padding(padding) + }.accessibility(identifier: "Simple Flows") + NavigationLink("Error Content Flow") { + FlowManagerView(flowSequence: [.firstFlow, .errorFlow], navTitle: "Error Content Flow") + .padding(padding) + }.accessibility(identifier: "Error Content Flow") + NavigationLink("Error Asset Flow") { + FlowManagerView(flowSequence: [.firstFlow, .assetErrorFlow], navTitle: "Error Asset Flow") + .padding(padding) + }.accessibility(identifier: "Error Asset Flow") + } header: { + Text("Managed Player") + } + } + .accessibility(identifier: "Player") + .navigationBarTitle(Text("Player")) + } + + var pluginFlows: some View { + let pubsubPlugin = PubSubPlugin([("some-event", { (eventName, eventData) in + $alertPresented.wrappedValue = true + + switch eventData { + case .string(data: let string): + $beaconAndPubsubInfo.wrappedValue = $beaconAndPubsubInfo.wrappedValue + "Published: `\(eventName)` with message: `\(string)` \n" + default: break + } + })]) + + let beaconPlugin = BeaconPlugin { beaconStruct in + $alertPresented.wrappedValue = true + let encoder = JSONEncoder() + if let data = try? encoder.encode(beaconStruct), let jsonString = String(data: data, encoding: .utf8) { + $beaconAndPubsubInfo.wrappedValue = $beaconAndPubsubInfo.wrappedValue + "Beacon: \(jsonString) \n" + } + } + + let externalActionPlugin = ExternalActionPlugin(handler: { state, options, transition in + guard state.ref == "test-1" else { return transition("Prev") } + let transitionValue = options.data.get(binding: "transitionValue") as? String + options.expression.evaluate("{{foo}} = 'bar'") + transition(transitionValue ?? "Next") + }) + + return ForEach(sections, id: \.title) { section in + Section { + ForEach(section.flows, id: \.name) { flow in + NavigationLink(flow.name) { + AssetFlowView(flow: flow.flow, plugins: plugins + [externalActionPlugin, beaconPlugin, pubsubPlugin], completion: completion(result:)) + .padding(padding) + .navigationBarTitle(Text(flow.name)) + .modifier( + AlertViewModifier( + alertPresented: $alertPresented, + pubsubEventName: $beaconAndPubsubInfo, + completionMessage: $completionMessage) + ) + .onDisappear { + // clear tracked beacons and pub sub info + $beaconAndPubsubInfo.wrappedValue = "" + } + } + .accessibility(identifier: "\(section.title) \(flow.name)") + } + } header: { + Text(section.title) + } + } + } + + struct AlertViewModifier: ViewModifier { + @Binding var alertPresented: Bool + @Binding var pubsubEventName: String + @Binding var completionMessage: String + + func body(content: Content) -> some View { + content + .alert( + isPresented: $alertPresented, + content: { + Alert( + title: (completionMessage != "" ? Text("FlowCompleted") : Text("Info")), + message: Text("Data: \n \($pubsubEventName.wrappedValue) \n Completion: \($completionMessage.wrappedValue)"), + dismissButton: .default(Text("OK")) + ) + } + ) + } + } + + func completion(result: Result) { + $alertPresented.wrappedValue = true + switch result { + case .success(let result): + completionMessage = result.endState?.outcome ?? "No Outcome" + case .failure(let error): + guard case let .promiseRejected(errorState) = error else { + completionMessage = "\(error)" + return + } + + completionMessage = "\(errorState.error)" + } + } +} diff --git a/ios/demo/Sources/SegmentControlView.swift b/ios/demo/Sources/SegmentControlView.swift new file mode 100644 index 000000000..9a753b0f9 --- /dev/null +++ b/ios/demo/Sources/SegmentControlView.swift @@ -0,0 +1,100 @@ +// +// SegmentControlView.swift +// PlayerUI +// +// Created by Zhao Xia Wu on 2023-11-08. +// + +import Foundation +import SwiftUI +import Combine +import PlayerUI +import PlayerUITestUtilitiesCore + +/** + A SwiftUI View that contains two tabs AssetCollection and PluginsAndPlayer tab for ease of UITesting + */ +public struct SegmentControlView: View { + let plugins: [NativePlugin] + let assetSections: [FlowLoader.FlowSection] + let pluginSections: [FlowLoader.FlowSection] + let padding: CGFloat + let result: Binding?> + /** + Initializes and loads flows + - parameters: + - plugins: Plugins to add to Player instance that is created + - assetSections: The `[FlowSection]` to display asset flows + - pluginSections: The `[FlowSection]` to display plugin flows + - padding: Padding around the AssetFlowView `` + - completion: A handler for when a flow reaches an end state + */ + public init( + plugins: [NativePlugin], + assetSections: [FlowLoader.FlowSection], + pluginSections: [FlowLoader.FlowSection], + padding: CGFloat = 16, + result: Binding?> + ) { + self.plugins = plugins + self.assetSections = assetSections + self.pluginSections = pluginSections + self.padding = padding + self.result = result + } + + enum HeaderSelection: String, CaseIterable { + case flows = "Asset Flows" + case pluginsAndPlayer = "Plugins + Managed Player" + } + + @State var segmentationSelection: HeaderSelection = .flows + + @State var pubsubEventPublished = false + @State var pubsubEventName = "" + @State var pubsubEventMessage = "" + + @State var beaconsRecieved = false + @State var beaconsInfo = "" + + @State var doneFlow = false + @State var outcome = "" + + public var body: some View { + VStack { + Picker("", selection: $segmentationSelection) { + ForEach(HeaderSelection.allCases, id: \.self) { option in + Text(option.rawValue) + } + }.pickerStyle(SegmentedPickerStyle()) + + Spacer() + + if segmentationSelection == .flows { + flowsListSection + } else { + playerListSection + } + } + } + + var flowsListSection: some View { + return AssetCollection( + plugins: plugins, + sections: assetSections, + padding: padding, + result: result + ) + .accessibility(identifier: "AssetCollection") + .navigationBarTitle(Text("Flows")) + .alert(isPresented: $doneFlow, content: { + Alert(title: Text("FlowFinished"), + message: Text("Outcome: \(outcome)"), + dismissButton: .default(Text("OK"))) + }) + } + + var playerListSection: some View { + return PluginsAndPlayerCollection(plugins: plugins, sections: pluginSections) + } +} diff --git a/ios/demo/Sources/String+Extensions.swift b/ios/demo/Sources/String+Extensions.swift new file mode 100644 index 000000000..eff08f595 --- /dev/null +++ b/ios/demo/Sources/String+Extensions.swift @@ -0,0 +1,156 @@ +// +// String + Extensions.swift +// PlayerUI-UI-XCUITests +// +// Created by Zhao Xia Wu on 2023-11-01. +// + +import Foundation + +// mocks for managed player flows +extension String { + static let firstFlow: String = + """ + { + "id": "flow_1", + "views": [ + { + "id": "first_view", + "type": "action", + "value": "flow_1", + "label": { + "asset": { + "id": "next-view-label", + "type": "text", + "value": "End Flow 1" + } + } + } + ], + "navigation": { + "BEGIN": "flow_1", + "flow_1": { + "startState": "view_1", + "view_1": { + "state_type": "VIEW", + "ref": "first_view", + "transitions": { + "*": "END_Done" + } + }, + "END_Done": { + "state_type": "END", + "outcome": "done" + } + } + } + } + """ + + static let secondFlow: String = + """ + { + "id": "flow_2", + "views": [ + { + "id": "second_view", + "type": "action", + "value": "flow_2", + "label": { + "asset": { + "id": "next-view-label", + "type": "text", + "value": "End View 2" + } + } + } + ], + "navigation": { + "BEGIN": "flow_2", + "flow_2": { + "startState": "view_2", + "view_2": { + "state_type": "VIEW", + "ref": "second_view", + "transitions": { + "*": "END_Done" + } + }, + "END_Done": { + "state_type": "END", + "outcome": "done" + } + } + } + } + """ + + static let errorFlow = + """ + { + "id": "flow_2", + "views": [ + { + "id": "second_view", + "type": "action", + "exp": "{{foo.bar..}", + "value": "end", + "label": { + "asset": { + "id": "next-view-label", + "type": "text", + "value": "End View 2" + } + } + } + ], + "navigation": { + "BEGIN": "flow_2", + "flow_2": { + "startState": "view_2", + "view_2": { + "state_type": "VIEW", + "ref": "second_view", + "transitions": { + "*": "END_Done" + } + }, + "END_Done": { + "state_type": "END", + "outcome": "done" + } + } + } + } + """ + + static let assetErrorFlow = + """ + { + "id": "flow_3", + "views": [ + { + "id": "third_view", + "type": "error" + } + ], + "navigation": { + "BEGIN": "flow_3", + "flow_3": { + "startState": "view_3", + "view_3": { + "state_type": "VIEW", + "ref": "third_view", + "transitions": { + "*": "END_Done" + } + }, + "END_Done": { + "state_type": "END", + "outcome": "done" + } + } + } + } + """ +} \ No newline at end of file diff --git a/ios/internal-test-utils/BUILD.bazel b/ios/internal-test-utils/BUILD.bazel new file mode 100644 index 000000000..6e68eab75 --- /dev/null +++ b/ios/internal-test-utils/BUILD.bazel @@ -0,0 +1,9 @@ +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") + +swift_library( + name = "PlayerUIInternalTestUtilities", + module_name = "PlayerUIInternalTestUtilities", + srcs = glob(["Sources/**/*.swift"]), + visibility = ["//visibility:public"], + deps = ["//ios/core:PlayerUI", "//ios/logger:PlayerUILogger"] +) \ No newline at end of file diff --git a/ios/packages/internal-test-utils/Sources/FlowData.swift b/ios/internal-test-utils/Sources/FlowData.swift similarity index 100% rename from ios/packages/internal-test-utils/Sources/FlowData.swift rename to ios/internal-test-utils/Sources/FlowData.swift diff --git a/ios/packages/internal-test-utils/Sources/HeadlessPlayerImpl.swift b/ios/internal-test-utils/Sources/HeadlessPlayerImpl.swift similarity index 98% rename from ios/packages/internal-test-utils/Sources/HeadlessPlayerImpl.swift rename to ios/internal-test-utils/Sources/HeadlessPlayerImpl.swift index 5d6e7ff16..3ed29e4b8 100644 --- a/ios/packages/internal-test-utils/Sources/HeadlessPlayerImpl.swift +++ b/ios/internal-test-utils/Sources/HeadlessPlayerImpl.swift @@ -1,4 +1,6 @@ import JavaScriptCore +import PlayerUI +import PlayerUILogger class HeadlessPlayerImpl: HeadlessPlayer { var assetRegistry: BaseAssetRegistry diff --git a/ios/packages/internal-test-utils/Sources/TestDecoder.swift b/ios/internal-test-utils/Sources/TestDecoder.swift similarity index 100% rename from ios/packages/internal-test-utils/Sources/TestDecoder.swift rename to ios/internal-test-utils/Sources/TestDecoder.swift diff --git a/ios/logger/BUILD.bazel b/ios/logger/BUILD.bazel new file mode 100644 index 000000000..0cd07c7a5 --- /dev/null +++ b/ios/logger/BUILD.bazel @@ -0,0 +1,27 @@ +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") + +load("@build_bazel_rules_ios//rules:test.bzl", "ios_unit_test") + +pkg_files( + name = "PlayerUILogger_Sources", + srcs = glob(["Sources/**/*.swift"]), + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//visibility:public"], +) + +swift_library( + name = "PlayerUILogger", + module_name = "PlayerUILogger", + srcs = [":PlayerUILogger_Sources"], + visibility = ["//visibility:public"], + deps = ["@swiftpkg_swift_hooks//:Sources_SwiftHooks"] +) + +ios_unit_test( + name = "PlayerUILoggerTests", + srcs = glob(["Tests/**/*.swift"]), + minimum_os_version = "14.0", + deps = [":PlayerUILogger"], + visibility = ["//visibility:public"], +) \ No newline at end of file diff --git a/ios/packages/logger/Sources/LogLevel.swift b/ios/logger/Sources/LogLevel.swift similarity index 100% rename from ios/packages/logger/Sources/LogLevel.swift rename to ios/logger/Sources/LogLevel.swift diff --git a/ios/packages/logger/Sources/TapableLogger.swift b/ios/logger/Sources/TapableLogger.swift similarity index 95% rename from ios/packages/logger/Sources/TapableLogger.swift rename to ios/logger/Sources/TapableLogger.swift index 498f351d0..d7640cc49 100644 --- a/ios/packages/logger/Sources/TapableLogger.swift +++ b/ios/logger/Sources/TapableLogger.swift @@ -96,10 +96,10 @@ public class TapableLogger { - level: The log level to create the function for - returns: A `JSLogFunction` to be used in JavaScriptCore */ - internal func getJSLogFor(level: LogLevel) -> JSLogFunction { - let logFn: JSLogFunction = { val in - guard let message = self.hooks.convertJSValue.call(val) else { return } - self.log(level: level, message: message) + public func getJSLogFor(level: LogLevel) -> JSLogFunction { + let logFn: JSLogFunction = { [weak self] val in + guard let message = self?.hooks.convertJSValue.call(val) else { return } + self?.log(level: level, message: message) } return logFn diff --git a/ios/packages/logger/Tests/LogLevelTests.swift b/ios/logger/Tests/LogLevelTests.swift similarity index 98% rename from ios/packages/logger/Tests/LogLevelTests.swift rename to ios/logger/Tests/LogLevelTests.swift index dd8c53f4d..e332bb087 100644 --- a/ios/packages/logger/Tests/LogLevelTests.swift +++ b/ios/logger/Tests/LogLevelTests.swift @@ -8,8 +8,8 @@ import Foundation import XCTest +@testable import PlayerUILogger -@testable import PlayerUI class LogLevelTests: XCTestCase { func testShouldLog() { XCTAssertEqual(LogLevel.trace.shouldLog(currentLevel: .trace), true) diff --git a/ios/packages/logger/Tests/TapableLoggerTests.swift b/ios/logger/Tests/TapableLoggerTests.swift similarity index 97% rename from ios/packages/logger/Tests/TapableLoggerTests.swift rename to ios/logger/Tests/TapableLoggerTests.swift index 890e07e89..8d1d7e02d 100644 --- a/ios/packages/logger/Tests/TapableLoggerTests.swift +++ b/ios/logger/Tests/TapableLoggerTests.swift @@ -10,7 +10,7 @@ import Foundation import XCTest import JavaScriptCore import SwiftHooks -@testable import PlayerUI +@testable import PlayerUILogger class TapableLoggerTests: XCTestCase { func testJSConversion() { @@ -57,6 +57,9 @@ class TapableLoggerTests: XCTestCase { wait(for: [logExpect], timeout: 1) } + enum TestError: Error { + case errored + } func testLogHooks() { let logger = TapableLogger() logger.logLevel = .trace @@ -84,7 +87,7 @@ class TapableLoggerTests: XCTestCase { logger.i("Message") logger.w("Message") logger.e("Message") - logger.e(DecodingError.baseAssetNotDecodable) + logger.e(TestError.errored) wait(for: [traceExpect, debugExpect, infoExpect, warningExpect, errorExpect, errorMsgExpect], timeout: 1) } diff --git a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/100.png b/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/100.png deleted file mode 100644 index 91547a7f1..000000000 Binary files a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/100.png and /dev/null differ diff --git a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/1024.png b/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/1024.png deleted file mode 100644 index c524f8dc1..000000000 Binary files a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/1024.png and /dev/null differ diff --git a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/114.png b/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/114.png deleted file mode 100644 index 8cc1441b9..000000000 Binary files a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/114.png and /dev/null differ diff --git a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/120.png b/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/120.png deleted file mode 100644 index 9d13d00b7..000000000 Binary files a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/120.png and /dev/null differ diff --git a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/144.png b/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/144.png deleted file mode 100644 index 8c5168d9e..000000000 Binary files a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/144.png and /dev/null differ diff --git a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/152.png b/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/152.png deleted file mode 100644 index 58ba68912..000000000 Binary files a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/152.png and /dev/null differ diff --git a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/167.png b/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/167.png deleted file mode 100644 index 3e0d4d497..000000000 Binary files a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/167.png and /dev/null differ diff --git a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/180.png b/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/180.png deleted file mode 100644 index a48c63fe2..000000000 Binary files a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/180.png and /dev/null differ diff --git a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/20.png b/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/20.png deleted file mode 100644 index 4da4be3ed..000000000 Binary files a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/20.png and /dev/null differ diff --git a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/29.png b/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/29.png deleted file mode 100644 index 7922a9a82..000000000 Binary files a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/29.png and /dev/null differ diff --git a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/40.png b/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/40.png deleted file mode 100644 index edc318b2c..000000000 Binary files a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/40.png and /dev/null differ diff --git a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/50.png b/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/50.png deleted file mode 100644 index 8cdaa5bc8..000000000 Binary files a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/50.png and /dev/null differ diff --git a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/57.png b/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/57.png deleted file mode 100644 index 38471d9d9..000000000 Binary files a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/57.png and /dev/null differ diff --git a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/58.png b/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/58.png deleted file mode 100644 index 5ec625392..000000000 Binary files a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/58.png and /dev/null differ diff --git a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/60.png b/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/60.png deleted file mode 100644 index a353389a2..000000000 Binary files a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/60.png and /dev/null differ diff --git a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/72.png b/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/72.png deleted file mode 100644 index 10c88baa4..000000000 Binary files a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/72.png and /dev/null differ diff --git a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/76.png b/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/76.png deleted file mode 100644 index 8c3c49d50..000000000 Binary files a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/76.png and /dev/null differ diff --git a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/80.png b/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/80.png deleted file mode 100644 index 6e7f5e8c4..000000000 Binary files a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/80.png and /dev/null differ diff --git a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/87.png b/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/87.png deleted file mode 100644 index 2ea16ec89..000000000 Binary files a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/87.png and /dev/null differ diff --git a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/Contents.json b/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 4fdf88263..000000000 --- a/ios/packages/demo/Resources/Images.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,158 +0,0 @@ -{ - "images" : [ - { - "filename" : "40.png", - "idiom" : "iphone", - "scale" : "2x", - "size" : "20x20" - }, - { - "filename" : "60.png", - "idiom" : "iphone", - "scale" : "3x", - "size" : "20x20" - }, - { - "filename" : "29.png", - "idiom" : "iphone", - "scale" : "1x", - "size" : "29x29" - }, - { - "filename" : "58.png", - "idiom" : "iphone", - "scale" : "2x", - "size" : "29x29" - }, - { - "filename" : "87.png", - "idiom" : "iphone", - "scale" : "3x", - "size" : "29x29" - }, - { - "filename" : "80.png", - "idiom" : "iphone", - "scale" : "2x", - "size" : "40x40" - }, - { - "filename" : "120.png", - "idiom" : "iphone", - "scale" : "3x", - "size" : "40x40" - }, - { - "filename" : "57.png", - "idiom" : "iphone", - "scale" : "1x", - "size" : "57x57" - }, - { - "filename" : "114.png", - "idiom" : "iphone", - "scale" : "2x", - "size" : "57x57" - }, - { - "filename" : "120.png", - "idiom" : "iphone", - "scale" : "2x", - "size" : "60x60" - }, - { - "filename" : "180.png", - "idiom" : "iphone", - "scale" : "3x", - "size" : "60x60" - }, - { - "filename" : "20.png", - "idiom" : "ipad", - "scale" : "1x", - "size" : "20x20" - }, - { - "filename" : "40.png", - "idiom" : "ipad", - "scale" : "2x", - "size" : "20x20" - }, - { - "filename" : "29.png", - "idiom" : "ipad", - "scale" : "1x", - "size" : "29x29" - }, - { - "filename" : "58.png", - "idiom" : "ipad", - "scale" : "2x", - "size" : "29x29" - }, - { - "filename" : "40.png", - "idiom" : "ipad", - "scale" : "1x", - "size" : "40x40" - }, - { - "filename" : "80.png", - "idiom" : "ipad", - "scale" : "2x", - "size" : "40x40" - }, - { - "filename" : "50.png", - "idiom" : "ipad", - "scale" : "1x", - "size" : "50x50" - }, - { - "filename" : "100.png", - "idiom" : "ipad", - "scale" : "2x", - "size" : "50x50" - }, - { - "filename" : "72.png", - "idiom" : "ipad", - "scale" : "1x", - "size" : "72x72" - }, - { - "filename" : "144.png", - "idiom" : "ipad", - "scale" : "2x", - "size" : "72x72" - }, - { - "filename" : "76.png", - "idiom" : "ipad", - "scale" : "1x", - "size" : "76x76" - }, - { - "filename" : "152.png", - "idiom" : "ipad", - "scale" : "2x", - "size" : "76x76" - }, - { - "filename" : "167.png", - "idiom" : "ipad", - "scale" : "2x", - "size" : "83.5x83.5" - }, - { - "filename" : "1024.png", - "idiom" : "ios-marketing", - "scale" : "1x", - "size" : "1024x1024" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/ios/packages/demo/Resources/Images.xcassets/PlayerLogo.imageset/Contents.json b/ios/packages/demo/Resources/Images.xcassets/PlayerLogo.imageset/Contents.json deleted file mode 100644 index eb71d2436..000000000 --- a/ios/packages/demo/Resources/Images.xcassets/PlayerLogo.imageset/Contents.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "images" : [ - { - "filename" : "small-light-2.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "filename" : "small-dark.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "small-light-1.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "filename" : "small-dark-1.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "small-light.png", - "idiom" : "universal", - "scale" : "3x" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "filename" : "small-dark-2.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/ios/packages/demo/Resources/Images.xcassets/PlayerLogo.imageset/small-dark-1.png b/ios/packages/demo/Resources/Images.xcassets/PlayerLogo.imageset/small-dark-1.png deleted file mode 100644 index 5f9861bfd..000000000 Binary files a/ios/packages/demo/Resources/Images.xcassets/PlayerLogo.imageset/small-dark-1.png and /dev/null differ diff --git a/ios/packages/demo/Resources/Images.xcassets/PlayerLogo.imageset/small-dark-2.png b/ios/packages/demo/Resources/Images.xcassets/PlayerLogo.imageset/small-dark-2.png deleted file mode 100644 index 5f9861bfd..000000000 Binary files a/ios/packages/demo/Resources/Images.xcassets/PlayerLogo.imageset/small-dark-2.png and /dev/null differ diff --git a/ios/packages/demo/Resources/Images.xcassets/PlayerLogo.imageset/small-dark.png b/ios/packages/demo/Resources/Images.xcassets/PlayerLogo.imageset/small-dark.png deleted file mode 100644 index 5f9861bfd..000000000 Binary files a/ios/packages/demo/Resources/Images.xcassets/PlayerLogo.imageset/small-dark.png and /dev/null differ diff --git a/ios/packages/demo/Resources/Images.xcassets/PlayerLogo.imageset/small-light-1.png b/ios/packages/demo/Resources/Images.xcassets/PlayerLogo.imageset/small-light-1.png deleted file mode 100644 index 726b21bb8..000000000 Binary files a/ios/packages/demo/Resources/Images.xcassets/PlayerLogo.imageset/small-light-1.png and /dev/null differ diff --git a/ios/packages/demo/Resources/Images.xcassets/PlayerLogo.imageset/small-light-2.png b/ios/packages/demo/Resources/Images.xcassets/PlayerLogo.imageset/small-light-2.png deleted file mode 100644 index 726b21bb8..000000000 Binary files a/ios/packages/demo/Resources/Images.xcassets/PlayerLogo.imageset/small-light-2.png and /dev/null differ diff --git a/ios/packages/demo/Resources/Images.xcassets/PlayerLogo.imageset/small-light.png b/ios/packages/demo/Resources/Images.xcassets/PlayerLogo.imageset/small-light.png deleted file mode 100644 index 726b21bb8..000000000 Binary files a/ios/packages/demo/Resources/Images.xcassets/PlayerLogo.imageset/small-light.png and /dev/null differ diff --git a/ios/packages/demo/Resources/Launch.xib b/ios/packages/demo/Resources/Launch.xib deleted file mode 100644 index 95c013ac4..000000000 --- a/ios/packages/demo/Resources/Launch.xib +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ios/packages/demo/Resources/Primary.storyboard b/ios/packages/demo/Resources/Primary.storyboard deleted file mode 100644 index c1aadd583..000000000 --- a/ios/packages/demo/Resources/Primary.storyboard +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ios/packages/demo/Resources/flows/action/action-transition-between-pages.json b/ios/packages/demo/Resources/flows/action/action-transition-between-pages.json deleted file mode 100644 index 508c10962..000000000 --- a/ios/packages/demo/Resources/flows/action/action-transition-between-pages.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "id": "transition-between-pages", - "views": [ - { - "id": "view-1", - "type": "action", - "value": "next", - "label": { - "asset": { - "id": "view-1-label", - "type": "text", - "value": "Go to View 2" - } - } - }, - { - "id": "view-2", - "type": "action", - "value": "prev", - "label": { - "asset": { - "id": "view-2-label", - "type": "text", - "value": "Go to View 1" - } - } - } - ], - "navigation": { - "BEGIN": "FLOW_1", - "FLOW_1": { - "startState": "VIEW_1", - "VIEW_1": { - "ref": "view-1", - "state_type": "VIEW", - "transitions": { - "next": "VIEW_2" - } - }, - "VIEW_2": { - "ref": "view-2", - "state_type": "VIEW", - "transitions": { - "prev": "VIEW_1" - } - } - } - } -} diff --git a/ios/packages/demo/Resources/flows/collection/collection-basic.json b/ios/packages/demo/Resources/flows/collection/collection-basic.json deleted file mode 100644 index a3845443a..000000000 --- a/ios/packages/demo/Resources/flows/collection/collection-basic.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "id": "generated-flow", - "views": [ - { - "id": "collection", - "type": "collection", - "values": [ - { - "asset": { - "id": "col-1", - "type": "text", - "value": "Item 1" - } - }, - { - "asset": { - "id": "col-2", - "type": "text", - "value": "Item 2" - } - } - ] - } - ], - "data": {}, - "navigation": { - "BEGIN": "FLOW_1", - "FLOW_1": { - "startState": "VIEW_1", - "VIEW_1": { - "state_type": "VIEW", - "ref": "collection", - "transitions": { - "*": "END_Done" - } - }, - "END_Done": { - "state_type": "END", - "outcome": "done" - } - } - } -} \ No newline at end of file diff --git a/ios/packages/demo/Resources/flows/info/info-dynamic-flow.json b/ios/packages/demo/Resources/flows/info/info-dynamic-flow.json deleted file mode 100644 index 3d2ed3976..000000000 --- a/ios/packages/demo/Resources/flows/info/info-dynamic-flow.json +++ /dev/null @@ -1,168 +0,0 @@ -{ - "id": "modal-flow", - "views": [ - { - "id": "view-1", - "type": "info", - "title": { - "asset": { - "id": "view-title", - "type": "text", - "value": "View 1" - } - }, - "actions": [ - { - "asset": { - "id": "action-1", - "type": "action", - "value": "Next", - "label": { - "asset": { - "id": "action-1-label", - "type": "text", - "value": "Next" - } - } - } - } - ] - }, - { - "id": "view-2", - "type": "info", - "title": { - "asset": { - "id": "view-title", - "type": "text", - "value": "View 2" - } - }, - "actions": [ - { - "asset": { - "id": "action-1", - "type": "action", - "value": "Next", - "label": { - "asset": { - "id": "action-1-label", - "type": "text", - "value": "Next" - } - } - } - }, - { - "asset": { - "id": "action-2", - "type": "action", - "value": "Dismiss", - "label": { - "asset": { - "id": "action-1-label", - "type": "text", - "value": "Dismiss" - } - } - } - } - ] - }, - { - "id": "view-3", - "type": "info", - "title": { - "asset": { - "id": "view-3-title", - "type": "text", - "value": "View 3" - } - }, - "actions": [ - { - "asset": { - "id": "action-3", - "type": "action", - "value": "Next", - "label": { - "asset": { - "id": "action-3-label", - "type": "text", - "value": "Next" - } - } - } - } - ] - }, - { - "id": "view-4", - "type": "info", - "title": { - "asset": { - "id": "view-4-title", - "type": "text", - "value": "View 4" - } - }, - "actions": [ - { - "asset": { - "id": "action-4", - "type": "action", - "value": "Next", - "label": { - "asset": { - "id": "action-4-label", - "type": "text", - "value": "Next" - } - } - } - } - ] - } - ], - "data": { - "viewRef": "VIEW_3" - }, - "navigation": { - "BEGIN": "FLOW_1", - "FLOW_1": { - "startState": "VIEW_1", - "VIEW_1": { - "state_type": "VIEW", - "ref": "view-1", - "transitions": { - "*": "VIEW_2" - } - }, - "VIEW_2": { - "state_type": "VIEW", - "ref": "view-2", - "attributes": { - "stacked": true - }, - "transitions": { - "Next": "{{viewRef}}", - "Dismiss": "VIEW_1" - } - }, - "VIEW_3": { - "state_type": "VIEW", - "ref": "view-3", - "transitions": { - "*": "VIEW_1" - } - }, - "VIEW_4": { - "state_type": "VIEW", - "ref": "view-4", - "transitions": { - "*": "VIEW_1" - } - } - } - } -} \ No newline at end of file diff --git a/ios/packages/demo/Resources/flows/info/info-modal-flow.json b/ios/packages/demo/Resources/flows/info/info-modal-flow.json deleted file mode 100644 index 53adda586..000000000 --- a/ios/packages/demo/Resources/flows/info/info-modal-flow.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "id": "modal-flow", - "views": [ - { - "id": "view-1", - "type": "info", - "title": { - "asset": { - "id": "view-title", - "type": "text", - "value": "View 1" - } - }, - "actions": [ - { - "asset": { - "id": "action-1", - "type": "action", - "value": "Next", - "label": { - "asset": { - "id": "action-1-label", - "type": "text", - "value": "Next" - } - } - } - } - ] - }, - { - "id": "view-2", - "type": "info", - "title": { - "asset": { - "id": "view-title", - "type": "text", - "value": "View 2" - } - }, - "actions": [ - { - "asset": { - "id": "action-1", - "type": "action", - "value": "Next", - "label": { - "asset": { - "id": "action-1-label", - "type": "text", - "value": "Next" - } - } - } - }, - { - "asset": { - "id": "action-2", - "type": "action", - "value": "Dismiss", - "label": { - "asset": { - "id": "action-1-label", - "type": "text", - "value": "Dismiss" - } - } - } - } - ] - }, - { - "id": "view-3", - "type": "info", - "title": { - "asset": { - "id": "view-3-title", - "type": "text", - "value": "View 3" - } - }, - "actions": [ - { - "asset": { - "id": "action-3", - "type": "action", - "value": "Next", - "label": { - "asset": { - "id": "action-3-label", - "type": "text", - "value": "Next" - } - } - } - } - ] - } - ], - "navigation": { - "BEGIN": "FLOW_1", - "FLOW_1": { - "startState": "VIEW_1", - "VIEW_1": { - "state_type": "VIEW", - "ref": "view-1", - "transitions": { - "*": "VIEW_2" - } - }, - "VIEW_2": { - "state_type": "VIEW", - "ref": "view-2", - "attributes": { - "stacked": true - }, - "transitions": { - "Next": "VIEW_3", - "Dismiss": "VIEW_1" - } - }, - "VIEW_3": { - "state_type": "VIEW", - "ref": "view-3", - "transitions": { - "*": "VIEW_1" - } - } - } - } -} \ No newline at end of file diff --git a/ios/packages/demo/Resources/flows/input/input-basic.json b/ios/packages/demo/Resources/flows/input/input-basic.json deleted file mode 100644 index a22298da9..000000000 --- a/ios/packages/demo/Resources/flows/input/input-basic.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "id": "generated-flow", - "views": [ - { - "id": "input", - "type": "input", - "binding": "foo.bar", - "label": { - "asset": { - "id": "input-label", - "type": "text", - "value": "This is an input" - } - } - } - ], - "data": {}, - "navigation": { - "BEGIN": "FLOW_1", - "FLOW_1": { - "startState": "VIEW_1", - "VIEW_1": { - "state_type": "VIEW", - "ref": "input", - "transitions": { - "*": "END_Done" - } - }, - "END_Done": { - "state_type": "END", - "outcome": "done" - } - } - } -} \ No newline at end of file diff --git a/ios/packages/demo/Resources/flows/input/input-validation.json b/ios/packages/demo/Resources/flows/input/input-validation.json deleted file mode 100644 index ee1e3b8ef..000000000 --- a/ios/packages/demo/Resources/flows/input/input-validation.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "id": "generated-flow", - "views": [ - { - "id": "view-1", - "type": "collection", - "values": [ - { - "asset": { - "id": "input-1", - "type": "input", - "binding": "person.age", - "label": { - "asset": { - "id": "input-1-label", - "type": "text", - "value": "Age" - } - } - } - }, - { - "asset": { - "id": "input-2", - "type": "input", - "binding": "person.name", - "label": { - "asset": { - "id": "input-2-label", - "type": "text", - "value": "Name" - } - } - } - }, - { - "asset": { - "id": "values", - "type": "text", - "value": "Name: \"{{person.name}}\". Age: \"{{person.age}}\"" - } - } - ] - } - ], - "data": {}, - "navigation": { - "BEGIN": "FLOW_1", - "FLOW_1": { - "startState": "VIEW_1", - "VIEW_1": { - "state_type": "VIEW", - "ref": "view-1", - "transitions": { - "*": "END_Done" - } - }, - "END_Done": { - "state_type": "END", - "outcome": "done" - } - } - }, - "schema": { - "ROOT": { - "person": { - "type": "PersonType" - } - }, - "PersonType": { - "age": { - "type": "IntegerType" - }, - "name": { - "type": "StringType", - "validation": [ - { - "type": "length", - "min": 1, - "max": 10 - } - ] - } - } - } -} \ No newline at end of file diff --git a/ios/packages/demo/Resources/flows/text/text-basic.json b/ios/packages/demo/Resources/flows/text/text-basic.json deleted file mode 100644 index a26855473..000000000 --- a/ios/packages/demo/Resources/flows/text/text-basic.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "id": "generated-flow", - "views": [ - { - "id": "text", - "type": "text", - "value": "Some text content" - } - ], - "data": {}, - "navigation": { - "BEGIN": "FLOW_1", - "FLOW_1": { - "startState": "VIEW_1", - "VIEW_1": { - "state_type": "VIEW", - "ref": "text", - "transitions": { - "*": "END_Done" - } - }, - "END_Done": { - "state_type": "END", - "outcome": "done" - } - } - } -} \ No newline at end of file diff --git a/ios/packages/demo/Resources/flows/text/text-with-link.json b/ios/packages/demo/Resources/flows/text/text-with-link.json deleted file mode 100644 index 3f719d186..000000000 --- a/ios/packages/demo/Resources/flows/text/text-with-link.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "id": "generated-flow", - "views": [ - { - "id": "text", - "type": "text", - "value": "A Link", - "modifiers": [ - { - "type": "link", - "metaData": { - "mime-type": "text/html", - "ref": "http://www.intuit.com" - } - } - ] - } - ], - "data": {}, - "navigation": { - "BEGIN": "FLOW_1", - "FLOW_1": { - "startState": "VIEW_1", - "VIEW_1": { - "state_type": "VIEW", - "ref": "text", - "transitions": { - "*": "END_Done" - } - }, - "END_Done": { - "state_type": "END", - "outcome": "done" - } - } - } -} \ No newline at end of file diff --git a/ios/packages/demo/Sources/AppDelegate.swift b/ios/packages/demo/Sources/AppDelegate.swift deleted file mode 100644 index cb7afc536..000000000 --- a/ios/packages/demo/Sources/AppDelegate.swift +++ /dev/null @@ -1,156 +0,0 @@ -// -// AppDelegate.swift -// PlayerUI -// -// Created by hborawski on 02/20/2020. -// Copyright (c) 2020 hborawski. All rights reserved. -// - -import UIKit -import PlayerUI -import SwiftUI -import Combine - -@UIApplicationMain -class AppDelegate: UIResponder, UIApplicationDelegate { - - var window: UIWindow? - - let plugins: [NativePlugin] = [ - PrintLoggerPlugin(level: .trace), - ReferenceAssetsPlugin(), - CommonTypesPlugin(), - ExpressionPlugin(), - CommonExpressionsPlugin(), - ExternalActionPlugin(handler: { _, _, _ in - print("external state") - }), - MetricsPlugin { timing, render, flow in - print(timing as Any) - print(render as Any) - print(flow as Any) - }, - RequestTimePlugin { 5 }, - PubSubPlugin([]), - TypesProviderPlugin(types: [], validators: [], formats: []), - TransitionPlugin(popTransition: .pop), - BeaconPlugin { print(String(describing: $0)) }, - SwiftUIPendingTransactionPlugin() - ] - - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - return true - } - - func applicationWillResignActive(_ application: UIApplication) { - // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. - // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. - } - - func applicationDidEnterBackground(_ application: UIApplication) { - // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. - // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. - } - - func applicationWillEnterForeground(_ application: UIApplication) { - // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. - } - - func applicationDidBecomeActive(_ application: UIApplication) { - // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. - } - - func applicationWillTerminate(_ application: UIApplication) { - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. - } -} - -class SceneDelegate: UIResponder, UISceneDelegate { - let plugins: [NativePlugin] = [ - PrintLoggerPlugin(level: .trace), - ReferenceAssetsPlugin(), - CommonTypesPlugin(), - ExpressionPlugin(), - CommonExpressionsPlugin(), - ExternalActionPlugin(handler: { _, _, _ in - print("external state") - }), - MetricsPlugin { timing, render, flow in - print(timing as Any) - print(render as Any) - print(flow as Any) - }, - RequestTimePlugin { 5 }, - PubSubPlugin([]), - TypesProviderPlugin(types: [], validators: [], formats: []), - TransitionPlugin(popTransition: .pop), - BeaconPlugin { print(String(describing: $0)) }, - SwiftUIPendingTransactionPlugin() - ] - - var window: UIWindow? - - func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { - guard let windowScene = scene as? UIWindowScene else { return } - window = window ?? UIWindow(windowScene: windowScene) - - if - UserDefaults.standard.bool(forKey: "isAppetize"), - let flowStr = UserDefaults.standard.string(forKey: "json") - { - window.loadView( - view: - AssetFlowView( - flow: flowStr, - plugins: plugins, - completion: self.completion(result:) - ).navigationBarTitle(Text("Storybook Flow")) - ) - } - - let isUiTest = ProcessInfo.processInfo.environment["UI_TESTING"] == "true" - - window.loadView( - view: NavigationView { - AssetCollection( - plugins: plugins, - sections: MockFlows.sections, - completion: self.completion(result:) - ) - .navigationBarTitleDisplayMode(.inline) - }, - hideStatusBar: isUiTest - ) - } -} - -extension SceneDelegate { - func completion(result: Result) { - switch result { - case .success(let result): - showAlert(message: result.endState?.outcome ?? "No Outcome") - case .failure(let error): - guard case let .promiseRejected(errorState) = error else { - showAlert(message: "\(error)", error: true) - return - } - showAlert(message: "\(errorState.error)", error: true) - } - } - - func showAlert(message: String, error: Bool = false) { - let alertController = UIAlertController(title: error ? "Flow Error" : "Flow Finished", message: message, preferredStyle: .alert) - alertController.view.accessibilityIdentifier = "FlowFinished" - alertController.addAction(UIAlertAction(title: "Done", style: .default, handler: { _ in - alertController.dismiss(animated: true, completion: nil) - })) - self.window?.rootViewController?.present(alertController, animated: true, completion: nil) - } -} - -extension Optional where Wrapped == UIWindow { - func loadView(view: V, hideStatusBar: Bool = false) { - self?.rootViewController = UIHostingController(rootView: view.statusBar(hidden: hideStatusBar)) - self?.makeKeyAndVisible() - } -} diff --git a/ios/packages/demo/scripts/generateFlowSections.js b/ios/packages/demo/scripts/generateFlowSections.js deleted file mode 100755 index fe6b34ac3..000000000 --- a/ios/packages/demo/scripts/generateFlowSections.js +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env node -const fs = require('fs') -const path = require('path') -const child_process = require('child_process') -const { camelCase } = require('change-case') -const { makeFlow } = require('@player-ui/make-flow') - -const mocksDir = '../../../../plugins/reference-assets/mocks' -const assetTypes = fs.readdirSync(mocksDir, { withFileTypes: true }) - .filter(type => type.isDirectory()) - .map(type => type.name) - -const sections = assetTypes.reduce((acc, currentType) => { - const filePaths = child_process.execSync(`find ${mocksDir}/${currentType} -name '*.json'`).toString().trim().split('\n').filter(p => p !== '') - return {...acc, [currentType]: filePaths} -}, {}) - -const toFlowTuple = (flowPath, section) => { - const { name } = path.parse(flowPath) - return `(name: "${name.replace(section, '').replace(/-/g, ' ').trim()}", flow: MockFlows.${camelCase(name)})` -} - -const toFlowSection = (section, indent) => { - const flows = sections[section] - return `${indent}(title: "${section}", flows: [ -${indent} ${flows.map(flowPath => toFlowTuple(flowPath, section)).join(`,\n${indent} `)} -${indent}])` -} - -const getFlowContents = (flowPath) => { - const { name } = path.parse(flowPath) - - return { - name: camelCase(name), - json: makeFlow(JSON.parse(fs.readFileSync(path.resolve(process.cwd(), flowPath)))) - } -} - -const output = `// swiftlint:disable all -import PlayerUI - -public struct MockFlows { - ${Object.keys(sections) - .reduce((flows, section) => [...flows, ...sections[section]], []) - .map(flowPath => getFlowContents(flowPath)) - .map(({name, json}) => `static let ${name}: String = """ -${JSON.stringify(json, null, 2).replace(/\\/g, '\\\\')} -"""`) - .join('\n') - } - public static let sections: [FlowLoader.FlowSection] = [ -${Object.keys(sections).map(section => toFlowSection(section, " ")).join(',\n')} - ] -} -` - -fs.writeFileSync('../Sources/MockFlows.swift', output) \ No newline at end of file diff --git a/ios/packages/internal-test-utils/Sources/Utilities.swift b/ios/packages/internal-test-utils/Sources/Utilities.swift deleted file mode 100644 index 737fbc0d2..000000000 --- a/ios/packages/internal-test-utils/Sources/Utilities.swift +++ /dev/null @@ -1,25 +0,0 @@ -// -// Utilities.swift -// PlayerUI_Example -// -// Created by Borawski, Harris on 3/11/20. -// Copyright © 2020 CocoaPods. All rights reserved. -// - -import Foundation -import JavaScriptCore -import XCTest -import Combine - -extension XCTestCase { - @discardableResult - func waitOnChange(_ publisher: AnyPublisher, timeout: Double = 5, condition: @escaping (T) -> Bool) -> Cancellable { - let expectation = XCTestExpectation(description: "Waiting for publisher to emit value") - let cancel = publisher.sink { (value) in - guard condition(value) else { return } - expectation.fulfill() - } - wait(for: [expectation], timeout: timeout) - return cancel - } -} diff --git a/ios/packages/internal-test-utils/Sources/ViewInspectorTestCase.swift b/ios/packages/internal-test-utils/Sources/ViewInspectorTestCase.swift deleted file mode 100644 index 913ed4da4..000000000 --- a/ios/packages/internal-test-utils/Sources/ViewInspectorTestCase.swift +++ /dev/null @@ -1,16 +0,0 @@ -// -// ViewInspectorTestCase.swift -// PlayerUI_ExampleUITests -// -// Created by Harris Borawski on 9/1/21. -// Copyright © 2021 CocoaPods. All rights reserved. -// - -import Foundation -import XCTest - -open class ViewInspectorTestCase: XCTestCase { - open override func setUp() { - XCUIApplication().terminate() - } -} diff --git a/ios/packages/reference-assets/Resources/svg/Icons.xcassets/Contents.json b/ios/packages/reference-assets/Resources/svg/Icons.xcassets/Contents.json deleted file mode 100644 index 73c00596a..000000000 --- a/ios/packages/reference-assets/Resources/svg/Icons.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/ios/packages/swiftui/Tests/types/WrappedFunctionTests.swift b/ios/packages/swiftui/Tests/types/WrappedFunctionTests.swift deleted file mode 100644 index cdef07dcd..000000000 --- a/ios/packages/swiftui/Tests/types/WrappedFunctionTests.swift +++ /dev/null @@ -1,77 +0,0 @@ -// -// WrappedFunctionTests.swift -// PlayerUI_Tests -// -// Created by Harris Borawski on 3/5/21. -// Copyright © 2021 CocoaPods. All rights reserved. -// - -import Foundation -import XCTest -import JavaScriptCore - -@testable import PlayerUI -class WrappedFunctionTests: XCTestCase { - let context: JSContext = JSContext() - - func testWrappedFunction() { - let called = expectation(description: "Function Called") - let callback: @convention(block) () -> Void = { called.fulfill() } - - let function = JSValue(object: callback, in: context) - let wrapper = WrappedFunction(rawValue: function) - - wrapper.callAsFunction() - - wait(for: [called], timeout: 1) - } - - struct CustomStruct: Decodable, Hashable, Encodable { - var someString: String - } - - func testWrappedFunctionWithCustomType() { - let called = expectation(description: "Function Called") - let callback: @convention(block) (JSValue) -> JSValue = { _ in - called.fulfill() - return self.context.evaluateScript("({someString: 'test'})") - } - - let function = JSValue(object: callback, in: context) - let wrapper = WrappedFunction(rawValue: function) - - do { - let customStruct = try wrapper.callAsFunction(customType: CustomStruct.self) - XCTAssertEqual(customStruct, CustomStruct(someString: "test")) - } catch { - XCTFail("could not call wrapped function with custom type") - } - - wait(for: [called], timeout: 1) - } - - func testWrappedFunctionThrowsError() { - let called = expectation(description: "Function Called") - let callback: @convention(block) (JSValue) -> JSValue = { _ in - called.fulfill() - return self.context.evaluateScript("({someStringWrong: 'test'})") - } - - let function = JSValue(object: callback, in: context) - let wrapper = WrappedFunction(rawValue: function) - - XCTAssertThrowsError(try wrapper.callAsFunction(customType: CustomStruct.self)) - - wait(for: [called], timeout: 1) - } - - func testModelReference() throws { - let context = JSContext() - guard let val = JSValue(object: "Hello World", in: context!) else { - return XCTFail("could not create JSValue") - } - let wrapper = try JSONDecoder().decode(ModelReference.self, from: val) - - XCTAssertEqual("Hello World", wrapper.stringValue) - } -} diff --git a/ios/packages/test-utils/Sources/ui-test/AssetFlowView.swift b/ios/packages/test-utils/Sources/ui-test/AssetFlowView.swift deleted file mode 100644 index 1ed94bfad..000000000 --- a/ios/packages/test-utils/Sources/ui-test/AssetFlowView.swift +++ /dev/null @@ -1,73 +0,0 @@ -// -// AssetFlowView.swift -// PlayerUI -// -// Created by Harris Borawski on 3/15/21. -// - -import SwiftUI - -/** - SwiftUI View to wrap the `SwiftUIPlayer` in a scroll view and handle the result - for use in UI testing - */ -public struct AssetFlowView: View { - let flow: String - let plugins: [NativePlugin] - let completion: ((Result) -> Void)? - - public init(flow: String, plugins: [NativePlugin], completion: ((Result) -> Void)? = nil) { - self.flow = flow - self.plugins = plugins - self.completion = completion - for plugin in self.plugins { - if let plugin = plugin as? JSBasePlugin { - plugin.context = nil - } - } - } - - public var body: some View { - ScrollView { - player.frame(maxWidth: .infinity, alignment: .topLeading) - } - } - - /// The SwiftUI player for this view - private var player: some View { - SwiftUIPlayer( - flow: flow, - plugins: plugins, - result: Binding( - get: {nil}, - set: { result in - guard let res = result else { return } - self.completion?(res) - } - ) - ) - } -} - -private extension View { - /// Establishes a preference for the height of the view based on the anchor bounds. - func anchorHeight(_ proxy: GeometryProxy) -> some View { - anchorPreference(key: ScrollHeightPreferenceKey.self, value: .bounds, transform: { (anchor) in - proxy[anchor].height - }) - } - - /// Performs the supplied block whenever the height preference (established with `anchorHeight`) - /// changes. - func onHeightChange(perform: @escaping (CGFloat) -> Void) -> some View { - onPreferenceChange(ScrollHeightPreferenceKey.self, perform: perform) - } -} - -/// Preference key used on iOS 13 for measuring scroll content height. -private struct ScrollHeightPreferenceKey: PreferenceKey { - static let defaultValue: CGFloat = 0 - static func reduce(value: inout CGFloat, nextValue: () -> CGFloat) { - value = nextValue() - } -} diff --git a/ios/packages/test-utils/ViewInspector/ui-test/mocks/action/action-basic.json b/ios/packages/test-utils/ViewInspector/ui-test/mocks/action/action-basic.json deleted file mode 100644 index 96c860453..000000000 --- a/ios/packages/test-utils/ViewInspector/ui-test/mocks/action/action-basic.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "id": "generated-flow", - "views": [ - { - "id": "action", - "type": "action", - "exp": "{{count}} = {{count}} + 1", - "label": { - "asset": { - "id": "action-label", - "type": "text", - "value": "Count: {{count}}" - } - } - } - ], - "data": { - "count": 0 - }, - "navigation": { - "BEGIN": "FLOW_1", - "FLOW_1": { - "startState": "VIEW_1", - "VIEW_1": { - "state_type": "VIEW", - "ref": "action", - "transitions": { - "*": "END_Done" - } - }, - "END_Done": { - "state_type": "END", - "outcome": "done" - } - } - } -} \ No newline at end of file diff --git a/ios/packages/test-utils/ViewInspector/ui-test/mocks/action/transition/action-transition-to-end.json b/ios/packages/test-utils/ViewInspector/ui-test/mocks/action/transition/action-transition-to-end.json deleted file mode 100644 index 409494495..000000000 --- a/ios/packages/test-utils/ViewInspector/ui-test/mocks/action/transition/action-transition-to-end.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "id": "generated-flow", - "views": [ - { - "id": "collection", - "type": "collection", - "values": [ - { - "asset": { - "id": "action-good", - "type": "action", - "value": "Next", - "label": { - "asset": { - "id": "action-good-label", - "type": "text", - "value": "End the flow (success)" - } - } - } - }, - { - "asset": { - "id": "action-bad", - "type": "action", - "exp": "{{foo.bar..}", - "label": { - "asset": { - "id": "action-bad-label", - "type": "text", - "value": "End the flow (error)" - } - } - } - } - ] - } - ], - "data": {}, - "navigation": { - "BEGIN": "FLOW_1", - "FLOW_1": { - "startState": "VIEW_1", - "VIEW_1": { - "state_type": "VIEW", - "ref": "collection", - "transitions": { - "*": "END_Done" - } - }, - "END_Done": { - "state_type": "END", - "outcome": "done" - } - } - } -} \ No newline at end of file diff --git a/ios/swiftui/BUILD.bazel b/ios/swiftui/BUILD.bazel new file mode 100644 index 000000000..db36f6be3 --- /dev/null +++ b/ios/swiftui/BUILD.bazel @@ -0,0 +1,43 @@ +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") + +load("@build_bazel_rules_ios//rules:test.bzl", "ios_unit_test", "ios_ui_test") + +pkg_files( + name = "PlayerUISwiftUI_Sources", + srcs = glob(["Sources/**/*.swift"]), + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//visibility:public"], +) + +swift_library( + name = "PlayerUISwiftUI", + module_name = "PlayerUISwiftUI", + srcs = [":PlayerUISwiftUI_Sources"], + visibility = ["//visibility:public"], + deps = ["@swiftpkg_swift_hooks//:Sources_SwiftHooks", "//ios/core:PlayerUI"], + defines = ["BAZEL_TARGET"] +) + +ios_unit_test( + name = "PlayerUISwiftUITests", + srcs = glob(["Tests/**/*.swift"]), + minimum_os_version = "14.0", + deps = [":PlayerUISwiftUI", "//ios/core:PlayerUI", "//ios/internal-test-utils:PlayerUIInternalTestUtilities"], + visibility = ["//visibility:public"] +) + +ios_ui_test( + name = "PlayerUISwiftUIViewInspectorTests", + srcs = glob(["ViewInspector/**/*.swift"]), + minimum_os_version = "14.0", + deps = [ + "@swiftpkg_viewinspector//:Sources_ViewInspector", + ":PlayerUISwiftUI", + "//ios/core:PlayerUI", + "//ios/internal-test-utils:PlayerUIInternalTestUtilities", + "//plugins/reference-assets/swiftui:PlayerUIReferenceAssets" + ], + visibility = ["//visibility:public"], + test_host = "//ios/demo:PlayerUIDemo" +) \ No newline at end of file diff --git a/ios/packages/swiftui/Sources/ManagedPlayer/ConstantFlowManager.swift b/ios/swiftui/Sources/ManagedPlayer/ConstantFlowManager.swift similarity index 97% rename from ios/packages/swiftui/Sources/ManagedPlayer/ConstantFlowManager.swift rename to ios/swiftui/Sources/ManagedPlayer/ConstantFlowManager.swift index 57a796b14..f7ba17ae9 100644 --- a/ios/packages/swiftui/Sources/ManagedPlayer/ConstantFlowManager.swift +++ b/ios/swiftui/Sources/ManagedPlayer/ConstantFlowManager.swift @@ -8,6 +8,10 @@ import Foundation import Combine +#if SWIFT_PACKAGE +import PlayerUI +#endif + /** A `FlowManager` implementation that advances through an array of flows on each successful flow completion with a variable delay for flow loading diff --git a/ios/packages/swiftui/Sources/ManagedPlayer/FlowManager.swift b/ios/swiftui/Sources/ManagedPlayer/FlowManager.swift similarity index 96% rename from ios/packages/swiftui/Sources/ManagedPlayer/FlowManager.swift rename to ios/swiftui/Sources/ManagedPlayer/FlowManager.swift index f8f0fa7bc..1747feb9c 100644 --- a/ios/packages/swiftui/Sources/ManagedPlayer/FlowManager.swift +++ b/ios/swiftui/Sources/ManagedPlayer/FlowManager.swift @@ -8,6 +8,10 @@ import Foundation import Combine +#if SWIFT_PACKAGE +import PlayerUI +#endif + /// A state object to return from a FlowManager to advance public enum NextState { case flow(String) diff --git a/ios/packages/swiftui/Sources/ManagedPlayer/ManagedPlayer.swift b/ios/swiftui/Sources/ManagedPlayer/ManagedPlayer.swift similarity index 99% rename from ios/packages/swiftui/Sources/ManagedPlayer/ManagedPlayer.swift rename to ios/swiftui/Sources/ManagedPlayer/ManagedPlayer.swift index f6b26b8b7..9e6e61de3 100644 --- a/ios/packages/swiftui/Sources/ManagedPlayer/ManagedPlayer.swift +++ b/ios/swiftui/Sources/ManagedPlayer/ManagedPlayer.swift @@ -10,6 +10,10 @@ import SwiftUI import Combine import JavaScriptCore +#if SWIFT_PACKAGE +import PlayerUI +#endif + /** An error type for errors from `ManagedPlayer` */ diff --git a/ios/packages/swiftui/Sources/ManagedPlayer/ManagedPlayerViewModel.swift b/ios/swiftui/Sources/ManagedPlayer/ManagedPlayerViewModel.swift similarity index 98% rename from ios/packages/swiftui/Sources/ManagedPlayer/ManagedPlayerViewModel.swift rename to ios/swiftui/Sources/ManagedPlayer/ManagedPlayerViewModel.swift index 542582478..7ce14d861 100644 --- a/ios/packages/swiftui/Sources/ManagedPlayer/ManagedPlayerViewModel.swift +++ b/ios/swiftui/Sources/ManagedPlayer/ManagedPlayerViewModel.swift @@ -9,11 +9,15 @@ import Foundation import Combine import SwiftHooks +#if SWIFT_PACKAGE +import PlayerUI +#endif + /// A plugin used by the ManagedPlayer. /// /// When a ManagedPlayer is instantiated it will call `apply(_:)` on all managed player plugins it is /// provided. -protocol ManagedPlayerPlugin { +public protocol ManagedPlayerPlugin { /// Called by the ManagedPlayer upon instantiation. func apply(_ model: ManagedPlayerViewModel) } diff --git a/ios/packages/swiftui/Sources/ManagedPlayer/ScrollPlugin.swift b/ios/swiftui/Sources/ManagedPlayer/ScrollPlugin.swift similarity index 98% rename from ios/packages/swiftui/Sources/ManagedPlayer/ScrollPlugin.swift rename to ios/swiftui/Sources/ManagedPlayer/ScrollPlugin.swift index ca7e7f6fe..c859fbce1 100644 --- a/ios/packages/swiftui/Sources/ManagedPlayer/ScrollPlugin.swift +++ b/ios/swiftui/Sources/ManagedPlayer/ScrollPlugin.swift @@ -1,5 +1,9 @@ import SwiftUI +#if SWIFT_PACKAGE +import PlayerUI +#endif + /// A plugin to wrap player content in a scrollview /// and provide `EnvironmentValues` for /// `\.scrollToProxy` for scrolling to elements diff --git a/ios/packages/swiftui/Sources/ManagedPlayer/ScrollToProxy.swift b/ios/swiftui/Sources/ManagedPlayer/ScrollToProxy.swift similarity index 100% rename from ios/packages/swiftui/Sources/ManagedPlayer/ScrollToProxy.swift rename to ios/swiftui/Sources/ManagedPlayer/ScrollToProxy.swift diff --git a/ios/packages/swiftui/Sources/SwiftUIPlayer.swift b/ios/swiftui/Sources/SwiftUIPlayer.swift similarity index 99% rename from ios/packages/swiftui/Sources/SwiftUIPlayer.swift rename to ios/swiftui/Sources/SwiftUIPlayer.swift index 91f1d4110..d2697bc69 100644 --- a/ios/packages/swiftui/Sources/SwiftUIPlayer.swift +++ b/ios/swiftui/Sources/SwiftUIPlayer.swift @@ -10,6 +10,11 @@ import JavaScriptCore import Combine import SwiftHooks +#if SWIFT_PACKAGE +import PlayerUI +import PlayerUILogger +#endif + /** A `HeadlessPlayer` implementation that renders itself as a SwiftUI View */ diff --git a/ios/packages/swiftui/Sources/SwiftUIRegistry.swift b/ios/swiftui/Sources/SwiftUIRegistry.swift similarity index 97% rename from ios/packages/swiftui/Sources/SwiftUIRegistry.swift rename to ios/swiftui/Sources/SwiftUIRegistry.swift index eecfa4e4a..58319238b 100644 --- a/ios/packages/swiftui/Sources/SwiftUIRegistry.swift +++ b/ios/swiftui/Sources/SwiftUIRegistry.swift @@ -7,6 +7,11 @@ import JavaScriptCore +#if SWIFT_PACKAGE +import PlayerUI +import PlayerUILogger +#endif + /** Registry for SwiftUI based `SwiftUIAsset` implementations */ diff --git a/ios/packages/swiftui/Sources/extensions/SwiftUI+Decoder+Extensions.swift b/ios/swiftui/Sources/extensions/SwiftUI+Decoder+Extensions.swift similarity index 94% rename from ios/packages/swiftui/Sources/extensions/SwiftUI+Decoder+Extensions.swift rename to ios/swiftui/Sources/extensions/SwiftUI+Decoder+Extensions.swift index b25833364..bccdfc722 100644 --- a/ios/packages/swiftui/Sources/extensions/SwiftUI+Decoder+Extensions.swift +++ b/ios/swiftui/Sources/extensions/SwiftUI+Decoder+Extensions.swift @@ -7,6 +7,10 @@ import Foundation +#if SWIFT_PACKAGE +import PlayerUI +#endif + /// A function that decodes a `SwiftUIAsset` public typealias DecodeSwiftUIFunction = ((Any) throws -> SwiftUIAsset?) diff --git a/ios/packages/swiftui/Sources/types/WrappedFunction.swift b/ios/swiftui/Sources/types/WrappedFunction.swift similarity index 56% rename from ios/packages/swiftui/Sources/types/WrappedFunction.swift rename to ios/swiftui/Sources/types/WrappedFunction.swift index 7ee908cba..064d9fabc 100644 --- a/ios/packages/swiftui/Sources/types/WrappedFunction.swift +++ b/ios/swiftui/Sources/types/WrappedFunction.swift @@ -8,6 +8,10 @@ import Foundation import JavaScriptCore +#if SWIFT_PACKAGE +import PlayerUI +#endif + /** Represents a JS Function that was part of the asset in the JS runtime */ @@ -51,13 +55,51 @@ public struct WrappedFunction: JSValueBacked, Decodable, Hashable { /** Executes the function and returns the customType specified */ - public func callAsFunction(customType: T.Type, args: Any...) throws -> T? where T: Decodable { + public func callAsFunction(customType: U.Type, args: Any...) throws -> U? where U: Decodable { guard let jsValue = rawValue else { throw DecodingError.malformedData } let decodedState = try JSONDecoder().decode(customType, from: jsValue.call(withArguments: args)) return decodedState } } +extension WrappedFunction where T: Decodable { + public enum Error: Swift.Error, Equatable { + /// There was a failure in the promise from calling a JS function + case promiseFailed(error: String) + } + + public func callAsFunctionAsync(args: Any...) async throws -> T { + try await withCheckedThrowingContinuation { continuation in + guard let jsValue = rawValue else { return continuation.resume(throwing: DecodingError.malformedData) } + + let promiseHandler: @convention(block) (JSValue) -> Void = { + do { + let value = try JSONDecoder().decode(T.self, from: $0) + continuation.resume(returning: value) + } catch { + continuation.resume(throwing: error) + } + } + + let errorHandler: @convention(block) (JSValue) -> Void = { error in + return continuation.resume(throwing: WrappedFunction.Error.promiseFailed(error: error.toString())) + } + + guard + let context = jsValue.context, + let callback = JSValue(object: promiseHandler, in: context), + let catchCallback = JSValue(object: errorHandler, in: context) + else { + return continuation.resume(throwing: PlayerError.jsConversionFailure) + } + + jsValue.call(withArguments: args) + .invokeMethod("then", withArguments: [callback]) + .invokeMethod("catch", withArguments: [catchCallback]) + } + } +} + /** Wrapper class to decode model references into strings from the raw JSValue */ diff --git a/ios/packages/swiftui/Sources/types/assets/ControlledAsset.swift b/ios/swiftui/Sources/types/assets/ControlledAsset.swift similarity index 98% rename from ios/packages/swiftui/Sources/types/assets/ControlledAsset.swift rename to ios/swiftui/Sources/types/assets/ControlledAsset.swift index b6c1e3f7f..9479758ba 100644 --- a/ios/packages/swiftui/Sources/types/assets/ControlledAsset.swift +++ b/ios/swiftui/Sources/types/assets/ControlledAsset.swift @@ -8,6 +8,10 @@ import Combine import SwiftUI +#if SWIFT_PACKAGE +import PlayerUI +#endif + /** A ViewModel that contains decoded AssetData for an Asset */ diff --git a/ios/packages/swiftui/Sources/types/assets/SwiftUIAsset.swift b/ios/swiftui/Sources/types/assets/SwiftUIAsset.swift similarity index 97% rename from ios/packages/swiftui/Sources/types/assets/SwiftUIAsset.swift rename to ios/swiftui/Sources/types/assets/SwiftUIAsset.swift index 1566b6b42..50633f1be 100644 --- a/ios/packages/swiftui/Sources/types/assets/SwiftUIAsset.swift +++ b/ios/swiftui/Sources/types/assets/SwiftUIAsset.swift @@ -8,6 +8,10 @@ import JavaScriptCore import SwiftUI +#if SWIFT_PACKAGE +import PlayerUI +#endif + /** A base class representing a Player Asset that will be rendering using SwiftUI */ diff --git a/ios/packages/swiftui/Sources/types/assets/WrappedAsset.swift b/ios/swiftui/Sources/types/assets/WrappedAsset.swift similarity index 66% rename from ios/packages/swiftui/Sources/types/assets/WrappedAsset.swift rename to ios/swiftui/Sources/types/assets/WrappedAsset.swift index 673bde03f..7811cd38e 100644 --- a/ios/packages/swiftui/Sources/types/assets/WrappedAsset.swift +++ b/ios/swiftui/Sources/types/assets/WrappedAsset.swift @@ -5,6 +5,10 @@ // Created by Harris Borawski on 2/26/21. // +#if SWIFT_PACKAGE +import PlayerUI +#endif + /** Represents the wrapping object that contains a SwiftUIAsset The JS Player will return assets in the format @@ -15,22 +19,31 @@ ``` { id, type } ``` - This wrapper decodes either to provide a consistent access mechanism */ -public typealias WrappedAsset = GenericWrappedAsset +public typealias WrappedAsset = GenericWrappedAsset + +public typealias GenericWrappedAsset = BaseGenericWrappedAsset + +public struct DefaultAdditionalData: Decodable, Equatable {} -public struct GenericWrappedAsset: Decodable, AssetContainer where AdditionalData: Decodable&Equatable { +public struct BaseGenericWrappedAsset: Decodable, AssetContainer + where MetaData: Decodable&Equatable, AdditionalData: Decodable&Equatable { /// The keys used to decode the wrapper public enum CodingKeys: String, CodingKey { /// Key to decode asset in a wrapper case asset + /// Key to decode metadata in a wrapper + case metaData } /// The underlying asset if it decoded public var asset: SwiftUIAsset? - /// Additional data that is associated with the adjacent asset + /// MetaData that is associated with the adjacent asset + public var metaData: MetaData? + + /// Additional data to decode as sibling keys to `asset` or `metaData` public var additionalData: AdditionalData? /** @@ -53,20 +66,15 @@ public struct GenericWrappedAsset: Decodable, AssetContainer whe public init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) self.asset = try container.decodeIfPresent(RegistryDecodeShim.self, forKey: .asset)?.asset + self.metaData = try container.decodeIfPresent(MetaData.self, forKey: .metaData) self.additionalData = try decoder.singleValueContainer().decode(AdditionalData.self) } } -extension GenericWrappedAsset where AdditionalData == DefaultAdditionalData { - /// MetaData associated with the sibling key `asset` - public var metaData: MetaData? { additionalData?.metaData } -} - // MARK: - Equatable conformance - -extension GenericWrappedAsset: Equatable where AdditionalData: Equatable { +extension GenericWrappedAsset: Equatable where MetaData: Equatable { public static func == (lhs: Self, rhs: Self) -> Bool { - let isMetaDataSame = lhs.additionalData == rhs.additionalData + let isMetaDataSame = lhs.metaData == rhs.metaData let areBothAssetsNil = lhs.asset == nil && rhs.asset == nil var areAssetsEqual: Bool { (lhs.asset?.valueData).flatMap { rhs.asset?.valueData.isEqual($0) } ?? false } return isMetaDataSame && (areBothAssetsNil || areAssetsEqual) diff --git a/ios/packages/swiftui/Tests/ManagedPlayer/ManagedPlayerViewModelTests.swift b/ios/swiftui/Tests/ManagedPlayer/ManagedPlayerViewModelTests.swift similarity index 99% rename from ios/packages/swiftui/Tests/ManagedPlayer/ManagedPlayerViewModelTests.swift rename to ios/swiftui/Tests/ManagedPlayer/ManagedPlayerViewModelTests.swift index 14e1d84f2..913eb51f4 100644 --- a/ios/packages/swiftui/Tests/ManagedPlayer/ManagedPlayerViewModelTests.swift +++ b/ios/swiftui/Tests/ManagedPlayer/ManagedPlayerViewModelTests.swift @@ -12,6 +12,8 @@ import XCTest import JavaScriptCore @testable import PlayerUI +@testable import PlayerUISwiftUI +@testable import PlayerUIInternalTestUtilities class ManagedPlayerViewModelTests: XCTestCase { let flow1 = FlowData.COUNTER diff --git a/ios/packages/swiftui/Tests/SwiftUIRegistryTests.swift b/ios/swiftui/Tests/SwiftUIRegistryTests.swift similarity index 95% rename from ios/packages/swiftui/Tests/SwiftUIRegistryTests.swift rename to ios/swiftui/Tests/SwiftUIRegistryTests.swift index 8eddfc141..802d2cc60 100644 --- a/ios/packages/swiftui/Tests/SwiftUIRegistryTests.swift +++ b/ios/swiftui/Tests/SwiftUIRegistryTests.swift @@ -12,6 +12,37 @@ import JavaScriptCore import Combine import SwiftUI @testable import PlayerUI +@testable import PlayerUISwiftUI +@testable import PlayerUILogger + +internal struct ActionData: AssetData { + var id: String + var type: String + var label: WrappedAsset? + var run: WrappedFunction? +} +internal struct TextData: AssetData { + var id: String + var type: String + var value: ModelReference +} + +internal struct CollectionData: AssetData { + var id: String + var type: String + var values: [WrappedAsset?] +} + +internal class ActionAsset: UncontrolledAsset { + override var view: AnyView { AnyView(EmptyView()) } +} + +internal class TextAsset: UncontrolledAsset { + override var view: AnyView { AnyView(EmptyView()) } +} +internal class CollectionAsset: UncontrolledAsset { + override var view: AnyView { AnyView(EmptyView()) } +} // swiftlint:disable type_body_length file_length class SwiftUIRegistryTests: XCTestCase { @@ -75,7 +106,7 @@ class SwiftUIRegistryTests: XCTestCase { var id: String var type: String - var nested: GenericWrappedAsset? + var nested: BaseGenericWrappedAsset? } class TestNestedAsset: UncontrolledAsset { @@ -213,14 +244,14 @@ class SwiftUIRegistryTests: XCTestCase { class SwiftUITestAsset: ControlledAsset { /// A type erased view object - public override var view: AnyView { AnyView(TextAssetView(model: model)) } + public override var view: AnyView { AnyView(EmptyView()) } } let partialMatch = PartialMatchFingerprintPlugin() partialMatch.context = context partialMatch.setMapping(assetId: "someId", index: 0) let registry = SwiftUIRegistry(logger: TapableLogger()) - registry.register("text", asset: SwiftUITestAsset.self) + registry.register("text", asset: TextAsset.self) registry.partialMatchRegistry = partialMatch XCTAssertNil(registry.root) diff --git a/ios/packages/swiftui/Tests/extensions/DecoderExtensionsTests.swift b/ios/swiftui/Tests/extensions/DecoderExtensionsTests.swift similarity index 88% rename from ios/packages/swiftui/Tests/extensions/DecoderExtensionsTests.swift rename to ios/swiftui/Tests/extensions/DecoderExtensionsTests.swift index ca0e2a0d2..7c43ca8f9 100644 --- a/ios/packages/swiftui/Tests/extensions/DecoderExtensionsTests.swift +++ b/ios/swiftui/Tests/extensions/DecoderExtensionsTests.swift @@ -9,6 +9,8 @@ import Foundation import XCTest @testable import PlayerUI +@testable import PlayerUISwiftUI +@testable import PlayerUIInternalTestUtilities class DecoderExtensionsTests: XCTestCase { func testNotAnAssetDecoderForSUIDecodeFunction() { diff --git a/ios/packages/swiftui/Tests/reference-assets/SwiftUIChoiceAsset.swift b/ios/swiftui/Tests/reference-assets/SwiftUIChoiceAsset.swift similarity index 98% rename from ios/packages/swiftui/Tests/reference-assets/SwiftUIChoiceAsset.swift rename to ios/swiftui/Tests/reference-assets/SwiftUIChoiceAsset.swift index ba1c7ca6d..f48c6108b 100644 --- a/ios/packages/swiftui/Tests/reference-assets/SwiftUIChoiceAsset.swift +++ b/ios/swiftui/Tests/reference-assets/SwiftUIChoiceAsset.swift @@ -8,6 +8,7 @@ import SwiftUI import Combine import PlayerUI +import PlayerUISwiftUI /** Data Decoded by Player for `ChoiceAssetData` diff --git a/ios/swiftui/Tests/types/WrappedFunctionTests.swift b/ios/swiftui/Tests/types/WrappedFunctionTests.swift new file mode 100644 index 000000000..96b21f16d --- /dev/null +++ b/ios/swiftui/Tests/types/WrappedFunctionTests.swift @@ -0,0 +1,190 @@ +// +// WrappedFunctionTests.swift +// PlayerUI_Tests +// +// Created by Harris Borawski on 3/5/21. +// Copyright © 2021 CocoaPods. All rights reserved. +// + +import Foundation +import XCTest +import JavaScriptCore + +@testable import PlayerUI +@testable import PlayerUISwiftUI + +class WrappedFunctionTests: XCTestCase { + let context: JSContext = JSContext() + + private enum PromiseValues: Decodable, Equatable { + case listOfString([String]) + case listOfCustomStruct([CustomStruct]) + + init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + do { + self = .listOfString(try container.decode([String].self)) + } catch { + self = .listOfCustomStruct(try container.decode([CustomStruct].self)) + } + } + } + + private struct CustomStruct: Decodable, Equatable, Encodable { + var someString: String + } + + func testWrappedFunction() { + let called = expectation(description: "Function Called") + let callback: @convention(block) () -> Void = { called.fulfill() } + + let function = JSValue(object: callback, in: context) + let wrapper = WrappedFunction(rawValue: function) + + wrapper.callAsFunction() + + wait(for: [called], timeout: 1) + } + + func testWrappedFunctionWithCustomType() { + let called = expectation(description: "Function Called") + let callback: @convention(block) (JSValue) -> JSValue = { _ in + called.fulfill() + return self.context.evaluateScript("({someString: 'test'})") + } + + let function = JSValue(object: callback, in: context) + let wrapper = WrappedFunction(rawValue: function) + + do { + let customStruct = try wrapper.callAsFunction(customType: CustomStruct.self) + XCTAssertEqual(customStruct, CustomStruct(someString: "test")) + } catch { + XCTFail("could not call wrapped function with custom type") + } + + wait(for: [called], timeout: 1) + } + + func testWrappedFunctionAsyncReturnsInt() async { + JSUtilities.polyfill(self.context) + + let function = self.context + .evaluateScript(""" + (() => { + return new Promise((resolve) => { + setTimeout( + () => { resolve(1) }, + 1000 + ) + }) + }) + """) + + let wrapper = WrappedFunction(rawValue: function) + + do { + let result = try await wrapper.callAsFunctionAsync(args: "") + XCTAssertEqual(result, 1) + } catch { + XCTFail("could not call async wrapped function") + } + } + + func testWrappedFunctionAsyncReturnsStrings() async { + JSUtilities.polyfill(self.context) + + let function = self.context + .evaluateScript(""" + (() => { + return new Promise((resolve) => { + setTimeout( + () => { resolve(["firstString", "secondString"]) }, + 1000 + ) + }) + }) + """) + + let wrapper = WrappedFunction(rawValue: function) + + do { + let result = try await wrapper.callAsFunctionAsync(args: "") + XCTAssertEqual(result, .listOfString(["firstString", "secondString"])) + } catch { + XCTFail("could not call async wrapped function") + } + } + + func testWrappedFunctionAsyncReturnsCustomStructs() async { + JSUtilities.polyfill(self.context) + + let function = self.context + .evaluateScript(""" + (() => { + return new Promise((resolve) => { + setTimeout( + () => { resolve([{someString: 'test1'}, {someString: 'test2'}]) }, + 1000 + ) + }) + }) + """) + + let wrapper = WrappedFunction(rawValue: function) + + do { + let result = try await wrapper.callAsFunctionAsync(args: "") + XCTAssertEqual(result, .listOfCustomStruct([CustomStruct(someString: "test1"), CustomStruct(someString: "test2")])) + } catch { + XCTFail("could not call async wrapped function") + } + } + + func testWrappedFunctionAsyncThrowsError() async { + JSUtilities.polyfill(self.context) + + let function = self.context + .evaluateScript(""" + ( () => Promise.reject(new Error("promise rejected")) ) + """) + + let wrapper = WrappedFunction(rawValue: function) + + do { + _ = try await wrapper.callAsFunctionAsync(args: "") + } catch { + XCTAssertEqual( + WrappedFunction.Error.promiseFailed( + error: """ + (extension in PlayerUISwiftUI):PlayerUISwiftUI.WrappedFunction.Error.promiseFailed(error: \"Error: promise rejected\") + """), + WrappedFunction.Error.promiseFailed(error: error.playerDescription)) + } + } + + func testWrappedFunctionThrowsError() { + let called = expectation(description: "Function Called") + let callback: @convention(block) (JSValue) -> JSValue = { _ in + called.fulfill() + return self.context.evaluateScript("({someStringWrong: 'test'})") + } + + let function = JSValue(object: callback, in: context) + let wrapper = WrappedFunction(rawValue: function) + + XCTAssertThrowsError(try wrapper.callAsFunction(customType: CustomStruct.self)) + + wait(for: [called], timeout: 1) + } + + func testModelReference() throws { + let context = JSContext() + guard let val = JSValue(object: "Hello World", in: context!) else { + return XCTFail("could not create JSValue") + } + let wrapper = try JSONDecoder().decode(ModelReference.self, from: val) + + XCTAssertEqual("Hello World", wrapper.stringValue) + } +} diff --git a/ios/packages/swiftui/Tests/types/assets/ControlledAssetTests.swift b/ios/swiftui/Tests/types/assets/ControlledAssetTests.swift similarity index 98% rename from ios/packages/swiftui/Tests/types/assets/ControlledAssetTests.swift rename to ios/swiftui/Tests/types/assets/ControlledAssetTests.swift index ef7b50285..19831661e 100644 --- a/ios/packages/swiftui/Tests/types/assets/ControlledAssetTests.swift +++ b/ios/swiftui/Tests/types/assets/ControlledAssetTests.swift @@ -11,6 +11,8 @@ import XCTest import JavaScriptCore import Combine @testable import PlayerUI +@testable import PlayerUISwiftUI +@testable import PlayerUILogger class ControlledAssetTests: XCTestCase { let context: JSContext = JSContext() diff --git a/ios/packages/swiftui/Tests/types/assets/SwiftUIAssetTests.swift b/ios/swiftui/Tests/types/assets/SwiftUIAssetTests.swift similarity index 97% rename from ios/packages/swiftui/Tests/types/assets/SwiftUIAssetTests.swift rename to ios/swiftui/Tests/types/assets/SwiftUIAssetTests.swift index 978dd7657..24c57f03c 100644 --- a/ios/packages/swiftui/Tests/types/assets/SwiftUIAssetTests.swift +++ b/ios/swiftui/Tests/types/assets/SwiftUIAssetTests.swift @@ -11,6 +11,8 @@ import XCTest import JavaScriptCore @testable import PlayerUI +@testable import PlayerUISwiftUI +@testable import PlayerUILogger class SwiftUIAssetTests: XCTestCase { let context: JSContext = JSContext() diff --git a/ios/packages/swiftui/ViewInspector/ManagedPlayer/ManagedPlayerTests.swift b/ios/swiftui/ViewInspector/ManagedPlayer/ManagedPlayerTests.swift similarity index 79% rename from ios/packages/swiftui/ViewInspector/ManagedPlayer/ManagedPlayerTests.swift rename to ios/swiftui/ViewInspector/ManagedPlayer/ManagedPlayerTests.swift index a2d611351..ddac1d40d 100644 --- a/ios/packages/swiftui/ViewInspector/ManagedPlayer/ManagedPlayerTests.swift +++ b/ios/swiftui/ViewInspector/ManagedPlayer/ManagedPlayerTests.swift @@ -12,24 +12,27 @@ import Combine import ViewInspector @testable import PlayerUI +@testable import PlayerUISwiftUI +@testable import PlayerUIInternalTestUtilities +@testable import PlayerUIReferenceAssets extension ManagedPlayer: Inspectable {} extension Inspection: InspectionEmissary where V: Inspectable { } extension ManagedPlayer14: Inspectable {} -class ManagedPlayer14Tests: ViewInspectorTestCase { +class ManagedPlayer14Tests: XCTestCase { func testLoadingView() throws { let viewModel = ManagedPlayerViewModel(manager: NeverLoad(), onComplete: {_ in }) let player = ManagedPlayer(plugins: [], context: .init(), viewModel: viewModel, fallback: { _ in Text("Error")}, loading: { Text("Loading")}) let playerView = try player.inspect() - try playerView.view(ManagedPlayer14.self).vStack().group(0).color(0).callOnAppear() + try playerView.find(ManagedPlayer14.self).vStack().group(0).color(0).callOnAppear() waitOnChange(viewModel.$loadingState.eraseToAnyPublisher()) { $0 == ManagedPlayerViewModel.LoadingState.loading } - let text = try playerView.view(ManagedPlayer14.self).vStack().group(0).text(0) + let text = try playerView.find(ManagedPlayer14.self).vStack().group(0).text(0) XCTAssertEqual("Loading", try text.string()) } @@ -40,14 +43,14 @@ class ManagedPlayer14Tests: ViewInspectorTestCase { let playerView = try player.inspect() - try playerView.view(ManagedPlayer14.self).vStack().group(0).color(0).callOnAppear() + try playerView.find(ManagedPlayer14.self).vStack().group(0).color(0).callOnAppear() waitOnChange(viewModel.$loadingState.eraseToAnyPublisher()) { guard case .failed = $0 else { return false } return true } - let text = try playerView.view(ManagedPlayer14.self).vStack().group(0).text(0).string() + let text = try playerView.find(ManagedPlayer14.self).vStack().group(0).text(0).string() XCTAssertEqual(text, "Error") } @@ -63,13 +66,13 @@ class ManagedPlayer14Tests: ViewInspectorTestCase { } ) - try player.inspect().view(ManagedPlayer14.self).vStack().group(0).color(0).callOnAppear() + try player.inspect().find(ManagedPlayer14.self).vStack().group(0).color(0).callOnAppear() ViewHosting.host(view: player) let exp2 = player.inspection.inspect(after: 3) { view in let view = try view - .view(ManagedPlayer14.self) + .find(ManagedPlayer14.self) .vStack() .group(0) .view(SwiftUIPlayer.self, 0) @@ -99,13 +102,13 @@ class ManagedPlayer14Tests: ViewInspectorTestCase { } ) - try player.inspect().view(ManagedPlayer14.self).vStack().group(0).color(0).callOnAppear() + try player.inspect().find(ManagedPlayer14.self).vStack().group(0).color(0).callOnAppear() ViewHosting.host(view: player) let exp2 = player.inspection.inspect(after: 3) { view in let view = try view - .view(ManagedPlayer14.self) + .find(ManagedPlayer14.self) .vStack() .group(0) .view(SwiftUIPlayer.self, 0) @@ -135,13 +138,13 @@ class ManagedPlayer14Tests: ViewInspectorTestCase { } ) - try player.inspect().view(ManagedPlayer14.self).vStack().group(0).color(0).callOnAppear() + try player.inspect().find(ManagedPlayer14.self).vStack().group(0).color(0).callOnAppear() ViewHosting.host(view: player) let exp2 = player.inspection.inspect(after: 3) { view in let view = try view - .view(ManagedPlayer14.self) + .find(ManagedPlayer14.self) .vStack() .group(0) .view(SwiftUIPlayer.self, 0) @@ -179,3 +182,16 @@ class AlwaysLoaded: FlowManager { return .flow(FlowData.COUNTER) } } + +extension XCTestCase { + @discardableResult + func waitOnChange(_ publisher: AnyPublisher, timeout: Double = 5, condition: @escaping (T) -> Bool) -> Cancellable { + let expectation = XCTestExpectation(description: "Waiting for publisher to emit value") + let cancel = publisher.sink { (value) in + guard condition(value) else { return } + expectation.fulfill() + } + wait(for: [expectation], timeout: timeout) + return cancel + } +} diff --git a/ios/packages/swiftui/ViewInspector/SwiftUIPlayerTests.swift b/ios/swiftui/ViewInspector/SwiftUIPlayerTests.swift similarity index 94% rename from ios/packages/swiftui/ViewInspector/SwiftUIPlayerTests.swift rename to ios/swiftui/ViewInspector/SwiftUIPlayerTests.swift index c9a278dd6..fa0a475dd 100644 --- a/ios/packages/swiftui/ViewInspector/SwiftUIPlayerTests.swift +++ b/ios/swiftui/ViewInspector/SwiftUIPlayerTests.swift @@ -14,6 +14,9 @@ import Combine import JavaScriptCore @testable import PlayerUI +@testable import PlayerUISwiftUI +@testable import PlayerUIInternalTestUtilities +@testable import PlayerUIReferenceAssets extension SwiftUIPlayer: Inspectable {} @@ -21,7 +24,7 @@ class SwiftUIPlayerTests: XCTestCase { func testFlowLoads() throws { var bag = Set() let context = SwiftUIPlayer.Context { JSContext() } - let player = SwiftUIPlayer(flow: FlowData.COUNTER, plugins: [ReferenceAssetsPlugin()], context: context) + let player = SwiftUIPlayer(flow: FlowData.COUNTER, plugins: [], context: context) let initialLoad = expectation(description: "Root loaded") player.assetRegistry.$root.sink { (asset) in @@ -62,7 +65,7 @@ class SwiftUIPlayerTests: XCTestCase { func testViewHook() throws { var bag = Set() - let player = SwiftUIPlayer(flow: FlowData.COUNTER, plugins: [ReferenceAssetsPlugin(), ViewHookPlugin()]) + let player = SwiftUIPlayer(flow: FlowData.COUNTER, plugins: [ViewHookPlugin()]) let initialLoad = expectation(description: "Root loaded") player.assetRegistry.$root.sink { (asset) in diff --git a/ios/test-utils-core/BUILD.bazel b/ios/test-utils-core/BUILD.bazel new file mode 100644 index 000000000..1e7aa1de2 --- /dev/null +++ b/ios/test-utils-core/BUILD.bazel @@ -0,0 +1,60 @@ +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") +load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") + +load("@build_bazel_rules_ios//rules:test.bzl", "ios_unit_test", "ios_ui_test") + +load("//tools/ios:util.bzl", "ios_bundle_module_shim") + +apple_resource_bundle( + name = "PlayerUITestUtilitiesCoreResourceBundle", + bundle_name = "TestUtilities", + bundle_id = "com.intuit.ios.player.resources.core", + resources = ["//core/make-flow:make-flow_native_bundle"] +) + +ios_bundle_module_shim("TestUtilities") + +pkg_files( + name = "PlayerUITestUtilitiesCore_Sources", + srcs = glob(["Sources/**/*.swift"]), + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//visibility:public"], +) + +swift_library( + name = "PlayerUITestUtilitiesCore", + module_name = "PlayerUITestUtilitiesCore", + srcs = [":PlayerUITestUtilitiesCore_Sources", ":TestUtilitiesResourceShim"], + visibility = ["//visibility:public"], + deps = ["//ios/core:PlayerUI", "//ios/swiftui:PlayerUISwiftUI", "//ios/logger:PlayerUILogger"], + data = [":PlayerUITestUtilitiesCoreResourceBundle"], + defines = ["BAZEL_TARGET"] +) + +ios_unit_test( + name = "PlayerUITestUtilitiesCoreTests", + srcs = glob(["Tests/**/*.swift"]), + minimum_os_version = "14.0", + deps = [ + ":PlayerUITestUtilitiesCore", + "//ios/internal-test-utils:PlayerUIInternalTestUtilities" + ], + visibility = ["//visibility:public"] +) + +ios_ui_test( + name = "PlayerUITestUtilitiesCoreViewInspectorTests", + srcs = glob(["ViewInspector/**/*.swift"]), + minimum_os_version = "14.0", + deps = [ + "@swiftpkg_viewinspector//:Sources_ViewInspector", + "//ios/swiftui:PlayerUISwiftUI", + "//ios/core:PlayerUI", + "//ios/internal-test-utils:PlayerUIInternalTestUtilities", + "//plugins/reference-assets/swiftui:PlayerUIReferenceAssets", + ":PlayerUITestUtilitiesCore" + ], + visibility = ["//visibility:public"], + test_host = "//ios/demo:PlayerUIDemo" +) \ No newline at end of file diff --git a/ios/packages/test-utils/Sources/ui-test/AssetCollection.swift b/ios/test-utils-core/Sources/ui-test/AssetCollection.swift similarity index 81% rename from ios/packages/test-utils/Sources/ui-test/AssetCollection.swift rename to ios/test-utils-core/Sources/ui-test/AssetCollection.swift index 82cada637..f48bade24 100644 --- a/ios/packages/test-utils/Sources/ui-test/AssetCollection.swift +++ b/ios/test-utils-core/Sources/ui-test/AssetCollection.swift @@ -9,6 +9,10 @@ import Foundation import SwiftUI import Combine +#if SWIFT_PACKAGE +import PlayerUI +#endif + /** A SwiftUI View to load flows for ease of UI testing */ @@ -16,7 +20,7 @@ public struct AssetCollection: View { let plugins: [NativePlugin] let sections: [FlowLoader.FlowSection] let padding: CGFloat - let completion: ((Result) -> Void)? + let result: Binding?> /** Initializes and loads flows @@ -29,11 +33,11 @@ public struct AssetCollection: View { plugins: [NativePlugin], sections: [FlowLoader.FlowSection], padding: CGFloat = 16, - completion: ((Result) -> Void)? = nil + result: Binding?> ) { self.plugins = plugins self.padding = padding - self.completion = completion + self.result = result self.sections = sections } @@ -43,7 +47,7 @@ public struct AssetCollection: View { Section { ForEach(section.flows, id: \.name) { flow in NavigationLink(flow.name) { - AssetFlowView(flow: flow.flow, plugins: plugins, completion: completion) + AssetFlowView(flow: flow.flow, plugins: plugins, result: result) .padding(padding) .navigationBarTitle(Text(flow.name)) } @@ -60,6 +64,35 @@ public struct AssetCollection: View { } } +public extension AssetCollection { + /** + Initializes and loads flows + - parameters: + - plugins: Plugins to add to Player instance that is created + - sections: The `[FlowSection]` to display + - completion: A handler for when a flow reaches an end state + */ + init( + plugins: [NativePlugin], + sections: [FlowLoader.FlowSection], + padding: CGFloat = 16, + completion: ((Result) -> Void)? = nil + ) { + self.init( + plugins: plugins, + sections: sections, + padding: padding, + result: Binding( + get: {nil}, + set: { result in + guard let res = result else { return } + completion?(res) + } + ) + ) + } +} + /** Helper for loading player flows */ diff --git a/ios/test-utils-core/Sources/ui-test/AssetFlowView.swift b/ios/test-utils-core/Sources/ui-test/AssetFlowView.swift new file mode 100644 index 000000000..652d29cf3 --- /dev/null +++ b/ios/test-utils-core/Sources/ui-test/AssetFlowView.swift @@ -0,0 +1,65 @@ +// +// AssetFlowView.swift +// PlayerUI +// +// Created by Harris Borawski on 3/15/21. +// + +import SwiftUI + +#if SWIFT_PACKAGE +import PlayerUI +import PlayerUISwiftUI +#endif + +/** + SwiftUI View to wrap the `SwiftUIPlayer` in a scroll view and handle the result + for use in UI testing + */ +public struct AssetFlowView: View { + let flow: String + let plugins: [NativePlugin] + let result: Binding?> + + public init(flow: String, plugins: [NativePlugin], result: Binding?>) { + self.flow = flow + self.plugins = plugins + self.result = result + for plugin in self.plugins { + if let plugin = plugin as? JSBasePlugin { + plugin.context = nil + } + } + } + + public var body: some View { + ScrollView { + player.frame(maxWidth: .infinity, alignment: .topLeading) + } + } + + /// The SwiftUI player for this view + private var player: some View { + SwiftUIPlayer( + flow: flow, + plugins: plugins, + result: result + ) + } +} + +public extension AssetFlowView { + init(flow: String, plugins: [NativePlugin], completion: ((Result) -> Void)? = nil) { + self.init( + flow: flow, + plugins: plugins, + result: Binding( + get: {nil}, + set: { result in + guard let res = result else { return } + completion?(res) + } + ) + ) + } +} diff --git a/ios/packages/test-utils-core/Sources/AssetTestHelper.swift b/ios/test-utils-core/Sources/utilities/AssetTestHelper.swift similarity index 89% rename from ios/packages/test-utils-core/Sources/AssetTestHelper.swift rename to ios/test-utils-core/Sources/utilities/AssetTestHelper.swift index 2ad6839d0..e9bf0c9ca 100644 --- a/ios/packages/test-utils-core/Sources/AssetTestHelper.swift +++ b/ios/test-utils-core/Sources/utilities/AssetTestHelper.swift @@ -1,6 +1,12 @@ import Foundation import JavaScriptCore +#if SWIFT_PACKAGE +import PlayerUI +import PlayerUILogger +import PlayerUISwiftUI +#endif + extension JSContext { func createAssetJsValue(string: String) -> JSValue { guard let container = self.evaluateScript("(\(string))") else { fatalError("JSON was malformed") } @@ -10,14 +16,24 @@ extension JSContext { func loadMakeFlow() { guard objectForKeyedSubscript("MakeFlow").isUndefined else { return } guard - let url = ResourceUtilities.urlForFile( - name: "make-flow.prod", - ext: "js", - bundle: Bundle(for: MakeFlowResourceShim.self), pathComponent: "TestUtilities.bundle"), + let url = bundleUrl, let contents = try? String(contentsOf: url) else { return } evaluateScript(contents) } + + var bundleUrl: URL? { + #if SWIFT_PACKAGE + ResourceUtilities.urlForFile(name: "MakeFlow.native", ext: "js", bundle: Bundle.module) + #else + ResourceUtilities.urlForFile( + name: "MakeFlow.native", + ext: "js", + bundle: Bundle(for: MakeFlowResourceShim.self), + pathComponent: "TestUtilities.bundle" + ) + #endif + } } class MakeFlowResourceShim {} diff --git a/ios/packages/test-utils-core/Sources/TestPlayer.swift b/ios/test-utils-core/Sources/utilities/TestPlayer.swift similarity index 96% rename from ios/packages/test-utils-core/Sources/TestPlayer.swift rename to ios/test-utils-core/Sources/utilities/TestPlayer.swift index 2eeda310b..80b4da123 100644 --- a/ios/packages/test-utils-core/Sources/TestPlayer.swift +++ b/ios/test-utils-core/Sources/utilities/TestPlayer.swift @@ -8,6 +8,11 @@ import Foundation import JavaScriptCore +#if SWIFT_PACKAGE +import PlayerUI +import PlayerUILogger +#endif + /** A `HeadlessPlayer` implementation for testing purposes. It utilizes @player-ui/make-flow as a means of resolving assets IDs to types so the registry can decode assets without needing to forcefully map them diff --git a/ios/packages/test-utils-core/Tests/AssetTestHelperTests.swift b/ios/test-utils-core/Tests/AssetTestHelperTests.swift similarity index 95% rename from ios/packages/test-utils-core/Tests/AssetTestHelperTests.swift rename to ios/test-utils-core/Tests/AssetTestHelperTests.swift index 5e496e7ef..59f58b431 100644 --- a/ios/packages/test-utils-core/Tests/AssetTestHelperTests.swift +++ b/ios/test-utils-core/Tests/AssetTestHelperTests.swift @@ -1,5 +1,8 @@ import XCTest @testable import PlayerUI +@testable import PlayerUITestUtilitiesCore +@testable import PlayerUIInternalTestUtilities +@testable import PlayerUILogger class AssetTestHelperTests: XCTestCase { let helper = AssetTestHelper> { diff --git a/ios/test-utils/BUILD.bazel b/ios/test-utils/BUILD.bazel new file mode 100644 index 000000000..4c72743c7 --- /dev/null +++ b/ios/test-utils/BUILD.bazel @@ -0,0 +1,55 @@ +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") +load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") + +load("@build_bazel_rules_ios//rules:test.bzl", "ios_unit_test", "ios_ui_test") + +pkg_files( + name = "PlayerUITestUtilities_Sources", + srcs = glob(["Sources/**/*.swift"]), + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//visibility:public"], +) + +swift_library( + name = "PlayerUITestUtilities", + module_name = "PlayerUITestUtilities", + srcs = [":PlayerUITestUtilities_Sources"], + # Because this relies on XCTest + testonly = True, + visibility = ["//visibility:public"], + deps = [ + "//ios/core:PlayerUI", + "//ios/swiftui:PlayerUISwiftUI", + "//ios/logger:PlayerUILogger", + "//ios/test-utils-core:PlayerUITestUtilitiesCore" + ], + defines = ["BAZEL_TARGET"] +) + +ios_unit_test( + name = "PlayerUITestUtilitiesTests", + srcs = glob(["Tests/**/*.swift"]), + minimum_os_version = "14.0", + deps = [ + ":PlayerUITestUtilities", + "//ios/internal-test-utils:PlayerUIInternalTestUtilities" + ], + visibility = ["//visibility:public"] +) + +ios_ui_test( + name = "PlayerUITestUtilitiesViewInspectorTests", + srcs = glob(["ViewInspector/**/*.swift"]), + minimum_os_version = "14.0", + deps = [ + "@swiftpkg_viewinspector//:Sources_ViewInspector", + "//ios/swiftui:PlayerUISwiftUI", + "//ios/core:PlayerUI", + "//ios/internal-test-utils:PlayerUIInternalTestUtilities", + "//plugins/reference-assets/swiftui:PlayerUIReferenceAssets", + ":PlayerUITestUtilities" + ], + visibility = ["//visibility:public"], + test_host = "//ios/demo:PlayerUIDemo" +) \ No newline at end of file diff --git a/ios/packages/test-utils/Sources/ui-test/AssetUITestCase.swift b/ios/test-utils/Sources/ui-test/AssetUITestCase.swift similarity index 100% rename from ios/packages/test-utils/Sources/ui-test/AssetUITestCase.swift rename to ios/test-utils/Sources/ui-test/AssetUITestCase.swift diff --git a/ios/packages/test-utils/Sources/unit-test/SwiftUIAssetUnitTestCase.swift b/ios/test-utils/Sources/unit-test/SwiftUIAssetUnitTestCase.swift similarity index 95% rename from ios/packages/test-utils/Sources/unit-test/SwiftUIAssetUnitTestCase.swift rename to ios/test-utils/Sources/unit-test/SwiftUIAssetUnitTestCase.swift index 684b99954..c8785ef8d 100644 --- a/ios/packages/test-utils/Sources/unit-test/SwiftUIAssetUnitTestCase.swift +++ b/ios/test-utils/Sources/unit-test/SwiftUIAssetUnitTestCase.swift @@ -11,6 +11,12 @@ import SwiftUI import Combine import XCTest +#if SWIFT_PACKAGE +import PlayerUI +import PlayerUISwiftUI +import PlayerUITestUtilitiesCore +#endif + /** A base class to use for SwiftUIAsset unit tests */ diff --git a/ios/packages/test-utils/Tests/unit-test/AssetUnitTestCaseTests.swift b/ios/test-utils/Tests/unit-test/AssetUnitTestCaseTests.swift similarity index 97% rename from ios/packages/test-utils/Tests/unit-test/AssetUnitTestCaseTests.swift rename to ios/test-utils/Tests/unit-test/AssetUnitTestCaseTests.swift index 0b409fa22..0cc88e859 100644 --- a/ios/packages/test-utils/Tests/unit-test/AssetUnitTestCaseTests.swift +++ b/ios/test-utils/Tests/unit-test/AssetUnitTestCaseTests.swift @@ -9,6 +9,10 @@ import XCTest import SwiftUI @testable import PlayerUI +@testable import PlayerUILogger +@testable import PlayerUISwiftUI +@testable import PlayerUITestUtilities +@testable import PlayerUITestUtilitiesCore struct ExampleAssetData: AssetData { var id: String diff --git a/ios/packages/test-utils/ViewInspector/ui-test/AssetFlowViewTests.swift b/ios/test-utils/ViewInspector/ui-test/AssetFlowViewTests.swift similarity index 100% rename from ios/packages/test-utils/ViewInspector/ui-test/AssetFlowViewTests.swift rename to ios/test-utils/ViewInspector/ui-test/AssetFlowViewTests.swift diff --git a/ios/packages/demo/Resources/flows/action/action-basic.json b/ios/test-utils/ViewInspector/ui-test/mocks/action/action-basic.json similarity index 100% rename from ios/packages/demo/Resources/flows/action/action-basic.json rename to ios/test-utils/ViewInspector/ui-test/mocks/action/action-basic.json diff --git a/ios/packages/demo/Resources/flows/action/action-transition-to-end.json b/ios/test-utils/ViewInspector/ui-test/mocks/action/transition/action-transition-to-end.json similarity index 100% rename from ios/packages/demo/Resources/flows/action/action-transition-to-end.json rename to ios/test-utils/ViewInspector/ui-test/mocks/action/transition/action-transition-to-end.json diff --git a/ios/packages/test-utils/ViewInspector/unit-test/SwiftUIAssetUnitTestCaseTests.swift b/ios/test-utils/ViewInspector/unit-test/SwiftUIAssetUnitTestCaseTests.swift similarity index 100% rename from ios/packages/test-utils/ViewInspector/unit-test/SwiftUIAssetUnitTestCaseTests.swift rename to ios/test-utils/ViewInspector/unit-test/SwiftUIAssetUnitTestCaseTests.swift diff --git a/plugins/beacon/ios/BUILD.bazel b/plugins/beacon/ios/BUILD.bazel new file mode 100644 index 000000000..c4d4ad8fb --- /dev/null +++ b/plugins/beacon/ios/BUILD.bazel @@ -0,0 +1,41 @@ +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") +load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") + +load("@build_bazel_rules_ios//rules:test.bzl", "ios_unit_test") + +load("//tools/ios:util.bzl", "ios_bundle_module_shim") + +apple_resource_bundle( + name = "PlayerUIBaseBeaconResourceBundle", + bundle_name = "BaseBeaconPlugin", + bundle_id = "com.intuit.ios.player.resources.core", + resources = ["//plugins/beacon/core:core_native_bundle"], +) + +ios_bundle_module_shim("BaseBeaconPlugin") + +pkg_files( + name = "PlayerUIBaseBeaconPlugin_Sources", + srcs = glob(["Sources/**/*.swift"]), + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//visibility:public"], +) + +swift_library( + name = "PlayerUIBaseBeaconPlugin", + module_name = "PlayerUIBaseBeaconPlugin", + srcs = [":PlayerUIBaseBeaconPlugin_Sources", ":BaseBeaconPluginResourceShim"], + visibility = ["//visibility:public"], + deps = ["//ios/core:PlayerUI"], + data = [":PlayerUIBaseBeaconResourceBundle"], + defines = ["BAZEL_TARGET"] +) + +ios_unit_test( + name = "PlayerUIBaseBeaconPluginTests", + srcs = glob(["Tests/**/*.swift"]), + minimum_os_version = "14.0", + deps = [":PlayerUIBaseBeaconPlugin", "//ios/internal-test-utils:PlayerUIInternalTestUtilities"], + visibility = ["//visibility:public"] +) \ No newline at end of file diff --git a/ios/plugins/BaseBeaconPlugin/Sources/BaseBeaconPlugin.swift b/plugins/beacon/ios/Sources/BaseBeaconPlugin.swift similarity index 93% rename from ios/plugins/BaseBeaconPlugin/Sources/BaseBeaconPlugin.swift rename to plugins/beacon/ios/Sources/BaseBeaconPlugin.swift index 3fd35fec1..acdab6af9 100644 --- a/ios/plugins/BaseBeaconPlugin/Sources/BaseBeaconPlugin.swift +++ b/plugins/beacon/ios/Sources/BaseBeaconPlugin.swift @@ -8,6 +8,10 @@ import Foundation import JavaScriptCore +#if SWIFT_PACKAGE +import PlayerUI +#endif + /** Represenation of a Beacon coming from Player */ @@ -61,18 +65,22 @@ open class BaseBeaconPlugin: JSBasePlugin { - onBeacon: A callback to receive beacon events */ public convenience init(plugins: [JSBasePlugin] = [], onBeacon: ((BeaconStruct) -> Void)?) { - self.init(fileName: "beacon-plugin.prod", pluginName: "BeaconPlugin.BeaconPlugin") + self.init(fileName: "BeaconPlugin.native", pluginName: "BeaconPlugin.BeaconPlugin") self.callback = onBeacon self.plugins = plugins } override open func getUrlForFile(fileName: String) -> URL? { + #if SWIFT_PACKAGE + ResourceUtilities.urlForFile(name: fileName, ext: "js", bundle: Bundle.module) + #else ResourceUtilities.urlForFile( name: fileName, ext: "js", bundle: Bundle(for: BaseBeaconPlugin.self), pathComponent: "BaseBeaconPlugin.bundle" ) + #endif } /** diff --git a/ios/plugins/BaseBeaconPlugin/Tests/BaseBeaconPluginTests.swift b/plugins/beacon/ios/Tests/BaseBeaconPluginTests.swift similarity index 89% rename from ios/plugins/BaseBeaconPlugin/Tests/BaseBeaconPluginTests.swift rename to plugins/beacon/ios/Tests/BaseBeaconPluginTests.swift index ef8ffea9d..6371aa1c3 100644 --- a/ios/plugins/BaseBeaconPlugin/Tests/BaseBeaconPluginTests.swift +++ b/plugins/beacon/ios/Tests/BaseBeaconPluginTests.swift @@ -10,6 +10,7 @@ import Foundation import XCTest import JavaScriptCore @testable import PlayerUI +@testable import PlayerUIBaseBeaconPlugin class BPPlugin: JSBasePlugin { override open func setup(context: JSContext) { @@ -18,6 +19,17 @@ class BPPlugin: JSBasePlugin { } class BaseBeaconPluginTests: XCTestCase { + func testBundleLoadsSymbols() { + let context = JSContext()! + + let plugin = BaseBeaconPlugin() { _ in } + + plugin.context = context + + // as accessed on main from beacon-plugin.prod.js + XCTAssertFalse(context.objectForKeyedSubscript("BeaconPlugin").objectForKeyedSubscript("BeaconPlugin").isUndefined) + XCTAssertFalse(context.objectForKeyedSubscript("BeaconPlugin").objectForKeyedSubscript("BeaconPluginSymbol").isUndefined) + } func testBeaconPluginAppliesContextToPlugins() { let context = JSContext()! JSUtilities.polyfill(context) diff --git a/plugins/beacon/swiftui/BUILD.bazel b/plugins/beacon/swiftui/BUILD.bazel new file mode 100644 index 000000000..a4c07da4d --- /dev/null +++ b/plugins/beacon/swiftui/BUILD.bazel @@ -0,0 +1,40 @@ +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") + +load("@build_bazel_rules_ios//rules:test.bzl", "ios_unit_test", "ios_ui_test") + +pkg_files( + name = "PlayerUIBeaconPlugin_Sources", + srcs = glob(["Sources/**/*.swift"]), + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//visibility:public"], +) + +swift_library( + name = "PlayerUIBeaconPlugin", + module_name = "PlayerUIBeaconPlugin", + srcs = [":PlayerUIBeaconPlugin_Sources"], + visibility = ["//visibility:public"], + deps = [ + "//ios/core:PlayerUI", + "//ios/swiftui:PlayerUISwiftUI", + "//plugins/beacon/ios:PlayerUIBaseBeaconPlugin" + ], + defines = ["BAZEL_TARGET"] +) + +ios_ui_test( + name = "PlayerUIBeaconPluginViewInspectorTests", + srcs = glob(["ViewInspector/**/*.swift"]), + minimum_os_version = "14.0", + deps = [ + "@swiftpkg_viewinspector//:Sources_ViewInspector", + ":PlayerUIBeaconPlugin", + "//ios/core:PlayerUI", + "//ios/swiftui:PlayerUISwiftUI", + "//plugins/reference-assets/swiftui:PlayerUIReferenceAssets", + "//ios/internal-test-utils:PlayerUIInternalTestUtilities" + ], + visibility = ["//visibility:public"], + test_host = "//ios/demo:PlayerUIDemo" +) \ No newline at end of file diff --git a/ios/plugins/BeaconPlugin/Sources/SwiftUIBeaconPlugin.swift b/plugins/beacon/swiftui/Sources/SwiftUIBeaconPlugin.swift similarity index 95% rename from ios/plugins/BeaconPlugin/Sources/SwiftUIBeaconPlugin.swift rename to plugins/beacon/swiftui/Sources/SwiftUIBeaconPlugin.swift index 9ca2e6a10..e7877f399 100644 --- a/ios/plugins/BeaconPlugin/Sources/SwiftUIBeaconPlugin.swift +++ b/plugins/beacon/swiftui/Sources/SwiftUIBeaconPlugin.swift @@ -9,6 +9,12 @@ import Foundation import JavaScriptCore import SwiftUI +#if SWIFT_PACKAGE +import PlayerUI +import PlayerUISwiftUI +import PlayerUIBaseBeaconPlugin +#endif + /** Plugin used by `SwiftUIPlayer` for beaconing in a uniform format between platforms */ @@ -20,7 +26,7 @@ public class BeaconPlugin: BaseBeaconPlugin Void)?) { - self.init(fileName: "beacon-plugin.prod", pluginName: "BeaconPlugin.BeaconPlugin") + self.init(fileName: "BeaconPlugin.native", pluginName: "BeaconPlugin.BeaconPlugin") self.callback = onBeacon self.plugins = plugins } diff --git a/ios/plugins/BeaconPlugin/ViewInspector/BeaconPluginTests.swift b/plugins/beacon/swiftui/ViewInspector/BeaconPluginTests.swift similarity index 94% rename from ios/plugins/BeaconPlugin/ViewInspector/BeaconPluginTests.swift rename to plugins/beacon/swiftui/ViewInspector/BeaconPluginTests.swift index 0d327eeb9..58aa55ef9 100644 --- a/ios/plugins/BeaconPlugin/ViewInspector/BeaconPluginTests.swift +++ b/plugins/beacon/swiftui/ViewInspector/BeaconPluginTests.swift @@ -11,6 +11,11 @@ import XCTest import SwiftUI import ViewInspector @testable import PlayerUI +@testable import PlayerUIInternalTestUtilities +@testable import PlayerUISwiftUI +@testable import PlayerUIReferenceAssets +@testable import PlayerUIBaseBeaconPlugin +@testable import PlayerUIBeaconPlugin class BeaconPluginTests: XCTestCase { func testContextAttachment() throws { diff --git a/plugins/check-path/core/BUILD b/plugins/check-path/core/BUILD index 922f02b47..5789ac2ce 100644 --- a/plugins/check-path/core/BUILD +++ b/plugins/check-path/core/BUILD @@ -10,7 +10,7 @@ vitest_config(name = "vitest_config") js_pipeline( package_name = "@player-ui/check-path-plugin", - native_bundle = "PubSubPlugin", + native_bundle = "CheckPathPlugin", peer_deps = [ ":node_modules/@player-ui/player", ], diff --git a/plugins/check-path/ios/BUILD.bazel b/plugins/check-path/ios/BUILD.bazel new file mode 100644 index 000000000..957361b1c --- /dev/null +++ b/plugins/check-path/ios/BUILD.bazel @@ -0,0 +1,41 @@ +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") +load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") + +load("@build_bazel_rules_ios//rules:test.bzl", "ios_unit_test") + +load("//tools/ios:util.bzl", "ios_bundle_module_shim") + +apple_resource_bundle( + name = "PlayerUICheckPathResourceBundle", + bundle_name = "CheckPathPlugin", + bundle_id = "com.intuit.ios.player.resources.core", + resources = ["//plugins/check-path/core:core_native_bundle"] +) + +ios_bundle_module_shim("CheckPathPlugin") + +pkg_files( + name = "PlayerUICheckPathPlugin_Sources", + srcs = glob(["Sources/**/*.swift"]), + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//visibility:public"], +) + +swift_library( + name = "PlayerUICheckPathPlugin", + module_name = "PlayerUICheckPathPlugin", + srcs = [":PlayerUICheckPathPlugin", ":CheckPathPluginResourceShim"], + visibility = ["//visibility:public"], + deps = ["//ios/core:PlayerUI"], + data = [":PlayerUICheckPathResourceBundle"], + defines = ["BAZEL_TARGET"] +) + +ios_unit_test( + name = "PlayerUICheckPathPluginTests", + srcs = glob(["Tests/**/*.swift"]), + minimum_os_version = "14.0", + deps = [":PlayerUICheckPathPlugin", "//ios/internal-test-utils:PlayerUIInternalTestUtilities"], + visibility = ["//visibility:public"] +) \ No newline at end of file diff --git a/ios/plugins/CheckPathPlugin/Sources/CheckPathPlugin.swift b/plugins/check-path/ios/Sources/CheckPathPlugin.swift similarity index 91% rename from ios/plugins/CheckPathPlugin/Sources/CheckPathPlugin.swift rename to plugins/check-path/ios/Sources/CheckPathPlugin.swift index c84a0d7e7..cd359025d 100644 --- a/ios/plugins/CheckPathPlugin/Sources/CheckPathPlugin.swift +++ b/plugins/check-path/ios/Sources/CheckPathPlugin.swift @@ -7,6 +7,10 @@ import Foundation +#if SWIFT_PACKAGE +import PlayerUI +#endif + /// Base functionality for CheckPath open class BaseCheckPathPlugin: JSBasePlugin { /** @@ -57,7 +61,11 @@ open class BaseCheckPathPlugin: JSBasePlugin { } override open func getUrlForFile(fileName: String) -> URL? { + #if SWIFT_PACKAGE + ResourceUtilities.urlForFile(name: fileName, ext: "js", bundle: Bundle.module) + #else ResourceUtilities.urlForFile(name: fileName, ext: "js", bundle: Bundle(for: BaseCheckPathPlugin.self), pathComponent: "CheckPathPlugin.bundle") + #endif } } @@ -69,6 +77,6 @@ open class CheckPathPlugin: BaseCheckPathPlugin, NativePlugin { Constructs the CheckPathPlugin */ public convenience init() { - self.init(fileName: "check-path-plugin.prod", pluginName: "CheckPathPlugin.CheckPathPlugin") + self.init(fileName: "CheckPathPlugin.native", pluginName: "CheckPathPlugin.CheckPathPlugin") } } diff --git a/ios/plugins/CheckPathPlugin/Tests/CheckPathPluginTests.swift b/plugins/check-path/ios/Tests/CheckPathPluginTests.swift similarity index 94% rename from ios/plugins/CheckPathPlugin/Tests/CheckPathPluginTests.swift rename to plugins/check-path/ios/Tests/CheckPathPluginTests.swift index 9dc340821..964ac434e 100644 --- a/ios/plugins/CheckPathPlugin/Tests/CheckPathPluginTests.swift +++ b/plugins/check-path/ios/Tests/CheckPathPluginTests.swift @@ -11,6 +11,8 @@ import XCTest import JavaScriptCore @testable import PlayerUI +@testable import PlayerUIInternalTestUtilities +@testable import PlayerUICheckPathPlugin class CheckPathPluginTests: XCTestCase { func testCheckPathPluginConstructs() { diff --git a/plugins/check-path/swiftui/BUILD.bazel b/plugins/check-path/swiftui/BUILD.bazel new file mode 100644 index 000000000..c38da1a14 --- /dev/null +++ b/plugins/check-path/swiftui/BUILD.bazel @@ -0,0 +1,39 @@ +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") + +load("@build_bazel_rules_ios//rules:test.bzl", "ios_unit_test", "ios_ui_test") + +pkg_files( + name = "PlayerUISwiftUICheckPathPlugin_Sources", + srcs = glob(["Sources/**/*.swift"]), + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//visibility:public"], +) + +swift_library( + name = "PlayerUISwiftUICheckPathPlugin", + module_name = "PlayerUISwiftUICheckPathPlugin", + srcs = [":PlayerUISwiftUICheckPathPlugin_Sources"], + visibility = ["//visibility:public"], + deps = [ + "//ios/core:PlayerUI", + "//ios/swiftui:PlayerUISwiftUI", + "//plugins/check-path/ios:PlayerUICheckPathPlugin" + ], + defines = ["BAZEL_TARGET"] +) + +ios_ui_test( + name = "PlayerUISwiftUICheckPathPluginViewInspectorTests", + srcs = glob(["ViewInspector/**/*.swift"]), + minimum_os_version = "14.0", + deps = [ + "@swiftpkg_viewinspector//:Sources_ViewInspector", + ":PlayerUISwiftUICheckPathPlugin", + "//ios/core:PlayerUI", + "//ios/swiftui:PlayerUISwiftUI", + "//ios/internal-test-utils:PlayerUIInternalTestUtilities" + ], + visibility = ["//visibility:public"], + test_host = "//ios/demo:PlayerUIDemo" +) \ No newline at end of file diff --git a/ios/plugins/SwiftUICheckPathPlugin/Sources/SwiftUICheckPathPlugin.swift b/plugins/check-path/swiftui/Sources/SwiftUICheckPathPlugin.swift similarity index 86% rename from ios/plugins/SwiftUICheckPathPlugin/Sources/SwiftUICheckPathPlugin.swift rename to plugins/check-path/swiftui/Sources/SwiftUICheckPathPlugin.swift index 4d638b20c..48ae9bbee 100644 --- a/ios/plugins/SwiftUICheckPathPlugin/Sources/SwiftUICheckPathPlugin.swift +++ b/plugins/check-path/swiftui/Sources/SwiftUICheckPathPlugin.swift @@ -1,13 +1,19 @@ import Foundation import SwiftUI +#if SWIFT_PACKAGE +import PlayerUI +import PlayerUISwiftUI +import PlayerUICheckPathPlugin +#endif + /// SwiftUI Version of `CheckPathPlugin` that puts itself into `\.checkPath` in EnvironmentValues public class SwiftUICheckPathPlugin: BaseCheckPathPlugin, NativePlugin { /** Constructs the SwiftUICheckPathPlugin */ public convenience init() { - self.init(fileName: "check-path-plugin.prod", pluginName: "CheckPathPlugin.CheckPathPlugin") + self.init(fileName: "CheckPathPlugin.native", pluginName: "CheckPathPlugin.CheckPathPlugin") } public func apply

(player: P) where P: HeadlessPlayer { diff --git a/ios/plugins/SwiftUICheckPathPlugin/ViewInspector/SwiftUICheckPathPluginTests.swift b/plugins/check-path/swiftui/ViewInspector/SwiftUICheckPathPluginTests.swift similarity index 91% rename from ios/plugins/SwiftUICheckPathPlugin/ViewInspector/SwiftUICheckPathPluginTests.swift rename to plugins/check-path/swiftui/ViewInspector/SwiftUICheckPathPluginTests.swift index 341960e56..a7f338e94 100644 --- a/ios/plugins/SwiftUICheckPathPlugin/ViewInspector/SwiftUICheckPathPluginTests.swift +++ b/plugins/check-path/swiftui/ViewInspector/SwiftUICheckPathPluginTests.swift @@ -3,6 +3,9 @@ import XCTest import SwiftUI import ViewInspector @testable import PlayerUI +@testable import PlayerUIInternalTestUtilities +@testable import PlayerUISwiftUI +@testable import PlayerUISwiftUICheckPathPlugin class SwiftUICheckPathPluginTests: XCTestCase { func testContextAttachment() throws { diff --git a/plugins/common-expressions/ios/BUILD.bazel b/plugins/common-expressions/ios/BUILD.bazel new file mode 100644 index 000000000..cae7a333f --- /dev/null +++ b/plugins/common-expressions/ios/BUILD.bazel @@ -0,0 +1,41 @@ +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") +load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") + +load("@build_bazel_rules_ios//rules:test.bzl", "ios_unit_test") + +load("//tools/ios:util.bzl", "ios_bundle_module_shim") + +apple_resource_bundle( + name = "PlayerUICommonExpressionsPluginResourceBundle", + bundle_name = "CommonExpressionsPlugin", + bundle_id = "com.intuit.ios.player.resources.core", + resources = ["//plugins/common-expressions/core:core_native_bundle"] +) + +ios_bundle_module_shim("CommonExpressionsPlugin") + +pkg_files( + name = "PlayerUICommonExpressionsPlugin_Sources", + srcs = glob(["Sources/**/*.swift"]), + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//visibility:public"], +) + +swift_library( + name = "PlayerUICommonExpressionsPlugin", + module_name = "PlayerUICommonExpressionsPlugin", + srcs = [":PlayerUICommonExpressionsPlugin_Sources", ":CommonExpressionsPluginResourceShim"], + visibility = ["//visibility:public"], + deps = ["//ios/core:PlayerUI"], + data = [":PlayerUICommonExpressionsPluginResourceBundle"], + defines = ["BAZEL_TARGET"] +) + +ios_unit_test( + name = "PlayerUICommonExpressionsPluginTests", + srcs = glob(["Tests/**/*.swift"]), + minimum_os_version = "14.0", + deps = [":PlayerUICommonExpressionsPlugin", "//ios/internal-test-utils:PlayerUIInternalTestUtilities"], + visibility = ["//visibility:public"] +) \ No newline at end of file diff --git a/ios/plugins/CommonExpressionsPlugin/Sources/CommonExpressionsPlugin.swift b/plugins/common-expressions/ios/Sources/CommonExpressionsPlugin.swift similarity index 69% rename from ios/plugins/CommonExpressionsPlugin/Sources/CommonExpressionsPlugin.swift rename to plugins/common-expressions/ios/Sources/CommonExpressionsPlugin.swift index 84d4a6eda..9229cdb1a 100644 --- a/ios/plugins/CommonExpressionsPlugin/Sources/CommonExpressionsPlugin.swift +++ b/plugins/common-expressions/ios/Sources/CommonExpressionsPlugin.swift @@ -1,3 +1,8 @@ +import Foundation +#if SWIFT_PACKAGE +import PlayerUI +#endif + /** Wrapper to instantiate @player-ui/common-expressions-plugin */ @@ -7,12 +12,16 @@ public class CommonExpressionsPlugin: JSBasePlugin, NativePlugin { */ public convenience init() { self.init( - fileName: "common-expressions-plugin.prod", + fileName: "CommonExpressionsPlugin.native", pluginName: "CommonExpressionsPlugin.CommonExpressionsPlugin" ) } override open func getUrlForFile(fileName: String) -> URL? { + #if SWIFT_PACKAGE + ResourceUtilities.urlForFile(name: fileName, ext: "js", bundle: Bundle.module) + #else ResourceUtilities.urlForFile(name: fileName, ext: "js", bundle: Bundle(for: CommonExpressionsPlugin.self), pathComponent: "CommonExpressionsPlugin.bundle") + #endif } } diff --git a/ios/plugins/CommonExpressionsPlugin/Tests/CommonExpressionsPluginTests.swift b/plugins/common-expressions/ios/Tests/CommonExpressionsPluginTests.swift similarity index 90% rename from ios/plugins/CommonExpressionsPlugin/Tests/CommonExpressionsPluginTests.swift rename to plugins/common-expressions/ios/Tests/CommonExpressionsPluginTests.swift index 67d1b2516..ff6e21965 100644 --- a/ios/plugins/CommonExpressionsPlugin/Tests/CommonExpressionsPluginTests.swift +++ b/plugins/common-expressions/ios/Tests/CommonExpressionsPluginTests.swift @@ -10,6 +10,7 @@ import Foundation import XCTest import JavaScriptCore @testable import PlayerUI +@testable import PlayerUICommonExpressionsPlugin class CommonExpressionsPluginTests: XCTestCase { func testPluginConstructs() { diff --git a/plugins/common-types/ios/BUILD.bazel b/plugins/common-types/ios/BUILD.bazel new file mode 100644 index 000000000..4fb1c75a0 --- /dev/null +++ b/plugins/common-types/ios/BUILD.bazel @@ -0,0 +1,41 @@ +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") +load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") + +load("@build_bazel_rules_ios//rules:test.bzl", "ios_unit_test") + +load("//tools/ios:util.bzl", "ios_bundle_module_shim") + +apple_resource_bundle( + name = "PlayerUICommonTypesPluginResourceBundle", + bundle_name = "CommonTypesPlugin", + bundle_id = "com.intuit.ios.player.resources.core", + resources = ["//plugins/common-types/core:core_native_bundle"] +) + +ios_bundle_module_shim("CommonTypesPlugin") + +pkg_files( + name = "PlayerUICommonTypesPlugin_Sources", + srcs = glob(["Sources/**/*.swift"]), + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//visibility:public"], +) + +swift_library( + name = "PlayerUICommonTypesPlugin", + module_name = "PlayerUICommonTypesPlugin", + srcs = [":PlayerUICommonTypesPlugin_Sources", ":CommonTypesPluginResourceShim"], + visibility = ["//visibility:public"], + deps = ["//ios/core:PlayerUI"], + data = [":PlayerUICommonTypesPluginResourceBundle"], + defines = ["BAZEL_TARGET"] +) + +ios_unit_test( + name = "PlayerUICommonTypesPluginTests", + srcs = glob(["Tests/**/*.swift"]), + minimum_os_version = "14.0", + deps = [":PlayerUICommonTypesPlugin", "//ios/internal-test-utils:PlayerUIInternalTestUtilities"], + visibility = ["//visibility:public"] +) \ No newline at end of file diff --git a/ios/plugins/CommonTypesPlugin/Sources/CommonTypesPlugin.swift b/plugins/common-types/ios/Sources/CommonTypesPlugin.swift similarity index 65% rename from ios/plugins/CommonTypesPlugin/Sources/CommonTypesPlugin.swift rename to plugins/common-types/ios/Sources/CommonTypesPlugin.swift index ce4dc0ee6..335e2143d 100644 --- a/ios/plugins/CommonTypesPlugin/Sources/CommonTypesPlugin.swift +++ b/plugins/common-types/ios/Sources/CommonTypesPlugin.swift @@ -1,3 +1,9 @@ +import Foundation + +#if SWIFT_PACKAGE +import PlayerUI +#endif + /** Wrapper to instantiate @player-ui/common-types-plugin */ @@ -6,10 +12,14 @@ public class CommonTypesPlugin: JSBasePlugin, NativePlugin { Constructs a PartialMatchRegistry JS object */ public convenience init() { - self.init(fileName: "common-types-plugin.prod", pluginName: "CommonTypesPlugin.CommonTypesPlugin") + self.init(fileName: "CommonTypesPlugin.native", pluginName: "CommonTypesPlugin.CommonTypesPlugin") } override open func getUrlForFile(fileName: String) -> URL? { + #if SWIFT_PACKAGE + ResourceUtilities.urlForFile(name: fileName, ext: "js", bundle: Bundle.module) + #else ResourceUtilities.urlForFile(name: fileName, ext: "js", bundle: Bundle(for: CommonTypesPlugin.self), pathComponent: "CommonTypesPlugin.bundle") + #endif } } diff --git a/ios/plugins/CommonTypesPlugin/Tests/CommonTypesPluginTests.swift b/plugins/common-types/ios/Tests/CommonTypesPluginTests.swift similarity index 91% rename from ios/plugins/CommonTypesPlugin/Tests/CommonTypesPluginTests.swift rename to plugins/common-types/ios/Tests/CommonTypesPluginTests.swift index 6a4e8b8e4..b296b3a9a 100644 --- a/ios/plugins/CommonTypesPlugin/Tests/CommonTypesPluginTests.swift +++ b/plugins/common-types/ios/Tests/CommonTypesPluginTests.swift @@ -10,6 +10,7 @@ import Foundation import XCTest import JavaScriptCore @testable import PlayerUI +@testable import PlayerUICommonTypesPlugin class CommonTypesPluginTests: XCTestCase { func testPluginConstructs() { diff --git a/plugins/computed-properties/ios/BUILD.bazel b/plugins/computed-properties/ios/BUILD.bazel new file mode 100644 index 000000000..c3af62e0f --- /dev/null +++ b/plugins/computed-properties/ios/BUILD.bazel @@ -0,0 +1,41 @@ +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") +load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") + +load("@build_bazel_rules_ios//rules:test.bzl", "ios_unit_test") + +load("//tools/ios:util.bzl", "ios_bundle_module_shim") + +apple_resource_bundle( + name = "PlayerUIComputedPropertiesPluginResourceBundle", + bundle_name = "ComputedPropertiesPlugin", + bundle_id = "com.intuit.ios.player.resources.core", + resources = ["//plugins/computed-properties/core:core_native_bundle"] +) + +ios_bundle_module_shim("ComputedPropertiesPlugin") + +pkg_files( + name = "PlayerUIComputedPropertiesPlugin_Sources", + srcs = glob(["Sources/**/*.swift"]), + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//visibility:public"], +) + +swift_library( + name = "PlayerUIComputedPropertiesPlugin", + module_name = "PlayerUIComputedPropertiesPlugin", + srcs = [":PlayerUIComputedPropertiesPlugin_Sources", ":ComputedPropertiesPluginResourceShim"], + visibility = ["//visibility:public"], + deps = ["//ios/core:PlayerUI"], + data = [":PlayerUIComputedPropertiesPluginResourceBundle"], + defines = ["BAZEL_TARGET"] +) + +ios_unit_test( + name = "PlayerUIComputedPropertiesPluginTests", + srcs = glob(["Tests/**/*.swift"]), + minimum_os_version = "14.0", + deps = [":PlayerUIComputedPropertiesPlugin", "//ios/internal-test-utils:PlayerUIInternalTestUtilities"], + visibility = ["//visibility:public"] +) \ No newline at end of file diff --git a/ios/plugins/ComputedPropertiesPlugin/Sources/ComputedPropertiesPlugin.swift b/plugins/computed-properties/ios/Sources/ComputedPropertiesPlugin.swift similarity index 69% rename from ios/plugins/ComputedPropertiesPlugin/Sources/ComputedPropertiesPlugin.swift rename to plugins/computed-properties/ios/Sources/ComputedPropertiesPlugin.swift index 1c56067bb..d7eb8a228 100644 --- a/ios/plugins/ComputedPropertiesPlugin/Sources/ComputedPropertiesPlugin.swift +++ b/plugins/computed-properties/ios/Sources/ComputedPropertiesPlugin.swift @@ -1,3 +1,9 @@ +import Foundation + +#if SWIFT_PACKAGE +import PlayerUI +#endif + /** Wrapper to instantiate @player/computed-properties-plugin */ @@ -6,15 +12,19 @@ public class ComputedPropertiesPlugin: JSBasePlugin, NativePlugin { Constructs a PartialMatchRegistry JS object */ public convenience init() { - self.init(fileName: "computed-properties-plugin.prod", pluginName: "ComputedPropertiesPlugin.ComputedPropertiesPlugin") + self.init(fileName: "ComputedPropertiesPlugin.native", pluginName: "ComputedPropertiesPlugin.ComputedPropertiesPlugin") } override open func getUrlForFile(fileName: String) -> URL? { + #if SWIFT_PACKAGE + ResourceUtilities.urlForFile(name: fileName, ext: "js", bundle: Bundle.module) + #else ResourceUtilities.urlForFile( name: fileName, ext: "js", bundle: Bundle(for: ComputedPropertiesPlugin.self), pathComponent: "ComputedPropertiesPlugin.bundle" ) + #endif } } diff --git a/ios/plugins/ComputedPropertiesPlugin/Tests/ComputedPropertiesPluginTests.swift b/plugins/computed-properties/ios/Tests/ComputedPropertiesPluginTests.swift similarity index 94% rename from ios/plugins/ComputedPropertiesPlugin/Tests/ComputedPropertiesPluginTests.swift rename to plugins/computed-properties/ios/Tests/ComputedPropertiesPluginTests.swift index 59867faa0..267005908 100644 --- a/ios/plugins/ComputedPropertiesPlugin/Tests/ComputedPropertiesPluginTests.swift +++ b/plugins/computed-properties/ios/Tests/ComputedPropertiesPluginTests.swift @@ -2,6 +2,8 @@ import Foundation import XCTest import JavaScriptCore @testable import PlayerUI +@testable import PlayerUIInternalTestUtilities +@testable import PlayerUIComputedPropertiesPlugin class ComputedPropertiesPluginTests: XCTestCase { func testPluginConstructs() { diff --git a/plugins/console-logger/ios/BUILD.bazel b/plugins/console-logger/ios/BUILD.bazel new file mode 100644 index 000000000..bbd40cd26 --- /dev/null +++ b/plugins/console-logger/ios/BUILD.bazel @@ -0,0 +1,29 @@ +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") +load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") + +load("@build_bazel_rules_ios//rules:test.bzl", "ios_unit_test") + +pkg_files( + name = "PlayerUIPrintLoggerPlugin_Sources", + srcs = glob(["Sources/**/*.swift"]), + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//visibility:public"], +) + +swift_library( + name = "PlayerUIPrintLoggerPlugin", + module_name = "PlayerUIPrintLoggerPlugin", + srcs = [":PlayerUIPrintLoggerPlugin_Sources"], + visibility = ["//visibility:public"], + deps = ["//ios/core:PlayerUI", "//ios/logger:PlayerUILogger"], + defines = ["BAZEL_TARGET"] +) + +ios_unit_test( + name = "PlayerUIPrintLoggerPluginTests", + srcs = glob(["Tests/**/*.swift"]), + minimum_os_version = "14.0", + deps = [":PlayerUIPrintLoggerPlugin", "//ios/internal-test-utils:PlayerUIInternalTestUtilities"], + visibility = ["//visibility:public"] +) \ No newline at end of file diff --git a/ios/plugins/PrintLoggerPlugin/Sources/PrintLoggerPlugin.swift b/plugins/console-logger/ios/Sources/PrintLoggerPlugin.swift similarity index 94% rename from ios/plugins/PrintLoggerPlugin/Sources/PrintLoggerPlugin.swift rename to plugins/console-logger/ios/Sources/PrintLoggerPlugin.swift index c8c74b47d..15fea46a7 100644 --- a/ios/plugins/PrintLoggerPlugin/Sources/PrintLoggerPlugin.swift +++ b/plugins/console-logger/ios/Sources/PrintLoggerPlugin.swift @@ -7,6 +7,11 @@ import Foundation +#if SWIFT_PACKAGE +import PlayerUI +import PlayerUILogger +#endif + /** A Logger plugin that prints messages */ diff --git a/ios/packages/logger/Tests/PrintLoggerPluginTests.swift b/plugins/console-logger/ios/Tests/PrintLoggerPluginTests.swift similarity index 84% rename from ios/packages/logger/Tests/PrintLoggerPluginTests.swift rename to plugins/console-logger/ios/Tests/PrintLoggerPluginTests.swift index 262883e86..94863eb64 100644 --- a/ios/packages/logger/Tests/PrintLoggerPluginTests.swift +++ b/plugins/console-logger/ios/Tests/PrintLoggerPluginTests.swift @@ -10,6 +10,9 @@ import Foundation import JavaScriptCore import XCTest @testable import PlayerUI +@testable import PlayerUIPrintLoggerPlugin +@testable import PlayerUILogger +@testable import PlayerUIInternalTestUtilities class PrintLoggerPluginTests: XCTestCase { func testPrintLogger() { diff --git a/plugins/expression/ios/BUILD.bazel b/plugins/expression/ios/BUILD.bazel new file mode 100644 index 000000000..0ba422144 --- /dev/null +++ b/plugins/expression/ios/BUILD.bazel @@ -0,0 +1,41 @@ +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") +load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") + +load("@build_bazel_rules_ios//rules:test.bzl", "ios_unit_test") + +load("//tools/ios:util.bzl", "ios_bundle_module_shim") + +apple_resource_bundle( + name = "PlayerUIExpressionPluginResourceBundle", + bundle_name = "ExpressionPlugin", + bundle_id = "com.intuit.ios.player.resources.core", + resources = ["//plugins/expression/core:core_native_bundle"] +) + +ios_bundle_module_shim("ExpressionPlugin") + +pkg_files( + name = "PlayerUIExpressionPlugin_Sources", + srcs = glob(["Sources/**/*.swift"]), + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//visibility:public"], +) + +swift_library( + name = "PlayerUIExpressionPlugin", + module_name = "PlayerUIExpressionPlugin", + srcs = [":PlayerUIExpressionPlugin_Sources", ":ExpressionPluginResourceShim"], + visibility = ["//visibility:public"], + deps = ["//ios/core:PlayerUI"], + data = [":PlayerUIExpressionPluginResourceBundle"], + defines = ["BAZEL_TARGET"] +) + +ios_unit_test( + name = "PlayerUIExpressionPluginTests", + srcs = glob(["Tests/**/*.swift"]), + minimum_os_version = "14.0", + deps = [":PlayerUIExpressionPlugin", "//ios/internal-test-utils:PlayerUIInternalTestUtilities"], + visibility = ["//visibility:public"] +) \ No newline at end of file diff --git a/ios/plugins/ExpressionPlugin/Sources/ExpressionPlugin.swift b/plugins/expression/ios/Sources/ExpressionPlugin.swift similarity index 85% rename from ios/plugins/ExpressionPlugin/Sources/ExpressionPlugin.swift rename to plugins/expression/ios/Sources/ExpressionPlugin.swift index 58cc88311..6045d1448 100644 --- a/ios/plugins/ExpressionPlugin/Sources/ExpressionPlugin.swift +++ b/plugins/expression/ios/Sources/ExpressionPlugin.swift @@ -8,6 +8,10 @@ import Foundation import JavaScriptCore +#if SWIFT_PACKAGE +import PlayerUI +#endif + /** Plugin for registering custom expressions with Player */ @@ -20,12 +24,16 @@ public class ExpressionPlugin: JSBasePlugin, NativePlugin { - expressions: A dictionary of expression name to handler function */ public convenience init(expressions: [String: ([Any]) -> Any?] = [:]) { - self.init(fileName: "expression-plugin.prod", pluginName: "ExpressionPlugin.ExpressionPlugin") + self.init(fileName: "ExpressionPlugin.native", pluginName: "ExpressionPlugin.ExpressionPlugin") self.expressions = expressions } override open func getUrlForFile(fileName: String) -> URL? { + #if SWIFT_PACKAGE + ResourceUtilities.urlForFile(name: fileName, ext: "js", bundle: Bundle.module) + #else ResourceUtilities.urlForFile(name: fileName, ext: "js", bundle: Bundle(for: ExpressionPlugin.self), pathComponent: "ExpressionPlugin.bundle") + #endif } override public func getArguments() -> [Any] { diff --git a/ios/plugins/ExpressionPlugin/Tests/ExpressionPluginTests.swift b/plugins/expression/ios/Tests/ExpressionPluginTests.swift similarity index 98% rename from ios/plugins/ExpressionPlugin/Tests/ExpressionPluginTests.swift rename to plugins/expression/ios/Tests/ExpressionPluginTests.swift index d79d7b561..de2988e6d 100644 --- a/ios/plugins/ExpressionPlugin/Tests/ExpressionPluginTests.swift +++ b/plugins/expression/ios/Tests/ExpressionPluginTests.swift @@ -10,6 +10,7 @@ import Foundation import XCTest import JavaScriptCore @testable import PlayerUI +@testable import PlayerUIExpressionPlugin class ExpressionPluginTests: XCTestCase { func testExpressionPluginConstructsWithoutExpressions() { diff --git a/plugins/external-action/ios/BUILD.bazel b/plugins/external-action/ios/BUILD.bazel new file mode 100644 index 000000000..6fa4d0a37 --- /dev/null +++ b/plugins/external-action/ios/BUILD.bazel @@ -0,0 +1,41 @@ +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") +load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") + +load("@build_bazel_rules_ios//rules:test.bzl", "ios_unit_test") + +load("//tools/ios:util.bzl", "ios_bundle_module_shim") + +apple_resource_bundle( + name = "PlayerUIExternalActionPluginResourceBundle", + bundle_name = "ExternalActionPlugin", + bundle_id = "com.intuit.ios.player.resources.core", + resources = ["//plugins/external-action/core:core_native_bundle"] +) + +ios_bundle_module_shim("ExternalActionPlugin") + +pkg_files( + name = "PlayerUIExternalActionPlugin_Sources", + srcs = glob(["Sources/**/*.swift"]), + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//visibility:public"], +) + +swift_library( + name = "PlayerUIExternalActionPlugin", + module_name = "PlayerUIExternalActionPlugin", + srcs = [":PlayerUIExternalActionPlugin_Sources", ":ExternalActionPluginResourceShim"], + visibility = ["//visibility:public"], + deps = ["//ios/core:PlayerUI"], + data = [":PlayerUIExternalActionPluginResourceBundle"], + defines = ["BAZEL_TARGET"] +) + +ios_unit_test( + name = "PlayerUIExternalActionPluginTests", + srcs = glob(["Tests/**/*.swift"]), + minimum_os_version = "14.0", + deps = [":PlayerUIExternalActionPlugin", "//ios/internal-test-utils:PlayerUIInternalTestUtilities"], + visibility = ["//visibility:public"] +) \ No newline at end of file diff --git a/ios/plugins/ExternalActionPlugin/Sources/ExternalActionPlugin.swift b/plugins/external-action/ios/Sources/ExternalActionPlugin.swift similarity index 89% rename from ios/plugins/ExternalActionPlugin/Sources/ExternalActionPlugin.swift rename to plugins/external-action/ios/Sources/ExternalActionPlugin.swift index 5d34d6797..39a8315b5 100644 --- a/ios/plugins/ExternalActionPlugin/Sources/ExternalActionPlugin.swift +++ b/plugins/external-action/ios/Sources/ExternalActionPlugin.swift @@ -8,6 +8,10 @@ import Foundation import JavaScriptCore +#if SWIFT_PACKAGE +import PlayerUI +#endif + /** This plugin is for registering a handler for EXTERNAL states */ @@ -30,7 +34,7 @@ public class ExternalActionPlugin: JSBasePlugin, NativePlugin { */ public convenience init(handler: @escaping ExternalStateHandler) { self.init( - fileName: "external-action-plugin.prod", + fileName: "ExternalActionPlugin.native", pluginName: "ExternalActionPlugin.ExternalActionPlugin" ) self.handler = handler @@ -63,6 +67,14 @@ public class ExternalActionPlugin: JSBasePlugin, NativePlugin { } override open func getUrlForFile(fileName: String) -> URL? { + #if SWIFT_PACKAGE + ResourceUtilities.urlForFile(name: fileName, ext: "js", bundle: Bundle.module) + #else ResourceUtilities.urlForFile(name: fileName, ext: "js", bundle: Bundle(for: ExternalActionPlugin.self), pathComponent: "ExternalActionPlugin.bundle") + #endif } + + #if SWIFT_PACKAGE + public static let bundle = Bundle.module + #endif } diff --git a/ios/plugins/ExternalActionPlugin/Tests/ExternalActionPluginTests.swift b/plugins/external-action/ios/Tests/ExternalActionPluginTests.swift similarity index 99% rename from ios/plugins/ExternalActionPlugin/Tests/ExternalActionPluginTests.swift rename to plugins/external-action/ios/Tests/ExternalActionPluginTests.swift index 5828ab081..75ef4d8f1 100644 --- a/ios/plugins/ExternalActionPlugin/Tests/ExternalActionPluginTests.swift +++ b/plugins/external-action/ios/Tests/ExternalActionPluginTests.swift @@ -10,6 +10,8 @@ import Foundation import XCTest import JavaScriptCore @testable import PlayerUI +@testable import PlayerUIInternalTestUtilities +@testable import PlayerUIExternalActionPlugin // swiftlint:disable type_body_length class ExternalActionPluginTests: XCTestCase { diff --git a/plugins/external-action/swiftui/BUILD.bazel b/plugins/external-action/swiftui/BUILD.bazel new file mode 100644 index 000000000..b7e02adf7 --- /dev/null +++ b/plugins/external-action/swiftui/BUILD.bazel @@ -0,0 +1,40 @@ +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") + +load("@build_bazel_rules_ios//rules:test.bzl", "ios_unit_test", "ios_ui_test") + +pkg_files( + name = "PlayerUIExternalActionViewModifierPlugin_Sources", + srcs = glob(["Sources/**/*.swift"]), + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//visibility:public"], +) + +swift_library( + name = "PlayerUIExternalActionViewModifierPlugin", + module_name = "PlayerUIExternalActionViewModifierPlugin", + srcs = [":PlayerUIExternalActionViewModifierPlugin_Sources"], + visibility = ["//visibility:public"], + deps = [ + "//ios/core:PlayerUI", + "//ios/swiftui:PlayerUISwiftUI", + "//plugins/external-action/ios:PlayerUIExternalActionPlugin" + ], + defines = ["BAZEL_TARGET"] +) + +ios_ui_test( + name = "PlayerUIExternalActionViewModifierPluginViewInspectorTests", + srcs = glob(["ViewInspector/**/*.swift"]), + minimum_os_version = "14.0", + deps = [ + "@swiftpkg_viewinspector//:Sources_ViewInspector", + ":PlayerUIExternalActionViewModifierPlugin", + "//ios/core:PlayerUI", + "//ios/swiftui:PlayerUISwiftUI", + "//plugins/reference-assets/swiftui:PlayerUIReferenceAssets", + "//ios/internal-test-utils:PlayerUIInternalTestUtilities" + ], + visibility = ["//visibility:public"], + test_host = "//ios/demo:PlayerUIDemo" +) \ No newline at end of file diff --git a/ios/plugins/ExternalActionViewModifierPlugin/Sources/ExternalActionViewModifierPlugin.swift b/plugins/external-action/swiftui/Sources/ExternalActionViewModifierPlugin.swift similarity index 94% rename from ios/plugins/ExternalActionViewModifierPlugin/Sources/ExternalActionViewModifierPlugin.swift rename to plugins/external-action/swiftui/Sources/ExternalActionViewModifierPlugin.swift index 6c5e2338d..682d1f4b2 100644 --- a/ios/plugins/ExternalActionViewModifierPlugin/Sources/ExternalActionViewModifierPlugin.swift +++ b/plugins/external-action/swiftui/Sources/ExternalActionViewModifierPlugin.swift @@ -1,6 +1,12 @@ import JavaScriptCore import SwiftUI +#if SWIFT_PACKAGE +import PlayerUI +import PlayerUISwiftUI +import PlayerUIExternalActionPlugin +#endif + /** A variation on `ExternalActionPlugin` for `SwiftUIPlayer` that applies a ViewModifier to SwiftUIPlayer content when in an external state */ @@ -31,7 +37,7 @@ open class ExternalActionViewModifierPlugin URL? { + #if SWIFT_PACKAGE + ResourceUtilities.urlForFile( + name: fileName, ext: "js", + bundle: ExternalActionPlugin.bundle + ) + #else ResourceUtilities.urlForFile( name: fileName, ext: "js", bundle: Bundle(for: ExternalActionPlugin.self), pathComponent: "ExternalActionPlugin.bundle" ) + #endif } } diff --git a/ios/plugins/ExternalActionViewModifierPlugin/ViewInspector/ExternalActionViewModifierPluginTests.swift b/plugins/external-action/swiftui/ViewInspector/ExternalActionViewModifierPluginTests.swift similarity index 94% rename from ios/plugins/ExternalActionViewModifierPlugin/ViewInspector/ExternalActionViewModifierPluginTests.swift rename to plugins/external-action/swiftui/ViewInspector/ExternalActionViewModifierPluginTests.swift index 8d89f2596..6bb119c19 100644 --- a/ios/plugins/ExternalActionViewModifierPlugin/ViewInspector/ExternalActionViewModifierPluginTests.swift +++ b/plugins/external-action/swiftui/ViewInspector/ExternalActionViewModifierPluginTests.swift @@ -12,8 +12,15 @@ import Combine import SwiftUI import ViewInspector @testable import PlayerUI - -class ExternalActionViewModifierPluginTests: ViewInspectorTestCase { +@testable import PlayerUIInternalTestUtilities +@testable import PlayerUISwiftUI +@testable import PlayerUIReferenceAssets +@testable import PlayerUIExternalActionViewModifierPlugin + +class ExternalActionViewModifierPluginTests: XCTestCase { + override func setUp() { + XCUIApplication().terminate() + } // swiftlint:disable function_body_length func testExternalStateHandling() throws { let json = """ @@ -75,7 +82,7 @@ class ExternalActionViewModifierPluginTests: ViewInspectorTestCase { ViewHosting.host(view: player) - let exp = player.inspection.inspect(after: 0.5) { view in + let exp = player.inspection.inspect(after: 1.0) { view in XCTAssertNotNil(plugin.state) let content = try view.vStack().first?.anyView().anyView().modifier(ExternalStateSheetModifier.self).viewModifierContent() try content?.sheet().anyView().text().callOnDisappear() @@ -242,3 +249,5 @@ class ExternalActionViewModifierPluginTests: ViewInspectorTestCase { extension ExternalStateSheetModifier: Inspectable {} extension InspectableSheet: PopupPresenter {} +extension SwiftUIPlayer: Inspectable {} +extension Inspection: InspectionEmissary where V: Inspectable { } diff --git a/plugins/metrics/swiftui/BUILD.bazel b/plugins/metrics/swiftui/BUILD.bazel new file mode 100644 index 000000000..a0eadf00d --- /dev/null +++ b/plugins/metrics/swiftui/BUILD.bazel @@ -0,0 +1,49 @@ +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") +load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") + +load("@build_bazel_rules_ios//rules:test.bzl", "ios_ui_test") + +load("//tools/ios:util.bzl", "ios_bundle_module_shim") + +apple_resource_bundle( + name = "PlayerUIMetricsPluginResourceBundle", + bundle_name = "MetricsPlugin", + bundle_id = "com.intuit.ios.player.resources.core", + resources = ["//plugins/metrics/core:core_native_bundle"] +) + +ios_bundle_module_shim("MetricsPlugin") + +pkg_files( + name = "PlayerUIMetricsPlugin_Sources", + srcs = glob(["Sources/**/*.swift"]), + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//visibility:public"], +) + +swift_library( + name = "PlayerUIMetricsPlugin", + module_name = "PlayerUIMetricsPlugin", + srcs = [":PlayerUIMetricsPlugin_Sources", ":MetricsPluginResourceShim"], + visibility = ["//visibility:public"], + deps = ["//ios/core:PlayerUI", "//ios/swiftui:PlayerUISwiftUI"], + data = [":PlayerUIMetricsPluginResourceBundle"], + defines = ["BAZEL_TARGET"] +) + +ios_ui_test( + name = "PlayerUIMetricsPluginViewInspectorTests", + srcs = glob(["ViewInspector/**/*.swift"]), + minimum_os_version = "14.0", + deps = [ + "@swiftpkg_viewinspector//:Sources_ViewInspector", + ":PlayerUIMetricsPlugin", + "//ios/core:PlayerUI", + "//ios/swiftui:PlayerUISwiftUI", + "//plugins/reference-assets/swiftui:PlayerUIReferenceAssets", + "//ios/internal-test-utils:PlayerUIInternalTestUtilities" + ], + visibility = ["//visibility:public"], + test_host = "//ios/demo:PlayerUIDemo" +) \ No newline at end of file diff --git a/ios/plugins/MetricsPlugin/Sources/MetricsPlugin.swift b/plugins/metrics/swiftui/Sources/MetricsPlugin.swift similarity index 93% rename from ios/plugins/MetricsPlugin/Sources/MetricsPlugin.swift rename to plugins/metrics/swiftui/Sources/MetricsPlugin.swift index 7d98647e4..4072f8b09 100644 --- a/ios/plugins/MetricsPlugin/Sources/MetricsPlugin.swift +++ b/plugins/metrics/swiftui/Sources/MetricsPlugin.swift @@ -9,6 +9,11 @@ import Foundation import JavaScriptCore import SwiftUI +#if SWIFT_PACKAGE +import PlayerUI +import PlayerUISwiftUI +#endif + /// A Plugin that provides request time data to `MetricsPlugin` public class RequestTimePlugin: NativePlugin { public var pluginName: String = "RequestTime" @@ -31,7 +36,7 @@ public class RequestTimePlugin: NativePlugin { class RequestTimeWebPlugin: JSBasePlugin { private var getRequestTime: () -> Int = { 0 } public convenience init(_ getRequestTime: @escaping () -> Int) { - self.init(fileName: "metrics-plugin.prod", pluginName: "MetricsPlugin.RequestTimeWebPlugin") + self.init(fileName: "MetricsPlugin.native", pluginName: "MetricsPlugin.RequestTimeWebPlugin") self.getRequestTime = getRequestTime } @@ -43,12 +48,16 @@ class RequestTimeWebPlugin: JSBasePlugin { } override open func getUrlForFile(fileName: String) -> URL? { + #if SWIFT_PACKAGE + ResourceUtilities.urlForFile(name: fileName, ext: "js", bundle: Bundle.module) + #else ResourceUtilities.urlForFile( name: fileName, ext: "js", bundle: Bundle(for: MetricsPlugin.self), pathComponent: "MetricsPlugin.bundle" ) + #endif } } /** @@ -89,7 +98,7 @@ public class MetricsPlugin: JSBasePlugin, NativePlugin, WithSymbol { - handler: A handler to receive events when rendering has finished */ public convenience init(trackRenderTime: Bool = true, handler: RenderEndHandler? = nil) { - self.init(fileName: "metrics-plugin.prod", pluginName: "MetricsPlugin.MetricsCorePlugin") + self.init(fileName: "MetricsPlugin.native", pluginName: "MetricsPlugin.MetricsCorePlugin") self.trackRenderTime = trackRenderTime self.onRenderEnd = handler } diff --git a/ios/plugins/MetricsPlugin/ViewInspector/MetricsPluginTests.swift b/plugins/metrics/swiftui/ViewInspector/MetricsPluginTests.swift similarity index 95% rename from ios/plugins/MetricsPlugin/ViewInspector/MetricsPluginTests.swift rename to plugins/metrics/swiftui/ViewInspector/MetricsPluginTests.swift index 6fcb4b8a8..91f37d73b 100644 --- a/ios/plugins/MetricsPlugin/ViewInspector/MetricsPluginTests.swift +++ b/plugins/metrics/swiftui/ViewInspector/MetricsPluginTests.swift @@ -11,6 +11,11 @@ import XCTest import JavaScriptCore import ViewInspector @testable import PlayerUI +@testable import PlayerUIInternalTestUtilities +@testable import PlayerUISwiftUI +@testable import PlayerUIMetricsPlugin +@testable import PlayerUIReferenceAssets + class TapCounterPlugin: NativePlugin { var pluginName: String = "TapCounter" var count = 0 diff --git a/plugins/pending-transaction/swiftui/BUILD.bazel b/plugins/pending-transaction/swiftui/BUILD.bazel new file mode 100644 index 000000000..70287e6db --- /dev/null +++ b/plugins/pending-transaction/swiftui/BUILD.bazel @@ -0,0 +1,33 @@ +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") + +load("@build_bazel_rules_ios//rules:test.bzl", "ios_unit_test", "ios_ui_test") + +pkg_files( + name = "PlayerUISwiftUIPendingTransactionPlugin_Sources", + srcs = glob(["Sources/**/*.swift"]), + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//visibility:public"], +) + +swift_library( + name = "PlayerUISwiftUIPendingTransactionPlugin", + module_name = "PlayerUISwiftUIPendingTransactionPlugin", + srcs = [":PlayerUISwiftUIPendingTransactionPlugin_Sources"], + visibility = ["//visibility:public"], + deps = ["//ios/core:PlayerUI", "//ios/swiftui:PlayerUISwiftUI"], + defines = ["BAZEL_TARGET"] +) + +ios_ui_test( + name = "PlayerUISwiftUIPendingTransactionPluginViewInspectorTests", + srcs = glob(["ViewInspector/**/*.swift"]), + minimum_os_version = "14.0", + deps = [ + "@swiftpkg_viewinspector//:Sources_ViewInspector", + ":PlayerUISwiftUIPendingTransactionPlugin", + "//ios/core:PlayerUI" + ], + visibility = ["//visibility:public"], + test_host = "//ios/demo:PlayerUIDemo" +) \ No newline at end of file diff --git a/ios/plugins/SwiftUIPendingTransactionPlugin/Sources/SwiftUIPendingTransactionPlugin.swift b/plugins/pending-transaction/swiftui/Sources/SwiftUIPendingTransactionPlugin.swift similarity index 98% rename from ios/plugins/SwiftUIPendingTransactionPlugin/Sources/SwiftUIPendingTransactionPlugin.swift rename to plugins/pending-transaction/swiftui/Sources/SwiftUIPendingTransactionPlugin.swift index f6de44ee5..924b0e3cd 100644 --- a/ios/plugins/SwiftUIPendingTransactionPlugin/Sources/SwiftUIPendingTransactionPlugin.swift +++ b/plugins/pending-transaction/swiftui/Sources/SwiftUIPendingTransactionPlugin.swift @@ -8,6 +8,11 @@ import Foundation import SwiftUI +#if SWIFT_PACKAGE +import PlayerUI +import PlayerUISwiftUI +#endif + /** A plugin that allows TransactionContext objects to be registered into the decoder's userInfo that is used to decode the view updates. Allows for handling pending transactions on the assets side so users can decide when and where to add new callbacks and commit them diff --git a/ios/plugins/SwiftUIPendingTransactionPlugin/ViewInspector/SwiftUIPendingTransactionPlugin.swift b/plugins/pending-transaction/swiftui/ViewInspector/SwiftUIPendingTransactionPlugin.swift similarity index 97% rename from ios/plugins/SwiftUIPendingTransactionPlugin/ViewInspector/SwiftUIPendingTransactionPlugin.swift rename to plugins/pending-transaction/swiftui/ViewInspector/SwiftUIPendingTransactionPlugin.swift index 7eace3a6d..bf8861e14 100644 --- a/ios/plugins/SwiftUIPendingTransactionPlugin/ViewInspector/SwiftUIPendingTransactionPlugin.swift +++ b/plugins/pending-transaction/swiftui/ViewInspector/SwiftUIPendingTransactionPlugin.swift @@ -10,8 +10,10 @@ import XCTest import SwiftUI import ViewInspector @testable import PlayerUI +@testable import PlayerUISwiftUI +@testable import PlayerUISwiftUIPendingTransactionPlugin -class SwiftUIPendingTransactionPluginTests: SwiftUIAssetUnitTestCase { +class SwiftUIPendingTransactionPluginTests: XCTestCase { func testContextAttachment() throws { let player = SwiftUIPlayer(flow: "", plugins: [SwiftUIPendingTransactionPlugin(keyPath: \.transactionContext)]) diff --git a/plugins/pubsub/ios/BUILD.bazel b/plugins/pubsub/ios/BUILD.bazel new file mode 100644 index 000000000..71b165279 --- /dev/null +++ b/plugins/pubsub/ios/BUILD.bazel @@ -0,0 +1,41 @@ +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") +load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") + +load("@build_bazel_rules_ios//rules:test.bzl", "ios_unit_test") + +load("//tools/ios:util.bzl", "ios_bundle_module_shim") + +apple_resource_bundle( + name = "PlayerUIPubSubPluginResourceBundle", + bundle_name = "PubSubPlugin", + bundle_id = "com.intuit.ios.player.resources.core", + resources = ["//plugins/pubsub/core:core_native_bundle"] +) + +ios_bundle_module_shim("PubSubPlugin") + +pkg_files( + name = "PlayerUIPubSubPlugin_Sources", + srcs = glob(["Sources/**/*.swift"]), + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//visibility:public"], +) + +swift_library( + name = "PlayerUIPubSubPlugin", + module_name = "PlayerUIPubSubPlugin", + srcs = [":PlayerUIPubSubPlugin_Sources", ":PubSubPluginResourceShim"], + visibility = ["//visibility:public"], + deps = ["//ios/core:PlayerUI"], + data = [":PlayerUIPubSubPluginResourceBundle"], + defines = ["BAZEL_TARGET"] +) + +ios_unit_test( + name = "PlayerUIPubSubPluginTests", + srcs = glob(["Tests/**/*.swift"]), + minimum_os_version = "14.0", + deps = [":PlayerUIPubSubPlugin", "//ios/internal-test-utils:PlayerUIInternalTestUtilities"], + visibility = ["//visibility:public"] +) \ No newline at end of file diff --git a/ios/plugins/PubSubPlugin/Sources/PubSubPlugin.swift b/plugins/pubsub/ios/Sources/PubSubPlugin.swift similarity index 93% rename from ios/plugins/PubSubPlugin/Sources/PubSubPlugin.swift rename to plugins/pubsub/ios/Sources/PubSubPlugin.swift index 6cfda1917..1bbe68dea 100644 --- a/ios/plugins/PubSubPlugin/Sources/PubSubPlugin.swift +++ b/plugins/pubsub/ios/Sources/PubSubPlugin.swift @@ -8,6 +8,10 @@ import Foundation import JavaScriptCore +#if SWIFT_PACKAGE +import PlayerUI +#endif + /** Additional options for `PubSubPlugin` */ @@ -42,7 +46,7 @@ public class PubSubPlugin: JSBasePlugin, NativePlugin { - eventReceived: A callback to receive events */ public convenience init(_ subscriptions: [PubSubSubscription], options: PubSubPluginOptions? = nil) { - self.init(fileName: "pubsub-plugin.prod", pluginName: "PubSubPlugin.PubSubPlugin") + self.init(fileName: "PubSubPlugin.native", pluginName: "PubSubPlugin.PubSubPlugin") eventSubscriptions = subscriptions self.options = options } @@ -65,7 +69,11 @@ public class PubSubPlugin: JSBasePlugin, NativePlugin { } override open func getUrlForFile(fileName: String) -> URL? { + #if SWIFT_PACKAGE + ResourceUtilities.urlForFile(name: fileName, ext: "js", bundle: Bundle.module) + #else ResourceUtilities.urlForFile(name: fileName, ext: "js", bundle: Bundle(for: PubSubPlugin.self), pathComponent: "PubSubPlugin.bundle") + #endif } /** diff --git a/ios/plugins/PubSubPlugin/Tests/PubSubPluginTests.swift b/plugins/pubsub/ios/Tests/PubSubPluginTests.swift similarity index 98% rename from ios/plugins/PubSubPlugin/Tests/PubSubPluginTests.swift rename to plugins/pubsub/ios/Tests/PubSubPluginTests.swift index 6abb92ac7..acd4aae44 100644 --- a/ios/plugins/PubSubPlugin/Tests/PubSubPluginTests.swift +++ b/plugins/pubsub/ios/Tests/PubSubPluginTests.swift @@ -10,6 +10,8 @@ import Foundation import XCTest import JavaScriptCore @testable import PlayerUI +@testable import PlayerUIInternalTestUtilities +@testable import PlayerUIPubSubPlugin class PubSubPluginTests: XCTestCase { func testPubSubPluginFromContent() { diff --git a/plugins/reference-assets/swiftui/BUILD.bazel b/plugins/reference-assets/swiftui/BUILD.bazel new file mode 100644 index 000000000..f22d4b9ce --- /dev/null +++ b/plugins/reference-assets/swiftui/BUILD.bazel @@ -0,0 +1,82 @@ +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") +load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") + +load("@build_bazel_rules_ios//rules:test.bzl", "ios_unit_test", "ios_ui_test") +load("@build_bazel_rules_apple//apple:ios.bzl", "ios_framework", "ios_build_test") + +load("//tools/ios:util.bzl", "ios_bundle_module_shim") + +apple_resource_bundle( + name = "PlayerUIReferenceAssetsResourceBundle", + bundle_name = "ReferenceAssets", + bundle_id = "com.intuit.ios.player.resources.core", + resources = ["//plugins/reference-assets/swiftui/Resources:PlayerUIReferenceAssets_Resources", "//plugins/reference-assets/core:core_native_bundle"] +) + +ios_bundle_module_shim("ReferenceAssets") + +pkg_files( + name = "PlayerUIReferenceAssets_Sources", + srcs = glob(["Sources/**/*.swift"]), + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//visibility:public"], +) + +swift_library( + name = "PlayerUIReferenceAssets", + module_name = "PlayerUIReferenceAssets", + srcs = [":PlayerUIReferenceAssets_Sources", ":ReferenceAssetsResourceShim"], + visibility = ["//visibility:public"], + deps = [ + "//ios/core:PlayerUI", + "//ios/swiftui:PlayerUISwiftUI", + "//plugins/beacon/swiftui:PlayerUIBeaconPlugin", + "//plugins/pending-transaction/swiftui:PlayerUISwiftUIPendingTransactionPlugin" + ], + data = [":PlayerUIReferenceAssetsResourceBundle"], + defines = ["BAZEL_TARGET"] +) + +ios_build_test( + name = "PlayerUIReferenceAssetsBuild", + minimum_os_version = "14.0", + targets = [ + ":PlayerUIReferenceAssets", + ], + visibility = ["//visibility:public"], +) + +ios_ui_test( + name = "PlayerUIReferenceAssetsViewInspectorTests", + srcs = glob(["ViewInspector/**/*.swift"]), + minimum_os_version = "14.0", + deps = [ + "@swiftpkg_viewinspector//:Sources_ViewInspector", + "//ios/swiftui:PlayerUISwiftUI", + "//ios/core:PlayerUI", + "//ios/test-utils:PlayerUITestUtilities", + "//ios/internal-test-utils:PlayerUIInternalTestUtilities", + ":PlayerUIReferenceAssets", + "//plugins/beacon/swiftui:PlayerUIBeaconPlugin" + ], + visibility = ["//visibility:public"], + test_host = "//ios/demo:PlayerUIDemo" +) + +ios_ui_test( + name = "PlayerUIReferenceAssetsUITests", + srcs = glob(["UITests/**/*.swift"]), + minimum_os_version = "14.0", + deps = [ + "@swiftpkg_eyes_xcui_swift_package//:remote_archive_EyesXCUI.xcframework.zip_EyesXCUI", + "//ios/swiftui:PlayerUISwiftUI", + "//ios/core:PlayerUI", + "//ios/test-utils:PlayerUITestUtilities", + "//ios/test-utils-core:PlayerUITestUtilitiesCore", + "//ios/internal-test-utils:PlayerUIInternalTestUtilities", + ":PlayerUIReferenceAssets" + ], + visibility = ["//visibility:public"], + test_host = "//ios/demo:PlayerUIDemo" +) \ No newline at end of file diff --git a/plugins/reference-assets/swiftui/Resources/BUILD.bazel b/plugins/reference-assets/swiftui/Resources/BUILD.bazel new file mode 100644 index 000000000..44145e40e --- /dev/null +++ b/plugins/reference-assets/swiftui/Resources/BUILD.bazel @@ -0,0 +1,8 @@ +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") + +pkg_files( + name = "PlayerUIReferenceAssets_Resources", + srcs = glob(["svg/**/*"]), + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//visibility:public"], +) \ No newline at end of file diff --git a/ios/packages/demo/Resources/Images.xcassets/Contents.json b/plugins/reference-assets/swiftui/Resources/svg/Icons.xcassets/Contents.json similarity index 100% rename from ios/packages/demo/Resources/Images.xcassets/Contents.json rename to plugins/reference-assets/swiftui/Resources/svg/Icons.xcassets/Contents.json diff --git a/ios/packages/reference-assets/Resources/svg/Icons.xcassets/dismiss.imageset/Contents.json b/plugins/reference-assets/swiftui/Resources/svg/Icons.xcassets/dismiss.imageset/Contents.json similarity index 100% rename from ios/packages/reference-assets/Resources/svg/Icons.xcassets/dismiss.imageset/Contents.json rename to plugins/reference-assets/swiftui/Resources/svg/Icons.xcassets/dismiss.imageset/Contents.json diff --git a/ios/packages/reference-assets/Resources/svg/Icons.xcassets/dismiss.imageset/dismiss.svg b/plugins/reference-assets/swiftui/Resources/svg/Icons.xcassets/dismiss.imageset/dismiss.svg similarity index 100% rename from ios/packages/reference-assets/Resources/svg/Icons.xcassets/dismiss.imageset/dismiss.svg rename to plugins/reference-assets/swiftui/Resources/svg/Icons.xcassets/dismiss.imageset/dismiss.svg diff --git a/ios/packages/reference-assets/Resources/svg/Icons.xcassets/error.imageset/Contents.json b/plugins/reference-assets/swiftui/Resources/svg/Icons.xcassets/error.imageset/Contents.json similarity index 100% rename from ios/packages/reference-assets/Resources/svg/Icons.xcassets/error.imageset/Contents.json rename to plugins/reference-assets/swiftui/Resources/svg/Icons.xcassets/error.imageset/Contents.json diff --git a/ios/packages/reference-assets/Resources/svg/Icons.xcassets/error.imageset/error.svg b/plugins/reference-assets/swiftui/Resources/svg/Icons.xcassets/error.imageset/error.svg similarity index 100% rename from ios/packages/reference-assets/Resources/svg/Icons.xcassets/error.imageset/error.svg rename to plugins/reference-assets/swiftui/Resources/svg/Icons.xcassets/error.imageset/error.svg diff --git a/ios/packages/reference-assets/Resources/svg/Icons.xcassets/warning.imageset/Contents.json b/plugins/reference-assets/swiftui/Resources/svg/Icons.xcassets/warning.imageset/Contents.json similarity index 100% rename from ios/packages/reference-assets/Resources/svg/Icons.xcassets/warning.imageset/Contents.json rename to plugins/reference-assets/swiftui/Resources/svg/Icons.xcassets/warning.imageset/Contents.json diff --git a/ios/packages/reference-assets/Resources/svg/Icons.xcassets/warning.imageset/warning.svg b/plugins/reference-assets/swiftui/Resources/svg/Icons.xcassets/warning.imageset/warning.svg similarity index 100% rename from ios/packages/reference-assets/Resources/svg/Icons.xcassets/warning.imageset/warning.svg rename to plugins/reference-assets/swiftui/Resources/svg/Icons.xcassets/warning.imageset/warning.svg diff --git a/ios/packages/reference-assets/Resources/svg/dismiss.svg b/plugins/reference-assets/swiftui/Resources/svg/dismiss.svg similarity index 100% rename from ios/packages/reference-assets/Resources/svg/dismiss.svg rename to plugins/reference-assets/swiftui/Resources/svg/dismiss.svg diff --git a/ios/packages/reference-assets/Resources/svg/error.svg b/plugins/reference-assets/swiftui/Resources/svg/error.svg similarity index 100% rename from ios/packages/reference-assets/Resources/svg/error.svg rename to plugins/reference-assets/swiftui/Resources/svg/error.svg diff --git a/ios/packages/reference-assets/Resources/svg/warning.svg b/plugins/reference-assets/swiftui/Resources/svg/warning.svg similarity index 100% rename from ios/packages/reference-assets/Resources/svg/warning.svg rename to plugins/reference-assets/swiftui/Resources/svg/warning.svg diff --git a/ios/packages/reference-assets/Sources/ReferenceAssetsPlugin.swift b/plugins/reference-assets/swiftui/Sources/ReferenceAssetsPlugin.swift similarity index 83% rename from ios/packages/reference-assets/Sources/ReferenceAssetsPlugin.swift rename to plugins/reference-assets/swiftui/Sources/ReferenceAssetsPlugin.swift index 64161e728..ae6bb8b39 100644 --- a/ios/packages/reference-assets/Sources/ReferenceAssetsPlugin.swift +++ b/plugins/reference-assets/swiftui/Sources/ReferenceAssetsPlugin.swift @@ -1,5 +1,10 @@ import SwiftUI +#if SWIFT_PACKAGE +import PlayerUI +import PlayerUISwiftUI +#endif + /** Reference Assets for the `SwiftUIPlayer` */ @@ -22,7 +27,7 @@ public class ReferenceAssetsPlugin: JSBasePlugin, NativePlugin { Constructs the SwiftUIReferenceAssetsPlugin */ public convenience init() { - self.init(fileName: "reference-assets-plugin.prod", pluginName: "ReferenceAssetsPlugin.ReferenceAssetsPlugin") + self.init(fileName: "ReferenceAssetsPlugin.native", pluginName: "ReferenceAssetsPlugin.ReferenceAssetsPlugin") } /** @@ -32,6 +37,10 @@ public class ReferenceAssetsPlugin: JSBasePlugin, NativePlugin { - returns: A URL if it exists in the bundle */ override open func getUrlForFile(fileName: String) -> URL? { + #if SWIFT_PACKAGE + ResourceUtilities.urlForFile(name: fileName, ext: "js", bundle: Bundle.module) + #else ResourceUtilities.urlForFile(name: fileName, ext: "js", bundle: Bundle(for: ReferenceAssetsPlugin.self), pathComponent: "ReferenceAssets.bundle") + #endif } } diff --git a/ios/packages/reference-assets/Sources/SwiftUI/ActionAsset.swift b/plugins/reference-assets/swiftui/Sources/SwiftUI/ActionAsset.swift similarity index 92% rename from ios/packages/reference-assets/Sources/SwiftUI/ActionAsset.swift rename to plugins/reference-assets/swiftui/Sources/SwiftUI/ActionAsset.swift index 6baa2ec4b..fe30368e2 100644 --- a/ios/packages/reference-assets/Sources/SwiftUI/ActionAsset.swift +++ b/plugins/reference-assets/swiftui/Sources/SwiftUI/ActionAsset.swift @@ -1,6 +1,13 @@ import SwiftUI import Combine +#if SWIFT_PACKAGE +import PlayerUI +import PlayerUISwiftUI +import PlayerUISwiftUIPendingTransactionPlugin +import PlayerUIBeaconPlugin +#endif + /** Data Decoded by Player for `ActionAsset` */ @@ -29,7 +36,7 @@ final class ActionAsset: UncontrolledAsset { /** View implementation for `ActionAsset` */ -struct ActionAssetView: View { +public struct ActionAssetView: View { /// The viewModel with decoded data, supplied by `ActionAsset` @ObservedObject var model: AssetViewModel @@ -43,7 +50,7 @@ struct ActionAssetView: View { internal var didAppear: ((Self) -> Void)? @ViewBuilder - var body: some View { + public var body: some View { Button( action: { beaconContext?.beacon(action: "clicked", element: "button", id: model.data.id, metaData: model.data.metaData) diff --git a/ios/packages/reference-assets/Sources/SwiftUI/CollectionAsset.swift b/plugins/reference-assets/swiftui/Sources/SwiftUI/CollectionAsset.swift similarity index 94% rename from ios/packages/reference-assets/Sources/SwiftUI/CollectionAsset.swift rename to plugins/reference-assets/swiftui/Sources/SwiftUI/CollectionAsset.swift index 32d0e2e2f..74227bfd6 100644 --- a/ios/packages/reference-assets/Sources/SwiftUI/CollectionAsset.swift +++ b/plugins/reference-assets/swiftui/Sources/SwiftUI/CollectionAsset.swift @@ -1,6 +1,11 @@ import SwiftUI import Combine +#if SWIFT_PACKAGE +import PlayerUI +import PlayerUISwiftUI +#endif + /** Data Decoded by Player for `CollectionAsset` */ diff --git a/ios/packages/reference-assets/Sources/SwiftUI/InfoAsset.swift b/plugins/reference-assets/swiftui/Sources/SwiftUI/InfoAsset.swift similarity index 96% rename from ios/packages/reference-assets/Sources/SwiftUI/InfoAsset.swift rename to plugins/reference-assets/swiftui/Sources/SwiftUI/InfoAsset.swift index b12f9aeab..25b5ea370 100644 --- a/ios/packages/reference-assets/Sources/SwiftUI/InfoAsset.swift +++ b/plugins/reference-assets/swiftui/Sources/SwiftUI/InfoAsset.swift @@ -1,5 +1,10 @@ import SwiftUI +#if SWIFT_PACKAGE +import PlayerUI +import PlayerUISwiftUI +#endif + /** Data Decoded by Player for `InfoAsset` */ diff --git a/ios/packages/reference-assets/Sources/SwiftUI/InputAsset.swift b/plugins/reference-assets/swiftui/Sources/SwiftUI/InputAsset.swift similarity index 97% rename from ios/packages/reference-assets/Sources/SwiftUI/InputAsset.swift rename to plugins/reference-assets/swiftui/Sources/SwiftUI/InputAsset.swift index 7603a4ec9..14323cac9 100644 --- a/ios/packages/reference-assets/Sources/SwiftUI/InputAsset.swift +++ b/plugins/reference-assets/swiftui/Sources/SwiftUI/InputAsset.swift @@ -1,6 +1,12 @@ import SwiftUI import Combine +#if SWIFT_PACKAGE +import PlayerUI +import PlayerUISwiftUI +import PlayerUISwiftUIPendingTransactionPlugin +#endif + /** Represents a DataType that is associated with the asset */ diff --git a/ios/packages/reference-assets/Sources/SwiftUI/TextAsset.swift b/plugins/reference-assets/swiftui/Sources/SwiftUI/TextAsset.swift similarity index 96% rename from ios/packages/reference-assets/Sources/SwiftUI/TextAsset.swift rename to plugins/reference-assets/swiftui/Sources/SwiftUI/TextAsset.swift index ab9ca4aaf..11c53812e 100644 --- a/ios/packages/reference-assets/Sources/SwiftUI/TextAsset.swift +++ b/plugins/reference-assets/swiftui/Sources/SwiftUI/TextAsset.swift @@ -1,5 +1,10 @@ import SwiftUI +#if SWIFT_PACKAGE +import PlayerUI +import PlayerUISwiftUI +#endif + /** Data Decoded by Player for `TextAsset` */ diff --git a/ios/packages/reference-assets/Sources/SwiftUI/ValidationView.swift b/plugins/reference-assets/swiftui/Sources/SwiftUI/ValidationView.swift similarity index 97% rename from ios/packages/reference-assets/Sources/SwiftUI/ValidationView.swift rename to plugins/reference-assets/swiftui/Sources/SwiftUI/ValidationView.swift index c1a8ee69f..52a0ff5e4 100644 --- a/ios/packages/reference-assets/Sources/SwiftUI/ValidationView.swift +++ b/plugins/reference-assets/swiftui/Sources/SwiftUI/ValidationView.swift @@ -7,6 +7,11 @@ import SwiftUI +#if SWIFT_PACKAGE +import PlayerUI +import PlayerUISwiftUI +#endif + /** The severity of a validation object */ diff --git a/ios/packages/reference-assets/Sources/Utilities/InternalAssets.swift b/plugins/reference-assets/swiftui/Sources/Utilities/InternalAssets.swift similarity index 99% rename from ios/packages/reference-assets/Sources/Utilities/InternalAssets.swift rename to plugins/reference-assets/swiftui/Sources/Utilities/InternalAssets.swift index 132a16411..b96992b7f 100644 --- a/ios/packages/reference-assets/Sources/Utilities/InternalAssets.swift +++ b/plugins/reference-assets/swiftui/Sources/Utilities/InternalAssets.swift @@ -6,6 +6,7 @@ // import Foundation +import UIKit /** Assets that are used internally for rendering ReferenceAssets diff --git a/ios/packages/reference-assets/UITests/ActionAssetUITests.swift b/plugins/reference-assets/swiftui/UITests/ActionAssetUITests.swift similarity index 71% rename from ios/packages/reference-assets/UITests/ActionAssetUITests.swift rename to plugins/reference-assets/swiftui/UITests/ActionAssetUITests.swift index cb07f11b7..83004824d 100644 --- a/ios/packages/reference-assets/UITests/ActionAssetUITests.swift +++ b/plugins/reference-assets/swiftui/UITests/ActionAssetUITests.swift @@ -24,11 +24,11 @@ class ActionAssetUITests: BaseTestCase { tap(app.buttons["action-good"]) - waitFor(app.alerts["FlowFinished"]) + waitFor(app.alerts["Flow Finished"]) check("After Click") - XCTAssertTrue(app.alerts["FlowFinished"].exists) + XCTAssertTrue(app.alerts["Flow Finished"].exists) - XCTAssertEqual(app.alerts["FlowFinished"].staticTexts.element(boundBy: 1).label, "done") + XCTAssertEqual(app.alerts["Flow Finished"].staticTexts.element(boundBy: 1).label, "done") } } @@ -39,11 +39,11 @@ class ActionAssetUITests: BaseTestCase { tap(app.buttons["action-bad"]) - waitFor(app.alerts["FlowFinished"]) + waitFor(app.alerts["Flow Finished"]) check("After Click") - XCTAssertTrue(app.alerts["FlowFinished"].exists) + XCTAssertTrue(app.alerts["Flow Finished"].exists) - XCTAssertTrue(app.alerts["FlowFinished"].staticTexts.element(boundBy: 1).label.contains("Unclosed brace")) + XCTAssertTrue(app.alerts["Flow Finished"].staticTexts.element(boundBy: 1).label.contains("Unclosed brace")) } } } diff --git a/ios/packages/reference-assets/UITests/BaseTestCase.swift b/plugins/reference-assets/swiftui/UITests/BaseTestCase.swift similarity index 98% rename from ios/packages/reference-assets/UITests/BaseTestCase.swift rename to plugins/reference-assets/swiftui/UITests/BaseTestCase.swift index 2fc7b4eb0..e80030ff2 100644 --- a/ios/packages/reference-assets/UITests/BaseTestCase.swift +++ b/plugins/reference-assets/swiftui/UITests/BaseTestCase.swift @@ -10,6 +10,8 @@ import Foundation import XCTest import EyesXCUI import PlayerUI +import PlayerUITestUtilities +import PlayerUITestUtilitiesCore import Combine class BaseTestCase: AssetUITestCase { diff --git a/ios/packages/reference-assets/UITests/CollectionAssetUITests.swift b/plugins/reference-assets/swiftui/UITests/CollectionAssetUITests.swift similarity index 100% rename from ios/packages/reference-assets/UITests/CollectionAssetUITests.swift rename to plugins/reference-assets/swiftui/UITests/CollectionAssetUITests.swift diff --git a/ios/packages/reference-assets/UITests/InfoAssetUITests.swift b/plugins/reference-assets/swiftui/UITests/InfoAssetUITests.swift similarity index 100% rename from ios/packages/reference-assets/UITests/InfoAssetUITests.swift rename to plugins/reference-assets/swiftui/UITests/InfoAssetUITests.swift diff --git a/ios/packages/reference-assets/UITests/InputAssetUITests.swift b/plugins/reference-assets/swiftui/UITests/InputAssetUITests.swift similarity index 100% rename from ios/packages/reference-assets/UITests/InputAssetUITests.swift rename to plugins/reference-assets/swiftui/UITests/InputAssetUITests.swift diff --git a/ios/packages/reference-assets/UITests/TextAssetUITests.swift b/plugins/reference-assets/swiftui/UITests/TextAssetUITests.swift similarity index 100% rename from ios/packages/reference-assets/UITests/TextAssetUITests.swift rename to plugins/reference-assets/swiftui/UITests/TextAssetUITests.swift diff --git a/ios/packages/reference-assets/ViewInspector/ReferenceAssetsPluginTests.swift b/plugins/reference-assets/swiftui/ViewInspector/ReferenceAssetsPluginTests.swift similarity index 86% rename from ios/packages/reference-assets/ViewInspector/ReferenceAssetsPluginTests.swift rename to plugins/reference-assets/swiftui/ViewInspector/ReferenceAssetsPluginTests.swift index 42c08a746..42f2ed1f6 100644 --- a/ios/packages/reference-assets/ViewInspector/ReferenceAssetsPluginTests.swift +++ b/plugins/reference-assets/swiftui/ViewInspector/ReferenceAssetsPluginTests.swift @@ -10,6 +10,9 @@ import Foundation import XCTest import JavaScriptCore @testable import PlayerUI +@testable import PlayerUITestUtilities +@testable import PlayerUIReferenceAssets +@testable import PlayerUISwiftUI class SwiftUIReferenceAssetsPluginTests: XCTestCase { func testReferenceAssetsPluginConstructs() { diff --git a/ios/packages/reference-assets/ViewInspector/SwiftUI/ActionAssetTests.swift b/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/ActionAssetTests.swift similarity index 95% rename from ios/packages/reference-assets/ViewInspector/SwiftUI/ActionAssetTests.swift rename to plugins/reference-assets/swiftui/ViewInspector/SwiftUI/ActionAssetTests.swift index 08ad23fd9..5c29d86c4 100644 --- a/ios/packages/reference-assets/ViewInspector/SwiftUI/ActionAssetTests.swift +++ b/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/ActionAssetTests.swift @@ -12,6 +12,10 @@ import SwiftUI import ViewInspector @testable import PlayerUI +@testable import PlayerUITestUtilities +@testable import PlayerUIReferenceAssets +@testable import PlayerUISwiftUI +@testable import PlayerUIBeaconPlugin extension ActionAssetView: Inspectable {} diff --git a/ios/packages/reference-assets/ViewInspector/SwiftUI/CollectionAssetTests.swift b/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/CollectionAssetTests.swift similarity index 95% rename from ios/packages/reference-assets/ViewInspector/SwiftUI/CollectionAssetTests.swift rename to plugins/reference-assets/swiftui/ViewInspector/SwiftUI/CollectionAssetTests.swift index f77f3282b..f14aa3b3c 100644 --- a/ios/packages/reference-assets/ViewInspector/SwiftUI/CollectionAssetTests.swift +++ b/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/CollectionAssetTests.swift @@ -12,6 +12,9 @@ import ViewInspector import SwiftUI @testable import PlayerUI +@testable import PlayerUITestUtilities +@testable import PlayerUIReferenceAssets +@testable import PlayerUISwiftUI extension CollectionAssetView: Inspectable {} diff --git a/ios/packages/reference-assets/ViewInspector/SwiftUI/InfoAssetTests.swift b/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/InfoAssetTests.swift similarity index 95% rename from ios/packages/reference-assets/ViewInspector/SwiftUI/InfoAssetTests.swift rename to plugins/reference-assets/swiftui/ViewInspector/SwiftUI/InfoAssetTests.swift index 04aa2c2ca..9ec6a9245 100644 --- a/ios/packages/reference-assets/ViewInspector/SwiftUI/InfoAssetTests.swift +++ b/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/InfoAssetTests.swift @@ -12,6 +12,9 @@ import ViewInspector import XCTest @testable import PlayerUI +@testable import PlayerUITestUtilities +@testable import PlayerUIReferenceAssets +@testable import PlayerUISwiftUI extension InfoAssetView: Inspectable {} diff --git a/ios/packages/reference-assets/ViewInspector/SwiftUI/InputAssetTests.swift b/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/InputAssetTests.swift similarity index 98% rename from ios/packages/reference-assets/ViewInspector/SwiftUI/InputAssetTests.swift rename to plugins/reference-assets/swiftui/ViewInspector/SwiftUI/InputAssetTests.swift index 69dde7542..f413cd5ab 100644 --- a/ios/packages/reference-assets/ViewInspector/SwiftUI/InputAssetTests.swift +++ b/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/InputAssetTests.swift @@ -11,9 +11,12 @@ import Combine import SwiftUI import ViewInspector import XCTest +import JavaScriptCore @testable import PlayerUI -import JavaScriptCore +@testable import PlayerUITestUtilities +@testable import PlayerUIReferenceAssets +@testable import PlayerUISwiftUI extension InputAssetView: Inspectable {} extension ValidationView: Inspectable {} diff --git a/ios/packages/reference-assets/ViewInspector/SwiftUI/TextAssetTests.swift b/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/TextAssetTests.swift similarity index 95% rename from ios/packages/reference-assets/ViewInspector/SwiftUI/TextAssetTests.swift rename to plugins/reference-assets/swiftui/ViewInspector/SwiftUI/TextAssetTests.swift index 764be3556..0517bfe18 100644 --- a/ios/packages/reference-assets/ViewInspector/SwiftUI/TextAssetTests.swift +++ b/plugins/reference-assets/swiftui/ViewInspector/SwiftUI/TextAssetTests.swift @@ -11,6 +11,9 @@ import XCTest import ViewInspector import SwiftUI @testable import PlayerUI +@testable import PlayerUIReferenceAssets +@testable import PlayerUISwiftUI +@testable import PlayerUITestUtilities extension TextAssetView: Inspectable {} extension LinkModifier: Inspectable {} diff --git a/ios/packages/reference-assets/ViewInspector/Utilities/ValidationTests.swift b/plugins/reference-assets/swiftui/ViewInspector/Utilities/ValidationTests.swift similarity index 94% rename from ios/packages/reference-assets/ViewInspector/Utilities/ValidationTests.swift rename to plugins/reference-assets/swiftui/ViewInspector/Utilities/ValidationTests.swift index 279d57141..11f6e2e49 100644 --- a/ios/packages/reference-assets/ViewInspector/Utilities/ValidationTests.swift +++ b/plugins/reference-assets/swiftui/ViewInspector/Utilities/ValidationTests.swift @@ -11,6 +11,9 @@ import XCTest import JavaScriptCore import SwiftUI @testable import PlayerUI +@testable import PlayerUITestUtilities +@testable import PlayerUIReferenceAssets +@testable import PlayerUISwiftUI class ValidationTests: SwiftUIAssetUnitTestCase { func testErrorValidation() { diff --git a/plugins/stage-revert-data/ios/BUILD.bazel b/plugins/stage-revert-data/ios/BUILD.bazel new file mode 100644 index 000000000..30a0f5c24 --- /dev/null +++ b/plugins/stage-revert-data/ios/BUILD.bazel @@ -0,0 +1,41 @@ +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") +load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") + +load("@build_bazel_rules_ios//rules:test.bzl", "ios_unit_test") + +load("//tools/ios:util.bzl", "ios_bundle_module_shim") + +apple_resource_bundle( + name = "PlayerUIStageRevertDataPluginResourceBundle", + bundle_name = "StageRevertDataPlugin", + bundle_id = "com.intuit.ios.player.resources.core", + resources = ["//plugins/stage-revert-data/core:core_native_bundle"] +) + +ios_bundle_module_shim("StageRevertDataPlugin") + +pkg_files( + name = "PlayerUIStageRevertDataPlugin_Sources", + srcs = glob(["Sources/**/*.swift"]), + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//visibility:public"], +) + +swift_library( + name = "PlayerUIStageRevertDataPlugin", + module_name = "PlayerUIStageRevertDataPlugin", + srcs = [":PlayerUIStageRevertDataPlugin_Sources", ":StageRevertDataPluginResourceShim"], + visibility = ["//visibility:public"], + deps = ["//ios/core:PlayerUI"], + data = [":PlayerUIStageRevertDataPluginResourceBundle"], + defines = ["BAZEL_TARGET"] +) + +ios_unit_test( + name = "PlayerUIStageRevertDataPluginTests", + srcs = glob(["Tests/**/*.swift"]), + minimum_os_version = "14.0", + deps = [":PlayerUIStageRevertDataPlugin", "//ios/internal-test-utils:PlayerUIInternalTestUtilities"], + visibility = ["//visibility:public"] +) \ No newline at end of file diff --git a/ios/plugins/StageRevertDataPlugin/Sources/StageRevertDataPlugin.swift b/plugins/stage-revert-data/ios/Sources/StageRevertDataPlugin.swift similarity index 62% rename from ios/plugins/StageRevertDataPlugin/Sources/StageRevertDataPlugin.swift rename to plugins/stage-revert-data/ios/Sources/StageRevertDataPlugin.swift index 383c69d69..d5170aad3 100644 --- a/ios/plugins/StageRevertDataPlugin/Sources/StageRevertDataPlugin.swift +++ b/plugins/stage-revert-data/ios/Sources/StageRevertDataPlugin.swift @@ -1,6 +1,10 @@ import Foundation import JavaScriptCore +#if SWIFT_PACKAGE +import PlayerUI +#endif + /** Plugin to stage data changes until an approved transition is made */ @@ -9,10 +13,14 @@ public class StageRevertDataPlugin: JSBasePlugin, NativePlugin { Constructs the StageRevertDataPlugin */ public convenience init() { - self.init(fileName: "stage-revert-data-plugin.prod", pluginName: "StageRevertDataPlugin.StageRevertDataPlugin") + self.init(fileName: "StageRevertDataPlugin.native", pluginName: "StageRevertDataPlugin.StageRevertDataPlugin") } override open func getUrlForFile(fileName: String) -> URL? { + #if SWIFT_PACKAGE + ResourceUtilities.urlForFile(name: fileName, ext: "js", bundle: Bundle.module) + #else ResourceUtilities.urlForFile(name: fileName, ext: "js", bundle: Bundle(for: StageRevertDataPlugin.self), pathComponent: "StageRevertDataPlugin.bundle") + #endif } } diff --git a/ios/plugins/StageRevertDataPlugin/Tests/StageRevertDataPluginTests.swift b/plugins/stage-revert-data/ios/Tests/StageRevertDataPluginTests.swift similarity index 92% rename from ios/plugins/StageRevertDataPlugin/Tests/StageRevertDataPluginTests.swift rename to plugins/stage-revert-data/ios/Tests/StageRevertDataPluginTests.swift index ee264e907..66f982a71 100644 --- a/ios/plugins/StageRevertDataPlugin/Tests/StageRevertDataPluginTests.swift +++ b/plugins/stage-revert-data/ios/Tests/StageRevertDataPluginTests.swift @@ -1,6 +1,8 @@ import Foundation import XCTest @testable import PlayerUI +@testable import PlayerUIInternalTestUtilities +@testable import PlayerUIStageRevertDataPlugin class StageRevertDataPluginTests: XCTestCase { let json = """ @@ -63,7 +65,7 @@ class StageRevertDataPluginTests: XCTestCase { """ func testStageRevertDataPluginStagesData() { let expected = XCTestExpectation(description: "data did not change") - let player = HeadlessPlayerImpl(plugins: [PrintLoggerPlugin(level: .trace), StageRevertDataPlugin()]) + let player = HeadlessPlayerImpl(plugins: [StageRevertDataPlugin()]) player.hooks?.viewController.tap { viewController in viewController.hooks.view.tap { view in @@ -87,7 +89,7 @@ class StageRevertDataPluginTests: XCTestCase { func testStageRevertDataPluginCommitsData() { let expected = XCTestExpectation(description: "data did not change") - let player = HeadlessPlayerImpl(plugins: [PrintLoggerPlugin(level: .trace), StageRevertDataPlugin()]) + let player = HeadlessPlayerImpl(plugins: [StageRevertDataPlugin()]) player.hooks?.viewController.tap { viewController in viewController.hooks.view.tap { view in diff --git a/plugins/transition/swiftui/BUILD.bazel b/plugins/transition/swiftui/BUILD.bazel new file mode 100644 index 000000000..8ee4a5735 --- /dev/null +++ b/plugins/transition/swiftui/BUILD.bazel @@ -0,0 +1,39 @@ +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") + +load("@build_bazel_rules_ios//rules:test.bzl", "ios_unit_test", "ios_ui_test") + +pkg_files( + name = "PlayerUITransitionPlugin_Sources", + srcs = glob(["Sources/**/*.swift"]), + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//visibility:public"], +) + +swift_library( + name = "PlayerUITransitionPlugin", + module_name = "PlayerUITransitionPlugin", + srcs = [":PlayerUITransitionPlugin_Sources"], + visibility = ["//visibility:public"], + deps = [ + "//ios/core:PlayerUI", + "//ios/swiftui:PlayerUISwiftUI" + ], + defines = ["BAZEL_TARGET"] +) + +ios_ui_test( + name = "PlayerUITransitionPluginViewInspectorTests", + srcs = glob(["ViewInspector/**/*.swift"]), + minimum_os_version = "14.0", + deps = [ + "@swiftpkg_viewinspector//:Sources_ViewInspector", + ":PlayerUITransitionPlugin", + "//ios/core:PlayerUI", + "//ios/swiftui:PlayerUISwiftUI", + "//plugins/reference-assets/swiftui:PlayerUIReferenceAssets", + "//ios/internal-test-utils:PlayerUIInternalTestUtilities" + ], + visibility = ["//visibility:public"], + test_host = "//ios/demo:PlayerUIDemo" +) \ No newline at end of file diff --git a/ios/plugins/TransitionPlugin/Sources/TransitionPlugin.swift b/plugins/transition/swiftui/Sources/TransitionPlugin.swift similarity index 97% rename from ios/plugins/TransitionPlugin/Sources/TransitionPlugin.swift rename to plugins/transition/swiftui/Sources/TransitionPlugin.swift index 4a1eaf3dd..0301caebd 100644 --- a/ios/plugins/TransitionPlugin/Sources/TransitionPlugin.swift +++ b/plugins/transition/swiftui/Sources/TransitionPlugin.swift @@ -2,6 +2,11 @@ import Combine import SwiftUI import SwiftHooks +#if SWIFT_PACKAGE +import PlayerUI +import PlayerUISwiftUI +#endif + /** A plugin to supply transition animations for initial flow load and between views in a flow */ @@ -44,7 +49,7 @@ public class TransitionPlugin: NativePlugin, ManagedPlayerPlugin { ) } - func apply(_ model: ManagedPlayerViewModel) { + public func apply(_ model: ManagedPlayerViewModel) { let stateTransition = self.stateTransition model.stateTransition.tap(name: pluginName, id: tapId) { .bail(stateTransition) } } diff --git a/ios/plugins/TransitionPlugin/ViewInspector/TransitionPluginTests.swift b/plugins/transition/swiftui/ViewInspector/TransitionPluginTests.swift similarity index 87% rename from ios/plugins/TransitionPlugin/ViewInspector/TransitionPluginTests.swift rename to plugins/transition/swiftui/ViewInspector/TransitionPluginTests.swift index 89b63da2b..a3a9106da 100644 --- a/ios/plugins/TransitionPlugin/ViewInspector/TransitionPluginTests.swift +++ b/plugins/transition/swiftui/ViewInspector/TransitionPluginTests.swift @@ -13,8 +13,16 @@ import ViewInspector import Combine @testable import PlayerUI +@testable import PlayerUIInternalTestUtilities +@testable import PlayerUIReferenceAssets +@testable import PlayerUISwiftUI +@testable import PlayerUITransitionPlugin + +class TransitionPluginTests: XCTestCase { + open override func setUp() { + XCUIApplication().terminate() + } -class TransitionPluginTests: ViewInspectorTestCase { func testTransitionPluginStateTransitions() { let flow = TestFlowManager() let model = ManagedPlayerViewModel(manager: flow) { _ in } diff --git a/plugins/types-provider/ios/BUILD.bazel b/plugins/types-provider/ios/BUILD.bazel new file mode 100644 index 000000000..26ada0597 --- /dev/null +++ b/plugins/types-provider/ios/BUILD.bazel @@ -0,0 +1,41 @@ +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") +load("@build_bazel_rules_apple//apple:resources.bzl", "apple_resource_bundle") + +load("@build_bazel_rules_ios//rules:test.bzl", "ios_unit_test") + +load("//tools/ios:util.bzl", "ios_bundle_module_shim") + +apple_resource_bundle( + name = "PlayerUITypesProviderPluginResourceBundle", + bundle_name = "TypesProviderPlugin", + bundle_id = "com.intuit.ios.player.resources.core", + resources = ["//plugins/types-provider/core:core_native_bundle"] +) + +ios_bundle_module_shim("TypesProviderPlugin") + +pkg_files( + name = "PlayerUITypesProviderPlugin_Sources", + srcs = glob(["Sources/**/*.swift"]), + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//visibility:public"], +) + +swift_library( + name = "PlayerUITypesProviderPlugin", + module_name = "PlayerUITypesProviderPlugin", + srcs = [":PlayerUITypesProviderPlugin_Sources", ":TypesProviderPluginResourceShim"], + visibility = ["//visibility:public"], + deps = ["//ios/core:PlayerUI"], + data = [":PlayerUITypesProviderPluginResourceBundle"], + defines = ["BAZEL_TARGET"] +) + +ios_unit_test( + name = "PlayerUITypesProviderPluginTests", + srcs = glob(["Tests/**/*.swift"]), + minimum_os_version = "14.0", + deps = [":PlayerUITypesProviderPlugin", "//ios/internal-test-utils:PlayerUIInternalTestUtilities"], + visibility = ["//visibility:public"] +) \ No newline at end of file diff --git a/ios/plugins/TypesProviderPlugin/Sources/Types/CustomType.swift b/plugins/types-provider/ios/Sources/Types/CustomType.swift similarity index 100% rename from ios/plugins/TypesProviderPlugin/Sources/Types/CustomType.swift rename to plugins/types-provider/ios/Sources/Types/CustomType.swift diff --git a/ios/plugins/TypesProviderPlugin/Sources/Types/FormatDeclaration.swift b/plugins/types-provider/ios/Sources/Types/FormatDeclaration.swift similarity index 100% rename from ios/plugins/TypesProviderPlugin/Sources/Types/FormatDeclaration.swift rename to plugins/types-provider/ios/Sources/Types/FormatDeclaration.swift diff --git a/ios/plugins/TypesProviderPlugin/Sources/Types/FormatReference.swift b/plugins/types-provider/ios/Sources/Types/FormatReference.swift similarity index 100% rename from ios/plugins/TypesProviderPlugin/Sources/Types/FormatReference.swift rename to plugins/types-provider/ios/Sources/Types/FormatReference.swift diff --git a/ios/plugins/TypesProviderPlugin/Sources/Types/ValidationDeclaration.swift b/plugins/types-provider/ios/Sources/Types/ValidationDeclaration.swift similarity index 100% rename from ios/plugins/TypesProviderPlugin/Sources/Types/ValidationDeclaration.swift rename to plugins/types-provider/ios/Sources/Types/ValidationDeclaration.swift diff --git a/ios/plugins/TypesProviderPlugin/Sources/Types/ValidationReference.swift b/plugins/types-provider/ios/Sources/Types/ValidationReference.swift similarity index 100% rename from ios/plugins/TypesProviderPlugin/Sources/Types/ValidationReference.swift rename to plugins/types-provider/ios/Sources/Types/ValidationReference.swift diff --git a/ios/plugins/TypesProviderPlugin/Sources/TypesProviderPlugin.swift b/plugins/types-provider/ios/Sources/TypesProviderPlugin.swift similarity index 96% rename from ios/plugins/TypesProviderPlugin/Sources/TypesProviderPlugin.swift rename to plugins/types-provider/ios/Sources/TypesProviderPlugin.swift index 631f0b3aa..c18f5dba0 100644 --- a/ios/plugins/TypesProviderPlugin/Sources/TypesProviderPlugin.swift +++ b/plugins/types-provider/ios/Sources/TypesProviderPlugin.swift @@ -8,6 +8,10 @@ import Foundation import JavaScriptCore +#if SWIFT_PACKAGE +import PlayerUI +#endif + /** Plugin for registering custom types Player */ @@ -30,7 +34,7 @@ public class TypesProviderPlugin: JSBasePlugin, NativePlugin { */ public convenience init(types: [CustomType], validators: [ValidationDeclaration], formats: [FormatDeclaration]) { self.init( - fileName: "types-provider-plugin.prod", + fileName: "TypesProviderPlugin.native", pluginName: "TypesProviderPlugin.TypesProviderPlugin" ) self.types = types @@ -39,7 +43,11 @@ public class TypesProviderPlugin: JSBasePlugin, NativePlugin { } override open func getUrlForFile(fileName: String) -> URL? { + #if SWIFT_PACKAGE + ResourceUtilities.urlForFile(name: fileName, ext: "js", bundle: Bundle.module) + #else ResourceUtilities.urlForFile(name: fileName, ext: "js", bundle: Bundle(for: TypesProviderPlugin.self), pathComponent: "TypesProviderPlugin.bundle") + #endif } /** diff --git a/ios/plugins/TypesProviderPlugin/Tests/TypesProviderPluginTests.swift b/plugins/types-provider/ios/Tests/TypesProviderPluginTests.swift similarity index 97% rename from ios/plugins/TypesProviderPlugin/Tests/TypesProviderPluginTests.swift rename to plugins/types-provider/ios/Tests/TypesProviderPluginTests.swift index 5cc6e8de0..61c13a495 100644 --- a/ios/plugins/TypesProviderPlugin/Tests/TypesProviderPluginTests.swift +++ b/plugins/types-provider/ios/Tests/TypesProviderPluginTests.swift @@ -10,8 +10,9 @@ import Foundation import XCTest import JavaScriptCore @testable import PlayerUI +@testable import PlayerUITypesProviderPlugin -class TypesProviderPluginTests: SwiftUIAssetUnitTestCase { +class TypesProviderPluginTests: XCTestCase { func testFormatReferenceConversion() { let plugin = TypesProviderPlugin(types: [], validators: [], formats: []) plugin.context = JSContext() diff --git a/swift_deps.bzl b/swift_deps.bzl new file mode 100644 index 000000000..44e885f1c --- /dev/null +++ b/swift_deps.bzl @@ -0,0 +1,114 @@ +load("@rules_swift_package_manager//swiftpkg:defs.bzl", "swift_package") + +def swift_dependencies(): + # version: 4.6.1 + swift_package( + name = "swiftpkg_aexml", + commit = "38f7d00b23ecd891e1ee656fa6aeebd6ba04ecc3", + dependencies_index = "@//:swift_deps_index.json", + remote = "https://github.com/tadija/AEXML.git", + ) + + # version: 8.9.1 + swift_package( + name = "swiftpkg_eyes_xcui_swift_package", + commit = "ba8bc9221d1f5ca733d794d9c85ad017df9e0423", + dependencies_index = "@//:swift_deps_index.json", + remote = "https://github.com/applitools/eyes-xcui-swift-package.git", + ) + + # version: 0.2.0 + swift_package( + name = "swiftpkg_graphviz", + commit = "70bebcf4597b9ce33e19816d6bbd4ba9b7bdf038", + dependencies_index = "@//:swift_deps_index.json", + remote = "https://github.com/SwiftDocOrg/GraphViz.git", + ) + + # version: 4.2.0 + swift_package( + name = "swiftpkg_jsonutilities", + commit = "128d2ffc22467f69569ef8ff971683e2393191a0", + dependencies_index = "@//:swift_deps_index.json", + remote = "https://github.com/yonaskolb/JSONUtilities.git", + ) + + # version: 1.0.1 + swift_package( + name = "swiftpkg_pathkit", + commit = "3bfd2737b700b9a36565a8c94f4ad2b050a5e574", + dependencies_index = "@//:swift_deps_index.json", + remote = "https://github.com/kylef/PathKit.git", + ) + + # version: 3.2.0 + swift_package( + name = "swiftpkg_rainbow", + commit = "626c3d4b6b55354b4af3aa309f998fae9b31a3d9", + dependencies_index = "@//:swift_deps_index.json", + remote = "https://github.com/onevcat/Rainbow.git", + ) + + # version: 0.10.1 + swift_package( + name = "swiftpkg_spectre", + commit = "26cc5e9ae0947092c7139ef7ba612e34646086c7", + dependencies_index = "@//:swift_deps_index.json", + remote = "https://github.com/kylef/Spectre.git", + ) + + # version: 0.1.0 + swift_package( + name = "swiftpkg_swift_hooks", + commit = "5f3136ac2a3c27aa469e3f9a1222b15080d431d3", + dependencies_index = "@//:swift_deps_index.json", + remote = "https://github.com/intuit/swift-hooks.git", + ) + + # version: 6.0.3 + swift_package( + name = "swiftpkg_swiftcli", + commit = "2e949055d9797c1a6bddcda0e58dada16cc8e970", + dependencies_index = "@//:swift_deps_index.json", + remote = "https://github.com/jakeheis/SwiftCLI.git", + ) + + # version: 2.0.1 + swift_package( + name = "swiftpkg_version", + commit = "1fe824b80d89201652e7eca7c9252269a1d85e25", + dependencies_index = "@//:swift_deps_index.json", + remote = "https://github.com/mxcl/Version", + ) + + # version: 0.9.8 + swift_package( + name = "swiftpkg_viewinspector", + commit = "07c090d73e0169c342a4ed46e9010be2781eca1e", + dependencies_index = "@//:swift_deps_index.json", + remote = "https://github.com/nalexn/ViewInspector", + ) + + # version: 2.38.0 + swift_package( + name = "swiftpkg_xcodegen", + commit = "87a275fb0852bb231550e66473804de57063c957", + dependencies_index = "@//:swift_deps_index.json", + remote = "https://github.com/yonaskolb/XcodeGen.git", + ) + + # version: 8.16.0 + swift_package( + name = "swiftpkg_xcodeproj", + commit = "447c159b0c5fb047a024fd8d942d4a76cf47dde0", + dependencies_index = "@//:swift_deps_index.json", + remote = "https://github.com/tuist/XcodeProj.git", + ) + + # version: 5.0.6 + swift_package( + name = "swiftpkg_yams", + commit = "0d9ee7ea8c4ebd4a489ad7a73d5c6cad55d6fed3", + dependencies_index = "@//:swift_deps_index.json", + remote = "https://github.com/jpsim/Yams.git", + ) diff --git a/swift_deps_index.json b/swift_deps_index.json new file mode 100644 index 000000000..f33b0831b --- /dev/null +++ b/swift_deps_index.json @@ -0,0 +1,505 @@ +{ + "direct_dep_identities": [ + "eyes-xcui-swift-package", + "swift-hooks", + "viewinspector", + "xcodegen" + ], + "modules": [ + { + "name": "AEXML", + "c99name": "AEXML", + "src_type": "swift", + "label": "@swiftpkg_aexml//:Sources_AEXML", + "package_identity": "aexml", + "product_memberships": [ + "AEXML" + ] + }, + { + "name": "EyesXCUI", + "c99name": "EyesXCUI", + "src_type": "binary", + "label": "@swiftpkg_eyes_xcui_swift_package//:remote_archive_EyesXCUI.xcframework.zip_EyesXCUI", + "package_identity": "eyes-xcui-swift-package", + "product_memberships": [ + "EyesXCUI" + ] + }, + { + "name": "DOT", + "c99name": "DOT", + "src_type": "swift", + "label": "@swiftpkg_graphviz//:Sources_DOT", + "package_identity": "graphviz", + "product_memberships": [ + "GraphViz" + ] + }, + { + "name": "GraphViz", + "c99name": "GraphViz", + "src_type": "swift", + "label": "@swiftpkg_graphviz//:Sources_GraphViz", + "package_identity": "graphviz", + "product_memberships": [ + "GraphViz", + "GraphVizBuilder" + ] + }, + { + "name": "GraphVizBuilder", + "c99name": "GraphVizBuilder", + "src_type": "swift", + "label": "@swiftpkg_graphviz//:Sources_GraphVizBuilder", + "package_identity": "graphviz", + "product_memberships": [ + "GraphVizBuilder" + ] + }, + { + "name": "Tools", + "c99name": "Tools", + "src_type": "swift", + "label": "@swiftpkg_graphviz//:Sources_Tools", + "package_identity": "graphviz", + "product_memberships": [ + "GraphViz" + ] + }, + { + "name": "JSONUtilities", + "c99name": "JSONUtilities", + "src_type": "swift", + "label": "@swiftpkg_jsonutilities//:Sources_JSONUtilities", + "package_identity": "jsonutilities", + "product_memberships": [ + "JSONUtilities" + ] + }, + { + "name": "PathKit", + "c99name": "PathKit", + "src_type": "swift", + "label": "@swiftpkg_pathkit//:Sources_PathKit", + "package_identity": "pathkit", + "product_memberships": [ + "PathKit" + ] + }, + { + "name": "Rainbow", + "c99name": "Rainbow", + "src_type": "swift", + "label": "@swiftpkg_rainbow//:Sources_Rainbow", + "package_identity": "rainbow", + "product_memberships": [ + "Rainbow" + ] + }, + { + "name": "Spectre", + "c99name": "Spectre", + "src_type": "swift", + "label": "@swiftpkg_spectre//:Sources_Spectre", + "package_identity": "spectre", + "product_memberships": [ + "Spectre" + ] + }, + { + "name": "SwiftHooks", + "c99name": "SwiftHooks", + "src_type": "swift", + "label": "@swiftpkg_swift_hooks//:Sources_SwiftHooks", + "package_identity": "swift-hooks", + "product_memberships": [ + "SwiftHooks" + ] + }, + { + "name": "SwiftCLI", + "c99name": "SwiftCLI", + "src_type": "swift", + "label": "@swiftpkg_swiftcli//:Sources_SwiftCLI", + "package_identity": "swiftcli", + "product_memberships": [ + "SwiftCLI" + ] + }, + { + "name": "Version", + "c99name": "Version", + "src_type": "swift", + "label": "@swiftpkg_version//:Sources_Version", + "package_identity": "version", + "product_memberships": [ + "Version" + ] + }, + { + "name": "ViewInspector", + "c99name": "ViewInspector", + "src_type": "swift", + "label": "@swiftpkg_viewinspector//:Sources_ViewInspector", + "modulemap_label": "@swiftpkg_viewinspector//:Sources_ViewInspector_modulemap", + "package_identity": "viewinspector", + "product_memberships": [ + "ViewInspector" + ] + }, + { + "name": "ProjectSpec", + "c99name": "ProjectSpec", + "src_type": "swift", + "label": "@swiftpkg_xcodegen//:Sources_ProjectSpec", + "package_identity": "xcodegen", + "product_memberships": [ + "xcodegen", + "XcodeGenKit", + "ProjectSpec" + ] + }, + { + "name": "XcodeGen", + "c99name": "XcodeGen", + "src_type": "swift", + "label": "@swiftpkg_xcodegen//:Sources_XcodeGen", + "package_identity": "xcodegen", + "product_memberships": [ + "xcodegen" + ] + }, + { + "name": "XcodeGenCLI", + "c99name": "XcodeGenCLI", + "src_type": "swift", + "label": "@swiftpkg_xcodegen//:Sources_XcodeGenCLI", + "package_identity": "xcodegen", + "product_memberships": [ + "xcodegen" + ] + }, + { + "name": "XcodeGenCore", + "c99name": "XcodeGenCore", + "src_type": "swift", + "label": "@swiftpkg_xcodegen//:Sources_XcodeGenCore", + "package_identity": "xcodegen", + "product_memberships": [ + "xcodegen", + "XcodeGenKit", + "ProjectSpec" + ] + }, + { + "name": "XcodeGenKit", + "c99name": "XcodeGenKit", + "src_type": "swift", + "label": "@swiftpkg_xcodegen//:Sources_XcodeGenKit", + "package_identity": "xcodegen", + "product_memberships": [ + "xcodegen", + "XcodeGenKit" + ] + }, + { + "name": "XcodeProj", + "c99name": "XcodeProj", + "src_type": "swift", + "label": "@swiftpkg_xcodeproj//:Sources_XcodeProj", + "package_identity": "xcodeproj", + "product_memberships": [ + "XcodeProj" + ] + }, + { + "name": "CYaml", + "c99name": "CYaml", + "src_type": "clang", + "label": "@swiftpkg_yams//:Sources_CYaml", + "package_identity": "yams", + "product_memberships": [ + "Yams" + ] + }, + { + "name": "Yams", + "c99name": "Yams", + "src_type": "swift", + "label": "@swiftpkg_yams//:Sources_Yams", + "package_identity": "yams", + "product_memberships": [ + "Yams" + ] + } + ], + "products": [ + { + "identity": "aexml", + "name": "AEXML", + "type": "library", + "target_labels": [ + "@swiftpkg_aexml//:Sources_AEXML" + ] + }, + { + "identity": "eyes-xcui-swift-package", + "name": "EyesXCUI", + "type": "library", + "target_labels": [ + "@swiftpkg_eyes_xcui_swift_package//:remote_archive_EyesXCUI.xcframework.zip_EyesXCUI" + ] + }, + { + "identity": "graphviz", + "name": "GraphViz", + "type": "library", + "target_labels": [ + "@swiftpkg_graphviz//:Sources_GraphViz", + "@swiftpkg_graphviz//:Sources_DOT", + "@swiftpkg_graphviz//:Sources_Tools" + ] + }, + { + "identity": "graphviz", + "name": "GraphVizBuilder", + "type": "library", + "target_labels": [ + "@swiftpkg_graphviz//:Sources_GraphVizBuilder" + ] + }, + { + "identity": "jsonutilities", + "name": "JSONUtilities", + "type": "library", + "target_labels": [ + "@swiftpkg_jsonutilities//:Sources_JSONUtilities" + ] + }, + { + "identity": "pathkit", + "name": "PathKit", + "type": "library", + "target_labels": [ + "@swiftpkg_pathkit//:Sources_PathKit" + ] + }, + { + "identity": "rainbow", + "name": "Rainbow", + "type": "library", + "target_labels": [ + "@swiftpkg_rainbow//:Sources_Rainbow" + ] + }, + { + "identity": "spectre", + "name": "Spectre", + "type": "library", + "target_labels": [ + "@swiftpkg_spectre//:Sources_Spectre" + ] + }, + { + "identity": "swift-hooks", + "name": "SwiftHooks", + "type": "library", + "target_labels": [ + "@swiftpkg_swift_hooks//:Sources_SwiftHooks" + ] + }, + { + "identity": "swiftcli", + "name": "SwiftCLI", + "type": "library", + "target_labels": [ + "@swiftpkg_swiftcli//:Sources_SwiftCLI" + ] + }, + { + "identity": "version", + "name": "Version", + "type": "library", + "target_labels": [ + "@swiftpkg_version//:Sources_Version" + ] + }, + { + "identity": "viewinspector", + "name": "ViewInspector", + "type": "library", + "target_labels": [ + "@swiftpkg_viewinspector//:Sources_ViewInspector" + ] + }, + { + "identity": "xcodegen", + "name": "ProjectSpec", + "type": "library", + "target_labels": [ + "@swiftpkg_xcodegen//:Sources_ProjectSpec" + ] + }, + { + "identity": "xcodegen", + "name": "XcodeGenKit", + "type": "library", + "target_labels": [ + "@swiftpkg_xcodegen//:Sources_XcodeGenKit" + ] + }, + { + "identity": "xcodegen", + "name": "xcodegen", + "type": "executable", + "target_labels": [ + "@swiftpkg_xcodegen//:Sources_XcodeGen" + ] + }, + { + "identity": "xcodeproj", + "name": "XcodeProj", + "type": "library", + "target_labels": [ + "@swiftpkg_xcodeproj//:Sources_XcodeProj" + ] + }, + { + "identity": "yams", + "name": "Yams", + "type": "library", + "target_labels": [ + "@swiftpkg_yams//:Sources_Yams" + ] + } + ], + "packages": [ + { + "name": "swiftpkg_aexml", + "identity": "aexml", + "remote": { + "commit": "38f7d00b23ecd891e1ee656fa6aeebd6ba04ecc3", + "remote": "https://github.com/tadija/AEXML.git", + "version": "4.6.1" + } + }, + { + "name": "swiftpkg_eyes_xcui_swift_package", + "identity": "eyes-xcui-swift-package", + "remote": { + "commit": "ba8bc9221d1f5ca733d794d9c85ad017df9e0423", + "remote": "https://github.com/applitools/eyes-xcui-swift-package.git", + "version": "8.9.1" + } + }, + { + "name": "swiftpkg_graphviz", + "identity": "graphviz", + "remote": { + "commit": "70bebcf4597b9ce33e19816d6bbd4ba9b7bdf038", + "remote": "https://github.com/SwiftDocOrg/GraphViz.git", + "version": "0.2.0" + } + }, + { + "name": "swiftpkg_jsonutilities", + "identity": "jsonutilities", + "remote": { + "commit": "128d2ffc22467f69569ef8ff971683e2393191a0", + "remote": "https://github.com/yonaskolb/JSONUtilities.git", + "version": "4.2.0" + } + }, + { + "name": "swiftpkg_pathkit", + "identity": "pathkit", + "remote": { + "commit": "3bfd2737b700b9a36565a8c94f4ad2b050a5e574", + "remote": "https://github.com/kylef/PathKit.git", + "version": "1.0.1" + } + }, + { + "name": "swiftpkg_rainbow", + "identity": "rainbow", + "remote": { + "commit": "626c3d4b6b55354b4af3aa309f998fae9b31a3d9", + "remote": "https://github.com/onevcat/Rainbow.git", + "version": "3.2.0" + } + }, + { + "name": "swiftpkg_spectre", + "identity": "spectre", + "remote": { + "commit": "26cc5e9ae0947092c7139ef7ba612e34646086c7", + "remote": "https://github.com/kylef/Spectre.git", + "version": "0.10.1" + } + }, + { + "name": "swiftpkg_swift_hooks", + "identity": "swift-hooks", + "remote": { + "commit": "5f3136ac2a3c27aa469e3f9a1222b15080d431d3", + "remote": "https://github.com/intuit/swift-hooks.git", + "version": "0.1.0" + } + }, + { + "name": "swiftpkg_swiftcli", + "identity": "swiftcli", + "remote": { + "commit": "2e949055d9797c1a6bddcda0e58dada16cc8e970", + "remote": "https://github.com/jakeheis/SwiftCLI.git", + "version": "6.0.3" + } + }, + { + "name": "swiftpkg_version", + "identity": "version", + "remote": { + "commit": "1fe824b80d89201652e7eca7c9252269a1d85e25", + "remote": "https://github.com/mxcl/Version", + "version": "2.0.1" + } + }, + { + "name": "swiftpkg_viewinspector", + "identity": "viewinspector", + "remote": { + "commit": "07c090d73e0169c342a4ed46e9010be2781eca1e", + "remote": "https://github.com/nalexn/ViewInspector", + "version": "0.9.8" + } + }, + { + "name": "swiftpkg_xcodegen", + "identity": "xcodegen", + "remote": { + "commit": "87a275fb0852bb231550e66473804de57063c957", + "remote": "https://github.com/yonaskolb/XcodeGen.git", + "version": "2.38.0" + } + }, + { + "name": "swiftpkg_xcodeproj", + "identity": "xcodeproj", + "remote": { + "commit": "447c159b0c5fb047a024fd8d942d4a76cf47dde0", + "remote": "https://github.com/tuist/XcodeProj.git", + "version": "8.16.0" + } + }, + { + "name": "swiftpkg_yams", + "identity": "yams", + "remote": { + "commit": "0d9ee7ea8c4ebd4a489ad7a73d5c6cad55d6fed3", + "remote": "https://github.com/jpsim/Yams.git", + "version": "5.0.6" + } + } + ] +} \ No newline at end of file diff --git a/tools/ios/BUILD.bazel b/tools/ios/BUILD.bazel new file mode 100644 index 000000000..0da427379 --- /dev/null +++ b/tools/ios/BUILD.bazel @@ -0,0 +1,3 @@ +exports_files([ + "ResourceShimTemplate.swift" +]) \ No newline at end of file diff --git a/tools/ios/ResourceShimTemplate.swift b/tools/ios/ResourceShimTemplate.swift new file mode 100644 index 000000000..b1bb305c6 --- /dev/null +++ b/tools/ios/ResourceShimTemplate.swift @@ -0,0 +1,32 @@ +#if BAZEL_TARGET +import Foundation + +private class BundleFinder {} + +extension Foundation.Bundle { + /// Returns the resource bundle associated with the current Swift module. + static let module: Bundle = { + let bundleName = "PLACEHOLDER" + + let candidates: [URL?] = [ + // Bundle should be present here when the package is linked into an App. + Bundle.main.resourceURL, + + // Bundle should be present here when the package is linked into a framework. + Bundle(for: BundleFinder.self).resourceURL, + + // For command-line tools. + Bundle.main.bundleURL, + ] + + for candidate in candidates { + let bundlePath = candidate?.appendingPathComponent(bundleName + ".bundle") + if let bundle = bundlePath.flatMap(Bundle.init(url:)) { + return bundle + } + } + + fatalError("unable to find bundle named \(bundleName)") + }() +} +#endif \ No newline at end of file diff --git a/tools/ios/util.bzl b/tools/ios/util.bzl new file mode 100644 index 000000000..4180ad169 --- /dev/null +++ b/tools/ios/util.bzl @@ -0,0 +1,45 @@ +load("@rules_pkg//:pkg.bzl", "pkg_zip") +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") + +def ios_bundle_module_shim(name): + native.genrule( + name = name + "ResourceShim", + srcs = ["//tools/ios:ResourceShimTemplate.swift"], + outs = [name + "ResourceShim.swift"], + cmd = "sed 's/PLACEHOLDER/" + name + "/g' < $< > $@" + ) + + +def assemble_pod( + name, + podspec = '', + srcs = [], + data = {} +): + pkg_files( + name = "podspec", + srcs = [podspec], + strip_prefix = strip_prefix.from_pkg(), + ) + + pkg_files( + name = "srcs", + srcs = srcs, + strip_prefix = strip_prefix.from_pkg(), + ) + + data_pkgs = [] + for target in data: + ident = "data_%d" % len(data_pkgs) + pkg_files( + name = ident, + srcs = [target], + strip_prefix = strip_prefix.from_pkg(), + prefix = data[target] + ) + data_pkgs.append(ident) + + pkg_zip( + name = name, + srcs = ["podspec", "srcs"] + data_pkgs + ) \ No newline at end of file diff --git a/tsup.config.ts b/tsup.config.ts index 4d53679ad..9e026d7c4 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -27,6 +27,9 @@ export function createConfig() { ...defaultOptions, globalName: bundleEntryName, external: [], + define: { + "process.env.NODE_ENV": JSON.stringify("production"), + }, format: ["iife"], async onSuccess() { await fs.promises.copyFile( diff --git a/xcode/Package.resolved b/xcode/Package.resolved new file mode 100644 index 000000000..f2a27e95f --- /dev/null +++ b/xcode/Package.resolved @@ -0,0 +1,131 @@ +{ + "pins" : [ + { + "identity" : "aexml", + "kind" : "remoteSourceControl", + "location" : "https://github.com/tadija/AEXML.git", + "state" : { + "revision" : "38f7d00b23ecd891e1ee656fa6aeebd6ba04ecc3", + "version" : "4.6.1" + } + }, + { + "identity" : "eyes-xcui-swift-package", + "kind" : "remoteSourceControl", + "location" : "https://github.com/applitools/eyes-xcui-swift-package.git", + "state" : { + "revision" : "ba8bc9221d1f5ca733d794d9c85ad017df9e0423", + "version" : "8.9.1" + } + }, + { + "identity" : "graphviz", + "kind" : "remoteSourceControl", + "location" : "https://github.com/SwiftDocOrg/GraphViz.git", + "state" : { + "revision" : "70bebcf4597b9ce33e19816d6bbd4ba9b7bdf038", + "version" : "0.2.0" + } + }, + { + "identity" : "jsonutilities", + "kind" : "remoteSourceControl", + "location" : "https://github.com/yonaskolb/JSONUtilities.git", + "state" : { + "revision" : "128d2ffc22467f69569ef8ff971683e2393191a0", + "version" : "4.2.0" + } + }, + { + "identity" : "pathkit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/kylef/PathKit.git", + "state" : { + "revision" : "3bfd2737b700b9a36565a8c94f4ad2b050a5e574", + "version" : "1.0.1" + } + }, + { + "identity" : "rainbow", + "kind" : "remoteSourceControl", + "location" : "https://github.com/onevcat/Rainbow.git", + "state" : { + "revision" : "626c3d4b6b55354b4af3aa309f998fae9b31a3d9", + "version" : "3.2.0" + } + }, + { + "identity" : "spectre", + "kind" : "remoteSourceControl", + "location" : "https://github.com/kylef/Spectre.git", + "state" : { + "revision" : "26cc5e9ae0947092c7139ef7ba612e34646086c7", + "version" : "0.10.1" + } + }, + { + "identity" : "swift-hooks", + "kind" : "remoteSourceControl", + "location" : "https://github.com/intuit/swift-hooks.git", + "state" : { + "revision" : "5f3136ac2a3c27aa469e3f9a1222b15080d431d3", + "version" : "0.1.0" + } + }, + { + "identity" : "swiftcli", + "kind" : "remoteSourceControl", + "location" : "https://github.com/jakeheis/SwiftCLI.git", + "state" : { + "revision" : "2e949055d9797c1a6bddcda0e58dada16cc8e970", + "version" : "6.0.3" + } + }, + { + "identity" : "version", + "kind" : "remoteSourceControl", + "location" : "https://github.com/mxcl/Version", + "state" : { + "revision" : "1fe824b80d89201652e7eca7c9252269a1d85e25", + "version" : "2.0.1" + } + }, + { + "identity" : "viewinspector", + "kind" : "remoteSourceControl", + "location" : "https://github.com/nalexn/ViewInspector", + "state" : { + "revision" : "07c090d73e0169c342a4ed46e9010be2781eca1e", + "version" : "0.9.8" + } + }, + { + "identity" : "xcodegen", + "kind" : "remoteSourceControl", + "location" : "https://github.com/yonaskolb/XcodeGen.git", + "state" : { + "revision" : "87a275fb0852bb231550e66473804de57063c957", + "version" : "2.38.0" + } + }, + { + "identity" : "xcodeproj", + "kind" : "remoteSourceControl", + "location" : "https://github.com/tuist/XcodeProj.git", + "state" : { + "revision" : "447c159b0c5fb047a024fd8d942d4a76cf47dde0", + "version" : "8.16.0" + } + }, + { + "identity" : "yams", + "kind" : "remoteSourceControl", + "location" : "https://github.com/jpsim/Yams.git", + "state" : { + "revision" : "0d9ee7ea8c4ebd4a489ad7a73d5c6cad55d6fed3", + "version" : "5.0.6" + } + } + ], + "version" : 2 +} diff --git a/xcode/Package.swift b/xcode/Package.swift new file mode 100644 index 000000000..3cde9e82a --- /dev/null +++ b/xcode/Package.swift @@ -0,0 +1,32 @@ +// swift-tools-version: 5.7 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +// SPM doesn't isolate dependencies that are not used by products +// So relying on a tool, like SwiftLint, a consuming user will still need to resolve that +// even though they would not use it +// this can cause conflicts for packages not used by the product at runtime +// +// So this file is used to generate dependencies for bazel so we can keep the actual Package.swift clean +// since the spm rules for bazel only work from a Package.swift +let package = Package( + name: "PlayerUIBazelDependencies", + platforms: [ + .macOS(.v11) + ], + products: [], + dependencies: [ + // Actual Dependencies + .package(url: "https://github.com/intuit/swift-hooks.git", .upToNextMajor(from: "0.1.0")), + + + // Tools + .package(url: "https://github.com/yonaskolb/XcodeGen.git", .upToNextMajor(from: "2.38.0")), + + // Testing + .package(url: "https://github.com/applitools/eyes-xcui-swift-package.git", exact: "8.9.1"), + .package(url: "https://github.com/nalexn/viewinspector.git", .upToNextMajor(from: "0.9.7")) + ], + targets: [] +) diff --git a/xcode/PlayerUI.xcodeproj/project.pbxproj b/xcode/PlayerUI.xcodeproj/project.pbxproj deleted file mode 100644 index 0769dc30d..000000000 --- a/xcode/PlayerUI.xcodeproj/project.pbxproj +++ /dev/null @@ -1,816 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 39079B2F69916F21823F6CDE /* Pods_PlayerUI_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 923D321F0192243570044107 /* Pods_PlayerUI_Example.framework */; }; - 542F3E1AE177500CD810768A /* Pods_PlayerUI_Example_PlayerUI_ExampleUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CDFFDB73090D1CC48E229E7D /* Pods_PlayerUI_Example_PlayerUI_ExampleUITests.framework */; }; - 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; }; - 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; }; - 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; }; - 6795F59827595DA8001DA77C /* Placeholder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6795F59727595DA8001DA77C /* Placeholder.swift */; }; - 956B238B2417F2B600CA4928 /* MockFlows in Resources */ = {isa = PBXBuildFile; fileRef = 956B238A2417F2B600CA4928 /* MockFlows */; }; - BE00EF7AB29E5341E0493D9D /* Pods_PlayerUI_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9057FA0502C90E2E1EA4377D /* Pods_PlayerUI_Tests.framework */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 607FACE61AFB9204008FA782 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 607FACC81AFB9204008FA782 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 607FACCF1AFB9204008FA782; - remoteInfo = PlayerUI; - }; - 67675D96240081D000F6BE33 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 607FACC81AFB9204008FA782 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 607FACCF1AFB9204008FA782; - remoteInfo = PlayerUI_Example; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 0B7D853B8863F18979E0BC7A /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; - 3D7B30D71B85F8C146017335 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; - 59BF382AE9C211D667C81B57 /* Pods-PlayerUI_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PlayerUI_Tests.debug.xcconfig"; path = "Target Support Files/Pods-PlayerUI_Tests/Pods-PlayerUI_Tests.debug.xcconfig"; sourceTree = ""; }; - 607FACD01AFB9204008FA782 /* PlayerUI_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PlayerUI_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 607FACDC1AFB9204008FA782 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - 607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; - 607FACE51AFB9204008FA782 /* PlayerUI_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PlayerUI_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 67077E13242AAB6100DBE54D /* PlayerUI_Example.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = PlayerUI_Example.entitlements; sourceTree = ""; }; - 67675D91240081D000F6BE33 /* PlayerUI_ExampleUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PlayerUI_ExampleUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 67675D95240081D000F6BE33 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 67857AD52756A6FD00012223 /* PlayerUI_ExampleDebug.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = PlayerUI_ExampleDebug.entitlements; sourceTree = ""; }; - 6795F59627595DA7001DA77C /* PlayerUI_ExampleUITests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "PlayerUI_ExampleUITests-Bridging-Header.h"; sourceTree = ""; }; - 6795F59727595DA8001DA77C /* Placeholder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Placeholder.swift; sourceTree = ""; }; - 82574C183BB500A35B81A849 /* Pods-PlayerUI_Example-PlayerUI_ExampleUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PlayerUI_Example-PlayerUI_ExampleUITests.debug.xcconfig"; path = "Target Support Files/Pods-PlayerUI_Example-PlayerUI_ExampleUITests/Pods-PlayerUI_Example-PlayerUI_ExampleUITests.debug.xcconfig"; sourceTree = ""; }; - 9057FA0502C90E2E1EA4377D /* Pods_PlayerUI_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PlayerUI_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 923D321F0192243570044107 /* Pods_PlayerUI_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PlayerUI_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 956B238A2417F2B600CA4928 /* MockFlows */ = {isa = PBXFileReference; lastKnownFileType = folder; path = MockFlows; sourceTree = ""; }; - 96E142EFE534A852E97BEC85 /* Pods-PlayerUI_Example-PlayerUI_ExampleUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PlayerUI_Example-PlayerUI_ExampleUITests.release.xcconfig"; path = "Target Support Files/Pods-PlayerUI_Example-PlayerUI_ExampleUITests/Pods-PlayerUI_Example-PlayerUI_ExampleUITests.release.xcconfig"; sourceTree = ""; }; - A63C17CEAE3B5779C2E10686 /* PlayerUI.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = PlayerUI.podspec; path = ../PlayerUI.podspec; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; - B324C2C7986D2A12F4C664B5 /* Pods-PlayerUI_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PlayerUI_Tests.release.xcconfig"; path = "Target Support Files/Pods-PlayerUI_Tests/Pods-PlayerUI_Tests.release.xcconfig"; sourceTree = ""; }; - BFC33DDADE2422767A914634 /* Pods-PlayerUI_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PlayerUI_Example.release.xcconfig"; path = "Target Support Files/Pods-PlayerUI_Example/Pods-PlayerUI_Example.release.xcconfig"; sourceTree = ""; }; - C12C7B7F2DF280BD785A35A2 /* Pods-PlayerUI_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PlayerUI_Example.debug.xcconfig"; path = "Target Support Files/Pods-PlayerUI_Example/Pods-PlayerUI_Example.debug.xcconfig"; sourceTree = ""; }; - CDFFDB73090D1CC48E229E7D /* Pods_PlayerUI_Example_PlayerUI_ExampleUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PlayerUI_Example_PlayerUI_ExampleUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 607FACCD1AFB9204008FA782 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 39079B2F69916F21823F6CDE /* Pods_PlayerUI_Example.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 607FACE21AFB9204008FA782 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - BE00EF7AB29E5341E0493D9D /* Pods_PlayerUI_Tests.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 67675D8E240081D000F6BE33 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 542F3E1AE177500CD810768A /* Pods_PlayerUI_Example_PlayerUI_ExampleUITests.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 2F47C1EA452266D9F885568C /* Frameworks */ = { - isa = PBXGroup; - children = ( - 923D321F0192243570044107 /* Pods_PlayerUI_Example.framework */, - 9057FA0502C90E2E1EA4377D /* Pods_PlayerUI_Tests.framework */, - CDFFDB73090D1CC48E229E7D /* Pods_PlayerUI_Example_PlayerUI_ExampleUITests.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 607FACC71AFB9204008FA782 = { - isa = PBXGroup; - children = ( - 67857AD52756A6FD00012223 /* PlayerUI_ExampleDebug.entitlements */, - 67077E13242AAB6100DBE54D /* PlayerUI_Example.entitlements */, - 607FACF51AFB993E008FA782 /* Podspec Metadata */, - 607FACD21AFB9204008FA782 /* Example for PlayerUI */, - 607FACE81AFB9204008FA782 /* Tests */, - 67675D92240081D000F6BE33 /* PlayerUI_ExampleUITests */, - 607FACD11AFB9204008FA782 /* Products */, - A22C02FE8589D2243B6D81FD /* Pods */, - 2F47C1EA452266D9F885568C /* Frameworks */, - ); - sourceTree = ""; - }; - 607FACD11AFB9204008FA782 /* Products */ = { - isa = PBXGroup; - children = ( - 607FACD01AFB9204008FA782 /* PlayerUI_Example.app */, - 607FACE51AFB9204008FA782 /* PlayerUI_Tests.xctest */, - 67675D91240081D000F6BE33 /* PlayerUI_ExampleUITests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - 607FACD21AFB9204008FA782 /* Example for PlayerUI */ = { - isa = PBXGroup; - children = ( - 607FACD51AFB9204008FA782 /* AppDelegate.swift */, - 607FACDC1AFB9204008FA782 /* Images.xcassets */, - 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */, - 956B238A2417F2B600CA4928 /* MockFlows */, - 607FACD31AFB9204008FA782 /* Supporting Files */, - ); - name = "Example for PlayerUI"; - path = PlayerUI; - sourceTree = ""; - }; - 607FACD31AFB9204008FA782 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 607FACD41AFB9204008FA782 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 607FACE81AFB9204008FA782 /* Tests */ = { - isa = PBXGroup; - children = ( - 607FACE91AFB9204008FA782 /* Supporting Files */, - ); - path = Tests; - sourceTree = ""; - }; - 607FACE91AFB9204008FA782 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 607FACEA1AFB9204008FA782 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 607FACF51AFB993E008FA782 /* Podspec Metadata */ = { - isa = PBXGroup; - children = ( - A63C17CEAE3B5779C2E10686 /* PlayerUI.podspec */, - 3D7B30D71B85F8C146017335 /* README.md */, - 0B7D853B8863F18979E0BC7A /* LICENSE */, - ); - name = "Podspec Metadata"; - sourceTree = ""; - }; - 67675D92240081D000F6BE33 /* PlayerUI_ExampleUITests */ = { - isa = PBXGroup; - children = ( - 67675D95240081D000F6BE33 /* Info.plist */, - 6795F59727595DA8001DA77C /* Placeholder.swift */, - 6795F59627595DA7001DA77C /* PlayerUI_ExampleUITests-Bridging-Header.h */, - ); - path = PlayerUI_ExampleUITests; - sourceTree = ""; - }; - A22C02FE8589D2243B6D81FD /* Pods */ = { - isa = PBXGroup; - children = ( - C12C7B7F2DF280BD785A35A2 /* Pods-PlayerUI_Example.debug.xcconfig */, - BFC33DDADE2422767A914634 /* Pods-PlayerUI_Example.release.xcconfig */, - 59BF382AE9C211D667C81B57 /* Pods-PlayerUI_Tests.debug.xcconfig */, - B324C2C7986D2A12F4C664B5 /* Pods-PlayerUI_Tests.release.xcconfig */, - 82574C183BB500A35B81A849 /* Pods-PlayerUI_Example-PlayerUI_ExampleUITests.debug.xcconfig */, - 96E142EFE534A852E97BEC85 /* Pods-PlayerUI_Example-PlayerUI_ExampleUITests.release.xcconfig */, - ); - path = Pods; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 607FACCF1AFB9204008FA782 /* PlayerUI_Example */ = { - isa = PBXNativeTarget; - buildConfigurationList = 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "PlayerUI_Example" */; - buildPhases = ( - E0A4B89B4BC9BD1D28E4AF4B /* [CP] Check Pods Manifest.lock */, - 607FACCC1AFB9204008FA782 /* Sources */, - 607FACCD1AFB9204008FA782 /* Frameworks */, - 607FACCE1AFB9204008FA782 /* Resources */, - 45BDEE9003BE3854F749371C /* [CP] Embed Pods Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = PlayerUI_Example; - productName = PlayerUI; - productReference = 607FACD01AFB9204008FA782 /* PlayerUI_Example.app */; - productType = "com.apple.product-type.application"; - }; - 607FACE41AFB9204008FA782 /* PlayerUI_Tests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "PlayerUI_Tests" */; - buildPhases = ( - 4FA3DC65C19A0CCC398F4413 /* [CP] Check Pods Manifest.lock */, - 607FACE11AFB9204008FA782 /* Sources */, - 607FACE21AFB9204008FA782 /* Frameworks */, - 607FACE31AFB9204008FA782 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 607FACE71AFB9204008FA782 /* PBXTargetDependency */, - ); - name = PlayerUI_Tests; - productName = Tests; - productReference = 607FACE51AFB9204008FA782 /* PlayerUI_Tests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 67675D90240081D000F6BE33 /* PlayerUI_ExampleUITests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 67675D9A240081D000F6BE33 /* Build configuration list for PBXNativeTarget "PlayerUI_ExampleUITests" */; - buildPhases = ( - 94DEBD56AA3C716C90DB27B6 /* [CP] Check Pods Manifest.lock */, - 67675D8D240081D000F6BE33 /* Sources */, - 67675D8E240081D000F6BE33 /* Frameworks */, - 67675D8F240081D000F6BE33 /* Resources */, - 45918C046C204D6051AED485 /* [CP] Embed Pods Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - 67675D97240081D000F6BE33 /* PBXTargetDependency */, - ); - name = PlayerUI_ExampleUITests; - productName = PlayerUI_ExampleUITests; - productReference = 67675D91240081D000F6BE33 /* PlayerUI_ExampleUITests.xctest */; - productType = "com.apple.product-type.bundle.ui-testing"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 607FACC81AFB9204008FA782 /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 1130; - LastUpgradeCheck = 1130; - ORGANIZATIONNAME = CocoaPods; - TargetAttributes = { - 607FACCF1AFB9204008FA782 = { - CreatedOnToolsVersion = 6.3.1; - DevelopmentTeam = F6DWWXWEX6; - LastSwiftMigration = 1130; - ProvisioningStyle = Manual; - }; - 607FACE41AFB9204008FA782 = { - CreatedOnToolsVersion = 6.3.1; - DevelopmentTeam = F6DWWXWEX6; - LastSwiftMigration = 1130; - ProvisioningStyle = Manual; - TestTargetID = 607FACCF1AFB9204008FA782; - }; - 67675D90240081D000F6BE33 = { - CreatedOnToolsVersion = 11.3.1; - DevelopmentTeam = F6DWWXWEX6; - LastSwiftMigration = 1300; - ProvisioningStyle = Manual; - TestTargetID = 607FACCF1AFB9204008FA782; - }; - }; - }; - buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "PlayerUI" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 607FACC71AFB9204008FA782; - productRefGroup = 607FACD11AFB9204008FA782 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 607FACCF1AFB9204008FA782 /* PlayerUI_Example */, - 607FACE41AFB9204008FA782 /* PlayerUI_Tests */, - 67675D90240081D000F6BE33 /* PlayerUI_ExampleUITests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 607FACCE1AFB9204008FA782 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */, - 956B238B2417F2B600CA4928 /* MockFlows in Resources */, - 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 607FACE31AFB9204008FA782 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 67675D8F240081D000F6BE33 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 45918C046C204D6051AED485 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-PlayerUI_Example-PlayerUI_ExampleUITests/Pods-PlayerUI_Example-PlayerUI_ExampleUITests-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/PlayerUI/PlayerUI.framework", - "${BUILT_PRODUCTS_DIR}/SwiftHooks/SwiftHooks.framework", - "${PODS_XCFRAMEWORKS_BUILD_DIR}/EyesXCUI/EyesXCUI.framework/EyesXCUI", - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PlayerUI.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftHooks.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/EyesXCUI.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-PlayerUI_Example-PlayerUI_ExampleUITests/Pods-PlayerUI_Example-PlayerUI_ExampleUITests-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - 45BDEE9003BE3854F749371C /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-PlayerUI_Example/Pods-PlayerUI_Example-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/PlayerUI/PlayerUI.framework", - "${BUILT_PRODUCTS_DIR}/SwiftHooks/SwiftHooks.framework", - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PlayerUI.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftHooks.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-PlayerUI_Example/Pods-PlayerUI_Example-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - 4FA3DC65C19A0CCC398F4413 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-PlayerUI_Tests-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - 94DEBD56AA3C716C90DB27B6 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-PlayerUI_Example-PlayerUI_ExampleUITests-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - E0A4B89B4BC9BD1D28E4AF4B /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-PlayerUI_Example-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 607FACCC1AFB9204008FA782 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 607FACE11AFB9204008FA782 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 67675D8D240081D000F6BE33 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 6795F59827595DA8001DA77C /* Placeholder.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 607FACE71AFB9204008FA782 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 607FACCF1AFB9204008FA782 /* PlayerUI_Example */; - targetProxy = 607FACE61AFB9204008FA782 /* PBXContainerItemProxy */; - }; - 67675D97240081D000F6BE33 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 607FACCF1AFB9204008FA782 /* PlayerUI_Example */; - targetProxy = 67675D96240081D000F6BE33 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */ = { - isa = PBXVariantGroup; - children = ( - 607FACDF1AFB9204008FA782 /* Base */, - ); - name = LaunchScreen.xib; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 607FACED1AFB9204008FA782 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; - MACH_O_TYPE = mh_dylib; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - 607FACEE1AFB9204008FA782 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; - MACH_O_TYPE = mh_dylib; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 607FACF01AFB9204008FA782 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = C12C7B7F2DF280BD785A35A2 /* Pods-PlayerUI_Example.debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_ENTITLEMENTS = PlayerUI_ExampleDebug.entitlements; - CODE_SIGN_IDENTITY = "iPhone Distribution"; - CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 235; - DEVELOPMENT_TEAM = F6DWWXWEX6; - ENABLE_BITCODE = NO; - INFOPLIST_FILE = PlayerUI/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MACH_O_TYPE = mh_execute; - MODULE_NAME = ExampleApp; - PRODUCT_BUNDLE_IDENTIFIER = com.intuit.ios.player; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "match InHouse com.intuit.ios.player"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 607FACF11AFB9204008FA782 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BFC33DDADE2422767A914634 /* Pods-PlayerUI_Example.release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_ENTITLEMENTS = PlayerUI_Example.entitlements; - CODE_SIGN_IDENTITY = "iPhone Distribution"; - CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 235; - DEVELOPMENT_TEAM = F6DWWXWEX6; - ENABLE_BITCODE = NO; - INFOPLIST_FILE = PlayerUI/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MACH_O_TYPE = mh_execute; - MODULE_NAME = ExampleApp; - PRODUCT_BUNDLE_IDENTIFIER = com.intuit.ios.player; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "match InHouse com.intuit.ios.player"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; - 607FACF31AFB9204008FA782 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 59BF382AE9C211D667C81B57 /* Pods-PlayerUI_Tests.debug.xcconfig */; - buildSettings = { - CODE_SIGN_IDENTITY = "iPhone Distribution"; - CODE_SIGN_STYLE = Manual; - DEVELOPMENT_TEAM = F6DWWXWEX6; - FRAMEWORK_SEARCH_PATHS = ( - "$(PLATFORM_DIR)/Developer/Library/Frameworks", - "$(inherited)", - ); - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = Tests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = ""; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PlayerUI_Example.app/PlayerUI_Example"; - }; - name = Debug; - }; - 607FACF41AFB9204008FA782 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = B324C2C7986D2A12F4C664B5 /* Pods-PlayerUI_Tests.release.xcconfig */; - buildSettings = { - DEVELOPMENT_TEAM = F6DWWXWEX6; - FRAMEWORK_SEARCH_PATHS = ( - "$(PLATFORM_DIR)/Developer/Library/Frameworks", - "$(inherited)", - ); - INFOPLIST_FILE = Tests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = Default; - SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PlayerUI_Example.app/PlayerUI_Example"; - }; - name = Release; - }; - 67675D98240081D000F6BE33 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 82574C183BB500A35B81A849 /* Pods-PlayerUI_Example-PlayerUI_ExampleUITests.debug.xcconfig */; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_IDENTITY = "iPhone Developer"; - CODE_SIGN_STYLE = Manual; - DEBUG_INFORMATION_FORMAT = dwarf; - DEVELOPMENT_TEAM = F6DWWXWEX6; - GCC_C_LANGUAGE_STANDARD = gnu11; - INFOPLIST_FILE = PlayerUI_ExampleUITests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = "com.intuit.ios.PlayerUI-ExampleUITests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "match Development com.intuit.ios.PlayerUI-ExampleUITests*"; - "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = ""; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OBJC_BRIDGING_HEADER = "PlayerUI_ExampleUITests/PlayerUI_ExampleUITests-Bridging-Header.h"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_TARGET_NAME = PlayerUI_Example; - }; - name = Debug; - }; - 67675D99240081D000F6BE33 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 96E142EFE534A852E97BEC85 /* Pods-PlayerUI_Example-PlayerUI_ExampleUITests.release.xcconfig */; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_IDENTITY = "iPhone Distribution"; - CODE_SIGN_STYLE = Manual; - DEVELOPMENT_TEAM = F6DWWXWEX6; - GCC_C_LANGUAGE_STANDARD = gnu11; - INFOPLIST_FILE = PlayerUI_ExampleUITests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = "com.intuit.ios.PlayerUI-ExampleUITests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "match InHouse com.intuit.ios.PlayerUI-ExampleUITests*"; - "PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = ""; - SWIFT_OBJC_BRIDGING_HEADER = "PlayerUI_ExampleUITests/PlayerUI_ExampleUITests-Bridging-Header.h"; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_TARGET_NAME = PlayerUI_Example; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "PlayerUI" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 607FACED1AFB9204008FA782 /* Debug */, - 607FACEE1AFB9204008FA782 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "PlayerUI_Example" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 607FACF01AFB9204008FA782 /* Debug */, - 607FACF11AFB9204008FA782 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "PlayerUI_Tests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 607FACF31AFB9204008FA782 /* Debug */, - 607FACF41AFB9204008FA782 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 67675D9A240081D000F6BE33 /* Build configuration list for PBXNativeTarget "PlayerUI_ExampleUITests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 67675D98240081D000F6BE33 /* Debug */, - 67675D99240081D000F6BE33 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 607FACC81AFB9204008FA782 /* Project object */; -} diff --git a/xcode/PlayerUI.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/xcode/PlayerUI.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 413a0108c..000000000 --- a/xcode/PlayerUI.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/xcode/PlayerUI.xcodeproj/xcshareddata/xcschemes/PlayerUI-Example.xcscheme b/xcode/PlayerUI.xcodeproj/xcshareddata/xcschemes/PlayerUI-Example.xcscheme deleted file mode 100644 index 3c2ca9924..000000000 --- a/xcode/PlayerUI.xcodeproj/xcshareddata/xcschemes/PlayerUI-Example.xcscheme +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xcode/PlayerUI.xcodeproj/xcshareddata/xcschemes/PlayerUIUITests.xcscheme b/xcode/PlayerUI.xcodeproj/xcshareddata/xcschemes/PlayerUIUITests.xcscheme deleted file mode 100644 index bdcd0ff3d..000000000 --- a/xcode/PlayerUI.xcodeproj/xcshareddata/xcschemes/PlayerUIUITests.xcscheme +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xcode/PlayerUI.xcworkspace/contents.xcworkspacedata b/xcode/PlayerUI.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index d83a304cc..000000000 --- a/xcode/PlayerUI.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/xcode/PlayerUI.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/xcode/PlayerUI.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d981003..000000000 --- a/xcode/PlayerUI.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/xcode/PlayerUI/AppDelegate.swift b/xcode/PlayerUI/AppDelegate.swift deleted file mode 100644 index 44295987b..000000000 --- a/xcode/PlayerUI/AppDelegate.swift +++ /dev/null @@ -1,41 +0,0 @@ -// -// AppDelegate.swift -// PlayerUI -// -// Created by hborawski on 02/20/2020. -// Copyright (c) 2020 hborawski. All rights reserved. -// - -import UIKit - -@UIApplicationMain -class AppDelegate: UIResponder, UIApplicationDelegate { - - var window: UIWindow? - - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - return true - } - - func applicationWillResignActive(_ application: UIApplication) { - // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. - // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. - } - - func applicationDidEnterBackground(_ application: UIApplication) { - // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. - // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. - } - - func applicationWillEnterForeground(_ application: UIApplication) { - // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. - } - - func applicationDidBecomeActive(_ application: UIApplication) { - // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. - } - - func applicationWillTerminate(_ application: UIApplication) { - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. - } -} diff --git a/xcode/PlayerUI/Base.lproj/LaunchScreen.xib b/xcode/PlayerUI/Base.lproj/LaunchScreen.xib deleted file mode 100644 index 95c013ac4..000000000 --- a/xcode/PlayerUI/Base.lproj/LaunchScreen.xib +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/100.png b/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/100.png deleted file mode 100644 index 91547a7f1..000000000 Binary files a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/100.png and /dev/null differ diff --git a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/1024.png b/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/1024.png deleted file mode 100644 index c524f8dc1..000000000 Binary files a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/1024.png and /dev/null differ diff --git a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/114.png b/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/114.png deleted file mode 100644 index 8cc1441b9..000000000 Binary files a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/114.png and /dev/null differ diff --git a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/120.png b/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/120.png deleted file mode 100644 index 9d13d00b7..000000000 Binary files a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/120.png and /dev/null differ diff --git a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/144.png b/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/144.png deleted file mode 100644 index 8c5168d9e..000000000 Binary files a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/144.png and /dev/null differ diff --git a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/152.png b/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/152.png deleted file mode 100644 index 58ba68912..000000000 Binary files a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/152.png and /dev/null differ diff --git a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/167.png b/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/167.png deleted file mode 100644 index 3e0d4d497..000000000 Binary files a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/167.png and /dev/null differ diff --git a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/180.png b/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/180.png deleted file mode 100644 index a48c63fe2..000000000 Binary files a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/180.png and /dev/null differ diff --git a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/20.png b/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/20.png deleted file mode 100644 index 4da4be3ed..000000000 Binary files a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/20.png and /dev/null differ diff --git a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/29.png b/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/29.png deleted file mode 100644 index 7922a9a82..000000000 Binary files a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/29.png and /dev/null differ diff --git a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/40.png b/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/40.png deleted file mode 100644 index edc318b2c..000000000 Binary files a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/40.png and /dev/null differ diff --git a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/50.png b/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/50.png deleted file mode 100644 index 8cdaa5bc8..000000000 Binary files a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/50.png and /dev/null differ diff --git a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/57.png b/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/57.png deleted file mode 100644 index 38471d9d9..000000000 Binary files a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/57.png and /dev/null differ diff --git a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/58.png b/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/58.png deleted file mode 100644 index 5ec625392..000000000 Binary files a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/58.png and /dev/null differ diff --git a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/60.png b/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/60.png deleted file mode 100644 index a353389a2..000000000 Binary files a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/60.png and /dev/null differ diff --git a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/72.png b/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/72.png deleted file mode 100644 index 10c88baa4..000000000 Binary files a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/72.png and /dev/null differ diff --git a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/76.png b/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/76.png deleted file mode 100644 index 8c3c49d50..000000000 Binary files a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/76.png and /dev/null differ diff --git a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/80.png b/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/80.png deleted file mode 100644 index 6e7f5e8c4..000000000 Binary files a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/80.png and /dev/null differ diff --git a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/87.png b/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/87.png deleted file mode 100644 index 2ea16ec89..000000000 Binary files a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/87.png and /dev/null differ diff --git a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/Contents.json b/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 4fdf88263..000000000 --- a/xcode/PlayerUI/Images.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,158 +0,0 @@ -{ - "images" : [ - { - "filename" : "40.png", - "idiom" : "iphone", - "scale" : "2x", - "size" : "20x20" - }, - { - "filename" : "60.png", - "idiom" : "iphone", - "scale" : "3x", - "size" : "20x20" - }, - { - "filename" : "29.png", - "idiom" : "iphone", - "scale" : "1x", - "size" : "29x29" - }, - { - "filename" : "58.png", - "idiom" : "iphone", - "scale" : "2x", - "size" : "29x29" - }, - { - "filename" : "87.png", - "idiom" : "iphone", - "scale" : "3x", - "size" : "29x29" - }, - { - "filename" : "80.png", - "idiom" : "iphone", - "scale" : "2x", - "size" : "40x40" - }, - { - "filename" : "120.png", - "idiom" : "iphone", - "scale" : "3x", - "size" : "40x40" - }, - { - "filename" : "57.png", - "idiom" : "iphone", - "scale" : "1x", - "size" : "57x57" - }, - { - "filename" : "114.png", - "idiom" : "iphone", - "scale" : "2x", - "size" : "57x57" - }, - { - "filename" : "120.png", - "idiom" : "iphone", - "scale" : "2x", - "size" : "60x60" - }, - { - "filename" : "180.png", - "idiom" : "iphone", - "scale" : "3x", - "size" : "60x60" - }, - { - "filename" : "20.png", - "idiom" : "ipad", - "scale" : "1x", - "size" : "20x20" - }, - { - "filename" : "40.png", - "idiom" : "ipad", - "scale" : "2x", - "size" : "20x20" - }, - { - "filename" : "29.png", - "idiom" : "ipad", - "scale" : "1x", - "size" : "29x29" - }, - { - "filename" : "58.png", - "idiom" : "ipad", - "scale" : "2x", - "size" : "29x29" - }, - { - "filename" : "40.png", - "idiom" : "ipad", - "scale" : "1x", - "size" : "40x40" - }, - { - "filename" : "80.png", - "idiom" : "ipad", - "scale" : "2x", - "size" : "40x40" - }, - { - "filename" : "50.png", - "idiom" : "ipad", - "scale" : "1x", - "size" : "50x50" - }, - { - "filename" : "100.png", - "idiom" : "ipad", - "scale" : "2x", - "size" : "50x50" - }, - { - "filename" : "72.png", - "idiom" : "ipad", - "scale" : "1x", - "size" : "72x72" - }, - { - "filename" : "144.png", - "idiom" : "ipad", - "scale" : "2x", - "size" : "72x72" - }, - { - "filename" : "76.png", - "idiom" : "ipad", - "scale" : "1x", - "size" : "76x76" - }, - { - "filename" : "152.png", - "idiom" : "ipad", - "scale" : "2x", - "size" : "76x76" - }, - { - "filename" : "167.png", - "idiom" : "ipad", - "scale" : "2x", - "size" : "83.5x83.5" - }, - { - "filename" : "1024.png", - "idiom" : "ios-marketing", - "scale" : "1x", - "size" : "1024x1024" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/xcode/PlayerUI/Images.xcassets/Contents.json b/xcode/PlayerUI/Images.xcassets/Contents.json deleted file mode 100644 index 73c00596a..000000000 --- a/xcode/PlayerUI/Images.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/xcode/PlayerUI/Images.xcassets/PlayerLogo.imageset/Contents.json b/xcode/PlayerUI/Images.xcassets/PlayerLogo.imageset/Contents.json deleted file mode 100644 index eb71d2436..000000000 --- a/xcode/PlayerUI/Images.xcassets/PlayerLogo.imageset/Contents.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "images" : [ - { - "filename" : "small-light-2.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "filename" : "small-dark.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "small-light-1.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "filename" : "small-dark-1.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "small-light.png", - "idiom" : "universal", - "scale" : "3x" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "filename" : "small-dark-2.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/xcode/PlayerUI/Images.xcassets/PlayerLogo.imageset/small-dark-1.png b/xcode/PlayerUI/Images.xcassets/PlayerLogo.imageset/small-dark-1.png deleted file mode 100644 index 5f9861bfd..000000000 Binary files a/xcode/PlayerUI/Images.xcassets/PlayerLogo.imageset/small-dark-1.png and /dev/null differ diff --git a/xcode/PlayerUI/Images.xcassets/PlayerLogo.imageset/small-dark-2.png b/xcode/PlayerUI/Images.xcassets/PlayerLogo.imageset/small-dark-2.png deleted file mode 100644 index 5f9861bfd..000000000 Binary files a/xcode/PlayerUI/Images.xcassets/PlayerLogo.imageset/small-dark-2.png and /dev/null differ diff --git a/xcode/PlayerUI/Images.xcassets/PlayerLogo.imageset/small-dark.png b/xcode/PlayerUI/Images.xcassets/PlayerLogo.imageset/small-dark.png deleted file mode 100644 index 5f9861bfd..000000000 Binary files a/xcode/PlayerUI/Images.xcassets/PlayerLogo.imageset/small-dark.png and /dev/null differ diff --git a/xcode/PlayerUI/Images.xcassets/PlayerLogo.imageset/small-light-1.png b/xcode/PlayerUI/Images.xcassets/PlayerLogo.imageset/small-light-1.png deleted file mode 100644 index 726b21bb8..000000000 Binary files a/xcode/PlayerUI/Images.xcassets/PlayerLogo.imageset/small-light-1.png and /dev/null differ diff --git a/xcode/PlayerUI/Images.xcassets/PlayerLogo.imageset/small-light-2.png b/xcode/PlayerUI/Images.xcassets/PlayerLogo.imageset/small-light-2.png deleted file mode 100644 index 726b21bb8..000000000 Binary files a/xcode/PlayerUI/Images.xcassets/PlayerLogo.imageset/small-light-2.png and /dev/null differ diff --git a/xcode/PlayerUI/Images.xcassets/PlayerLogo.imageset/small-light.png b/xcode/PlayerUI/Images.xcassets/PlayerLogo.imageset/small-light.png deleted file mode 100644 index 726b21bb8..000000000 Binary files a/xcode/PlayerUI/Images.xcassets/PlayerLogo.imageset/small-light.png and /dev/null differ diff --git a/xcode/PlayerUI/MockFlows/action/action-basic.json b/xcode/PlayerUI/MockFlows/action/action-basic.json deleted file mode 100644 index 96c860453..000000000 --- a/xcode/PlayerUI/MockFlows/action/action-basic.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "id": "generated-flow", - "views": [ - { - "id": "action", - "type": "action", - "exp": "{{count}} = {{count}} + 1", - "label": { - "asset": { - "id": "action-label", - "type": "text", - "value": "Count: {{count}}" - } - } - } - ], - "data": { - "count": 0 - }, - "navigation": { - "BEGIN": "FLOW_1", - "FLOW_1": { - "startState": "VIEW_1", - "VIEW_1": { - "state_type": "VIEW", - "ref": "action", - "transitions": { - "*": "END_Done" - } - }, - "END_Done": { - "state_type": "END", - "outcome": "done" - } - } - } -} \ No newline at end of file diff --git a/xcode/PlayerUI/MockFlows/action/action-transition-between-pages.json b/xcode/PlayerUI/MockFlows/action/action-transition-between-pages.json deleted file mode 100644 index 508c10962..000000000 --- a/xcode/PlayerUI/MockFlows/action/action-transition-between-pages.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "id": "transition-between-pages", - "views": [ - { - "id": "view-1", - "type": "action", - "value": "next", - "label": { - "asset": { - "id": "view-1-label", - "type": "text", - "value": "Go to View 2" - } - } - }, - { - "id": "view-2", - "type": "action", - "value": "prev", - "label": { - "asset": { - "id": "view-2-label", - "type": "text", - "value": "Go to View 1" - } - } - } - ], - "navigation": { - "BEGIN": "FLOW_1", - "FLOW_1": { - "startState": "VIEW_1", - "VIEW_1": { - "ref": "view-1", - "state_type": "VIEW", - "transitions": { - "next": "VIEW_2" - } - }, - "VIEW_2": { - "ref": "view-2", - "state_type": "VIEW", - "transitions": { - "prev": "VIEW_1" - } - } - } - } -} diff --git a/xcode/PlayerUI/MockFlows/action/action-transition-to-end.json b/xcode/PlayerUI/MockFlows/action/action-transition-to-end.json deleted file mode 100644 index 409494495..000000000 --- a/xcode/PlayerUI/MockFlows/action/action-transition-to-end.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "id": "generated-flow", - "views": [ - { - "id": "collection", - "type": "collection", - "values": [ - { - "asset": { - "id": "action-good", - "type": "action", - "value": "Next", - "label": { - "asset": { - "id": "action-good-label", - "type": "text", - "value": "End the flow (success)" - } - } - } - }, - { - "asset": { - "id": "action-bad", - "type": "action", - "exp": "{{foo.bar..}", - "label": { - "asset": { - "id": "action-bad-label", - "type": "text", - "value": "End the flow (error)" - } - } - } - } - ] - } - ], - "data": {}, - "navigation": { - "BEGIN": "FLOW_1", - "FLOW_1": { - "startState": "VIEW_1", - "VIEW_1": { - "state_type": "VIEW", - "ref": "collection", - "transitions": { - "*": "END_Done" - } - }, - "END_Done": { - "state_type": "END", - "outcome": "done" - } - } - } -} \ No newline at end of file diff --git a/xcode/PlayerUI/MockFlows/collection/collection-basic.json b/xcode/PlayerUI/MockFlows/collection/collection-basic.json deleted file mode 100644 index a3845443a..000000000 --- a/xcode/PlayerUI/MockFlows/collection/collection-basic.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "id": "generated-flow", - "views": [ - { - "id": "collection", - "type": "collection", - "values": [ - { - "asset": { - "id": "col-1", - "type": "text", - "value": "Item 1" - } - }, - { - "asset": { - "id": "col-2", - "type": "text", - "value": "Item 2" - } - } - ] - } - ], - "data": {}, - "navigation": { - "BEGIN": "FLOW_1", - "FLOW_1": { - "startState": "VIEW_1", - "VIEW_1": { - "state_type": "VIEW", - "ref": "collection", - "transitions": { - "*": "END_Done" - } - }, - "END_Done": { - "state_type": "END", - "outcome": "done" - } - } - } -} \ No newline at end of file diff --git a/xcode/PlayerUI/MockFlows/info/info-dynamic-flow.json b/xcode/PlayerUI/MockFlows/info/info-dynamic-flow.json deleted file mode 100644 index 3d2ed3976..000000000 --- a/xcode/PlayerUI/MockFlows/info/info-dynamic-flow.json +++ /dev/null @@ -1,168 +0,0 @@ -{ - "id": "modal-flow", - "views": [ - { - "id": "view-1", - "type": "info", - "title": { - "asset": { - "id": "view-title", - "type": "text", - "value": "View 1" - } - }, - "actions": [ - { - "asset": { - "id": "action-1", - "type": "action", - "value": "Next", - "label": { - "asset": { - "id": "action-1-label", - "type": "text", - "value": "Next" - } - } - } - } - ] - }, - { - "id": "view-2", - "type": "info", - "title": { - "asset": { - "id": "view-title", - "type": "text", - "value": "View 2" - } - }, - "actions": [ - { - "asset": { - "id": "action-1", - "type": "action", - "value": "Next", - "label": { - "asset": { - "id": "action-1-label", - "type": "text", - "value": "Next" - } - } - } - }, - { - "asset": { - "id": "action-2", - "type": "action", - "value": "Dismiss", - "label": { - "asset": { - "id": "action-1-label", - "type": "text", - "value": "Dismiss" - } - } - } - } - ] - }, - { - "id": "view-3", - "type": "info", - "title": { - "asset": { - "id": "view-3-title", - "type": "text", - "value": "View 3" - } - }, - "actions": [ - { - "asset": { - "id": "action-3", - "type": "action", - "value": "Next", - "label": { - "asset": { - "id": "action-3-label", - "type": "text", - "value": "Next" - } - } - } - } - ] - }, - { - "id": "view-4", - "type": "info", - "title": { - "asset": { - "id": "view-4-title", - "type": "text", - "value": "View 4" - } - }, - "actions": [ - { - "asset": { - "id": "action-4", - "type": "action", - "value": "Next", - "label": { - "asset": { - "id": "action-4-label", - "type": "text", - "value": "Next" - } - } - } - } - ] - } - ], - "data": { - "viewRef": "VIEW_3" - }, - "navigation": { - "BEGIN": "FLOW_1", - "FLOW_1": { - "startState": "VIEW_1", - "VIEW_1": { - "state_type": "VIEW", - "ref": "view-1", - "transitions": { - "*": "VIEW_2" - } - }, - "VIEW_2": { - "state_type": "VIEW", - "ref": "view-2", - "attributes": { - "stacked": true - }, - "transitions": { - "Next": "{{viewRef}}", - "Dismiss": "VIEW_1" - } - }, - "VIEW_3": { - "state_type": "VIEW", - "ref": "view-3", - "transitions": { - "*": "VIEW_1" - } - }, - "VIEW_4": { - "state_type": "VIEW", - "ref": "view-4", - "transitions": { - "*": "VIEW_1" - } - } - } - } -} \ No newline at end of file diff --git a/xcode/PlayerUI/MockFlows/info/info-modal-flow.json b/xcode/PlayerUI/MockFlows/info/info-modal-flow.json deleted file mode 100644 index 53adda586..000000000 --- a/xcode/PlayerUI/MockFlows/info/info-modal-flow.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "id": "modal-flow", - "views": [ - { - "id": "view-1", - "type": "info", - "title": { - "asset": { - "id": "view-title", - "type": "text", - "value": "View 1" - } - }, - "actions": [ - { - "asset": { - "id": "action-1", - "type": "action", - "value": "Next", - "label": { - "asset": { - "id": "action-1-label", - "type": "text", - "value": "Next" - } - } - } - } - ] - }, - { - "id": "view-2", - "type": "info", - "title": { - "asset": { - "id": "view-title", - "type": "text", - "value": "View 2" - } - }, - "actions": [ - { - "asset": { - "id": "action-1", - "type": "action", - "value": "Next", - "label": { - "asset": { - "id": "action-1-label", - "type": "text", - "value": "Next" - } - } - } - }, - { - "asset": { - "id": "action-2", - "type": "action", - "value": "Dismiss", - "label": { - "asset": { - "id": "action-1-label", - "type": "text", - "value": "Dismiss" - } - } - } - } - ] - }, - { - "id": "view-3", - "type": "info", - "title": { - "asset": { - "id": "view-3-title", - "type": "text", - "value": "View 3" - } - }, - "actions": [ - { - "asset": { - "id": "action-3", - "type": "action", - "value": "Next", - "label": { - "asset": { - "id": "action-3-label", - "type": "text", - "value": "Next" - } - } - } - } - ] - } - ], - "navigation": { - "BEGIN": "FLOW_1", - "FLOW_1": { - "startState": "VIEW_1", - "VIEW_1": { - "state_type": "VIEW", - "ref": "view-1", - "transitions": { - "*": "VIEW_2" - } - }, - "VIEW_2": { - "state_type": "VIEW", - "ref": "view-2", - "attributes": { - "stacked": true - }, - "transitions": { - "Next": "VIEW_3", - "Dismiss": "VIEW_1" - } - }, - "VIEW_3": { - "state_type": "VIEW", - "ref": "view-3", - "transitions": { - "*": "VIEW_1" - } - } - } - } -} \ No newline at end of file diff --git a/xcode/PlayerUI/MockFlows/input/input-basic.json b/xcode/PlayerUI/MockFlows/input/input-basic.json deleted file mode 100644 index a22298da9..000000000 --- a/xcode/PlayerUI/MockFlows/input/input-basic.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "id": "generated-flow", - "views": [ - { - "id": "input", - "type": "input", - "binding": "foo.bar", - "label": { - "asset": { - "id": "input-label", - "type": "text", - "value": "This is an input" - } - } - } - ], - "data": {}, - "navigation": { - "BEGIN": "FLOW_1", - "FLOW_1": { - "startState": "VIEW_1", - "VIEW_1": { - "state_type": "VIEW", - "ref": "input", - "transitions": { - "*": "END_Done" - } - }, - "END_Done": { - "state_type": "END", - "outcome": "done" - } - } - } -} \ No newline at end of file diff --git a/xcode/PlayerUI/MockFlows/input/input-validation.json b/xcode/PlayerUI/MockFlows/input/input-validation.json deleted file mode 100644 index ee1e3b8ef..000000000 --- a/xcode/PlayerUI/MockFlows/input/input-validation.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "id": "generated-flow", - "views": [ - { - "id": "view-1", - "type": "collection", - "values": [ - { - "asset": { - "id": "input-1", - "type": "input", - "binding": "person.age", - "label": { - "asset": { - "id": "input-1-label", - "type": "text", - "value": "Age" - } - } - } - }, - { - "asset": { - "id": "input-2", - "type": "input", - "binding": "person.name", - "label": { - "asset": { - "id": "input-2-label", - "type": "text", - "value": "Name" - } - } - } - }, - { - "asset": { - "id": "values", - "type": "text", - "value": "Name: \"{{person.name}}\". Age: \"{{person.age}}\"" - } - } - ] - } - ], - "data": {}, - "navigation": { - "BEGIN": "FLOW_1", - "FLOW_1": { - "startState": "VIEW_1", - "VIEW_1": { - "state_type": "VIEW", - "ref": "view-1", - "transitions": { - "*": "END_Done" - } - }, - "END_Done": { - "state_type": "END", - "outcome": "done" - } - } - }, - "schema": { - "ROOT": { - "person": { - "type": "PersonType" - } - }, - "PersonType": { - "age": { - "type": "IntegerType" - }, - "name": { - "type": "StringType", - "validation": [ - { - "type": "length", - "min": 1, - "max": 10 - } - ] - } - } - } -} \ No newline at end of file diff --git a/xcode/PlayerUI/MockFlows/text/text-basic.json b/xcode/PlayerUI/MockFlows/text/text-basic.json deleted file mode 100644 index a26855473..000000000 --- a/xcode/PlayerUI/MockFlows/text/text-basic.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "id": "generated-flow", - "views": [ - { - "id": "text", - "type": "text", - "value": "Some text content" - } - ], - "data": {}, - "navigation": { - "BEGIN": "FLOW_1", - "FLOW_1": { - "startState": "VIEW_1", - "VIEW_1": { - "state_type": "VIEW", - "ref": "text", - "transitions": { - "*": "END_Done" - } - }, - "END_Done": { - "state_type": "END", - "outcome": "done" - } - } - } -} \ No newline at end of file diff --git a/xcode/PlayerUI/MockFlows/text/text-with-link.json b/xcode/PlayerUI/MockFlows/text/text-with-link.json deleted file mode 100644 index 3f719d186..000000000 --- a/xcode/PlayerUI/MockFlows/text/text-with-link.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "id": "generated-flow", - "views": [ - { - "id": "text", - "type": "text", - "value": "A Link", - "modifiers": [ - { - "type": "link", - "metaData": { - "mime-type": "text/html", - "ref": "http://www.intuit.com" - } - } - ] - } - ], - "data": {}, - "navigation": { - "BEGIN": "FLOW_1", - "FLOW_1": { - "startState": "VIEW_1", - "VIEW_1": { - "state_type": "VIEW", - "ref": "text", - "transitions": { - "*": "END_Done" - } - }, - "END_Done": { - "state_type": "END", - "outcome": "done" - } - } - } -} \ No newline at end of file diff --git a/xcode/PlayerUI/ViewControllers/FlowViewController.swift b/xcode/PlayerUI/ViewControllers/FlowViewController.swift deleted file mode 100644 index e2d72b6fd..000000000 --- a/xcode/PlayerUI/ViewControllers/FlowViewController.swift +++ /dev/null @@ -1,90 +0,0 @@ -// -// ViewController.swift -// PlayerUI -// -// Created by Borawski, Harris on 2/18/20. -// Copyright © 2020 Intuit, Inc. All rights reserved. -// - -import UIKit -import PlayerUI - -class FlowViewController: UIViewController { - @IBOutlet weak var outputLabel: UILabel! - - @IBOutlet weak var outputView: UIScrollView! - - var refreshButton: UIBarButtonItem? - - var flow: String? - - var player: Player? - - override func viewDidLoad() { - super.viewDidLoad() - - refreshButton = UIBarButtonItem(barButtonSystemItem: .refresh, target: self, action: #selector(startFlow)) - - player = Player( - plugins: [ - ReferenceAssetsPlugin(), - CommonTypesPlugin(), - BeaconPlugin(onBeacon: { - print(String(describing: $0)) - }) - ] - ) - - outputView.delegate = player - - guard let player = player else { return } - player.accessibilityIdentifier = "player-view" - player.logLevel = .trace - outputView.addSubview(player) - player.translatesAutoresizingMaskIntoConstraints = false - let height = player.heightAnchor.constraint(lessThanOrEqualTo: self.outputView.heightAnchor) - height.priority = UILayoutPriority(250) - NSLayoutConstraint.activate([ - player.topAnchor.constraint(equalTo: self.outputView.topAnchor, constant: 16), - player.leadingAnchor.constraint(equalTo: self.outputView.leadingAnchor, constant: 16), - player.trailingAnchor.constraint(equalTo: self.outputView.trailingAnchor, constant: -16), - player.bottomAnchor.constraint(equalTo: self.outputView.bottomAnchor, constant: -16), - player.widthAnchor.constraint(equalTo: self.outputView.widthAnchor, constant: -32), - height - ]) - player.alpha = 0 - startFlow() - } - - @objc func startFlow() { - guard let flow = flow else { return } - - outputView.layoutIfNeeded() - player?.start(flow: flow, viewDidLayout: { [weak self] in - self?.outputView.layoutSubviews() - self?.outputView.layoutIfNeeded() - UIView.animate(withDuration: 0.3) { - self?.player?.alpha = 1.0 - } - }) { [weak self] result in - switch result { - case .success(let result): - self?.showAlert(message: result.endState?.outcome ?? "") - case .failure(let error): - self?.showAlert(message: error.localizedDescription, error: true) - } - } - - navigationItem.rightBarButtonItem = nil - } - - func showAlert(message: String, error: Bool = false) { - let alertController = UIAlertController(title: error ? "Flow Error" : "Flow Finished", message: message, preferredStyle: .alert) - alertController.view.accessibilityIdentifier = "FlowFinished" - alertController.addAction(UIAlertAction(title: "Done", style: .default, handler: { [weak self] _ in - self?.navigationItem.rightBarButtonItem = self?.refreshButton - alertController.dismiss(animated: true, completion: nil) - })) - present(alertController, animated: true, completion: nil) - } -} diff --git a/xcode/PlayerUI_Example.entitlements b/xcode/PlayerUI_Example.entitlements deleted file mode 100644 index 0c67376eb..000000000 --- a/xcode/PlayerUI_Example.entitlements +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/xcode/PlayerUI_ExampleDebug.entitlements b/xcode/PlayerUI_ExampleDebug.entitlements deleted file mode 100644 index 0c67376eb..000000000 --- a/xcode/PlayerUI_ExampleDebug.entitlements +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/xcode/PlayerUI_ExampleUITests/Info.plist b/xcode/PlayerUI_ExampleUITests/Info.plist deleted file mode 100644 index e622dd662..000000000 --- a/xcode/PlayerUI_ExampleUITests/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - $(PRODUCT_BUNDLE_PACKAGE_TYPE) - CFBundleShortVersionString - 1.0 - CFBundleVersion - 235 - - diff --git a/xcode/PlayerUI_ExampleUITests/Placeholder.swift b/xcode/PlayerUI_ExampleUITests/Placeholder.swift deleted file mode 100644 index 919c044be..000000000 --- a/xcode/PlayerUI_ExampleUITests/Placeholder.swift +++ /dev/null @@ -1,9 +0,0 @@ -// -// Placeholder.swift -// PlayerUI_ExampleUITests -// -// Created by Harris Borawski on 12/2/21. -// Copyright © 2021 CocoaPods. All rights reserved. -// - -import Foundation diff --git a/xcode/PlayerUI_ExampleUITests/PlayerUI_ExampleUITests-Bridging-Header.h b/xcode/PlayerUI_ExampleUITests/PlayerUI_ExampleUITests-Bridging-Header.h deleted file mode 100644 index 1b2cb5d6d..000000000 --- a/xcode/PlayerUI_ExampleUITests/PlayerUI_ExampleUITests-Bridging-Header.h +++ /dev/null @@ -1,4 +0,0 @@ -// -// Use this file to import your target's public headers that you would like to expose to Swift. -// - diff --git a/xcode/Podfile b/xcode/Podfile deleted file mode 100644 index 63f0e57ba..000000000 --- a/xcode/Podfile +++ /dev/null @@ -1,94 +0,0 @@ -use_frameworks! -platform :ios, '14.0' -source 'https://cdn.cocoapods.org' - -target 'PlayerUI_Example' do - pod 'SwiftLint', '0.42.0' - - # Main - pod 'PlayerUI', :path => '../', :appspecs => ['Demo'], :testspecs => ['Unit', 'ViewInspectorTests', 'XCUITests'] - - # Packages - pod 'PlayerUI/Core', :path => '../' - pod 'PlayerUI/TestUtilitiesCore', :path => '../' - pod 'PlayerUI/TestUtilities', :path => '../' - pod 'PlayerUI/ReferenceAssets', :path => '../' - pod 'PlayerUI/SwiftUI', :path => '../' - pod 'PlayerUI/Logger', :path => '../' - - # Plugins - pod 'PlayerUI/BeaconPlugin', :path => '../' - pod 'PlayerUI/CheckPathPlugin', :path => '../' - pod 'PlayerUI/CommonTypesPlugin', :path => '../' - pod 'PlayerUI/CommonExpressionsPlugin', :path => '../' - pod 'PlayerUI/ComputedPropertiesPlugin', :path => '../' - pod 'PlayerUI/ExpressionPlugin', :path => '../' - pod 'PlayerUI/ExternalActionPlugin', :path => '../' - pod 'PlayerUI/ExternalActionViewModifierPlugin', :path => '../' - pod 'PlayerUI/MetricsPlugin', :path => '../' - pod 'PlayerUI/PrintLoggerPlugin', :path => '../' - pod 'PlayerUI/PubSubPlugin', :path => '../' - pod 'PlayerUI/StageRevertDataPlugin', :path => '../' - pod 'PlayerUI/SwiftUICheckPathPlugin', :path => '../' - pod 'PlayerUI/SwiftUIPendingTransactionPlugin', :path => '../' - pod 'PlayerUI/TransitionPlugin', :path => '../' - pod 'PlayerUI/TypesProviderPlugin', :path => '../' - - target 'PlayerUI_Tests' do - inherit! :search_paths - end - target 'PlayerUI_ExampleUITests' do - pod 'EyesXCUI' - end -end - -plugin 'cocoapods-resource-bundle-copier', { - 'bazelCommand' => 'bazel shutdown && bazel', - 'resource_map' => { - # Core - "PlayerUI/PlayerUI" => { - 'targets' => [ - { - 'target' => "//core/player:Player_Bundles_bundle_prod", - 'files' => ['player.prod.js'] - }, - { - 'target' => "//plugins/partial-match-fingerprint/core:PartialMatchFingerprintPlugin_Bundles_bundle_prod", - 'files' => ['partial-match-fingerprint-plugin.prod.js'] - }, - { - 'target' => "//core/partial-match-registry:Registry_Bundles_bundle_prod", - 'files' => ['partial-match-registry.prod.js'] - }, - ] - }, - "PlayerUI/TestUtilities" => {'target' => "//core/make-flow:MakeFlow_Bundles_bundle_prod", 'files' => ['make-flow.prod.js']}, - "PlayerUI/ReferenceAssets" => {'target' => "//plugins/reference-assets/core:ReferenceAssetsPlugin_Bundles_bundle_prod", 'files' => ['reference-assets-plugin.prod.js']}, - - # Plugins - "PlayerUI/BaseBeaconPlugin" => {'target' => "//plugins/beacon/core:BeaconPlugin_Bundles_bundle_prod", 'files' => ['beacon-plugin.prod.js']}, - "PlayerUI/CommonTypesPlugin" => {'target' => "//plugins/common-types/core:CommonTypesPlugin_Bundles_bundle_prod", 'files' => ['common-types-plugin.prod.js']}, - "PlayerUI/CheckPathPlugin" => {'target' => "//plugins/check-path/core:CheckPathPlugin_Bundles_bundle_prod", 'files' => ['check-path-plugin.prod.js']}, - "PlayerUI/CommonExpressionsPlugin" => {'target' => "//plugins/common-expressions/core:CommonExpressionsPlugin_Bundles_bundle_prod", 'files' => ['common-expressions-plugin.prod.js']}, - "PlayerUI/ComputedPropertiesPlugin" => {'target' => "//plugins/computed-properties/core:ComputedPropertiesPlugin_Bundles_bundle_prod", 'files' => ['computed-properties-plugin.prod.js']}, - "PlayerUI/ExpressionPlugin" => {'target' => "//plugins/expression/core:ExpressionPlugin_Bundles_bundle_prod", 'files' => ['expression-plugin.prod.js']}, - "PlayerUI/ExternalActionPlugin" => {'target' => "//plugins/external-action/core:ExternalActionPlugin_Bundles_bundle_prod", 'files' => ['external-action-plugin.prod.js']}, - "PlayerUI/MetricsPlugin" => {'target' => "//plugins/metrics/core:MetricsPlugin_Bundles_bundle_prod", 'files' => ['metrics-plugin.prod.js']}, - "PlayerUI/PubSubPlugin" => {'target' => "//plugins/pubsub/core:PubSubPlugin_Bundles_bundle_prod", 'files' => ['pubsub-plugin.prod.js']}, - "PlayerUI/TypesProviderPlugin" => {'target' => "//plugins/types-provider/core:TypesProviderPlugin_Bundles_bundle_prod", 'files' => ['types-provider-plugin.prod.js']}, - "PlayerUI/StageRevertDataPlugin" => {'target' => "//plugins/stage-revert-data/core:StageRevertDataPlugin_Bundles_bundle_prod", 'files' => ['stage-revert-data-plugin.prod.js']}, - } -} - -plugin 'cocoapods-bazel', { - rules: { - 'apple_framework' => { load: '@build_bazel_rules_ios//rules:framework.bzl', rule: 'apple_framework' }.freeze, - 'ios_application' => { load: '@build_bazel_rules_ios//rules:app.bzl', rule: 'ios_application' }.freeze, - 'ios_unit_test' => { load: '@build_bazel_rules_ios//rules:test.bzl', rule: 'ios_unit_test' }.freeze, - 'ios_ui_test' => { load: '@build_bazel_rules_ios//rules:test.bzl', rule: 'ios_ui_test' }.freeze - }.freeze, - features: { - external_repository: true, - generate_macro: true - } -} diff --git a/xcode/Podfile.lock b/xcode/Podfile.lock deleted file mode 100644 index c93c82995..000000000 --- a/xcode/Podfile.lock +++ /dev/null @@ -1,143 +0,0 @@ -PODS: - - EyesXCUI (8.8.8) - - PlayerUI (0.0.1-placeholder): - - PlayerUI/Main (= 0.0.1-placeholder) - - PlayerUI/BaseBeaconPlugin (0.0.1-placeholder): - - PlayerUI/Core - - PlayerUI/BeaconPlugin (0.0.1-placeholder): - - PlayerUI/BaseBeaconPlugin - - PlayerUI/Core - - PlayerUI/SwiftUI - - PlayerUI/CheckPathPlugin (0.0.1-placeholder): - - PlayerUI/Core - - PlayerUI/CommonExpressionsPlugin (0.0.1-placeholder): - - PlayerUI/Core - - PlayerUI/CommonTypesPlugin (0.0.1-placeholder): - - PlayerUI/Core - - PlayerUI/ComputedPropertiesPlugin (0.0.1-placeholder): - - PlayerUI/Core - - PlayerUI/Core (0.0.1-placeholder): - - PlayerUI/Logger - - SwiftHooks (>= 0.1.0, ~> 0) - - PlayerUI/Demo (0.0.1-placeholder): - - PlayerUI/BeaconPlugin - - PlayerUI/MetricsPlugin - - PlayerUI/ReferenceAssets - - PlayerUI/SwiftUI - - PlayerUI/TransitionPlugin - - PlayerUI/ExpressionPlugin (0.0.1-placeholder): - - PlayerUI/Core - - PlayerUI/ExternalActionPlugin (0.0.1-placeholder): - - PlayerUI/Core - - PlayerUI/ExternalActionViewModifierPlugin (0.0.1-placeholder): - - PlayerUI/Core - - PlayerUI/ExternalActionPlugin - - PlayerUI/SwiftUI - - PlayerUI/InternalUnitTestUtilities (0.0.1-placeholder): - - PlayerUI/Core - - PlayerUI/Logger (0.0.1-placeholder): - - SwiftHooks (>= 0.1.0, ~> 0) - - PlayerUI/Main (0.0.1-placeholder): - - PlayerUI/SwiftUI - - PlayerUI/MetricsPlugin (0.0.1-placeholder): - - PlayerUI/Core - - PlayerUI/SwiftUI - - PlayerUI/PrintLoggerPlugin (0.0.1-placeholder): - - PlayerUI/Core - - PlayerUI/PubSubPlugin (0.0.1-placeholder): - - PlayerUI/Core - - PlayerUI/ReferenceAssets (0.0.1-placeholder): - - PlayerUI/BeaconPlugin - - PlayerUI/Core - - PlayerUI/SwiftUI - - PlayerUI/StageRevertDataPlugin (0.0.1-placeholder): - - PlayerUI/Core - - PlayerUI/SwiftUI (0.0.1-placeholder): - - PlayerUI/Core - - PlayerUI/SwiftUICheckPathPlugin (0.0.1-placeholder): - - PlayerUI/CheckPathPlugin - - PlayerUI/Core - - PlayerUI/SwiftUI - - PlayerUI/SwiftUIPendingTransactionPlugin (0.0.1-placeholder): - - PlayerUI/Core - - PlayerUI/SwiftUI - - PlayerUI/TestUtilities (0.0.1-placeholder): - - PlayerUI/Core - - PlayerUI/SwiftUI - - PlayerUI/TestUtilitiesCore - - PlayerUI/TestUtilitiesCore (0.0.1-placeholder): - - PlayerUI/Core - - PlayerUI/SwiftUI - - PlayerUI/TransitionPlugin (0.0.1-placeholder): - - PlayerUI/Core - - PlayerUI/SwiftUI - - PlayerUI/TypesProviderPlugin (0.0.1-placeholder): - - PlayerUI/Core - - PlayerUI/Unit (0.0.1-placeholder): - - PlayerUI/Demo - - PlayerUI/InternalUnitTestUtilities - - PlayerUI/TestUtilities - - PlayerUI/ViewInspectorTests (0.0.1-placeholder): - - PlayerUI/Demo - - PlayerUI/InternalUnitTestUtilities - - ViewInspector (= 0.9.0) - - PlayerUI/XCUITests (0.0.1-placeholder): - - EyesXCUI (= 8.8.8) - - PlayerUI/Demo - - PlayerUI/InternalUnitTestUtilities - - SwiftHooks (0.1.0) - - SwiftLint (0.42.0) - - ViewInspector (0.9.0) - -DEPENDENCIES: - - EyesXCUI - - PlayerUI (from `../`) - - PlayerUI/BeaconPlugin (from `../`) - - PlayerUI/CheckPathPlugin (from `../`) - - PlayerUI/CommonExpressionsPlugin (from `../`) - - PlayerUI/CommonTypesPlugin (from `../`) - - PlayerUI/ComputedPropertiesPlugin (from `../`) - - PlayerUI/Core (from `../`) - - PlayerUI/Demo (from `../`) - - PlayerUI/ExpressionPlugin (from `../`) - - PlayerUI/ExternalActionPlugin (from `../`) - - PlayerUI/ExternalActionViewModifierPlugin (from `../`) - - PlayerUI/Logger (from `../`) - - PlayerUI/MetricsPlugin (from `../`) - - PlayerUI/PrintLoggerPlugin (from `../`) - - PlayerUI/PubSubPlugin (from `../`) - - PlayerUI/ReferenceAssets (from `../`) - - PlayerUI/StageRevertDataPlugin (from `../`) - - PlayerUI/SwiftUI (from `../`) - - PlayerUI/SwiftUICheckPathPlugin (from `../`) - - PlayerUI/SwiftUIPendingTransactionPlugin (from `../`) - - PlayerUI/TestUtilities (from `../`) - - PlayerUI/TestUtilitiesCore (from `../`) - - PlayerUI/TransitionPlugin (from `../`) - - PlayerUI/TypesProviderPlugin (from `../`) - - PlayerUI/Unit (from `../`) - - PlayerUI/ViewInspectorTests (from `../`) - - PlayerUI/XCUITests (from `../`) - - SwiftLint (= 0.42.0) - -SPEC REPOS: - trunk: - - EyesXCUI - - SwiftHooks - - SwiftLint - - ViewInspector - -EXTERNAL SOURCES: - PlayerUI: - :path: "../" - -SPEC CHECKSUMS: - EyesXCUI: bbb10a48b8bd1a15d541f2bc1f4d18f4db654ef1 - PlayerUI: 7b9bdbf01b4da672a0b6be1281f7b70e134d4e3c - SwiftHooks: 3ecc67c23da335d44914a8a74bd1dd23c7c149e6 - SwiftLint: 4fa9579c63416865179bc416f0a92d55f009600d - ViewInspector: 53313c757eddc5c4842bc7943a66821a68d02d3e - -PODFILE CHECKSUM: 686834ace47c0cba292c80557dcd114a09d0f180 - -COCOAPODS: 1.11.3 diff --git a/xcode/Tests/Info.plist b/xcode/Tests/Info.plist deleted file mode 100644 index 4f53e0933..000000000 --- a/xcode/Tests/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 235 - -