-
Notifications
You must be signed in to change notification settings - Fork 40
[MOB-12261] Add IterableEmbeddedManager class #742
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
base: loren/embedded/MOB-12260-create-embedded-tab-in-example-app
Are you sure you want to change the base?
Changes from all commits
15e1894
952eebe
2a62913
789ae83
9940f46
e7d4ecb
4441759
8201c4d
e13756e
79926df
5206902
2b4da8a
11f8227
935cf22
047f94b
92c8c9e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -329,6 +329,16 @@ export class IterableConfig { | |
| */ | ||
| encryptionEnforced = false; | ||
|
|
||
| /** | ||
| * Should the SDK enable and use embedded messaging? | ||
| * | ||
| * **Documentation** | ||
| * - [Embedded Messaging Overview](https://support.iterable.com/hc/en-us/articles/23060529977364-Embedded-Messaging-Overview) | ||
| * - [Android Embedded Messaging](https://support.iterable.com/hc/en-us/articles/23061877893652-Embedded-Messages-with-Iterable-s-Android-SDK) | ||
| * - [iOS Embedded Messaging](https://support.iterable.com/hc/en-us/articles/23061840746900-Embedded-Messages-with-Iterable-s-iOS-SDK) | ||
| */ | ||
| embeddedMessagingEnabled = false; | ||
|
||
|
|
||
| /** | ||
| * Converts the IterableConfig instance to a dictionary object. | ||
| * | ||
|
|
@@ -378,6 +388,7 @@ export class IterableConfig { | |
| pushPlatform: this.pushPlatform, | ||
| encryptionEnforced: this.encryptionEnforced, | ||
| retryPolicy: this.retryPolicy, | ||
| embeddedMessagingEnabled: this.embeddedMessagingEnabled, | ||
| }; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import { IterableEmbeddedManager } from './IterableEmbeddedManager'; | ||
|
|
||
| describe('IterableEmbeddedManager', () => { | ||
| let embeddedManager: IterableEmbeddedManager; | ||
|
|
||
| beforeEach(() => { | ||
| embeddedManager = new IterableEmbeddedManager(); | ||
| }); | ||
|
|
||
| describe('isEnabled', () => { | ||
| it('should be false by default', () => { | ||
| expect(embeddedManager.isEnabled).toBe(false); | ||
| }); | ||
|
|
||
| it('should return true after being enabled', () => { | ||
| embeddedManager.setEnabled(true); | ||
| expect(embeddedManager.isEnabled).toBe(true); | ||
| }); | ||
|
|
||
| it('should return false after being disabled', () => { | ||
| embeddedManager.setEnabled(false); | ||
| expect(embeddedManager.isEnabled).toBe(false); | ||
| }); | ||
| }); | ||
|
|
||
| describe('setEnabled', () => { | ||
| it('should enable the embedded manager', () => { | ||
| embeddedManager.setEnabled(true); | ||
| expect(embeddedManager.isEnabled).toBe(true); | ||
| }); | ||
|
|
||
| it('should disable the embedded manager', () => { | ||
| embeddedManager.setEnabled(false); | ||
| expect(embeddedManager.isEnabled).toBe(false); | ||
| }); | ||
|
|
||
| it('should toggle enabled state multiple times', () => { | ||
| embeddedManager.setEnabled(true); | ||
| expect(embeddedManager.isEnabled).toBe(true); | ||
|
|
||
| embeddedManager.setEnabled(false); | ||
| expect(embeddedManager.isEnabled).toBe(false); | ||
|
|
||
| embeddedManager.setEnabled(true); | ||
| expect(embeddedManager.isEnabled).toBe(true); | ||
| }); | ||
|
|
||
| it('should handle setting the same state multiple times', () => { | ||
| embeddedManager.setEnabled(true); | ||
| embeddedManager.setEnabled(true); | ||
| expect(embeddedManager.isEnabled).toBe(true); | ||
|
|
||
| embeddedManager.setEnabled(false); | ||
| embeddedManager.setEnabled(false); | ||
| expect(embeddedManager.isEnabled).toBe(false); | ||
| }); | ||
| }); | ||
| }); | ||
|
|
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.
The documentation example shows calling
getMessages()method, but theIterableEmbeddedManagerclass does not implement this method. The current implementation only hasisEnabledproperty andsetEnabled()method.Either update the example to reflect the current API:
Or remove the example until
getMessages()is implemented.