You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
// Ampli.instance.
NB1: or however you're using your instance defined in your ampli.json
NB2: the dot . after the instance is required
Hi all
This issue is related to the CLI running
ampli status
on 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.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
methodBut 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
// Ampli.instance.
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
The text was updated successfully, but these errors were encountered: