-
Notifications
You must be signed in to change notification settings - Fork 39
[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
Draft
lposen
wants to merge
2
commits into
loren/embedded/MOB-12267-android-add-start-impression-and-pause-impressio
Choose a base branch
from
loren/embedded/MOB-12268-android-add-click-handling-and-track
base: loren/embedded/MOB-12267-android-add-start-impression-and-pause-impressio
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 new issues
This is from Qlty Cloud, the successor to Code Climate Quality. Learn more. |
Comment on lines
+9
to
+19
| 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; |
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.
Comment on lines
+200
to
+240
| handleClick( | ||
| message: IterableEmbeddedMessage, | ||
| buttonId: string | null, | ||
| action?: IterableAction | null | ||
| ) { | ||
| const { data, type: actionType } = action ?? {}; | ||
| const clickedUrl = data && data?.length > 0 ? data : actionType; | ||
|
|
||
| IterableLogger.log( | ||
| 'IterableEmbeddedManager.handleClick', | ||
| message, | ||
| buttonId, | ||
| clickedUrl | ||
| ); | ||
|
|
||
| if (!clickedUrl) { | ||
| IterableLogger.log( | ||
| 'IterableEmbeddedManager.handleClick:', | ||
| 'A url or action is required to handle an embedded click', | ||
| clickedUrl | ||
| ); | ||
| return; | ||
| } | ||
|
|
||
| const actionPrefix = getActionPrefix(clickedUrl); | ||
| const source = IterableActionSource.embedded; | ||
|
|
||
| this.trackClick(message, buttonId, clickedUrl); | ||
|
|
||
| if (actionPrefix) { | ||
| const actionName = clickedUrl?.replace(actionPrefix, ''); | ||
| const actionDetails = new IterableAction(actionName, '', ''); | ||
| const context = new IterableActionContext(actionDetails, source); | ||
| if (this.config.customActionHandler) { | ||
| this.config.customActionHandler(actionDetails, context); | ||
| } | ||
| } else { | ||
| const actionDetails = new IterableAction('openUrl', clickedUrl, ''); | ||
| const context = new IterableActionContext(actionDetails, source); | ||
| callUrlHandler(this.config, clickedUrl, context); | ||
| } |
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…ages## 🔹 JIRA Ticket(s) if any
✏️ Description