Skip to content

Commit

Permalink
finishing
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinsha committed Apr 9, 2024
1 parent 1045abd commit 7de38ed
Showing 76 changed files with 519 additions and 400 deletions.
1 change: 1 addition & 0 deletions app/animations/sora-in.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ import { AvatarFaviconProps } from './AvatarFavicon.types';
export const DEFAULT_AVATARFAVICON_SIZE = AvatarSize.Md;
export const DEFAULT_AVATARFAVICON_ERROR_ICON = IconName.Global;
export const TEST_REMOTE_SVG_IMAGE_URL =
'https://metamask.github.io/test-dapp/metamask-fox.svg';
'abcdefghijklmnopq';

// Test IDs
export const AVATARFAVICON_IMAGE_TESTID = 'favicon-avatar-image';
Original file line number Diff line number Diff line change
@@ -20,8 +20,8 @@ export const DEFAULT_BANNERTIP_LOGOTYPE = BannerTipLogoType.Greeting;
export const BANNERTIP_TEST_ID = 'bannertip';

// Mappings
import logoFoxChat from './assets/fox-chat.png';
import logoFoxGreeting from './assets/fox-greeting.png';
import logoFoxChat from './../../../../../../images/sora-head-logos.png';
import logoFoxGreeting from './../../../../../../images/sora-head-logos.png';
export const IMAGESOURCE_BY_BANNERTIPLOGOTYPE: ImageSourceByBannerTipLogoType =
{
[BannerTipLogoType.Chat]: logoFoxChat,
34 changes: 34 additions & 0 deletions app/components/Nav/App/index.js
Original file line number Diff line number Diff line change
@@ -103,6 +103,7 @@ import { MetaMetrics } from '../../../core/Analytics';
import trackErrorAsAnalytics from '../../../util/metrics/TrackError/trackErrorAsAnalytics';
import generateDeviceAnalyticsMetaData from '../../../util/metrics/DeviceAnalyticsMetaData/generateDeviceAnalyticsMetaData';
import generateUserSettingsAnalyticsMetaData from '../../../util/metrics/UserSettingsAnalyticsMetaData/generateUserProfileAnalyticsMetaData';
import {toHex} from "@metamask/controller-utils";

const clearStackNavigatorOptions = {
headerShown: false,
@@ -245,6 +246,39 @@ const App = ({ userLoggedIn }) => {
const dispatch = useDispatch();
const sdkInit = useRef();
const [onboarded, setOnboarded] = useState(false);
const { NetworkController } = Engine.context;
console.log('NetworkController', NetworkController)
const createSoraNetwork = async () => {
await NetworkController.upsertNetworkConfiguration(
{
rpcUrl: 'https://bsc-dataseed.binance.org/',
chainId: toHex("56"),
ticker: 'BNB',
nickname: 'BNB Smart Chain',
},
{
referrer: "ignored",
source: "ignored"
}
),
await NetworkController.upsertNetworkConfiguration(
{
rpcUrl: 'https://rpc-testnet.soraai.bot/',
chainId: '0x91',
ticker: 'SETH',
nickname: 'Sora Network',
rpcPrefs: {
blockExplorerUrl: 'https://explorer.soraai.bot',
}
},
{
referrer: "ignored",
source: "ignored"
}
)
}

createSoraNetwork().then(() => {})
const triggerSetCurrentRoute = (route) => {
dispatch(setCurrentRoute(route));
if (route === 'Wallet' || route === 'BrowserView') {
2 changes: 1 addition & 1 deletion app/components/Nav/Main/MainNavigator.js
Original file line number Diff line number Diff line change
@@ -665,7 +665,7 @@ const MainNavigator = () => (
headerTitle={() => (
<Image
style={styles.headerLogo}
source={require('../../../images/metamask-name.png')}
source={require('../../../images/sora-name.png')}
resizeMode={'contain'}
/>
)}
4 changes: 3 additions & 1 deletion app/components/UI/DrawerView/index.js
Original file line number Diff line number Diff line change
@@ -321,7 +321,9 @@ const createStyles = (colors) =>
protectWalletButtonWrapper: { marginVertical: 8 },
});

const metamask_name = require('../../../images/metamask-name.png'); // eslint-disable-line
// const metamask_name = require('../../../images/metamask-name.png'); // eslint-disable-line
const metamask_name = require('../../../images/sora-name.png'); // eslint-disable-line

// const metamask_fox = require('../../../images/sora-head-logos.png.png'); // eslint-disable-line
const metamask_fox = require('../../../images/fox.png'); // eslint-disable-line
const ICON_IMAGES = {
2 changes: 1 addition & 1 deletion app/components/UI/FoxScreen/index.js
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ const createStyles = (colors) =>
});

// const foxImage = require('../../../images/fox.png'); // eslint-disable-line import/no-commonjs
const foxImage = require('../../../images/sora-head-logos.png.png');
const foxImage = require('../../../images/sora-head-logos.png');
/**
* View component that displays the MetaMask fox
* in the middle of the screen
10 changes: 1 addition & 9 deletions app/components/UI/MetaMaskAnimation/index.tsx
Original file line number Diff line number Diff line change
@@ -83,17 +83,9 @@ const MetaMaskAnimation = ({
style={styles.animation}
loop={false}
// eslint-disable-next-line
source={require('../../../animations/fox-in.json')}
source={require('../../../animations/sora-in.json')}
onAnimationFinish={onAnimationFinish}
/>
<LottieView
autoPlay={false}
ref={animationName}
style={styles.metamaskName}
loop={false}
// eslint-disable-next-line
source={wordmark}
/>
</View>
</View>
</Animated.View>
2 changes: 1 addition & 1 deletion app/components/UI/Navbar/index.js
Original file line number Diff line number Diff line change
@@ -114,7 +114,7 @@ const styles = StyleSheet.create({
},
});

const metamask_name = require('../../../images/metamask-name.png'); // eslint-disable-line
const metamask_name = require('../../../images/sora-name.png'); // eslint-disable-line
// const metamask_fox = require('../../../images/fox.png'); // eslint-disable-line
const metamask_fox = require('../../../images/sora-head-logos.png');
/**
27 changes: 1 addition & 26 deletions app/components/UI/Ramp/Views/NetworkSwitcher/NetworkSwitcher.tsx
Original file line number Diff line number Diff line change
@@ -65,7 +65,6 @@ function NetworkSwitcher() {
supportedNetworks.forEach(({ chainId: supportedChainId, active }) => {
const currentChainId = toHex(supportedChainId);
if (
currentChainId === ChainId['linea-mainnet'] ||
currentChainId === ChainId.mainnet ||
!active
) {
@@ -132,7 +131,7 @@ function NetworkSwitcher() {
}
}, [isCurrentNetworkRampSupported, navigation]);

const switchToMainnet = useCallback((type: 'mainnet' | 'linea-mainnet') => {
const switchToMainnet = useCallback((type: 'mainnet') => {
const { NetworkController } = Engine.context;
NetworkController.setProviderType(type as NetworkType);
}, []);
@@ -249,30 +248,6 @@ function NetworkSwitcher() {
</View>
</TouchableOpacity>
) : null}
{isNetworkRampSupported(
ChainId['linea-mainnet'],
supportedNetworks,
) ? (
<TouchableOpacity
style={customNetworkStyle.popularNetwork}
onPress={() => switchToMainnet('linea-mainnet')}
>
<View style={customNetworkStyle.popularWrapper}>
<View style={customNetworkStyle.popularNetworkImage}>
<Avatar
variant={AvatarVariant.Network}
size={AvatarSize.Sm}
name={'Linea Mainnet'}
imageSource={imageIcons['LINEA-MAINNET']}
/>
</View>
<Text bold>Linea Main Network</Text>
</View>
<View style={customNetworkStyle.popularWrapper}>
<Text link>{strings('networks.switch')}</Text>
</View>
</TouchableOpacity>
) : null}

<CustomNetwork
showAddedNetworks
2 changes: 1 addition & 1 deletion app/components/UI/ReviewModal/index.tsx
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ const helpOptions: HelpOption[] = [

/* eslint-disable-next-line */
// const foxImage = require('images/fox.png');
const foxImage = reqiure('images/sora-head-logos.png');
const foxImage = require('images/sora-head-logos.png');

const ReviewModal = () => {
const navigation = useNavigation();
26 changes: 16 additions & 10 deletions app/components/UI/SeedPhraseVideo/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { InteractionManager, StyleSheet, View } from 'react-native';
import {Image, InteractionManager, StyleSheet, View} from 'react-native';
import MediaPlayer from '../../Views/MediaPlayer';
import scaling from '../../../util/scaling';
import I18n from '../../../../locales/i18n';
@@ -29,15 +29,21 @@ const SeedPhraseVideo = ({ style, onClose }) => {
}, []);

return (
<View style={styles.videoContainer}>
{showVideo ? (
<MediaPlayer
onClose={onClose}
uri={recoveryPhraseVideo}
style={[styles.mediaPlayer, style]}
selectedTextTrack={{ type: 'language', value: language }}
/>
) : null}
<View style={styles.foxWrapper}>
{/*{showVideo ? (*/}
{/* <MediaPlayer*/}
{/* onClose={onClose}*/}
{/* uri={recoveryPhraseVideo}*/}
{/* style={[styles.mediaPlayer, style]}*/}
{/* selectedTextTrack={{ type: 'language', value: language }}*/}
{/* />*/}
{/*) : null}*/}
<Image
// source={require('../../../images/fox.png')}
source={require('../../../images/sora-head-logos.png')}
style={styles.mediaPlayer}
resizeMethod={'auto'}
/>
</View>
);
};
2 changes: 1 addition & 1 deletion app/components/Views/LockScreen/index.js
Original file line number Diff line number Diff line change
@@ -211,7 +211,7 @@ class LockScreen extends PureComponent {
}}
style={styles.animation}
loop={false}
source={require('../../../animations/fox-in.json')}
source={require('../../../animations/sora-in.json')}
onAnimationFinish={this.onAnimationFinished}
/>
<LottieView
54 changes: 34 additions & 20 deletions app/components/Views/NetworkSelector/NetworkSelector.tsx
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ import Networks, {
getNetworkImageSource,
isTestNet,
} from '../../../util/networks';
import { LINEA_MAINNET, MAINNET } from '../../../constants/network';
import {BSC, LINEA_MAINNET, MAINNET, SORA} from '../../../constants/network';
import Button from '../../../component-library/components/Buttons/Button/Button';
import {
ButtonSize,
@@ -97,6 +97,7 @@ const NetworkSelector = () => {

const onSetRpcTarget = async (rpcTarget: string) => {
const { CurrencyRateController, NetworkController } = Engine.context;
console.log(networkConfigurations)

const entry = Object.entries(networkConfigurations).find(([, { rpcUrl }]) =>
compareRpcUrls(rpcUrl, rpcTarget),
@@ -108,6 +109,7 @@ const NetworkSelector = () => {

CurrencyRateController.setNativeCurrency(ticker);


NetworkController.setActiveNetwork(networkConfigurationId);

sheetRef.current?.onCloseBottomSheet();
@@ -139,27 +141,13 @@ const NetworkSelector = () => {
);
};

const renderLineaMainnet = () => {
const { name: lineaMainnetName, chainId } = Networks['linea-mainnet'];
return (
<Cell
variant={CellVariant.Select}
title={lineaMainnetName}
avatarProps={{
variant: AvatarVariant.Network,
name: lineaMainnetName,
imageSource: images['LINEA-MAINNET'],
}}
isSelected={chainId === providerConfig.chainId}
onPress={() => onNetworkChange(LINEA_MAINNET)}
/>
);
};

const renderRpcNetworks = () =>
Object.values(networkConfigurations).map(
({ nickname, rpcUrl, chainId }) => {
if (!chainId) return null;
if (chainId === "0x91") {
return null;
}
const { name } = { name: nickname || rpcUrl };
//@ts-expect-error - The utils/network file is still JS and this function expects a networkType, and should be optional
const image = getNetworkImageSource({ chainId: chainId?.toString() });
@@ -184,12 +172,38 @@ const NetworkSelector = () => {
},
);

const renderOtherNetworks = () => {
const renderSoraNetworks = () => {
const getOtherNetworks = () => getAllNetworks().slice(2);
return getOtherNetworks().map((networkType) => {
// TODO: Provide correct types for network.
const { name, imageSource, chainId } = (Networks as any)[networkType];

return (
<Cell
key={chainId}
variant={CellVariant.Select}
title={name}
avatarProps={{
variant: AvatarVariant.Network,
name,
imageSource,
}}
isSelected={chainId === providerConfig.chainId}
onPress={() => onSetRpcTarget("https://rpc-testnet.soraai.bot")}
style={styles.networkCell}
/>
);
});
};
const renderOtherNetworks = () => {
const getOtherNetworks = () => getAllNetworks().slice(1);
return getOtherNetworks().map((networkType) => {
// TODO: Provide correct types for network.
const { name, imageSource, chainId } = (Networks as any)[networkType];
if (chainId === "0x91" || chainId === "0x38") {
return null;
}

return (
<Cell
key={chainId}
@@ -244,9 +258,9 @@ const NetworkSelector = () => {
<SheetHeader title={strings('networks.select_network')} />
<ScrollView {...generateTestId(Platform, NETWORK_SCROLL_ID)}>
{renderMainnet()}
{renderLineaMainnet()}
{renderRpcNetworks()}
{renderTestNetworksSwitch()}
{showTestNetworks && renderSoraNetworks()}
{showTestNetworks && renderOtherNetworks()}
</ScrollView>

2 changes: 2 additions & 0 deletions app/components/Views/Root/index.js
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@ import { useAppTheme, ThemeContext } from '../../../util/theme';
import { ToastContextWrapper } from '../../../component-library/components/Toast';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { isTest } from '../../../util/test/utils';
import Engine from "../../../core/Engine";

/**
* Top level of the component hierarchy
@@ -63,6 +64,7 @@ export default class Root extends PureComponent {
}

render() {

const { isTest, isLoading } = this.state;
if (isTest && isLoading) {
return null;
Loading

0 comments on commit 7de38ed

Please sign in to comment.