Skip to content

Commit

Permalink
0.7.3 initial sync
Browse files Browse the repository at this point in the history
  • Loading branch information
hborawski committed Jun 7, 2024
0 parents commit e651edb
Show file tree
Hide file tree
Showing 123 changed files with 72,179 additions and 0 deletions.
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2022 Intuit

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.
162 changes: 162 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
// swift-tools-version: 5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

typealias SwiftPlugin = (name: String, path: String, resources: Bool)
typealias SwiftUIPlugin = (name: String, path: String, dependencies: [String], resources: Bool)

// Simple iOS plugins that just rely on PlayerUI and optionally JS resources
let ios_plugins: [SwiftPlugin] = [
(name: "BaseBeaconPlugin", path: "beacon", resources: true),
(name: "CheckPathPlugin", path: "check-path", resources: true),
(name: "CommonExpressionsPlugin", path: "common-expressions", resources: true),
(name: "CommonTypesPlugin", path: "common-types", resources: true),
(name: "ComputedPropertiesPlugin", path: "computed-properties", resources: true),
(name: "ExpressionPlugin", path: "expression", resources: true),
(name: "ExternalActionPlugin", path: "external-action", resources: true),
(name: "PubSubPlugin", path: "pubsub", resources: true),
(name: "StageRevertDataPlugin", path: "stage-revert-data", resources: true),
(name: "TypesProviderPlugin", path: "types-provider", resources: true),
(name: "PrintLoggerPlugin", path: "console-logger", resources: false)
]

// SwiftUI Plugins
let swiftui_plugins: [SwiftUIPlugin] = [
(name: "BeaconPlugin", path: "beacon", dependencies: ["BaseBeaconPlugin"], resources: false),
(name: "MetricsPlugin", path: "metrics", dependencies: [], resources: true),
(name: "SwiftUICheckPathPlugin", path: "check-path", dependencies: ["CheckPathPlugin"], resources: false),
(name: "ExternalActionViewModifierPlugin", path: "external-action", dependencies: ["ExternalActionPlugin"], resources: false),
(name: "SwiftUIPendingTransactionPlugin", path: "pending-transaction", dependencies: [], resources: false),
(name: "TransitionPlugin", path: "transition", dependencies: [], resources: false),
]

// Map plugins to Target / Product entries
let plugins: [(Target, Product)] = ios_plugins.map {
(
Target.swiftPlugin(plugin: $0),
Product.playerPlugin(name: $0.name)
)
} + swiftui_plugins.map {
(
Target.swiftuiPlugin(plugin: $0),
Product.playerPlugin(name: $0.name)
)
}

let package = Package(
name: "PlayerUI",
platforms: [
.iOS(.v14),
.macOS(.v11)
],
products: [
.playerPackage(name: "PlayerUI"),
.playerPackage(name: "PlayerUISwiftUI"),
.playerPackage(name: "PlayerUIReferenceAssets"),
.playerPackage(name: "PlayerUILogger"),
.playerPackage(name: "PlayerUITestUtilities"),
.playerPackage(name: "PlayerUITestUtilitiesCore"),
] + 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.map(\.0)
)


extension Product {
static func playerPlugin(name: String) -> Product {
playerPackage(name: "PlayerUI\(name)")
}
static func playerPackage(name: String) -> Product {
.library(name: name, targets: [name])
}
}
extension Target {
static func swiftPlugin(plugin: SwiftPlugin) -> Target {
let resources: [Resource] = plugin.resources ? [ .process("Resources") ] : []
return .target(
name: "PlayerUI\(plugin.name)",
dependencies: [
.target(name: "PlayerUI")
],
path: "plugins/\(plugin.path)/ios",
resources: resources
)
}

static func swiftuiPlugin(plugin: SwiftUIPlugin) -> Target {
let resources: [Resource] = plugin.resources ? [ .process("Resources") ] : []
return .target(
name: "PlayerUI\(plugin.name)",
dependencies: [
.target(name: "PlayerUI"),
.target(name: "PlayerUISwiftUI")
] + plugin.dependencies.map { Dependency.target(name: "PlayerUI\($0)") },
path: "plugins/\(plugin.path)/swiftui",
resources: resources
)
}
}
141 changes: 141 additions & 0 deletions PlayerUI.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# Be sure to run `pod lib lint PlayerUI.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#

Pod::Spec.new do |s|
s.name = 'PlayerUI'
s.version = '0.7.2'
s.summary = 'A native renderer for Player content'
s.swift_versions = ['5.1']
s.description = <<-DESC
This package is used to process semantic JSON in the Player format
and display it as a SwiftUI view comprised of registered assets.
DESC

s.homepage = 'https://github.com/player-ui/player'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'hborawski' => '[email protected]' }
s.source = { :http => "https://github.com/player-ui/player/releases/download/#{s.version.to_s}/PlayerUI_Pod.zip" }

s.ios.deployment_target = '14.0'

s.default_subspec = 'Main'

s.subspec 'Main' do |all|
all.dependency 'PlayerUI/SwiftUI'
end

