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
jkasten2
left a comment
There was a problem hiding this comment.
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
jkasten2
left a comment
There was a problem hiding this comment.
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
OSDeviceInfoCompletionHandlersetLanguage(String, OSDeviceInfoCompletionHandler)Testing
Unit Tests
Add
TestSetLanguageHandlerto set up callbacks for setLanguageAdd following Unit test cases
shouldSetLanguageWithResponseto test for success callbackshouldFailToSetLanguageWithResponseto test for failure callbackThis change is