Skip to content

Commit

Permalink
Merge branch '2.0.0-alpha/MOB-10208-fix-npmignore' into 2.0.0-alpha/M…
Browse files Browse the repository at this point in the history
…OB-10290-create-loader-for-rniterableapi
  • Loading branch information
lposen authored Dec 13, 2024
2 parents 01f1fae + 38493d9 commit 5471444
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 35 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Iterable's React Native SDK relies on:
- **iOS**
- Xcode 12+
- [Deployment target 10.0+](https://help.apple.com/xcode/mac/current/#/deve69552ee5)
- [Iterable's iOS SDK](https://github.com/Iterable/swift-sdk)
- [Iterable's iOS SDK](https://github.com/Iterable/iterable-swift-sdk)

- **Android**
- [`minSdkVersion` 16+, `compileSdkVersion` 28+](https://medium.com/androiddevelopers/picking-your-compilesdkversion-minsdkversion-targetsdkversion-a098a0341ebd)
Expand Down
Empty file added src/constants/index.ts
Empty file.
Empty file added src/hooks/index.ts
Empty file.
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 @@ -35,6 +35,9 @@ import {
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 @@ -228,10 +231,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 @@ -249,9 +257,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 5471444

Please sign in to comment.