amplitude / Amplitude-Swift

Native iOS/tvOS/macOS/watchOS SDK
MIT License
32 stars 22 forks source link

`ampli status` does not understand cross package calls #170

Closed dsaliberti closed 4 months ago

dsaliberti commented 5 months ago

Hi all First of all apologies that this is surely not be the right repo, but I don't think the command line is open anyway

Summary

My point is quite simple:

I create my strongly typed events and pass it to my own AnalyticsClient which finally calls ampli.track But status command fails because the ampli instance is not in the same file

Motivations

In more details: In packages/Feature/FeatureLogic I call: analyticsClient.logEvent(MyStronglyTypedEventViewed(params: vars)) where MyStronglyTypedEventViewed(params:) is from my tracking plan

and finally in: packages/AnalyticsClient I receive such call and pass it to Ampli instance track method

func logEvent(Event) {
  Ampli.instance.track(event)
}

But sadly it seems the instance has to be in the same file of the strongly typed events for the command ampli status to succeed.

The request

Could we consider that status could do what it does today OR requires at least one occurrence of <instance>.track(event:) wherever it is?

Thank you Danilo Aliberti

dsaliberti commented 5 months ago

@izaaz hey hello 👋 is there a chance to consider this with the CLI team? Or maybe, it's not meant to work with cross packages calls it just feels a bit weird telling my team to leave a comment to make status happy like:

// Ampli.instance.

thanks, I appreciate 👍

crleona commented 4 months ago

Hi @dsaliberti, please open issues for Ampli on the https://github.com/amplitude/ampli-examples repo so they can be directed to the right place. Thanks!