Skip to content

Commit 01c7919

Browse files
committed
refactor: instantiate IterableInAppManager and IterableAuthManager directly in the Iterable class
1 parent a9f46c1 commit 01c7919

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

src/core/classes/Iterable.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ const RNEventEmitter = new NativeEventEmitter(RNIterableAPI);
3030

3131
const defaultConfig = new IterableConfig();
3232
const defaultLogger = new IterableLogger(defaultConfig);
33-
const defaultInAppManager = new IterableInAppManager(defaultLogger);
34-
const defaultAuthManager = new IterableAuthManager(defaultLogger);
3533

3634
/* eslint-disable tsdoc/syntax */
3735
/**
@@ -80,7 +78,9 @@ export class Iterable {
8078
* Iterable.inAppManager.showMessage(message, true);
8179
* ```
8280
*/
83-
static inAppManager: IterableInAppManager = defaultInAppManager;
81+
static inAppManager: IterableInAppManager = new IterableInAppManager(
82+
defaultLogger
83+
);
8484

8585
/**
8686
* Authentication manager for the current user.
@@ -93,7 +93,9 @@ export class Iterable {
9393
* Iterable.authManager.pauseAuthRetries(true);
9494
* ```
9595
*/
96-
static authManager: IterableAuthManager = defaultAuthManager;
96+
static authManager: IterableAuthManager = new IterableAuthManager(
97+
defaultLogger
98+
);
9799

98100
/**
99101
* Initializes the Iterable React Native SDK in your app's Javascript or Typescript code.

src/core/classes/IterableAuthManager.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,13 @@ export class IterableAuthManager {
3939
pauseAuthRetries(pauseRetry: boolean) {
4040
return IterableApi.pauseAuthRetries(pauseRetry);
4141
}
42+
43+
/**
44+
* Pass along an auth token to the SDK.
45+
*
46+
* @param authToken - The auth token to pass along
47+
*/
48+
passAlongAuthToken(authToken: string | null | undefined) {
49+
return IterableApi.passAlongAuthToken(authToken);
50+
}
4251
}

0 commit comments

Comments
 (0)