diff --git a/Makefile b/Makefile index f8c3661..ab2691d 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ PREFIX?=/usr/local PRODUCT_NAME=analyticsgen -PRODUCT_VERSION=0.6.9 +PRODUCT_VERSION=0.6.10 TEMPLATES_NAME=Templates README_NAME=README.md LICENSE_NAME=LICENSE diff --git a/Sources/AnalyticsGen/Generators/Event/DefaultEventGenerator.swift b/Sources/AnalyticsGen/Generators/Event/DefaultEventGenerator.swift index af9a099..909519a 100644 --- a/Sources/AnalyticsGen/Generators/Event/DefaultEventGenerator.swift +++ b/Sources/AnalyticsGen/Generators/Event/DefaultEventGenerator.swift @@ -143,7 +143,18 @@ final class DefaultEventGenerator: EventGenerator { hasParametersToInit: !internalEvent .parameters .filter { !$0.type.oneOf.isNil || !$0.type.swiftType.isNil } - .isEmpty + .isEmpty, + isForDesignSystem: event.isForDesignSystem ?? false, + isDesignSystem: event.isDesignSystem ?? false, + hhtmSource: internalEvent.hhtmSource.map { hhtmSource in + InternalEventContext.Parameter( + name: hhtmSource.name, + description: hhtmSource.description, + oneOf: hhtmSource.type.oneOf, + const: hhtmSource.type.const, + type: hhtmSource.type.swiftType + ) + } ) ) } diff --git a/Sources/AnalyticsGen/Generators/Event/InternalEventContext.swift b/Sources/AnalyticsGen/Generators/Event/InternalEventContext.swift index 48977db..e0b3fb1 100644 --- a/Sources/AnalyticsGen/Generators/Event/InternalEventContext.swift +++ b/Sources/AnalyticsGen/Generators/Event/InternalEventContext.swift @@ -38,4 +38,7 @@ struct InternalEventContext: Encodable { let schemePath: String let parameters: [Parameter]? let hasParametersToInit: Bool + let isForDesignSystem: Bool + let isDesignSystem: Bool + let hhtmSource: Parameter? } diff --git a/Sources/AnalyticsGen/Models/Event/Event.swift b/Sources/AnalyticsGen/Models/Event/Event.swift index c867482..feb9f4b 100644 --- a/Sources/AnalyticsGen/Models/Event/Event.swift +++ b/Sources/AnalyticsGen/Models/Event/Event.swift @@ -13,4 +13,6 @@ struct Event: Decodable { let external: ExternalEvent? let `internal`: InternalEvent? let name: String + let isForDesignSystem: Bool? + let isDesignSystem: Bool? } diff --git a/Sources/AnalyticsGen/Models/Event/Internal/InternalEvent.swift b/Sources/AnalyticsGen/Models/Event/Internal/InternalEvent.swift index 468726e..c6d9413 100644 --- a/Sources/AnalyticsGen/Models/Event/Internal/InternalEvent.swift +++ b/Sources/AnalyticsGen/Models/Event/Internal/InternalEvent.swift @@ -49,6 +49,7 @@ struct InternalEvent: Decodable { let platform: EventPlatform? let sql: String? let parameters: [InternalEventParameter] + let hhtmSource: InternalEventParameter? // MARK: - @@ -66,6 +67,7 @@ struct InternalEvent: Decodable { self.event = try container.decode(forKey: .event) self.platform = try container.decodeIfPresent(forKey: .platform) self.sql = try container.decodeIfPresent(forKey: .sql) + self.hhtmSource = try container.decodeIfPresent(forKey: .hhtmSource) self.parameters = try container .allKeys diff --git a/Sources/AnalyticsGen/main.swift b/Sources/AnalyticsGen/main.swift index feacd57..76e9066 100644 --- a/Sources/AnalyticsGen/main.swift +++ b/Sources/AnalyticsGen/main.swift @@ -20,6 +20,6 @@ private extension String { // MARK: - Type Properties - static let version = "0.6.9" + static let version = "0.6.10" static let description = "Generate analytics code for you Swift iOS project" }