-
Notifications
You must be signed in to change notification settings - Fork 47
Checks in events publishing #1
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
Conversation
anglinb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dropped a few notes, feel free to change whatever you want. I still need to finish up a bit of the logic on the backend but I tested it on own GitPod and it seems to be working.
| baseURL: URL = URL(string: "https://api.superwall.dev/api/v1/")!, | ||
| // baseURL: URL = URL(string: "https://3000-scarlet-guppy-4bhnibfc.ws-us13.gitpod.io/api/v1/")!, | ||
| analyticsBaseURL: URL = URL(string: "https://collector.paywalrus.com/v1/")!) { | ||
| analyticsBaseURL: URL = URL(string: "https://collector.superwall.dev/v1/")!) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So right now master in paywall-next goes to superwall.dev so this means this is on the bleeding edge. We should probably move this to superwall.me. Once we have a few customers, it would actually be really dope to have Fitness AI be the "pre-prod" deployment--at GitHub, the github org was always feature flagged into things before everything else.
| // We want to send this event off right away & we might need to process it in | ||
| // somewhat real time so we send it to the api instead of the collector. | ||
| if (name == "user_attributes"){ | ||
| Network.shared.identify(identifyRequest: IdentifyRequest(parameters: JSON(eventParams), created_at: JSON(Date.init(timeIntervalSinceNow: 0).timeIntervalSince1970))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None of these calls really have fallbacks, they probably should? 🤷♂️
| var event_name: String | ||
| } | ||
|
|
||
| class Queue { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here be the jank:
So I wanted save on network requests by batching these up on a timer. It seems to work, especially since there are a lot of events all centered around the same time but if you quit the app right away we loose them.
Amplitude uses SQLite but it looks like they are moving away from it.
Not sure what the right move here is but felt like a decent compromise between missing events & creating a ton of inefficient traffic for right now.
|
|
||
| public init () { | ||
|
|
||
| timer = Timer.scheduledTimer(timeInterval: 1.0, target:self, selector: #selector(flush), userInfo: nil, repeats: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does the objective-c style functions work if the object is de-allocated?
| } | ||
|
|
||
| @objc | ||
| func flush() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're free to call this and we probably will want to right after an important event like purchase.
No description provided.