Skip to content

Commit

Permalink
Feat/move on (#177)
Browse files Browse the repository at this point in the history
* fix login + nav + right

* dynamic screen for evm onboarding with oauth or otp

* add wallet manager evm & strk with passkey + nostr key manager with passkey

* videos hooks nostr

* add dynamic lib
  • Loading branch information
MSghais authored Oct 9, 2024
1 parent 22f262f commit 564ec9b
Show file tree
Hide file tree
Showing 32 changed files with 1,677 additions and 186 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { createStripeBuySession } from "@funkit/api-base";
import type { FastifyInstance, RouteOptions } from "fastify";
import {
FUNKIT_STRIPE_SOURCE_CURRENCY,
Expand Down Expand Up @@ -39,7 +38,9 @@ async function createFunkitStripeCheckout(
}
try {
const sourceAsset = TOKEN_INFO.STARKNET_USDC;
const { initializeCheckout } = await import("@funkit/api-base");
const { initializeCheckout, createStripeBuySession } = await import(
"@funkit/api-base"
);
const depositAddress = await initializeCheckout({
userOp: null,
quoteId,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getCheckoutQuote, getStripeBuyQuote } from "@funkit/api-base";

import type { FastifyInstance, RouteOptions } from "fastify";
import { getChecksumAddress } from "starknet";
import {
Expand Down Expand Up @@ -46,7 +46,9 @@ async function getFunkitStripeCheckoutQuote(
try {
// 1 - Generate the funkit checkout quote
const sourceAsset = TOKEN_INFO.STARKNET_USDC;

const { getCheckoutQuote, getStripeBuyQuote } = await import(
"@funkit/api-base"
);
const normalizedRecipientAddress = getChecksumAddress(address);
const baseQuote = await getCheckoutQuote({
fromChainId: sourceAsset.networkId,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { getCheckoutByDepositAddress } from "@funkit/api-base";
import type { FastifyInstance, RouteOptions } from "fastify";

const FUNKIT_API_KEY = process.env.FUNKIT_API_KEY || "";
Expand All @@ -22,6 +21,9 @@ async function getFunkitStripeCheckoutStatus(
}

try {
const { getCheckoutByDepositAddress } = await import(
"@funkit/api-base"
);
const checkoutItem = await getCheckoutByDepositAddress({
depositAddress: funkitDepositAddress as `0x${string}`,
apiKey: FUNKIT_API_KEY,
Expand Down
9 changes: 6 additions & 3 deletions apps/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@
"@docusaurus/core": "^3.5.2",
"@docusaurus/preset-classic": "^3.5.2",
"@dynamic-labs/client": "4.0.0-alpha.8",
"@dynamic-labs/react-hooks": "4.0.0-alpha.8",
"@dynamic-labs/react-native-extension": "4.0.0-alpha.8",
"@dynamic-labs/utils": "^3.3.0",
"@dynamic-labs/viem-extension": "4.0.0-alpha.8",
"@expo/metro-runtime": "~3.2.1",
"@getalby/bitcoin-connect-react": "^3.5.3",
"@getalby/lightning-tools": "^5.0.3",
Expand All @@ -45,9 +48,9 @@
"@react-navigation/native": "^6.1.17",
"@react-navigation/native-stack": "^6.9.26",
"@react-navigation/stack": "^6.3.29",
"@reown/appkit-auth-wagmi-react-native": "0.0.0-canary-20241004192634",
"@reown/appkit-siwe-react-native": "0.0.0-canary-20241004192634",
"@reown/appkit-wagmi-react-native": "0.0.0-canary-20241004192634",
"@reown/appkit-auth-wagmi-react-native": "1.0.1",
"@reown/appkit-siwe-react-native": "1.0.1",
"@reown/appkit-wagmi-react-native": "1.0.1",
"@starknet-react/chains": "^0.1.7",
"@starknet-react/core": "^2.8.2",
"@starknet-wc/core": "0.0.4",
Expand Down
25 changes: 25 additions & 0 deletions apps/mobile/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"short_name": "AFK",
"name": "AFK - Aligned Fam Kernel",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
144 changes: 74 additions & 70 deletions apps/mobile/src/app/Router.tsx
Original file line number Diff line number Diff line change
@@ -1,70 +1,71 @@
// Hooks
import {useEffect, useMemo, useState} from 'react';
import {useWindowDimensions} from 'react-native';
import {useStyles, useTheme} from '../hooks';
import { useMemo } from 'react';
import { useWindowDimensions } from 'react-native';
import { useStyles, useTheme } from '../hooks';

// Navigation Components
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
import {createDrawerNavigator} from '@react-navigation/drawer';
import {NavigationContainer, useNavigation, useRoute} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { createDrawerNavigator } from '@react-navigation/drawer';
import { NavigationContainer, useNavigation, useRoute } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';

// Modules and Layout
import GroupChatDetail from '../modules/Group/groupDetail/GroupChatDetail';
import GroupChatGroupRequest from '../modules/Group/memberAction/ViewRequest';
import GroupChat from '../modules/Group/message/GroupMessage';
import AuthSidebar from '../modules/Layout/auth-sidebar';
import Sidebar from '../modules/Layout/sidebar';
import RightSidebar from '../modules/Layout/RightSideBar';
// import RightSidebar from '../modules/Layout/RightSideBar';

// Components
import {View} from 'react-native';
import {Icon} from '../components';
import {Navbar} from '../components/Navbar';
import { View } from 'react-native';
import { Icon } from '../components';
import { Navbar } from '../components/Navbar';

// Screens
import {CreateAccount} from '../screens/Auth/CreateAccount';
import {ImportKeys} from '../screens/Auth/ImportKeys';
import {Login} from '../screens/Auth/Login';
import {SaveKeys} from '../screens/Auth/SaveKeys';
import {ChannelDetail} from '../screens/ChannelDetail';
import {ChannelsFeed} from '../screens/ChannelsFeed';
import {CreateChannel} from '../screens/CreateChannel';
import {CreateForm} from '../screens/CreateForm';
import {CreatePost} from '../screens/CreatePost';
import {Defi} from '../screens/Defi';
import {EditProfile} from '../screens/EditProfile';
import {Feed} from '../screens/Feed';
import {Games} from '../screens/Games';
import {LaunchDetail} from '../screens/LaunchDetail';
import {LightningNetworkScreen} from '../screens/Lightning';
import {PostDetail} from '../screens/PostDetail';
import {Profile} from '../screens/Profile';
import {Search} from '../screens/Search';
import {Settings} from '../screens/Settings';
import {Tips} from '../screens/Tips';
import {CashuScreen} from '../screens/Cashu';
import {WalletBTC} from '../screens/WalletBTC';
import {Wallet} from '../screens/Wallet';
import { CreateAccount } from '../screens/Auth/CreateAccount';
import { ImportKeys } from '../screens/Auth/ImportKeys';
import { Login } from '../screens/Auth/Login';
import { SaveKeys } from '../screens/Auth/SaveKeys';
import { ChannelDetail } from '../screens/ChannelDetail';
import { ChannelsFeed } from '../screens/ChannelsFeed';
import { CreateChannel } from '../screens/CreateChannel';
import { CreateForm } from '../screens/CreateForm';
import { CreatePost } from '../screens/CreatePost';
import { Defi } from '../screens/Defi';
import { EditProfile } from '../screens/EditProfile';
import { Feed } from '../screens/Feed';
import { Games } from '../screens/Games';
import { LaunchDetail } from '../screens/LaunchDetail';
import { LightningNetworkScreen } from '../screens/Lightning';
import { PostDetail } from '../screens/PostDetail';
import { Profile } from '../screens/Profile';
import { Search } from '../screens/Search';
import { Settings } from '../screens/Settings';
import { Tips } from '../screens/Tips';
import { CashuScreen } from '../screens/Cashu';
import { WalletBTC } from '../screens/WalletBTC';
import { Wallet } from '../screens/Wallet';

// Styles
import {StyleSheet} from 'react-native';
import {ThemedStyleSheet} from '../styles';
import { StyleSheet } from 'react-native';
import { ThemedStyleSheet } from '../styles';

// Utilities
import {AuthStackParams, HomeBottomStackParams, MainStackParams, RootStackParams} from '../types';
import { AuthStackParams, HomeBottomStackParams, MainStackParams, RootStackParams } from '../types';
// import { retrievePublicKey } from '../utils/storage';

// Icons
import {IconNames} from '../components/Icon';
import {useAuth} from 'afk_nostr_sdk';
import { IconNames } from '../components/Icon';
import { useAuth } from 'afk_nostr_sdk';
import { OnboardingWallet } from '../screens/Onboarding';

type TabBarIconProps = {
focused: boolean;
name: IconNames;
};

const TabBarIcon = ({focused, name}: TabBarIconProps) => {
const TabBarIcon = ({ focused, name }: TabBarIconProps) => {
const styles = useStyles(stylesheet);
return (
<View style={styles.tabBarIcon}>
Expand All @@ -82,9 +83,10 @@ const HomeBottomTabsStack = createBottomTabNavigator<HomeBottomStackParams>();

// Home Bottom Tab Navigator
const HomeBottomTabNavigator: React.FC = () => {
const [publicKey, setPublicKey] = useState<string | null | undefined>(undefined);
const { publicKey } = useAuth()
// const [publicKey, setPublicKey] = useState<string | null | undefined>(undefined);
const styles = useStyles(stylesheet);
const {theme} = useTheme();
const { theme } = useTheme();

// useEffect(() => {
// retrievePublicKey().then((key) => {
Expand All @@ -108,7 +110,7 @@ const HomeBottomTabNavigator: React.FC = () => {
options={{
tabBarActiveTintColor: 'white',
tabBarInactiveTintColor: theme.colors.background,
tabBarIcon: ({focused}) => <TabBarIcon focused={focused} name="HomeIcon" />,
tabBarIcon: ({ focused }) => <TabBarIcon focused={focused} name="HomeIcon" />,
}}
/>

Expand All @@ -118,7 +120,7 @@ const HomeBottomTabNavigator: React.FC = () => {
options={{
tabBarActiveTintColor: 'white',
tabBarInactiveTintColor: 'grey',
tabBarIcon: ({focused}) => <TabBarIcon focused={focused} name="HomeIcon" />,
tabBarIcon: ({ focused }) => <TabBarIcon focused={focused} name="CoinIcon" />,
}}
/>

Expand All @@ -128,7 +130,7 @@ const HomeBottomTabNavigator: React.FC = () => {
options={{
tabBarActiveTintColor: 'white',
tabBarInactiveTintColor: 'grey',
tabBarIcon: ({focused}) => <TabBarIcon focused={focused} name="HomeIcon" />,
tabBarIcon: ({ focused }) => <TabBarIcon focused={focused} name="GameIcon" />,
}}
/>

Expand All @@ -138,19 +140,19 @@ const HomeBottomTabNavigator: React.FC = () => {
options={{
tabBarActiveTintColor: 'white',
tabBarInactiveTintColor: theme.colors.background,
tabBarIcon: ({focused}) => <TabBarIcon focused={focused} name="HomeIcon" />,
tabBarIcon: ({ focused }) => <TabBarIcon focused={focused} name="HomeIcon" />,
}}
/>

{publicKey ? (
<HomeBottomTabsStack.Screen
name="UserProfile"
component={Profile as any}
initialParams={{publicKey}}
initialParams={{ publicKey }}
options={{
tabBarActiveTintColor: 'white',
tabBarInactiveTintColor: 'grey',
tabBarIcon: ({focused}) => <TabBarIcon focused={focused} name="HomeIcon" />,
tabBarIcon: ({ focused }) => <TabBarIcon focused={focused} name="UserIcon" />,
}}
/>
) : (
Expand All @@ -160,7 +162,7 @@ const HomeBottomTabNavigator: React.FC = () => {
options={{
tabBarActiveTintColor: 'white',
tabBarInactiveTintColor: 'grey',
tabBarIcon: ({focused}) => <TabBarIcon focused={focused} name="HomeIcon" />,
tabBarIcon: ({ focused }) => <TabBarIcon focused={focused} name="UserPlusIcon" />,
}}
/>
)}
Expand All @@ -175,7 +177,7 @@ const AuthNavigator: React.FC = () => {
return dimensions.width >= 1024;
}, [dimensions]);

const {publicKey} = useAuth();
const { publicKey } = useAuth();
// const [publicKey, setPublicKey] = useState<string | null | undefined>(undefined);

const theme = useTheme();
Expand All @@ -191,7 +193,7 @@ const AuthNavigator: React.FC = () => {
return (
<AuthStack.Navigator
drawerContent={(props) => <AuthSidebar navigation={props?.navigation}></AuthSidebar>}
screenOptions={({navigation}) => ({
screenOptions={({ navigation }) => ({
header: () => <></>,
// header: () =>!isDesktop ? <Navbar navigation={navigation} title="AFK" showLogo={true} /> : null,
headerShown: !isDesktop,
Expand Down Expand Up @@ -234,15 +236,15 @@ const MainNavigator: React.FC = () => {
const theme = useTheme();

const FeedWithSidebar: React.FC = () => (
<View style={{flexDirection: 'row', flex: 1}}>
<View style={{flex: 1}}>
<View style={{ flexDirection: 'row', flex: 1 }}>
<View style={{ flex: 1 }}>
<Feed navigation={useNavigation()} route={useRoute()} />
</View>
{isDesktop && (
{/* {isDesktop && (
<View style={{width: 300, backgroundColor: theme.theme.colors.surface}}>
<RightSidebar />
</View>
)}
)} */}
</View>
);

Expand All @@ -251,7 +253,7 @@ const MainNavigator: React.FC = () => {
initialRouteName="Home"
// initialRouteName="Feed"
drawerContent={(props) => <Sidebar navigation={props?.navigation}></Sidebar>}
screenOptions={({navigation}) => ({
screenOptions={({ navigation }) => ({
header: () =>
!isDesktop ? <Navbar navigation={navigation} title="AFK" showLogo={true} /> : null,
headerShown: !isDesktop,
Expand Down Expand Up @@ -302,6 +304,7 @@ const MainNavigator: React.FC = () => {
<MainStack.Screen name="ImportKeys" component={ImportKeys} />

<MainStack.Screen name="Wallet" component={Wallet} />
<MainStack.Screen name="Onboarding" component={OnboardingWallet} />
</MainStack.Navigator>
);
};
Expand All @@ -316,9 +319,9 @@ const RootNavigator: React.FC = () => {
// });
// }, []);

const {publicKey} = useAuth();
const { publicKey } = useAuth();
return (
<RootStack.Navigator screenOptions={{headerShown: false}}>
<RootStack.Navigator screenOptions={{ headerShown: false }}>
{/* {publicKey ? (
<RootStack.Screen name="MainStack" component={MainNavigator} />
) : (
Expand Down Expand Up @@ -373,19 +376,20 @@ const linking = {
MainStack: {
path: 'app',
screens: {
AuthStack: {
path: 'auth',
screens: {
Login: 'login',
CreateAccount: 'create-account',
SaveKeys: 'save-keys',
ImportKeys: 'import-keys',
},
},
BottomBar: {
path: '',
},
// AuthStack: {
// path: 'auth',
// screens: {
// Login: 'login',
// CreateAccount: 'create-account',
// SaveKeys: 'save-keys',
// ImportKeys: 'import-keys',
// },
// },
// BottomBar: {
// path: '',
// },
Login: 'login',
Onboarding:"onboarding",
CreateAccount: 'create-account',
SaveKeys: 'save-keys',
ImportKeys: 'import-keys',
Expand Down
Loading

0 comments on commit 564ec9b

Please sign in to comment.