-
Notifications
You must be signed in to change notification settings - Fork 192
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
feat: add method to get device ID synchronously #490
Conversation
Plan on adding a test case here too. |
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.
I don't think this needs to be a separate method - initializeDeviceID
has no dependencies other than dbhelper which is set up at init, so it should be safe to call early from the regular accessor if the deviceID is nil.
It looks like the late binding is just to avoid db access on the main thread, if someone needs it earlier, we don't need to defer the work.
Sources/Amplitude/Amplitude.m
Outdated
@@ -1669,19 +1669,21 @@ - (NSString *)getAdSupportID { | |||
} | |||
|
|||
- (NSString *)getDeviceId { | |||
return self.deviceId; | |||
return [self initializeDeviceId]; |
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.
@crleona So something like this?
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.
yeah, this works - we could only call initializeDeviceId on a nil check, but the overhead should be negligible and I doubt we're going to encounter any thread contention.
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.
LGTM, thanks!
# [8.19.0](v8.18.3...v8.19.0) (2024-04-04) ### Features * add method to get device ID synchronously ([#490](#490)) ([f5066b2](f5066b2))
🎉 This PR is included in version 8.19.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Summary
Checklist