Skip to content

Commit 67f853d

Browse files
authored
Merge branch '2.0.0-alpha/MOB-9680-new-fix-lefthook' into 2.0.0-alpha/MOB-10412-remove-integration-testing-code
2 parents dfba298 + 3ea4ea6 commit 67f853d

File tree

4 files changed

+49
-34
lines changed

4 files changed

+49
-34
lines changed

src/inApp/classes/IterableInAppMessage.ts

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { type ViewToken } from 'react-native';
22

33
import { IterableUtil } from '../../core';
44
import { IterableInAppTriggerType } from '../enums';
5+
import type { IterableInAppMessageRaw } from '../types';
56
import { IterableInAppTrigger } from './IterableInAppTrigger';
67
import { IterableInboxMetadata } from './IterableInboxMetadata';
78

@@ -166,35 +167,7 @@ export class IterableInAppMessage {
166167
* @param dict - The dictionary containing the properties of the in-app message.
167168
* @returns An instance of `IterableInAppMessage` populated with the provided properties.
168169
*/
169-
static fromDict(dict: {
170-
/** The unique identifier for the message. */
171-
messageId: string;
172-
/** The campaign identifier associated with the message. */
173-
campaignId: number;
174-
/** The trigger that initiates the in-app message. */
175-
trigger: IterableInAppTrigger;
176-
/** The timestamp when the message was created, in milliseconds. */
177-
createdAt?: number;
178-
/** The timestamp when the message expires, in milliseconds. */
179-
expiresAt?: number;
180-
/** A boolean indicating if the message should be saved to the inbox. */
181-
saveToInbox?: boolean;
182-
/** Metadata for the inbox message, including title, subtitle, and icon. */
183-
inboxMetadata?: {
184-
/** The title of the inbox message. */
185-
title: string | undefined;
186-
/** The subtitle of the inbox message. */
187-
subtitle: string | undefined;
188-
/** The icon of the inbox message. */
189-
icon: string | undefined;
190-
};
191-
/** Custom payload associated with the message. */
192-
customPayload?: unknown;
193-
/** A boolean indicating if the message has been read. */
194-
read?: boolean;
195-
/** The priority level of the message. */
196-
priorityLevel?: number;
197-
}): IterableInAppMessage {
170+
static fromDict(dict: IterableInAppMessageRaw): IterableInAppMessage {
198171
const messageId = dict.messageId;
199172
const campaignId = dict.campaignId;
200173
const trigger = IterableInAppTrigger.fromDict(dict.trigger);
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import type { IterableInAppTrigger } from '../classes/IterableInAppTrigger';
2+
3+
/** The raw message returned from the `IterableEventName.handleInAppCalled` event */
4+
export type IterableInAppMessageRaw = {
5+
/** The unique identifier for the message. */
6+
messageId: string;
7+
/** The campaign identifier associated with the message. */
8+
campaignId: number;
9+
/** The trigger that initiates the in-app message. */
10+
trigger: IterableInAppTrigger;
11+
/** The timestamp when the message was created, in milliseconds. */
12+
createdAt?: number;
13+
/** The timestamp when the message expires, in milliseconds. */
14+
expiresAt?: number;
15+
/** A boolean indicating if the message should be saved to the inbox. */
16+
saveToInbox?: boolean;
17+
/** Metadata for the inbox message, including title, subtitle, and icon. */
18+
inboxMetadata?: {
19+
/** The title of the inbox message. */
20+
title: string | undefined;
21+
/** The subtitle of the inbox message. */
22+
subtitle: string | undefined;
23+
/** The icon of the inbox message. */
24+
icon: string | undefined;
25+
};
26+
/** Custom payload associated with the message. */
27+
customPayload?: unknown;
28+
/** A boolean indicating if the message has been read. */
29+
read?: boolean;
30+
/** The priority level of the message. */
31+
priorityLevel?: number;
32+
};

src/inApp/types/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
export * from './IterableInAppContent';
21
export * from './IterableHtmlInAppContentRaw';
2+
export * from './IterableInAppContent';
3+
export * from './IterableInAppMessageRaw';

src/inbox/components/IterableInbox.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ const RNIterableAPI = NativeModules.RNIterableAPI;
3636
const RNEventEmitter = new NativeEventEmitter(RNIterableAPI);
3737

3838
const DEFAULT_HEADLINE_HEIGHT = 60;
39+
const ANDROID_HEADLINE_HEIGHT = 70;
40+
const HEADLINE_PADDING_LEFT_PORTRAIT = 30;
41+
const HEADLINE_PADDING_LEFT_LANDSCAPE = 70;
3942

4043
/**
4144
* Props for the IterableInbox component.
@@ -229,10 +232,15 @@ export const IterableInbox = ({
229232
backgroundColor: ITERABLE_INBOX_COLORS.CONTAINER_BACKGROUND,
230233
fontSize: 40,
231234
fontWeight: 'bold',
232-
height: Platform.OS === 'android' ? 70 : DEFAULT_HEADLINE_HEIGHT,
235+
height:
236+
Platform.OS === 'android'
237+
? ANDROID_HEADLINE_HEIGHT
238+
: DEFAULT_HEADLINE_HEIGHT,
233239
marginTop: 0,
234240
paddingBottom: 10,
235-
paddingLeft: isPortrait ? 30 : 70,
241+
paddingLeft: isPortrait
242+
? HEADLINE_PADDING_LEFT_PORTRAIT
243+
: HEADLINE_PADDING_LEFT_LANDSCAPE,
236244
paddingTop: 10,
237245
width: '100%',
238246
},
@@ -250,9 +258,10 @@ export const IterableInbox = ({
250258
},
251259
});
252260

253-
const { headline } = styles;
254261
const navTitleHeight =
255-
DEFAULT_HEADLINE_HEIGHT + headline.paddingTop + headline.paddingBottom;
262+
DEFAULT_HEADLINE_HEIGHT +
263+
styles.headline.paddingTop +
264+
styles.headline.paddingBottom;
256265

257266
//fetches inbox messages and adds listener for inbox changes on mount
258267
useEffect(() => {

0 commit comments

Comments
 (0)