diff --git a/apps/ledger-live-mobile/src/components/DeviceAction/InstallSetOfApps/Items.tsx b/apps/ledger-live-mobile/src/components/DeviceAction/InstallSetOfApps/Items.tsx
deleted file mode 100644
index a910dc30aca8..000000000000
--- a/apps/ledger-live-mobile/src/components/DeviceAction/InstallSetOfApps/Items.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-import React from "react";
-import { Trans } from "react-i18next";
-import { Flex, Text } from "@ledgerhq/native-ui";
-import type { AppOp } from "@ledgerhq/live-common/apps/types";
-import Item from "./Item";
-
-type Props = {
- currentAppOp: AppOp;
- dependencies?: string[];
- installQueue: string[];
- itemProgress: number;
- progress: number;
-};
-
-const Items = ({
- currentAppOp,
- dependencies,
- installQueue,
- itemProgress,
- progress,
-}: Props) => (
-
-
-
-
- {dependencies?.map((appName, i) => (
-
- ))}
-
-);
-
-export default Items;
diff --git a/apps/ledger-live-mobile/src/components/DeviceAction/InstallSetOfApps/WrappedOverriddenUI.tsx b/apps/ledger-live-mobile/src/components/DeviceAction/InstallSetOfApps/WrappedOverriddenUI.tsx
deleted file mode 100644
index 1c44070e3971..000000000000
--- a/apps/ledger-live-mobile/src/components/DeviceAction/InstallSetOfApps/WrappedOverriddenUI.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import React from "react";
-import { Flex, Text } from "@ledgerhq/native-ui";
-import { Trans } from "react-i18next";
-
-type Props = {
- children: JSX.Element;
- productName: string;
-};
-
-const WrappedOverriddenUI = ({ children, productName }: Props) => (
-
-
- {children}
-
-
-
-
-
-);
-
-export default WrappedOverriddenUI;
diff --git a/apps/ledger-live-mobile/src/components/DeviceAction/InstallSetOfApps/index.tsx b/apps/ledger-live-mobile/src/components/DeviceAction/InstallSetOfApps/index.tsx
index 7b3127cf33f3..4a4b10733d99 100644
--- a/apps/ledger-live-mobile/src/components/DeviceAction/InstallSetOfApps/index.tsx
+++ b/apps/ledger-live-mobile/src/components/DeviceAction/InstallSetOfApps/index.tsx
@@ -3,15 +3,14 @@ import { Trans } from "react-i18next";
import { createAction } from "@ledgerhq/live-common/lib/hw/actions/app";
import type { Device } from "@ledgerhq/live-common/hw/actions/types";
import connectApp from "@ledgerhq/live-common/lib/hw/connectApp";
-import { Flex, ProgressLoader, Text } from "@ledgerhq/native-ui";
+import { Flex, Text } from "@ledgerhq/native-ui";
import { getDeviceModel } from "@ledgerhq/devices";
import { DeviceActionDefaultRendering } from "..";
import BottomModal from "../../BottomModal";
-import Items from "./Items";
+import Item from "./Item";
import Confirmation from "./Confirmation";
-import WrappedOverriddenUI from "./WrappedOverriddenUI";
type Props = {
dependencies?: string[];
@@ -22,13 +21,20 @@ type Props = {
const action = createAction(connectApp);
+/**
+ * This component overrides the default rendering for device actions in some
+ * cases, falling back to the default one for the rest. Actions such as user blocking
+ * requests, errors and such will be rendered in a BottomModal whereas installation
+ * progress and loading states will be handled inline as part of the screen where this
+ * this is rendered.
+ */
const InstallSetOfApps = ({
dependencies = [],
device: selectedDevice,
onResult,
onError,
}: Props) => {
- const [installing, setInstalling] = useState(false);
+ const [userConfirmed, setUserConfirmed] = useState(false);
const productName = getDeviceModel(selectedDevice.modelId).productName;
const commandRequest = useMemo(
@@ -41,103 +47,88 @@ const InstallSetOfApps = ({
);
const status: any = action.useHook(
- installing ? selectedDevice : undefined,
+ userConfirmed ? selectedDevice : undefined,
commandRequest,
);
const {
allowManagerRequestedWording,
listingApps,
- unresponsive,
error,
- isLoading,
currentAppOp,
itemProgress,
progress,
opened,
- device,
installQueue,
} = status;
const onWrappedError = useCallback(() => {
- if (onError) {
+ if (onError && error) {
onError(error);
}
}, [error, onError]);
- if (!installing) {
- return (
- setInstalling(true)}
- onReject={() => onResult(false)}
- />
- );
- }
-
if (opened) {
onResult(true);
return null;
}
- if (listingApps) {
- return (
-
-
-
-
-
- );
- }
-
- if (
- !error &&
- !allowManagerRequestedWording &&
- (isLoading || (!isLoading && !device) || unresponsive || !currentAppOp)
- ) {
- return (
-
-
-
-
+ return userConfirmed ? (
+
+
+
+
+ {listingApps ? (
+
+ ) : progress || currentAppOp ? (
+
+ ) : (
+
+ )}
-
+ {dependencies?.map((appName, i) => (
+
+ ))}
-
- );
- }
-
- if (currentAppOp) {
- return (
-
-
+
+
-
- );
- }
-
- // Fallback for non-overridden UI cases using the default UI
- return (
-
-
-
-
+
+
+
+
+
+
-
-
+
+
+ ) : (
+ setUserConfirmed(true)}
+ onReject={() => onResult(false)}
+ />
);
};