Skip to content
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] Add callbacks to setLanguage #1400

Merged
merged 1 commit into from
Jun 9, 2022
Merged

Conversation

nan-li
Copy link
Contributor

@nan-li nan-li commented Jun 8, 2022

Description

One Line Summary

Adds optional onSuccess and onFailure callbacks for setting language (setLanguage method).

Details

Motivation

Provides developers with success and failure callbacks.

Scope

  • Add setLanguage onSuccess and onFailure callbacks
  • On Android, if multiple channels are set (ie push, email, SMS), the callback will fire once for the first successful channel and subsequent success or failure callbacks will not be invoked.
  • On iOS, if multiple channels are set (ie push, email, SMS), the callback will be invoked once with the states of all the channels.
  • When testing Android, the responses from the native SDK are null for the successful message and the error response (I created error callback by turning off network connection). When these are null, I pass through a custom object.
    {'success' : 'true', 'message' : 'Successfully set language.'}
    
    {"error":"Failed to set language."}

Testing

Manual testing

Tested setting various languages on iOS and Android.

  • ✅ Tested setting a language without providing any callbacks.
  • ✅ Tested setting a language with onSuccess and onFailure callbacks provided, and no other channels set.
  • ✅ Tested setting email and SMS first, then setting a language. See below for the responses passed to the developer's callbacks.
// Android success
{'success' : 'true', 'message' : 'Successfully set language.'}

// iOS success
{"push":{"success":true},"email":{"success":true},"sms":{"success":true}}

// Android failure example: turn off wifi and data
{"error":"Failed to set language."}

// iOS failure example: turn off wifi and data
"Network Error"

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
  • I have reviewed this PR myself, ensuring it meets each checklist item

This change is Reviewable

- adds optional success and failure callbacks to setting language
@nan-li nan-li merged commit 35d4628 into main Jun 9, 2022
@nan-li nan-li deleted the feat/add_set_language_callback branch August 1, 2022 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants