Skip to content

Commit

Permalink
LLM - Update Storyly and fixes issues (#7841)
Browse files Browse the repository at this point in the history
* fix(llm): update storyly and fixes issues

* fix(llm): update storyly and fixes issues

* fix(llm): fix storyly type
  • Loading branch information
cgrellard-ledger authored Sep 20, 2024
1 parent 3d658dc commit 31a12e7
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .changeset/sixty-insects-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"live-mobile": patch
---

LLM - Update Storyly and fix some issues
10 changes: 5 additions & 5 deletions apps/ledger-live-mobile/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1398,10 +1398,10 @@ PODS:
- SocketRocket (0.6.1)
- sovran-react-native (0.4.5):
- React-Core
- Storyly (2.18.1)
- storyly-react-native (2.18.1):
- Storyly (3.6.0)
- storyly-react-native (3.6.0):
- React
- Storyly (= 2.18.1)
- Storyly (= 3.6.0)
- TOCropViewController (2.5.3)
- Yoga (1.14.0)
- ZXingObjC/Core (3.6.9)
Expand Down Expand Up @@ -1959,8 +1959,8 @@ SPEC CHECKSUMS:
SentryPrivate: d651efb234cf385ec9a1cdd3eff94b5e78a0e0fe
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
sovran-react-native: fd3dc8f1a4b14acdc4ad25fc6b4ac4f52a2a2a15
Storyly: 97332ff6eccc9ce4024207338f88b34177c95503
storyly-react-native: a112c85399fefc126d8d6a7d692be1b7a12bfaa7
Storyly: 310297bcf4493d3d5b41e71834fba49502c8067a
storyly-react-native: f14aab1a353a8c685b1ab3371fb5fd0c028bc311
TOCropViewController: 20a14b6a7a098308bf369e7c8d700dc983a974e6
Yoga: 805bf71192903b20fc14babe48080582fee65a80
ZXingObjC: 8898711ab495761b2dbbdec76d90164a6d7e14c5
Expand Down
2 changes: 1 addition & 1 deletion apps/ledger-live-mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
"rn-fetch-blob": "^0.12.0",
"rxjs": "^7.8.1",
"semver": "^7.3.7",
"storyly-react-native": "2.18.1",
"storyly-react-native": "3.6.0",
"styled-components": "^5.3.3",
"styled-system": "^5.1.5",
"text-encoding-polyfill": "^0.6.7",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ 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";
import { useSettings } from "~/hooks";

interface StorylyProviderProps {
children: ReactNode;
Expand All @@ -27,6 +28,7 @@ const getTokenForInstanceId = (stories: StoriesType, targetInstanceId: string):
const StorylyProvider: React.FC<StorylyProviderProps> = ({ children }) => {
const [url, setUrl] = useState<string | null>(null);
const [token, setToken] = useState<string | null>(null);
const { language } = useSettings();

const storylyRef = useRef<Storyly>(null);

Expand Down Expand Up @@ -61,11 +63,14 @@ const StorylyProvider: React.FC<StorylyProviderProps> = ({ children }) => {
};

const handleEvent = (e: Storyly.StoryEvent) => {
if (["StoryGroupClosed", "StoryGroupCompleted", "StoryPaused"].includes(e.event)) {
if (
(e.event === "StoryPreviousClicked" && e.story?.index === 0) ||
["StoryGroupClosed", "StoryGroupCompleted"].includes(e.event)
) {
clear();
}
if (e.event === "StoryCTAClicked" && e?.story?.media?.actionUrl) {
Linking.openURL(e.story.media.actionUrl);
if (e.event === "StoryCTAClicked" && e?.story?.actionUrl) {
Linking.openURL(e.story.actionUrl);
clear();
}
};
Expand All @@ -81,6 +86,7 @@ const StorylyProvider: React.FC<StorylyProviderProps> = ({ children }) => {
style={{ flex: 1 }} // necessary for touches to work
onLoad={handleLoad}
onEvent={handleEvent}
storylyLocale={language}
/>
</Flex>
) : null}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const StorylyLocalizedWrapper = forwardRef((props: Props, ref: ForwardedRef<Stor
{...props}
storylyId={storylyInstanceId}
storylySegments={segments}
storylyLocale={language}
onLoad={handleLoad}
storylyTestMode={storyConfig.testingEnabled}
style={{ flex: 1 }} // necessary for touches to work
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ const Stories: React.FC<Props> = props => {
const newStoryGroupList = computeNewStoryGroupList(storyGroupList, event);
if (!isEqual(storyGroupList, newStoryGroupList)) setStoryGroupList(newStoryGroupList);
}
if (event.event === "StoryCTAClicked" && event?.story?.media?.actionUrl) {
Linking.openURL(event.story.media.actionUrl);
if (event.event === "StoryCTAClicked" && event?.story?.actionUrl) {
Linking.openURL(event.story.actionUrl);
storylyRef.current?.closeStory?.();
}
},
Expand Down
4 changes: 4 additions & 0 deletions apps/ledger-live-mobile/src/navigation/DeeplinksProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,10 @@ export const DeeplinksProvider = ({
}
const platform = pathname.split("/")[1];

if (isStorylyLink(url.toString())) {
storylyContext.setUrl(url.toString());
}

if (hostname === "earn") {
if (searchParams.get("action") === "info-modal") {
const message = searchParams.get("message") ?? "";
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 31a12e7

Please sign in to comment.