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

Fix: get app dir from native part to initialize Gno's structures #7

Merged
merged 2 commits into from
Aug 25, 2023

Conversation

D4ryl00
Copy link
Contributor

@D4ryl00 D4ryl00 commented Aug 25, 2023

This PR fixes a crash when I try to run the gnoboard app on Android and on some iOS devices.
The Gno configuration struct BaseOptions needs a dataDir path to create files. The default HomeDir() function provided in tm2/pkg/crypto/keys/client/common.go to get that path doesn't work on mobile and causes a panic, because some environment variables are not set on mobile.
The HomeDir function is called every time the tm2/pkg/crypto/keys/client subfolder is imported because of the global variable DefaultBaseOptions that calls Homedir. To avoid the call of the HomeDir function that calls a panic, we duplicated BaseOptions in gnomobile, so the tm2/pkg/crypto/keys/client is no more imported and we provided it the app container path directory from the Android/iOS native parts.

This PR also updates the go.mod to use the latest version of Gno that fixes the ambiguous import of the btcd dependencies.

@D4ryl00 D4ryl00 requested a review from jefft0 August 25, 2023 10:46
@D4ryl00 D4ryl00 self-assigned this Aug 25, 2023
Copy link
Contributor

@jefft0 jefft0 left a comment

Choose a reason for hiding this comment

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

The gnoboard example works for me on Android and iOS simulators.

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

Successfully merging this pull request may close these issues.

2 participants