Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ampli Swift + CLI status]ampli status does not understand cross package calls #325

Open
dsaliberti opened this issue Jun 5, 2024 · 2 comments

Comments

@dsaliberti
Copy link

dsaliberti commented Jun 5, 2024

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


Thanks @crleona 👍

Thank you
Danilo Aliberti

@dsaliberti
Copy link
Author

Any chance for a feedback here please?

@dsaliberti
Copy link
Author

Hi there @crleona
Gentle nudge here to see if there's any chance to get this appreciated?

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant