-
Notifications
You must be signed in to change notification settings - Fork 40
[MOB-12268] Add click handling and tracking #747
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-12267-android-add-start-impression-and-pause-impressio
Are you sure you want to change the base?
Changes from all commits
00506f0
45ef4eb
9d60963
5c2bc6d
974e9b2
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 | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,9 @@ | ||||||
| /** | ||||||
| * Enum representing the prefix of build-in custom action URL. | ||||||
|
||||||
| * Enum representing the prefix of build-in custom action URL. | |
| * Enum representing the prefix of built-in custom action URL. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { Linking } from 'react-native'; | ||
| import type { IterableActionContext } from '../classes/IterableActionContext'; | ||
| import { IterableLogger } from '../classes/IterableLogger'; | ||
| import type { IterableConfig } from '../classes/IterableConfig'; | ||
|
|
||
| /** | ||
| * Calls the URL handler and attempts to open the URL if the handler returns false. | ||
| * | ||
| * @param config - The config to use. | ||
| * @param url - The URL to call. | ||
| * @param context - The context to use. | ||
| */ | ||
| export function callUrlHandler( | ||
| config: IterableConfig, | ||
| url: string, | ||
| context: IterableActionContext | ||
| ) { | ||
| if (!config.urlHandler?.(url, context)) { | ||
| Linking.canOpenURL(url) | ||
| .then((canOpen) => { | ||
| if (canOpen) { | ||
| Linking.openURL(url); | ||
| } else { | ||
| IterableLogger?.log('Url cannot be opened: ' + url); | ||
| } | ||
| }) | ||
| .catch((reason) => { | ||
| IterableLogger?.log('Error opening url: ' + reason); | ||
| }); | ||
| } | ||
qltysh[bot] marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import { IterableCustomActionPrefix } from '../enums/IterableCustomActionPrefix'; | ||
|
|
||
| /** | ||
| * Gets the action prefix from a string. | ||
| * | ||
| * @param str - The string to get the action prefix from. | ||
| * @returns The action prefix. | ||
| */ | ||
| export const getActionPrefix = ( | ||
| str?: string | null | ||
| ): IterableCustomActionPrefix | null => { | ||
| if (!str) return null; | ||
| if (str.startsWith(IterableCustomActionPrefix.Action)) { | ||
| return IterableCustomActionPrefix.Action; | ||
| } | ||
| if (str.startsWith(IterableCustomActionPrefix.Itbl)) { | ||
| return IterableCustomActionPrefix.Itbl; | ||
| } | ||
| return null; | ||
qltysh[bot] marked this conversation as resolved.
Show resolved
Hide resolved
qltysh[bot] marked this conversation as resolved.
Show resolved
Hide resolved
qltysh[bot] marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export * from './getActionPrefix'; | ||
| export * from './callUrlHandler'; |
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 Android native implementation adds the
trackEmbeddedClickmethod, but there's no corresponding iOS implementation visible in this PR. This will cause the feature to not work on iOS devices. Ensure that the iOS native module also implements this method, or document that this feature is Android-only if that's intentional.