Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## [Unreleased]

- Fix `native_type` replacing `Long`/`Boolean` substrings inside custom type names (e.g. `FlyoverLongPressAction` → `FlyoverIntPressAction`)

## [0.8.4] - 2026-06-25

- Add trailing commas to all generated Kotlin declarations
Expand Down
4 changes: 2 additions & 2 deletions lib/evva/swift_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ def template_from(path)

def native_type(type)
type
.gsub("Boolean","Bool")
.gsub("Long", "Int")
.gsub(/\bBoolean\b/, "Bool")
.gsub(/\bLong\b/, "Int")
end

def special_property?(type)
Expand Down
10 changes: 10 additions & 0 deletions spec/lib/evva/swift_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
Evva::AnalyticsEvent.new("cp_page_view_b", { course_id: "Long", course_name: "String", from_screen: "CourseProfileSource" }, []),
Evva::AnalyticsEvent.new("cp_page_view_c", { course_id: "Long", course_name: "String", from_screen: "CourseProfileSource?" }, []),
Evva::AnalyticsEvent.new("cp_page_view_d", { course_id: "Long?", course_name: "String" }, []),
Evva::AnalyticsEvent.new("flyover_long_press_action_selected", { action: "FlyoverLongPressAction" }, ["firebase"]),
] }

let(:expected) {
Expand Down Expand Up @@ -41,6 +42,7 @@
case cpPageViewB = "cp_page_view_b"
case cpPageViewC = "cp_page_view_c"
case cpPageViewD = "cp_page_view_d"
case flyoverLongPressActionSelected = "flyover_long_press_action_selected"

var name: String { return rawValue }

Expand All @@ -51,6 +53,7 @@
case .cpPageViewB: return []
case .cpPageViewC: return []
case .cpPageViewD: return []
case .flyoverLongPressActionSelected: return [.firebase]
}
}
}
Expand All @@ -61,6 +64,7 @@
case cpPageViewB(course_id: Int, course_name: String, from_screen: CourseProfileSource)
case cpPageViewC(course_id: Int, course_name: String, from_screen: CourseProfileSource?)
case cpPageViewD(course_id: Int?, course_name: String)
case flyoverLongPressActionSelected(action: FlyoverLongPressAction)

var data: EventData {
switch self {
Expand Down Expand Up @@ -97,6 +101,12 @@
"course_id": course_id as Any,
"course_name": course_name as Any,
])

case let .flyoverLongPressActionSelected(action):
return EventData(type: .flyoverLongPressActionSelected,
properties: [
"action": action.rawValue as Any,
])
}
}
}
Expand Down
Loading