Hi all
This issue is related to the CLI running ampli status on an iOS Swift project which has packages
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 CLI command fails because the ampli instance is not in the same file/package of the events.
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?
The workaround
Just in case someone runs into the same issue:
I had to add a comment mimicking the instance to make status happy:
So add this anywhere in the file of the strongly typed events
NB1: or however you're using your instance defined in your ampli.json
NB2: the dot . after the instance is required
Thanks @crleona 👍
Thank you
Danilo Aliberti
Hi all
This issue is related to the CLI running
ampli statuson an iOS Swift project which has packagesSummary
My point is quite simple:
I create my strongly typed events and pass it to my own AnalyticsClient which finally calls
ampli.trackBut status CLI command fails because the ampli instance is not in the same file/package of the events.
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
trackmethodBut sadly it seems the instance has to be in the same file of the strongly typed events for the command
ampli statusto succeed.The request
Could we consider that
statuscould do what it does today OR requires at least one occurrence of<instance>.track(event:)wherever it is?The workaround
Just in case someone runs into the same issue:
I had to add a comment mimicking the instance to make
statushappy:So add this anywhere in the file of the strongly typed events
NB1: or however you're using your instance defined in your ampli.json
NB2: the dot
.after the instance is requiredThanks @crleona 👍
Thank you
Danilo Aliberti