klaviyo / klaviyo-swift-sdk

SDK that allows users to incorporate Klaviyo's event and person tracking functionality within iOS applications. Written in Swift.
MIT License
10 stars 10 forks source link

fix event names #126

Closed ndurell closed 5 months ago

ndurell commented 6 months ago

Description

We used inccorect event names in some cases. This should fix the names to be more in line with other Klaviyo SDKs. These names will also look better in Klaviyo.

Check List

Manual Test Plan

1.

Supporting Materials

evan-masseau commented 6 months ago

Maybe worth adding "missing" types in the same release https://github.com/klaviyo/klaviyo-swift-sdk/issues/119

evan-masseau commented 6 months ago

Would this work for namespacing the event names?


public struct Event: Equatable {
    private enum EventName: Equatable {}

    public struct V1 {
        public enum EventName: EventName {
            case OpenedPush
            case ViewedProduct
            case CustomEvent(String)
        }
    }

    public struct V2 {
        public enum EventName: EventName {
            case OpenedPush
            case ViewedProduct
            case CustomEvent(String)
        }
    }

and


extension Event.V1.EventName {
    var value: String {
        switch self {
        case .OpenedPush: return "$opened_push"
        case .ViewedProduct: return "$viewed_product"
        case let .CustomEvent(value): return "\(value)"
        }
    }
}

extension Event.V2.EventName {
    var value: String {
        switch self {
        case .OpenedPush: return "$opened_push"
        case .ViewedProduct: return "Viewed Product"
        case let .CustomEvent(value): return "\(value)"
        }
    }
}
evan-masseau commented 6 months ago

Never mind, my XCode was broken, that idea doesn't even compile

evan-masseau commented 5 months ago

This PR needs to be split up now, into a non-breaking deprecation for a minor version release, and a breaking change for major release.

ajaysubra commented 5 months ago

This PR needs to be split up now, into a non-breaking deprecation for a minor version release, and a breaking change for major release.

I can help with this if you have not already started on it.

evan-masseau commented 5 months ago

Superceded by #138 and #139