-
Notifications
You must be signed in to change notification settings - Fork 327
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bugfix/live 8698 Manager API v2 breaking changes adaptations (#4896)
* fix(common/manager/listAppsV2): handle breaking change in /v2/apps/hash * fix(lld,llm/featureflags): replace listAppsV2 by listAppsV2dot1 * fix(lld,llm/featureflags): replace listAppsV2dot1 by listAppsV2minot1 * fix(common/types-live): default feature val for listAppsV2minor1 * docs(llc/manager/api): change comment on getAppsByHash * fix(common/manager/api): add MANAGER_API_BASE env to caching key extractor * fix(common/apps/polyfill): same currencyId polyfill logic in v1 and v2 * fix(llm/InstalledAppsModal): UninstallDependenciesModal not opening * style(llm, common): lint * fix(llm/InstalledAppsModal): layout issues when too many apps * refacto(llm/manager): replace prop drilling hell by context * refactor(llm/manager): type fix & stateless install/uninstall modals * fix(llm/InstallAppDependenciesModal): styling * refacto(common/listapps/v2): reorder without breaking + document * style(llm, common): lint * style(llm): rename action installAppFirstTime to setHasInstalledAnyApp * fix(llm): dispatch setHasInstalledAnyApp in installAppWithDependencies * chore: changeset * fix(manager): using correct dispatch * docs(common/listApps): fix typos * refactor(manager/api): clearer String(array) * docs: remove outdated todo --------- Co-authored-by: OlivierFreyssinet <olivier.freyssinet@gmail.com>
- Loading branch information
1 parent
63657e5
commit 95cf52e
Showing
25 changed files
with
325 additions
and
300 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
"@ledgerhq/types-live": patch | ||
"@ledgerhq/live-common": patch | ||
"ledger-live-desktop": patch | ||
"live-mobile": patch | ||
--- | ||
|
||
Feature flag listAppsV2 replaced by listAppsV2minor1 | ||
Fix listApps v2 logic: adapt to breaking changes in the API and fix "polyfilling" logic of data of apps |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
"live-mobile": patch | ||
--- | ||
|
||
Fix interaction between "InstalledAppsModal" and "UninstallDependenciesModal", the later one was not getting opened in case an app with dependents was getting uninstalled from the first one, due to a bad usage of drawers (not using QueuedDrawer). | ||
Refactor prop drilling nightmare of setAppInstallWithDependencies/setAppUninstallWithDependencies with a simple React.Context. | ||
Refactor InstalledAppDependenciesModal and UninstallAppDependenciesModal to have no business logic inside | ||
Rename action creator installAppFirstTime to setHasInstalledAnyApp for more clarity |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
48 changes: 48 additions & 0 deletions
48
apps/ledger-live-mobile/src/screens/Manager/AppsInstallUninstallWithDependenciesContext.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { App } from "@ledgerhq/types-live"; | ||
import React, { useContext } from "react"; | ||
|
||
/** | ||
* Represents an installed app that depends on other installed apps. | ||
* For instance: | ||
* `{ app: polygonApp, dependents: [ethereumApp] }` | ||
*/ | ||
export type AppWithDependencies = { | ||
app: App; | ||
dependencies: App[]; | ||
}; | ||
|
||
/** | ||
* Represents an installed app that has other installed apps depending on it. | ||
* For instance: | ||
* `{ app: ethereumApp, dependents: [polygonApp] }` | ||
*/ | ||
export type AppWithDependents = { | ||
app: App; | ||
dependents: App[]; | ||
}; | ||
|
||
type AppsInstallUninstallWithDependenciesValue = { | ||
setAppWithDependenciesToInstall: (appWithDependencies: AppWithDependencies | null) => void; | ||
setAppWithDependentsToUninstall: (appWithDependents: AppWithDependents | null) => void; | ||
}; | ||
|
||
/** | ||
* Defines setters for apps to install with their dependencies or apps to | ||
* uninstall with their dependents. | ||
* This context was introduced to avoid prop drilling. | ||
*/ | ||
const AppsInstallUninstallWithDependenciesContext = React.createContext< | ||
AppsInstallUninstallWithDependenciesValue | undefined | ||
>(undefined); | ||
|
||
export const AppsInstallUninstallWithDependenciesContextProvider = | ||
AppsInstallUninstallWithDependenciesContext.Provider; | ||
|
||
export function useSetAppsWithDependenciesToInstallUninstall() { | ||
const contextValue = useContext(AppsInstallUninstallWithDependenciesContext); | ||
if (contextValue === undefined) | ||
throw new Error( | ||
"useAppsInstallUninstallWithDependencies must be used within a context provider", | ||
); | ||
return contextValue; | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
95cf52e
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.
Successfully deployed to the following URLs:
web-tools – ./apps/web-tools
ledger-live-tools.vercel.app
live.ledger.tools
web-tools-git-develop-ledgerhq.vercel.app
ledger-live.vercel.app
web-tools-ledgerhq.vercel.app