Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

enable privy wallet login #2551

Merged
merged 1 commit into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 6 additions & 1 deletion packages/app/components/header/header.md.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@

export const HeaderMd = withColorScheme(() => {
const { user, isAuthenticated } = useUser();
const { handleSubmitWallet, loading: loginLoading } = useLogin();

Check warning on line 238 in packages/app/components/header/header.md.web.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/components/header/header.md.web.tsx#L238

[unused-imports/no-unused-vars] 'handleSubmitWallet' is assigned a value but never used. Allowed unused vars must match /^_/u.
const { links, social } = useFooter();
const isDark = useIsDarkMode();
const router = useRouter();
Expand Down Expand Up @@ -560,7 +560,12 @@
<Button
size="regular"
tw="mt-6"
onPress={handleSubmitWallet}
onPress={async () => {
if (privy.authenticated) {
await privy.logout();
}
privy.login();
}}
disabled={loginLoading}
>
<>
Expand Down
8 changes: 6 additions & 2 deletions packages/app/components/login/index.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export function Login() {
walletName,
showSignMessage,
verifySignature,
handleSubmitWallet,
loading,
} = useLogin();
const privy = usePrivy();
Expand Down Expand Up @@ -100,7 +99,12 @@ export function Login() {
variant="primary"
tw={`my-2 ${loading ? "opacity-[0.5]" : ""}`}
disabled={loading}
onPress={handleSubmitWallet}
onPress={async () => {
if (privy.authenticated) {
await privy.logout();
}
privy.login();
}}
>
<View tw="absolute left-4 top-3">
<Ethereum
Expand Down
2 changes: 1 addition & 1 deletion packages/app/lib/privy/privy-provider.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<PrivyProviderImpl
appId={process.env.NEXT_PUBLIC_PRIVY_APP_ID}
config={{
loginMethods: ["sms", "google", "apple"],
loginMethods: ["wallet", "sms", "google", "apple"],
defaultChain: baseChain,
embeddedWallets: {
noPromptOnSignature: true,
Expand All @@ -44,7 +44,7 @@
current: null,
} as { current: PrivyInterface | null };

export const PrivyAuth = forwardRef(function PrivyAuth(props: any, ref) {

Check warning on line 47 in packages/app/lib/privy/privy-provider.web.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/lib/privy/privy-provider.web.tsx#L47

[unused-imports/no-unused-vars] 'ref' is defined but never used. Allowed unused args must match /^_/u.
const privy = usePrivy();
const { authenticationStatus, setAuthenticationStatus, login, logout } =
useAuth();
Expand Down
Loading