Skip to content

Commit

Permalink
Merge branch '2.0.0-alpha/MOB-9680-new-fix-lefthook' into 2.0.0-alpha…
Browse files Browse the repository at this point in the history
…/MOB-10412-remove-integration-testing-code
  • Loading branch information
lposen authored Dec 13, 2024
2 parents dfba298 + 3ea4ea6 commit 67f853d
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 34 deletions.
31 changes: 2 additions & 29 deletions src/inApp/classes/IterableInAppMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { type ViewToken } from 'react-native';

import { IterableUtil } from '../../core';
import { IterableInAppTriggerType } from '../enums';
import type { IterableInAppMessageRaw } from '../types';
import { IterableInAppTrigger } from './IterableInAppTrigger';
import { IterableInboxMetadata } from './IterableInboxMetadata';

Expand Down Expand Up @@ -166,35 +167,7 @@ export class IterableInAppMessage {
* @param dict - The dictionary containing the properties of the in-app message.
* @returns An instance of `IterableInAppMessage` populated with the provided properties.
*/
static fromDict(dict: {
/** The unique identifier for the message. */
messageId: string;
/** The campaign identifier associated with the message. */
campaignId: number;
/** The trigger that initiates the in-app message. */
trigger: IterableInAppTrigger;
/** The timestamp when the message was created, in milliseconds. */
createdAt?: number;
/** The timestamp when the message expires, in milliseconds. */
expiresAt?: number;
/** A boolean indicating if the message should be saved to the inbox. */
saveToInbox?: boolean;
/** Metadata for the inbox message, including title, subtitle, and icon. */
inboxMetadata?: {
/** The title of the inbox message. */
title: string | undefined;
/** The subtitle of the inbox message. */
subtitle: string | undefined;
/** The icon of the inbox message. */
icon: string | undefined;
};
/** Custom payload associated with the message. */
customPayload?: unknown;
/** A boolean indicating if the message has been read. */
read?: boolean;
/** The priority level of the message. */
priorityLevel?: number;
}): IterableInAppMessage {
static fromDict(dict: IterableInAppMessageRaw): IterableInAppMessage {
const messageId = dict.messageId;
const campaignId = dict.campaignId;
const trigger = IterableInAppTrigger.fromDict(dict.trigger);
Expand Down
32 changes: 32 additions & 0 deletions src/inApp/types/IterableInAppMessageRaw.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import type { IterableInAppTrigger } from '../classes/IterableInAppTrigger';

/** The raw message returned from the `IterableEventName.handleInAppCalled` event */
export type IterableInAppMessageRaw = {
/** The unique identifier for the message. */
messageId: string;
/** The campaign identifier associated with the message. */
campaignId: number;
/** The trigger that initiates the in-app message. */
trigger: IterableInAppTrigger;
/** The timestamp when the message was created, in milliseconds. */
createdAt?: number;
/** The timestamp when the message expires, in milliseconds. */
expiresAt?: number;
/** A boolean indicating if the message should be saved to the inbox. */
saveToInbox?: boolean;
/** Metadata for the inbox message, including title, subtitle, and icon. */
inboxMetadata?: {
/** The title of the inbox message. */
title: string | undefined;
/** The subtitle of the inbox message. */
subtitle: string | undefined;
/** The icon of the inbox message. */
icon: string | undefined;
};
/** Custom payload associated with the message. */
customPayload?: unknown;
/** A boolean indicating if the message has been read. */
read?: boolean;
/** The priority level of the message. */
priorityLevel?: number;
};
3 changes: 2 additions & 1 deletion src/inApp/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './IterableInAppContent';
export * from './IterableHtmlInAppContentRaw';
export * from './IterableInAppContent';
export * from './IterableInAppMessageRaw';
17 changes: 13 additions & 4 deletions src/inbox/components/IterableInbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ const RNIterableAPI = NativeModules.RNIterableAPI;
const RNEventEmitter = new NativeEventEmitter(RNIterableAPI);

const DEFAULT_HEADLINE_HEIGHT = 60;
const ANDROID_HEADLINE_HEIGHT = 70;
const HEADLINE_PADDING_LEFT_PORTRAIT = 30;
const HEADLINE_PADDING_LEFT_LANDSCAPE = 70;

/**
* Props for the IterableInbox component.
Expand Down Expand Up @@ -229,10 +232,15 @@ export const IterableInbox = ({
backgroundColor: ITERABLE_INBOX_COLORS.CONTAINER_BACKGROUND,
fontSize: 40,
fontWeight: 'bold',
height: Platform.OS === 'android' ? 70 : DEFAULT_HEADLINE_HEIGHT,
height:
Platform.OS === 'android'
? ANDROID_HEADLINE_HEIGHT
: DEFAULT_HEADLINE_HEIGHT,
marginTop: 0,
paddingBottom: 10,
paddingLeft: isPortrait ? 30 : 70,
paddingLeft: isPortrait
? HEADLINE_PADDING_LEFT_PORTRAIT
: HEADLINE_PADDING_LEFT_LANDSCAPE,
paddingTop: 10,
width: '100%',
},
Expand All @@ -250,9 +258,10 @@ export const IterableInbox = ({
},
});

const { headline } = styles;
const navTitleHeight =
DEFAULT_HEADLINE_HEIGHT + headline.paddingTop + headline.paddingBottom;
DEFAULT_HEADLINE_HEIGHT +
styles.headline.paddingTop +
styles.headline.paddingBottom;

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

0 comments on commit 67f853d

Please sign in to comment.