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

feat: save last selected account #34

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

feat: save last selected account #34

wants to merge 7 commits into from

Conversation

yuyongmao
Copy link
Contributor

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind api-change
/kind ui-change
/kind bug
/kind cleanup
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake

Which issue(s) this PR fixes:

Fixes #33

React.useEffect(() => {
async function init() {
try {
const lastSelectedAssets = await AsyncStorage.getItem(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we turn these getter and setter to react hooks? https://usehooks.com/useLocalStorage/

Toast.success(i18n.t("saveSuccess"), 2, () => {
Toast.success(i18n.t("saveSuccess"), 2, async () => {
try {
await AsyncStorage.setItem("@LastSelectedAssets:key", assets);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about move to mmkv

@@ -104,6 +104,7 @@
"@apollo/client": "3.3.12",
"@callstack/react-theme-provider": "^2.1.0",
"@expo/vector-icons": "^12.0.4",
"@react-native-async-storage/async-storage": "^1.14.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are there two async-storage?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@react-native-community/async-storage not found at npmjs.com
I deleted it.

@@ -85,18 +79,20 @@ export const About = connect(

const [reportAnimateCount, setReportAnimateCount] = useState(0);
const [subscriptionFlash, setSubscriptionFlash] = useState(false);

const { getItem, setItem } = useAsyncStorage("@SubscriptionFlash:key");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SubscriptionFlashCard:key

""
);

const [, setSubFlash] = useAsyncStorage("@SubscriptionFlash:key", "");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SubscriptionFlashCard:key

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

remember the "From" "To" entries of the last time for the user
3 participants