-
Notifications
You must be signed in to change notification settings - Fork 369
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
Feature set language callbacks #1536
Conversation
* Add getLanguage to OneSignalStateSynchronizer and UserStatePushSynchronizer
* Add OSDeviceInfoError and OSDeviceInfoCompletionHandler to OneSignal.java
* Add deviceInfoCompletionHandler * Add deviceInfoHandlersPerformOnSuccess * Add deviceInfoHandlersPerformOnFailure
* Update updateDeviceInfo by adding OSDeviceInfoCompletionHandler
* Add setLanguage with completion handler * setLanguage without completion handler calls null on completion handler * Add OSDeviceInfo completion handler to setLanguage
* Add OSLanguageCompletionHandler * Add OSLanguageError * Update setLanguage with OSLanguageCompletionHandler
* Add TestSetLanguageHandler for unit test setLanguage with callback setup * Add shouldSetLanguageWithResponse to check for success callback * Add shouldFailToSetLanguageWithResponse to check for failure callback
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.
Reviewed 5 of 5 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @nan-li and @tanaynigam)
OneSignalSDK/onesignal/src/main/java/com/onesignal/OneSignal.java, line 232 at r1 (raw file):
} static class OSDeviceInfoError {
Since OneSignalStateSynchronizer
produces this internal type it should be defined there. Along with OSDeviceInfoCompletionHandler
below.
OneSignalSDK/unittest/src/test/java/com/test/onesignal/MainOneSignalClassRunner.java, line 2810 at r1 (raw file):
// now test to make sure the handler still fires for a call to // setLanguage() that doesn't modify existing language (no JSON delta)
This comment isn't accurate, above the language is "fr" and below it is "es" so there is a change.
* Move OSDeviceInfoError and OSDeviceInfoCompletionHandler to OneSignalStateSynchronizer * Add appropriate imports in files OneSignal.java, OneSignalStateSynchronizer and UserStateSynchronizer
* Update comment in setLanguage with success handler in Unit Test
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.
Reviewed 4 of 4 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @nan-li and @tanaynigam)
Description
Line Summary
Add set language callback
Details
Motivation
The feature allows the user to use the onSuccess and onFailure callbacks for setLanguage method
Public API Changes
The documentation will need to be updated for Android to provide these new methods
OSDeviceInfoCompletionHandler
setLanguage(String, OSDeviceInfoCompletionHandler)
Testing
Unit Tests
Add
TestSetLanguageHandler
to set up callbacks for setLanguageAdd following Unit test cases
shouldSetLanguageWithResponse
to test for success callbackshouldFailToSetLanguageWithResponse
to test for failure callbackThis change is