Skip to content

Commit 35d71a5

Browse files
authored
Design system event support (#88)
* added support for design system event * version up * добавил обработку * hhtmsource proxy * hhtmsource proxy * tmp
1 parent 5fcfa0d commit 35d71a5

6 files changed

Lines changed: 21 additions & 3 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PREFIX?=/usr/local
22

33
PRODUCT_NAME=analyticsgen
4-
PRODUCT_VERSION=0.6.9
4+
PRODUCT_VERSION=0.6.10
55
TEMPLATES_NAME=Templates
66
README_NAME=README.md
77
LICENSE_NAME=LICENSE

Sources/AnalyticsGen/Generators/Event/DefaultEventGenerator.swift

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,18 @@ final class DefaultEventGenerator: EventGenerator {
143143
hasParametersToInit: !internalEvent
144144
.parameters
145145
.filter { !$0.type.oneOf.isNil || !$0.type.swiftType.isNil }
146-
.isEmpty
146+
.isEmpty,
147+
isForDesignSystem: event.isForDesignSystem ?? false,
148+
isDesignSystem: event.isDesignSystem ?? false,
149+
hhtmSource: internalEvent.hhtmSource.map { hhtmSource in
150+
InternalEventContext.Parameter(
151+
name: hhtmSource.name,
152+
description: hhtmSource.description,
153+
oneOf: hhtmSource.type.oneOf,
154+
const: hhtmSource.type.const,
155+
type: hhtmSource.type.swiftType
156+
)
157+
}
147158
)
148159
)
149160
}

Sources/AnalyticsGen/Generators/Event/InternalEventContext.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,7 @@ struct InternalEventContext: Encodable {
3838
let schemePath: String
3939
let parameters: [Parameter]?
4040
let hasParametersToInit: Bool
41+
let isForDesignSystem: Bool
42+
let isDesignSystem: Bool
43+
let hhtmSource: Parameter?
4144
}

Sources/AnalyticsGen/Models/Event/Event.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ struct Event: Decodable {
1313
let external: ExternalEvent?
1414
let `internal`: InternalEvent?
1515
let name: String
16+
let isForDesignSystem: Bool?
17+
let isDesignSystem: Bool?
1618
}

Sources/AnalyticsGen/Models/Event/Internal/InternalEvent.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ struct InternalEvent: Decodable {
4949
let platform: EventPlatform?
5050
let sql: String?
5151
let parameters: [InternalEventParameter]
52+
let hhtmSource: InternalEventParameter?
5253

5354
// MARK: -
5455

@@ -66,6 +67,7 @@ struct InternalEvent: Decodable {
6667
self.event = try container.decode(forKey: .event)
6768
self.platform = try container.decodeIfPresent(forKey: .platform)
6869
self.sql = try container.decodeIfPresent(forKey: .sql)
70+
self.hhtmSource = try container.decodeIfPresent(forKey: .hhtmSource)
6971

7072
self.parameters = try container
7173
.allKeys

Sources/AnalyticsGen/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ private extension String {
2020

2121
// MARK: - Type Properties
2222

23-
static let version = "0.6.9"
23+
static let version = "0.6.10"
2424
static let description = "Generate analytics code for you Swift iOS project"
2525
}

0 commit comments

Comments
 (0)