Skip to content

Commit

Permalink
fix: handle cta click on Storyly LLM
Browse files Browse the repository at this point in the history
  • Loading branch information
KVNLS committed Jun 11, 2024
1 parent 68fab96 commit f813822
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/stupid-mangos-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"live-mobile": minor
---

Handle cta click on storyly
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import useFeature from "@ledgerhq/live-common/featureFlags/useFeature";
import { Flex } from "@ledgerhq/native-ui";
import { Linking } from "react-native";
import { Feature_Storyly, StorylyInstanceType } from "@ledgerhq/types-live";
import React, { createContext, useState, useContext, ReactNode, useRef, useEffect } from "react";
import { Storyly } from "storyly-react-native";
Expand Down Expand Up @@ -61,6 +62,10 @@ const StorylyProvider: React.FC<StorylyProviderProps> = ({ children }) => {

const handleEvent = (e: Storyly.StoryEvent) => {
if (e.event === "StoryGroupClosed" || e.event === "StoryGroupCompleted") clear();
if (e.event === "StoryCTAClicked" && e?.story?.media?.actionUrl) {
Linking.openURL(e.story.media.actionUrl);
storylyRef.current?.close?.();
}
};

return (
Expand Down

0 comments on commit f813822

Please sign in to comment.