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

Improve performance #1257

Merged
merged 7 commits into from
Feb 14, 2025
Merged

Improve performance #1257

merged 7 commits into from
Feb 14, 2025

Conversation

nop33
Copy link
Member

@nop33 nop33 commented Feb 11, 2025

Copy link

changeset-bot bot commented Feb 11, 2025

🦋 Changeset detected

Latest commit: 141fa4a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@alephium/mobile-wallet Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@nop33 nop33 marked this pull request as draft February 11, 2025 09:32
@nop33 nop33 changed the title Remove console logs in prod builds Improve performance Feb 11, 2025
@nop33 nop33 added the 📱 MW Mobile wallet label Feb 11, 2025
@nop33 nop33 marked this pull request as ready for review February 11, 2025 16:43
@nop33 nop33 requested a review from mvaivre February 11, 2025 16:43
Comment on lines +7 to +9
import { enableFreeze } from 'react-native-screens'

enableFreeze(true)
Copy link
Member Author

Choose a reason for hiding this comment

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

The current version of screens/freeze integration, freezes updates only on views that are more than one level deep the stack hierarchy (the top and second to top screens are not freezing). This is necessary for slide-to-go-back functionality to work as by sliding back we may reveal the content that is displayed below. This is something we plan on improving in the future such that only the top screen is not frozen.
https://github.com/software-mansion/react-freeze?tab=readme-ov-file#quick-start-with-react-navigation-react-native-

Copy link
Member Author

Choose a reason for hiding this comment

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

Removing the WC code that kept the app running in the bg

@@ -154,7 +154,7 @@ const AddressAnimatedBackground = ({ addressHash }: Pick<AddressDetailsModalHead

if (!address) return null

return <AnimatedBackground shade={address.settings.color} isAnimated />
Copy link
Member Author

Choose a reason for hiding this comment

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

It's the default

Copy link
Member Author

@nop33 nop33 Feb 12, 2025

Choose a reason for hiding this comment

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

This is the main new component that enables animation and gyroscope only when the screen is in focus. The energy consumption remains as it was before when the user remains on the Dashboard, but it significantly reduces in every other screen 👍

Below you can see the difference between being on the Dashboard screen and being on the Addresses screen on a dark theme (half left is the Dashboard, half right is the Addresses)

image

@@ -20,4 +20,11 @@ config.resolver.nodeModulesPaths = [
// Use turborepo to restore the cache when possible
config.cacheStores = [new FileStore({ root: path.join(projectRoot, 'node_modules', '.cache', 'metro') })]

config.transformer.minifierConfig = {
compress: {
// The option below removes all console logs statements in production.
Copy link
Member

Choose a reason for hiding this comment

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

Nice

Copy link
Member

@mvaivre mvaivre left a comment

Choose a reason for hiding this comment

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

Awesome. Great step forward!

@nop33 nop33 merged commit 8a628c6 into next Feb 14, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📱 MW Mobile wallet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants