-
Notifications
You must be signed in to change notification settings - Fork 134
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
chore: remove lint warnings #1272
Open
linnall
wants to merge
8
commits into
main
Choose a base branch
from
linna/mav2-basic-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+33
−29
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ff1d987
docs: updates usage of createSMAV2Account
linnall 4689f74
docs: moves example usage code snippet
linnall 5144ea8
docs: moves changes to correct file
linnall aea4038
docs: adds experimental to import
linnall caff389
refactor: fixes linting warnings
linnall 559de84
fix: fixes lint warnings
linnall 0e4a575
fix: removes mav2 experimental docs
linnall f89d87a
Merge branch 'main' into linna/mav2-basic-docs
linnall File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* eslint-disable import/extensions */ | ||
import { RNAlchemySigner } from "@account-kit/react-native-signer"; | ||
import type { User } from "@account-kit/signer"; | ||
import { useEffect, useState } from "react"; | ||
import { useCallback, useEffect, useState } from "react"; | ||
import { | ||
Linking, | ||
StyleSheet, | ||
|
@@ -20,48 +20,54 @@ export default function MagicLinkAuthScreen() { | |
const [email, setEmail] = useState<string>(""); | ||
const [user, setUser] = useState<User | null>(null); | ||
|
||
const handleUserAuth = ({ bundle }: { bundle: string }) => { | ||
signer | ||
.authenticate({ | ||
bundle, | ||
type: "email", | ||
}) | ||
.then(setUser) | ||
.catch(console.error); | ||
}; | ||
const handleUserAuth = useCallback( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @moldy530 is this refactor okay? there were lint warnings here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. seems fine to me cc @iykazrji |
||
({ bundle }: { bundle: string }) => { | ||
signer | ||
.authenticate({ | ||
bundle, | ||
type: "email", | ||
}) | ||
.then(setUser) | ||
.catch(console.error); | ||
}, | ||
[signer] | ||
); | ||
|
||
const handleIncomingURL = (event: { url: string }) => { | ||
const regex = /[?&]([^=#]+)=([^&#]*)/g; | ||
const handleIncomingURL = useCallback( | ||
(event: { url: string }) => { | ||
const regex = /[?&]([^=#]+)=([^&#]*)/g; | ||
|
||
let params: Record<string, string> = {}; | ||
let match: RegExpExecArray | null; | ||
let params: Record<string, string> = {}; | ||
let match: RegExpExecArray | null; | ||
|
||
while ((match = regex.exec(event.url))) { | ||
if (match[1] && match[2]) { | ||
params[match[1]] = match[2]; | ||
while ((match = regex.exec(event.url))) { | ||
if (match[1] && match[2]) { | ||
params[match[1]] = match[2]; | ||
} | ||
} | ||
} | ||
|
||
if (!params.bundle || !params.orgId) { | ||
return; | ||
} | ||
if (!params.bundle || !params.orgId) { | ||
return; | ||
} | ||
|
||
handleUserAuth({ | ||
bundle: params.bundle ?? "", | ||
}); | ||
}; | ||
handleUserAuth({ | ||
bundle: params.bundle ?? "", | ||
}); | ||
}, | ||
[handleUserAuth] | ||
); | ||
|
||
useEffect(() => { | ||
// get the user if already logged in | ||
signer.getAuthDetails().then(setUser); | ||
}, []); | ||
}, [signer]); | ||
|
||
// Add listener for incoming links | ||
useEffect(() => { | ||
const subscription = Linking.addEventListener("url", handleIncomingURL); | ||
|
||
return () => subscription.remove(); | ||
}, []); | ||
}, [handleIncomingURL]); | ||
|
||
return ( | ||
<View style={styles.container}> | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was this not used? cc @iykazrji