Skip to content

Commit

Permalink
Merge branch 'feat-multichain-list' into salim/PORTFOLIO_VIEW-on
Browse files Browse the repository at this point in the history
  • Loading branch information
salimtb authored Dec 10, 2024
2 parents 9e80e4c + d1d239e commit 9d91baa
Show file tree
Hide file tree
Showing 53 changed files with 1,478 additions and 841 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ app/util/walletconnect.js @MetaMask/sdk-devs

# Accounts Team
app/core/Encryptor/ @MetaMask/accounts-engineers
app/core/Engine/controllers/accounts @MetaMask/accounts-engineers
app/core/Engine/controllers/AccountsController @MetaMask/accounts-engineers

# Swaps Team
app/components/UI/Swaps @MetaMask/swaps-engineers
Expand Down
30 changes: 20 additions & 10 deletions app/actions/navigation/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
/* eslint-disable import/prefer-default-export */
import {
SET_CURRENT_ROUTE,
SET_CURRENT_BOTTOM_NAV_ROUTE,
} from '../../reducers/navigation';
type OnNavigationReadyAction,
type SetCurrentRouteAction,
type SetCurrentBottomNavRouteAction,
NavigationActionType,
} from './types';

/**
* Action Creators
*/
export const setCurrentRoute = (route: string) => ({
type: SET_CURRENT_ROUTE,
export * from './types';

export const setCurrentRoute = (route: string): SetCurrentRouteAction => ({
type: NavigationActionType.SET_CURRENT_ROUTE,
payload: { route },
});

export const setCurrentBottomNavRoute = (route: string) => ({
type: SET_CURRENT_BOTTOM_NAV_ROUTE,
export const setCurrentBottomNavRoute = (
route: string,
): SetCurrentBottomNavRouteAction => ({
type: NavigationActionType.SET_CURRENT_BOTTOM_NAV_ROUTE,
payload: { route },
});

/**
* Action that is called when navigation is ready
*/
export const onNavigationReady = (): OnNavigationReadyAction => ({
type: NavigationActionType.ON_NAVIGATION_READY,
});
31 changes: 31 additions & 0 deletions app/actions/navigation/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { type Action } from 'redux';

/**
* Navigation action type enum
*/
export enum NavigationActionType {
ON_NAVIGATION_READY = 'ON_NAVIGATION_READY',
SET_CURRENT_ROUTE = 'SET_CURRENT_ROUTE',
SET_CURRENT_BOTTOM_NAV_ROUTE = 'SET_CURRENT_BOTTOM_NAV_ROUTE',
}

export type OnNavigationReadyAction =
Action<NavigationActionType.ON_NAVIGATION_READY>;

export type SetCurrentRouteAction =
Action<NavigationActionType.SET_CURRENT_ROUTE> & {
payload: { route: string };
};

export type SetCurrentBottomNavRouteAction =
Action<NavigationActionType.SET_CURRENT_BOTTOM_NAV_ROUTE> & {
payload: { route: string };
};

/**
* Navigation action
*/
export type NavigationAction =
| OnNavigationReadyAction
| SetCurrentRouteAction
| SetCurrentBottomNavRouteAction;
134 changes: 0 additions & 134 deletions app/actions/user/index.js

This file was deleted.

161 changes: 161 additions & 0 deletions app/actions/user/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
import { type AppThemeKey } from '../../util/theme/models';
import {
type InterruptBiometricsAction,
type LockAppAction,
type AuthSuccessAction,
type AuthErrorAction,
type PasswordSetAction,
type PasswordUnsetAction,
type SeedphraseBackedUpAction,
type SeedphraseNotBackedUpAction,
type BackUpSeedphraseVisibleAction,
type BackUpSeedphraseNotVisibleAction,
type ProtectModalVisibleAction,
type ProtectModalNotVisibleAction,
type LoadingSetAction,
type LoadingUnsetAction,
type SetGasEducationCarouselSeenAction,
type LoginAction,
type LogoutAction,
type SetAppThemeAction,
type CheckedAuthAction,
type PersistedDataLoadedAction,
UserActionType,
} from './types';

export * from './types';

export function interruptBiometrics(): InterruptBiometricsAction {
return {
type: UserActionType.INTERRUPT_BIOMETRICS,
};
}

export function lockApp(): LockAppAction {
return {
type: UserActionType.LOCKED_APP,
};
}

export function authSuccess(bioStateMachineId?: string): AuthSuccessAction {
return {
type: UserActionType.AUTH_SUCCESS,
payload: { bioStateMachineId },
};
}

export function authError(bioStateMachineId?: string): AuthErrorAction {
return {
type: UserActionType.AUTH_ERROR,
payload: { bioStateMachineId },
};
}

export function passwordSet(): PasswordSetAction {
return {
type: UserActionType.PASSWORD_SET,
};
}

export function passwordUnset(): PasswordUnsetAction {
return {
type: UserActionType.PASSWORD_UNSET,
};
}

export function seedphraseBackedUp(): SeedphraseBackedUpAction {
return {
type: UserActionType.SEEDPHRASE_BACKED_UP,
};
}

export function seedphraseNotBackedUp(): SeedphraseNotBackedUpAction {
return {
type: UserActionType.SEEDPHRASE_NOT_BACKED_UP,
};
}

export function backUpSeedphraseAlertVisible(): BackUpSeedphraseVisibleAction {
return {
type: UserActionType.BACK_UP_SEEDPHRASE_VISIBLE,
};
}

export function backUpSeedphraseAlertNotVisible(): BackUpSeedphraseNotVisibleAction {
return {
type: UserActionType.BACK_UP_SEEDPHRASE_NOT_VISIBLE,
};
}

export function protectWalletModalVisible(): ProtectModalVisibleAction {
return {
type: UserActionType.PROTECT_MODAL_VISIBLE,
};
}

export function protectWalletModalNotVisible(): ProtectModalNotVisibleAction {
return {
type: UserActionType.PROTECT_MODAL_NOT_VISIBLE,
};
}

export function loadingSet(loadingMsg: string): LoadingSetAction {
return {
type: UserActionType.LOADING_SET,
loadingMsg,
};
}

export function loadingUnset(): LoadingUnsetAction {
return {
type: UserActionType.LOADING_UNSET,
};
}

export function setGasEducationCarouselSeen(): SetGasEducationCarouselSeenAction {
return {
type: UserActionType.SET_GAS_EDUCATION_CAROUSEL_SEEN,
};
}

export function logIn(): LoginAction {
return {
type: UserActionType.LOGIN,
};
}

export function logOut(): LogoutAction {
return {
type: UserActionType.LOGOUT,
};
}

export function setAppTheme(theme: AppThemeKey): SetAppThemeAction {
return {
type: UserActionType.SET_APP_THEME,
payload: { theme },
};
}

/**
* Temporary action to control auth flow
*
* @param initialScreen - "login" or "onboarding"
*/
export function checkedAuth(initialScreen: string): CheckedAuthAction {
return {
type: UserActionType.CHECKED_AUTH,
payload: {
initialScreen,
},
};
}

/**
* Action to signal that persisted data has been loaded
*/
export function onPersistedDataLoaded(): PersistedDataLoadedAction {
return {
type: UserActionType.ON_PERSISTED_DATA_LOADED,
};
}
Loading

0 comments on commit 9d91baa

Please sign in to comment.