# <PACKAGES>
s.subspec 'Core' do |core|
core.source_files = 'ios/core/Sources/**/*'
core.dependency 'SwiftHooks', '~> 0', '>= 0.1.0'
core.dependency 'PlayerUI/Logger'
core.resource_bundles = {
'PlayerUI' => ['ios/core/Resources/**/*.js']
}
end

s.subspec 'SwiftUI' do |swiftui|
swiftui.dependency 'PlayerUI/Core'

swiftui.source_files = 'ios/swiftui/Sources/**/*'
end

s.subspec 'Logger' do |pkg|
pkg.dependency 'SwiftHooks', '~> 0', '>= 0.1.0'
pkg.source_files = 'ios/logger/Sources/**/*'
end

s.subspec 'ReferenceAssets' do |assets|
assets.dependency 'PlayerUI/Core'
assets.dependency 'PlayerUI/SwiftUI'
assets.dependency 'PlayerUI/BeaconPlugin'
assets.dependency 'PlayerUI/SwiftUIPendingTransactionPlugin'

assets.source_files = 'plugins/reference-assets/swiftui/Sources/**/*'
assets.resource_bundles = {
'ReferenceAssets' => [
'plugins/reference-assets/swiftui/Resources/js/**/*.js',
'plugins/reference-assets/swiftui/Resources/svg/*.xcassets',
'plugins/reference-assets/swiftui/Resources/svg/*.xcassets/**/*'
]
}
end

s.subspec 'TestUtilitiesCore' do |utils|
utils.dependency 'PlayerUI/Core'
utils.dependency 'PlayerUI/SwiftUI'

utils.source_files = 'ios/test-utils-core/Sources/**/*'
utils.resource_bundles = {
'TestUtilities' => ['ios/test-utils-core/Resources/**/*.js']
}
end

s.subspec 'TestUtilities' do |utils|
utils.dependency 'PlayerUI/Core'
utils.dependency 'PlayerUI/SwiftUI'
utils.dependency 'PlayerUI/TestUtilitiesCore'

utils.source_files = 'ios/test-utils/Sources/**/*'

utils.weak_framework = 'XCTest'
utils.pod_target_xcconfig = {
'ENABLE_BITCODE' => 'NO',
'ENABLE_TESTING_SEARCH_PATHS' => 'YES'
}
end
# </PACKAGES>

ios_plugin = lambda { |name, path, resources|
s.subspec name do |subspec|
subspec.dependency 'PlayerUI/Core'
subspec.source_files = "plugins/#{path}/ios/Sources/**/*"
if resources == TRUE
subspec.resource_bundles = {
name => ["plugins/#{path}/ios/Resources/**/*.js"]
}
end
end
}

swiftui_plugin = lambda { |name, path, deps, resources|
s.subspec name do |subspec|
subspec.dependency 'PlayerUI/Core'
subspec.dependency 'PlayerUI/SwiftUI'
deps.each { |dep|
subspec.dependency "PlayerUI/#{dep}"
}
subspec.source_files = "plugins/#{path}/swiftui/Sources/**/*"
if resources == TRUE
subspec.resource_bundles = {
name => ["plugins/#{path}/swiftui/Resources/**/*.js"]
}
end
end
}

# <PLUGINS>
ios_plugin.call("BaseBeaconPlugin", "beacon", TRUE)
ios_plugin.call("CheckPathPlugin", "check-path", TRUE)
ios_plugin.call("CommonExpressionsPlugin", "common-expressions", TRUE)
ios_plugin.call("CommonTypesPlugin", "common-types", TRUE)
ios_plugin.call("ComputedPropertiesPlugin", "computed-properties", TRUE)
ios_plugin.call("ExpressionPlugin", "expression", TRUE)
ios_plugin.call("ExternalActionPlugin", "external-action", TRUE)
ios_plugin.call("PubSubPlugin", "pubsub", TRUE)
ios_plugin.call("StageRevertDataPlugin", "stage-revert-data", TRUE)
ios_plugin.call("TypesProviderPlugin", "types-provider", TRUE)
ios_plugin.call("PrintLoggerPlugin", "console-logger", FALSE)

swiftui_plugin.call("BeaconPlugin", "beacon", ["BaseBeaconPlugin"], FALSE)
swiftui_plugin.call("MetricsPlugin", "metrics", [], TRUE)
swiftui_plugin.call("SwiftUICheckPathPlugin", "check-path", ["CheckPathPlugin"], FALSE)
swiftui_plugin.call("ExternalActionViewModifierPlugin", "external-action", ["ExternalActionPlugin"], FALSE)
swiftui_plugin.call("SwiftUIPendingTransactionPlugin", "pending-transaction", [], FALSE)
swiftui_plugin.call("TransitionPlugin", "transition", [], FALSE)
# </PLUGINS>
end
57 changes: 57 additions & 0 deletions ios/core/Resources/dist/PartialMatchFingerprintPlugin.native.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e651edb

Please sign in to comment.