-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor singleton service initializers (#172)
* Convert SystemClock to class * These shouldn't have been mocked in this test class, its masking a bug. * Remove unnecessary, slightly risky, object initializers in core. * Restore system clock to object -- I take it back, we don't have to get rid of objects, just have to be more particular about using object initializers. * KLog can be a singleton object, no risk there. * This simple fix would take care of the issue, but i still don't love KlaviyoApiClient being a singleton object that can hit an unrecoverable exception in its initializer... * Found a balanced solution for KlaviyoApiClient -- converting this to a class was complicated by the inner class, and besides it works well as a singleton. The initializer was the real problem, so I extract the listeners from the initializer and created a startService method. This is safe to run multiple times if the SDK is re-initialized. * Prefer this way: we don't need to wrap any of the code in this method body except the methods that are themselves protected anyway * Forgot to add back starting the service in these tests' setup * Naming convention things * First shot at a pre-init buffer for failed operations. Needs tests * Added test of in-memory slate * I don't like import * * Added comments, logging, and wrapped the retry operations in safeCall * Trivial: move error logging out of exception class. Now that we wrap all SDK functions in safeCall, it is more straightforward to log from there. * Allow ONLY handlePush to be buffered * Remove unused test * keep 3.0 version increment * don't add this back * never trust github * Update versions.properties --------- Co-authored-by: Evan Masseau <>
- Loading branch information
1 parent
1b368e9
commit 7038aa1
Showing
24 changed files
with
281 additions
and
278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.