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

[PS] Implement Permission System #5062

Merged
merged 113 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
38eeb7a
Feature/4761 update network picker on wallet screen (#4844)
Cal-L Aug 22, 2022
413d91d
Feature/4768 action selector sheet (#4891)
Cal-L Aug 25, 2022
c5b946a
Add new logos (#5046)
Cal-L Sep 28, 2022
40614d1
[PS] Fix component styles (#5047)
Cal-L Sep 28, 2022
92e9654
[PS] Patch controllers (#5048)
Cal-L Sep 28, 2022
04b824a
[PS] Organize account utils (#5049)
Cal-L Sep 28, 2022
b1ad836
[PS] Hook up PS controller (#5050)
Cal-L Sep 28, 2022
3c264d8
[PS] Connect ps to browser (#5051)
Cal-L Sep 28, 2022
caf410f
[PS] Create first time connect sheet (#5052)
Cal-L Sep 28, 2022
c2d0515
[PS] Create permissions sheet (#5053)
Cal-L Sep 28, 2022
90e59f0
[PS] Tab bar bottom navigation (#4949)
jpcloureiro Sep 29, 2022
a64253f
[PS] Browser nav bar facelift (#4907)
jpcloureiro Sep 29, 2022
7b62ec3
Feature/5068 code clean up cal (#5073)
Cal-L Oct 3, 2022
1a3e42d
Fix non-components tests
Cal-L Oct 3, 2022
4d88950
Fix WalletConnect and transacting logic
Cal-L Oct 4, 2022
0d8c597
[PS] code cleanup (#5084)
jpcloureiro Oct 4, 2022
410502e
Fix snapshot
Cal-L Oct 5, 2022
1d33480
Update onboarding wizard
Cal-L Oct 5, 2022
a578fb6
don't show account toast when host name is the same
Cal-L Oct 5, 2022
eb936f6
Merge branch 'main' into feature/4754-permission-system
joaoloureirop Oct 13, 2022
0bcf975
[PS]: update component library imports
joaoloureirop Oct 13, 2022
e15afd1
Merge branch 'main' into feature/4754-permission-system
joaoloureirop Oct 14, 2022
1a00887
(CustomNetwork): update prop to allow wallet return
joaoloureirop Oct 14, 2022
21b9a3b
Merge branch 'feature/5099-post-bug-bash-clean-up' into feature/4754-…
joaoloureirop Oct 14, 2022
a9053e2
update build number
joaoloureirop Oct 14, 2022
5430223
implement visual & ux updates
joaoloureirop Oct 14, 2022
1136fe9
(TestBuild) bump version
joaoloureirop Oct 15, 2022
ea6c741
Toast: respect account avatar global settings
joaoloureirop Oct 17, 2022
5203dc8
(TabBarItem): update component jest snapshot
joaoloureirop Oct 31, 2022
78474db
Merge branch 'main' into feature/4754-permission-system-bugbash-build
joaoloureirop Oct 31, 2022
4eeaac7
(util/address): remove duplicate import
joaoloureirop Oct 31, 2022
f530cb1
Merge branch 'main' into feature/4754-permission-system-bugbash-build
joaoloureirop Nov 2, 2022
88bbc90
Merge from main
Cal-L Nov 15, 2022
37b226a
SDK compatibility
andrepimenta Nov 18, 2022
af6cce6
Update coinbase
andrepimenta Nov 18, 2022
3f5b098
Clean up SDK support a bit
Cal-L Nov 18, 2022
357fdab
Add padding to TagURL
Cal-L Nov 18, 2022
008c182
updated android SDK versions
sethkfman Nov 17, 2022
17f7afd
update to react-native 0.66.5
joaoloureirop Nov 17, 2022
722c568
fix linter
joaoloureirop Nov 18, 2022
8766c87
Merge branch 'main' into feature/4754-permission-system
joaoloureirop Dec 13, 2022
649b974
fix typo
joaoloureirop Dec 13, 2022
e222a44
Fix revoke button colors (#5255)
Cal-L Dec 14, 2022
406610f
Hide tab bar on Android (#5261)
Cal-L Dec 14, 2022
eb79109
Merge branch 'main' into feature/4754-permission-system
joaoloureirop Dec 14, 2022
fd1e94f
fix lint errors
joaoloureirop Dec 14, 2022
d2b2753
update Permission System translations (#5401)
jpcloureiro Dec 15, 2022
0e49621
[PS] Allow Permission Request Rejection (#5405)
jpcloureiro Dec 20, 2022
0dcd780
(RootRPCMethodsUI): relocate requestData destruct
joaoloureirop Dec 20, 2022
2c44874
Merge branch 'main' into feature/4754-permission-system
joaoloureirop Dec 21, 2022
245764a
move backup wallet reminder popup (#5402)
jpcloureiro Dec 21, 2022
2015c93
Fix bug report 12 & 3
Cal-L Jan 10, 2023
3a2acdc
Merge from main
Cal-L Jan 10, 2023
32c93ba
Use MetaMetrics and update snapshots
Cal-L Jan 10, 2023
b7c5f7c
(Loader): add color prop
joaoloureirop Jan 10, 2023
9367b18
remove inline styles
joaoloureirop Jan 10, 2023
cd00216
(TabBar): remove null label condition.
joaoloureirop Jan 10, 2023
c9b2d2e
Fix snapshots
Cal-L Jan 10, 2023
88c949a
Merge branch 'feature/4754-permission-system' of https://github.com/M…
Cal-L Jan 10, 2023
2c9977d
Merge with main
Cal-L Jan 10, 2023
8018336
Improve logic to autoscroll account selector
Cal-L Jan 10, 2023
23468a8
Fix analytics
Cal-L Jan 11, 2023
59175ac
Enable ability to delete imported account while in connect mode
Cal-L Jan 11, 2023
db97df6
Auto scroll multiselect when possible
Cal-L Jan 11, 2023
5e677b2
Fix lint
Cal-L Jan 11, 2023
35575b9
Merge with main
Cal-L Jan 11, 2023
b14ca94
Replace @metamask/controllers imports
Cal-L Jan 11, 2023
572425d
(Navigation): adopt useNavigationDetails pattern
joaoloureirop Jan 11, 2023
763c07a
Improve wallet tab contrast
Cal-L Jan 11, 2023
2ee9ae7
Merge branch 'feature/4754-permission-system' of https://github.com/M…
Cal-L Jan 11, 2023
e28d85c
Remove unused network prop from browser tab
Cal-L Jan 12, 2023
0c10e6c
force permitted accounts to be lower case
joaoloureirop Jan 12, 2023
57f5432
Change favicon size to 50. Opensea doesn't support 64
Cal-L Jan 12, 2023
0795505
Update revoke translations
Cal-L Jan 13, 2023
3333c38
Merge with main
Cal-L Jan 13, 2023
d189ecd
Fix lint issue
Cal-L Jan 14, 2023
d402627
Fix missing account name in toast
Cal-L Jan 14, 2023
83ca69f
Only allow removing imported wallets via seed
Cal-L Jan 17, 2023
ad522d1
Merge in main
Cal-L Jan 17, 2023
dcf54ce
Improve avatar network placeholder padding
Cal-L Jan 17, 2023
c522e65
Improve network icon display when switching networks
Cal-L Jan 17, 2023
ce2c3f8
E2e/permission system (#5539)
cortisiko Jan 18, 2023
c38364d
Merge with main
Cal-L Jan 18, 2023
f0f5226
fix snapshot
cortisiko Jan 19, 2023
5468ab8
Fix storybook
Cal-L Jan 19, 2023
c330786
Merge branch 'feature/4754-permission-system' of https://github.com/M…
Cal-L Jan 19, 2023
5b65e51
Fix XS avatar alignment
Cal-L Jan 19, 2023
00bcd6b
Lower font size for XS avatar fallback
Cal-L Jan 19, 2023
99cf794
Use test network images
Cal-L Jan 20, 2023
86b1e62
Keep import flow persistent within account selection
Cal-L Jan 20, 2023
21c2885
Reduce picker network to 1 line
Cal-L Jan 20, 2023
3be2dee
Re-add skip button for onboarding wizard
Cal-L Jan 20, 2023
5f54279
Clean up network icon on network info screen when switching networks
Cal-L Jan 21, 2023
b85ea31
Show toast when switching between networks with same chainId but diff…
Cal-L Jan 21, 2023
b5b59be
fix onboarding tutorial appium test
cortisiko Jan 23, 2023
2aa7397
fix appium tests
cortisiko Jan 23, 2023
f5248f1
forgot a commit to the helpers file.
cortisiko Jan 23, 2023
870baed
Merge branch 'main' into feature/4754-permission-system
joaoloureirop Jan 24, 2023
1e09708
Merge from mina
Cal-L Jan 25, 2023
3322274
fix broken wallet.steps
cortisiko Jan 25, 2023
0a97531
Handle adding and removing accounts during connect flows
Cal-L Jan 25, 2023
67db807
Merge branch 'feature/4754-permission-system' of https://github.com/M…
Cal-L Jan 25, 2023
8ebe5bb
Enable passing interacting address to watch asset
Cal-L Jan 26, 2023
2908f89
fix detox wallet e2e
cortisiko Jan 26, 2023
4eed218
Permission System UI bugfixes (#5603)
jpcloureiro Jan 27, 2023
1c4e7f3
E2e appium/fix browser test permission system (#5611)
SamuelSalas Jan 28, 2023
0dee0b3
Fix E2E merge conflicts on Permission System Branch (#5635)
cortisiko Jan 30, 2023
87216d6
Fix/4754 importing wallet via qr (#5634)
Cal-L Feb 1, 2023
f6eac15
Merge with main
Cal-L Feb 1, 2023
537646f
Add analytics to permission system (#5500)
jpcloureiro Feb 1, 2023
a515dcf
Fix lint issues
Cal-L Feb 1, 2023
d0eb4d7
temporary bandaid for elements that do not appear.
cortisiko Feb 2, 2023
6a07a68
remove useless else
owencraston Feb 2, 2023
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
9 changes: 2 additions & 7 deletions app/actions/modals/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
// eslint-disable-next-line import/prefer-default-export
export function toggleNetworkModal() {
export function toggleNetworkModal(shouldNetworkSwitchPopToWallet = true) {
return {
type: 'TOGGLE_NETWORK_MODAL',
};
}

export function toggleAccountsModal() {
return {
type: 'TOGGLE_ACCOUNT_MODAL',
shouldNetworkSwitchPopToWallet,
};
}

Expand Down
10 changes: 9 additions & 1 deletion app/actions/navigation/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/* eslint-disable import/prefer-default-export */
import { SET_CURRENT_ROUTE } from '../../reducers/navigation';
import {
SET_CURRENT_ROUTE,
SET_CURRENT_BOTTOM_NAV_ROUTE,
} from '../../reducers/navigation';

/**
* Action Creators
Expand All @@ -8,3 +11,8 @@ export const setCurrentRoute = (route: string) => ({
type: SET_CURRENT_ROUTE,
payload: { route },
});

export const setCurrentBottomNavRoute = (route: string) => ({
type: SET_CURRENT_BOTTOM_NAV_ROUTE,
payload: { route },
});
11 changes: 0 additions & 11 deletions app/actions/privacy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@ export function rejectHost(hostname) {
};
}

export function clearHosts() {
return { type: 'CLEAR_HOSTS' };
}

export function setPrivacyMode(enabled) {
return {
type: 'SET_PRIVACY_MODE',
enabled,
};
}

export function setThirdPartyApiMode(enabled) {
return {
type: 'SET_THIRD_PARTY_API_MODE',
Expand Down
29 changes: 29 additions & 0 deletions app/component-library/components-temp/Loader/Loader.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Third party dependencies.
import { StyleSheet } from 'react-native';

// External dependencies.
import { Theme } from '../../../util/theme/models';

/**
* Style sheet function for SheetActions component.
*
* @param params Style sheet params.
* @param params.theme App theme from ThemeContext.
* @param params.vars Inputs that the style sheet depends on.
* @returns StyleSheet object.
*/
const styleSheet = (params: { theme: Theme }) => {
const { theme } = params;
const { colors } = theme;

return StyleSheet.create({
base: {
...StyleSheet.absoluteFillObject,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: colors.background.default,
},
});
};

export default styleSheet;
25 changes: 25 additions & 0 deletions app/component-library/components-temp/Loader/Loader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Third party dependencies.
import React from 'react';
import { ActivityIndicator, View } from 'react-native';

// External dependencies.
import { useStyles } from '../../hooks';

// Internal dependencies.
import styleSheet from './Loader.styles';
import { LoaderProps } from './Loader.types';

const Loader = ({ size = 'large', color }: LoaderProps) => {
const { styles, theme } = useStyles(styleSheet, {});
const { colors } = theme;

const indicatorColor = color ?? colors.primary.default;

return (
<View style={styles.base}>
<ActivityIndicator size={size} color={indicatorColor} />
</View>
);
};

export default Loader;
16 changes: 16 additions & 0 deletions app/component-library/components-temp/Loader/Loader.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Third party dependencies.
import { ActivityIndicatorProps, ColorValue } from 'react-native';

/**
* Loader props.
*/
export interface LoaderProps {
/**
* Activity indicator size.
*/
size?: ActivityIndicatorProps['size'];
/**
* Activity indicator color.
*/
color?: ColorValue;
}
1 change: 1 addition & 0 deletions app/component-library/components-temp/Loader/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './Loader';
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Third party dependencies.
import { StyleSheet } from 'react-native';

// External dependencies.
import { Theme } from '../../../util/theme/models';

/**
* Style sheet function for SheetActions component.
*
* @param params Style sheet params.
* @param params.theme App theme from ThemeContext.
* @param params.vars Inputs that the style sheet depends on.
* @returns StyleSheet object.
*/
const styleSheet = (params: { theme: Theme }) => {
const { theme } = params;
const { colors } = theme;

return StyleSheet.create({
separator: {
height: 1,
backgroundColor: colors.border.muted,
marginHorizontal: 16,
Cal-L marked this conversation as resolved.
Show resolved Hide resolved
},
});
};

export default styleSheet;
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Third party dependencies.
import React, { useCallback } from 'react';
import { Platform, View } from 'react-native';

// External dependencies.
import { useStyles } from '../../hooks';
import ButtonTertiary from '../../components/Buttons/Button/variants/ButtonTertiary';
import { ButtonSize } from '../../components/Buttons/Button';
import Loader from '../Loader';
import generateTestId from '../../../../wdio/utils/generateTestId';

// Internal dependencies.
import { SheetActionsProps } from './SheetActions.types';
import styleSheet from './SheetActions.styles';

const SheetActions = ({ actions }: SheetActionsProps) => {
const { styles } = useStyles(styleSheet, {});

const renderActions = useCallback(
() =>
actions.map(
({ label, onPress, testID, isLoading, disabled, variant }, index) => {
Cal-L marked this conversation as resolved.
Show resolved Hide resolved
const key = `${label}-${index}`;
// Avoid drawing separator above the first element
const isFirstElement = index === 0;

const buttonStyle = {
opacity: disabled ? 0.5 : 1,
};

return (
<React.Fragment key={key}>
{actions.length > 1 && !isFirstElement && (
<View style={styles.separator} />
)}
<View>
<ButtonTertiary
onPress={onPress}
label={label}
size={ButtonSize.Lg}
disabled={disabled || isLoading}
style={buttonStyle}
variant={variant}
{...generateTestId(Platform, testID)}
/>
{isLoading && <Loader size={'small'} />}
</View>
</React.Fragment>
);
},
),
[actions, styles.separator],
);

return <>{renderActions()}</>;
Cal-L marked this conversation as resolved.
Show resolved Hide resolved
};

export default SheetActions;
Cal-L marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// External dependencies.
import { ButtonTertiaryVariant } from '../../../component-library/components/Buttons/ButtonTertiary';

/**
* Sheet action options.
*/
export interface Action {
label: string;
onPress: () => void;
testID?: string;
disabled?: boolean;
isLoading?: boolean;
variant?: ButtonTertiaryVariant;
}

/**
* SheetActionsProps props.
*/
export interface SheetActionsProps {
/**
* List of actions.
*/
actions: Action[];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './SheetActions';
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ const styleSheet = (params: {
: {};
return StyleSheet.create({
base: Object.assign(baseStyle, style) as ViewStyle,
label: size === AvatarSize.Xs ? { lineHeight: 16 } : {},
label:
// Temporarily lower font size in XS size to prevent cut off
size === AvatarSize.Xs ? { lineHeight: undefined, fontSize: 10 } : {},
image: {
flex: 1,
height: undefined,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable react/prop-types */

// Third party dependencies.
import React, { useCallback, useState } from 'react';
import React, { useCallback, useEffect, useState } from 'react';
import { Image, ImageSourcePropType } from 'react-native';

// External dependencies.
Expand Down Expand Up @@ -31,6 +31,10 @@ const AvatarNetwork = ({

const onError = useCallback(() => setShowFallback(true), [setShowFallback]);

useEffect(() => {
setShowFallback(!imageSource);
}, [imageSource]);

return (
<AvatarBase size={size} style={styles.base}>
{showFallback ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ const styleSheet = (params: {
overflow: 'hidden',
borderRadius: haloSize / 2,
},
label: size === AvatarSize.Xs ? { lineHeight: 16 } : {},
label:
// Temporarily lower font size in XS size to prevent cut off
size === AvatarSize.Xs ? { lineHeight: undefined, fontSize: 10 } : {},
image: {
flex: 1,
height: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,98 +9,84 @@ export const AVAILABLE_TOKEN_LIST: AvatarGroupTokenList = [
imageSource: {
uri: 'https://cryptologos.cc/logos/avalanche-avax-logo.png',
},
id: '0',
},
{
name: 'Ethereum',
imageSource: {
uri: 'https://cryptologos.cc/logos/avalanche-avax-logo.png',
},
id: '1',
},
{
name: 'Ethereum',
imageSource: {
uri: 'https://cryptologos.cc/logos/avalanche-avax-logo.png',
},
id: '2',
},
{
name: 'Ethereum',
imageSource: {
uri: 'https://cryptologos.cc/logos/avalanche-avax-logo.png',
},
id: '3',
},
{
name: 'Ethereum',
imageSource: {
uri: 'https://cryptologos.cc/logos/avalanche-avax-logo.png',
},
id: '4',
},
{
name: 'Ethereum',
imageSource: {
uri: 'https://cryptologos.cc/logos/avalanche-avax-logo.png',
},
id: '5',
},
{
name: 'Ethereum',
imageSource: {
uri: 'https://cryptologos.cc/logos/avalanche-avax-logo.png',
},
id: '6',
},
{
name: 'Ethereum',
imageSource: {
uri: 'https://cryptologos.cc/logos/avalanche-avax-logo.png',
},
id: '7',
},
{
name: 'Ethereum',
imageSource: {
uri: 'https://cryptologos.cc/logos/avalanche-avax-logo.png',
},
id: '8',
},
{
name: 'Ethereum',
imageSource: {
uri: 'https://cryptologos.cc/logos/avalanche-avax-logo.png',
},
id: '9',
},
{
name: 'Ethereum',
imageSource: {
uri: 'https://cryptologos.cc/logos/avalanche-avax-logo.png',
},
id: '10',
},
{
name: 'Ethereum',
imageSource: {
uri: 'https://cryptologos.cc/logos/avalanche-avax-logo.png',
},
id: '11',
},
{
name: 'Ethereum',
imageSource: {
uri: 'https://cryptologos.cc/logos/avalanche-avax-logo.png',
},
id: '12',
},
{
name: 'Ethereum',
imageSource: {
uri: 'https://cryptologos.cc/logos/avalanche-avax-logo.png',
},
id: '13',
},
];

Expand Down
Loading