Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Live 1792: Synchronized onboarding logic #214

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6651535
feat(llc/hw): extract onboarding state function
alexandremgo May 19, 2022
fd508af
feat(llm): sync onboarding logic and screen
alexandremgo May 19, 2022
05fc5f7
feat(llm): WIP select a nano for sync onboarding
alexandremgo May 19, 2022
3f4306f
chore(llm): isolate deep linking for already onboarded devices
alexandremgo May 19, 2022
42c9d49
feat(llm): enable deep linking to onboarding steps
alexandremgo May 19, 2022
3d36f57
feat(llc): up-to-date onboarding state extract
alexandremgo May 23, 2022
87a11f7
feat(llc): extractOnboardingState does not return null
alexandremgo May 26, 2022
9955aaa
feat(llc): onboarding state polling logic in a hook
alexandremgo May 27, 2022
dbb03c7
feat(llc): sync onboarding cli
alexandremgo May 27, 2022
269e209
feat(llm): SyncOnboarding screen uses onboarding state polling hook
alexandremgo May 27, 2022
28440e3
feat(llm): sync onboarding reacts to allowed and fatal errors
alexandremgo May 27, 2022
7e8adec
chore(llc): enum types for seed phrasse and onboarding step
alexandremgo May 30, 2022
b6c6dba
feat(llc): timeout on request to device during polling
alexandremgo May 30, 2022
f453674
chore(llc): unit test for timeout feature
alexandremgo May 31, 2022
87ac892
feat(llc): add being able to stop onboarding state polling
alexandremgo May 31, 2022
36b3326
refactor(llc): split observable into a firmwareInfo and an allowedErr…
alexandremgo May 31, 2022
a96aed9
fix(llc): no any type for isAllowedOnboardingStatePollingError
alexandremgo Jun 6, 2022
8d40a79
refactor(llc): Boolean() instead of !!
alexandremgo Jun 6, 2022
d69e116
feat(llc): getOnboardingStatePolling logic
alexandremgo Jun 6, 2022
4aa4911
refactor(llc): useOnboardingStatePolling uses getOnboardingStatePolling
alexandremgo Jun 8, 2022
ec989ad
refactor(llc): SeedPhraseType in types/manager
alexandremgo Jun 9, 2022
448911f
chore(llm): for QA & demo
alexandremgo Jun 9, 2022
e75cc11
chore(llm): config app_identifier on Fastfile
alexandremgo Jun 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/cli/src/commands-index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import signMessage from "./commands/signMessage";
import speculosList from "./commands/speculosList";
import swap from "./commands/swap";
import sync from "./commands/sync";
import synchronousOnboarding from "./commands/synchronousOnboarding";
import testDetectOpCollision from "./commands/testDetectOpCollision";
import testGetTrustedInputFromTxHash from "./commands/testGetTrustedInputFromTxHash";
import user from "./commands/user";
Expand Down Expand Up @@ -93,6 +94,7 @@ export default {
speculosList,
swap,
sync,
synchronousOnboarding,
testDetectOpCollision,
testGetTrustedInputFromTxHash,
user,
Expand Down
30 changes: 30 additions & 0 deletions apps/cli/src/commands/synchronousOnboarding.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import {
getOnboardingStatePolling,
OnboardingStatePollingResult,
} from "@ledgerhq/live-common/lib/hw/getOnboardingStatePolling";
import { Observable } from "rxjs";
import { deviceOpt } from "../scan";

export default {
description: "track the onboarding status of your device",
args: [
{
name: "pollingPeriodMs",
alias: "p",
desc: "polling period in milliseconds",
type: Number,
},
deviceOpt,
],
job: ({
device,
pollingPeriodMs,
}: Partial<{
device: string;
pollingPeriodMs: number;
}>): Observable<OnboardingStatePollingResult | null> =>
getOnboardingStatePolling({
deviceId: device ?? "",
pollingPeriodMs: pollingPeriodMs ?? 1000,
}),
};
2 changes: 1 addition & 1 deletion apps/ledger-live-mobile/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ platform :ios do

build_number = latest_testflight_build_number(
version: trim_version_number(package["version"]),
app_identifier: MY_APP_BUNDLE_ID
app_identifier: "com.ledger.live"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was a fixed to be able to build iOS that Valentin told me to try -> as this PR won't be merged, i did not put any comment on it. But Valentin merged this fix on develop yesterday ;)

)

increment_build_number({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { ScreenName, NavigatorName } from "../../const";
import PairDevices from "../../screens/PairDevices";
import EditDeviceName from "../../screens/EditDeviceName";
import OnboardingNavigator from "./OnboardingNavigator";
import { SyncOnboardingNavigator } from "./SyncOnboardingNavigator";
import ImportAccountsNavigator from "./ImportAccountsNavigator";
import PasswordAddFlowNavigator from "./PasswordAddFlowNavigator";
import PasswordModifyFlowNavigator from "./PasswordModifyFlowNavigator";
Expand Down Expand Up @@ -63,6 +64,10 @@ export default function BaseOnboardingNavigator() {
name={NavigatorName.Onboarding}
component={OnboardingNavigator}
/>
<Stack.Screen
name={NavigatorName.SyncOnboarding}
component={SyncOnboardingNavigator}
/>
<Stack.Screen
name={NavigatorName.ImportAccounts}
component={ImportAccountsNavigator}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from "react";
import { createStackNavigator } from "@react-navigation/stack";
import type { Device } from "@ledgerhq/live-common/lib/hw/actions/types";
import { ScreenName } from "../../const";
import { SyncOnboarding } from "../../screens/SyncOnboarding";

// TODO - https://reactnavigation.org/docs/typescript/
// With route type, do we still need https://github.com/LedgerHQ/ledger-live-mobile/blob/develop/src/const/navigation.js
// ? Need to cast each name to be able to use the const and the navigator typing
export type SyncOnboardingStackParamList = {
SyncOnboardingWelcome: { pairedDevice: Device | null };
};

const Stack = createStackNavigator<SyncOnboardingStackParamList>();

export const SyncOnboardingNavigator = () => (
<Stack.Navigator
screenOptions={{
headerShown: false,
headerTitle: "",
headerShadowVisible: false,
}}
>
<Stack.Screen
name={ScreenName.SyncOnboardingWelcome as "SyncOnboardingWelcome"}
component={SyncOnboarding}
initialParams={{ pairedDevice: null }}
/>
</Stack.Navigator>
);
3 changes: 3 additions & 0 deletions apps/ledger-live-mobile/src/const/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@ export const ScreenName = {
"OnboardingModalSyncDesktopInformation",
OnboardingModalRecoveryPhraseWarning: "OnboardingModalRecoveryPhraseWarning",

SyncOnboardingWelcome: "SyncOnboardingWelcome",

PlatformCatalog: "PlatformCatalog",
PlatformApp: "PlatformApp",

Expand Down Expand Up @@ -386,6 +388,7 @@ export const NavigatorName = {
MigrateAccountsFlow: "MigrateAccountsFlow",
NftNavigator: "NftNavigator",
Onboarding: "Onboarding",
SyncOnboarding: "SyncOnboarding",
PasswordAddFlow: "PasswordAddFlow",
PasswordModifyFlow: "PasswordModifyFlow",
Platform: "Platform",
Expand Down
Loading