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 7dabd12
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 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
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,23 @@ const RemoveContainer = styled(TouchableHighlight)`
width: 90px;
`;

const notificationCards = [
{
tag: "hello",
title: "Click me",
link: "ledgerlive://storyly?g=142749&instance=17650&play=sg",
description: "test",
cta: "Click me",
},
];

export default function NotificationCenter() {
const rowRefs = new Map();
const { t } = useTranslation();
const dispatch = useDispatch();
const { colors } = useTheme();
const {
notificationCards,
logImpressionCard,
logDismissCard,
logClickCard,
trackContentCardEvent,
} = useDynamicContent();
const { logImpressionCard, logDismissCard, logClickCard, trackContentCardEvent } =
useDynamicContent();
const { fetchData, refreshDynamicContent } = useDynamicContentLogic();
const [isDynamicContentLoading, setIsDynamicContentLoading] = useState(false);

Expand Down

0 comments on commit 7dabd12

Please sign in to comment.