-
Notifications
You must be signed in to change notification settings - Fork 149
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
Torified webview in react-native #247
Torified webview in react-native #247
Conversation
91ae9bc
to
914dc05
Compare
const injectMessage = (id: string, data: object) => { | ||
const json = JSON.stringify(data); | ||
webViewRef.current?.injectJavaScript( | ||
`(function() {window.NativeRobosats.onMessageResolve(${id}, ${json});})();`, |
Check warning
Code scanning / CodeQL
Improper code sanitization
aff1c2e
to
feb3190
Compare
ce2ef1f
to
0ce559f
Compare
1885f18
to
55358d8
Compare
d6358ca
to
b6bcd75
Compare
smooth={true} | ||
avatarClass="" | ||
tooltip={t('This is your trading avatar')} | ||
/> |
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.
I missed this one on the Refactor, should be checked on frontend
413b77b
to
64e3463
Compare
64e3463
to
85b0882
Compare
On the fully dockerized dev environment the npm process cannot save files outside of /frontend directory. Now it can also save the builds to /mobile
return http.status === 200; | ||
} catch { | ||
return false; | ||
} |
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.
@Reckless-Satoshi A gentle try...catch
did the job :)
597a2ca
to
0df6ab2
Compare
Other than the main avatar looking different (style missing) everything else seems to work as intended in web. Ready to merge to create a pre-release with a .apk for testing. Submit a LN invoice from a proxy wallet for 2M Sats. Thanks a lot for figuring out one of the biggest hurdles so far during the development of RoboSats! 🚀 |
this.baseUrl = 'http://robosats6tkf3eva7x2voqso3a5wcorsnw34jveyxfqi2fu7oyheasid.onion'; | ||
this.daemon = Tor({ | ||
stopDaemonOnBackground: false, | ||
numberConcurrentRequests: 0, |
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.
@Reckless-Satoshi According to https://github.com/Sifir-io/react-native-tor/blob/ed9dc6f1c474c3aa1ae7512f7437343159a46480/src/index.tsx#L349 we are safe to set this to 0 (we are using v8) and it should resolve the error you got. I tested loading all pages and didn't get any error.
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.
Awesome!
Has been fun! |
|
3837663333336464643462343531353332346162383631326635353661313764 |
* Add android build workflow * Initial webview on tsx template * Insert ReactJS app from local * Add Android app icon by @red_purdy (#174) * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload * Add files via upload Co-authored-by: RedPurdy <[email protected]> * Fix local reactjs * Add setup guide. Bundled dev main.js * Add react native tor * Move Android CHANGELOG.md to /mobile * Add torified webview in react-native (#247) * Add android build workflow * Android Tor Requests * Fetching internal files (i18n) * react-native-tor does not implement PUT * Get Files from Tor * Revert "Add android build workflow" This reverts commit 340bcf8. * Fix Rebase Removals * External sources * react-native-tor crashes * Last Refactor * Fix/revert setup guide * Add /mobile as volume to npm-dev container On the fully dockerized dev environment the npm process cannot save files outside of /frontend directory. Now it can also save the builds to /mobile * Fix UsafeAlert * Run prettier * Run lint:fix * Main Profile Image fix * Remove Tor Requests limitation Co-authored-by: Reckless_Satoshi <[email protected]> Co-authored-by: RedPurdy <[email protected]> Co-authored-by: KoalaSat <[email protected]>
Fixes #42
We previously refactored the front-end to have a high level API client we can easily switch #242 and created a single component for avatars so static image files can be easily managed #251
This PR includes:
Screenshot taken from an Android device, all the data is being obtained through the Tor daemon.
Issues found on Android
Details of this list: #42 (comment)
Including extra static files on the app will also help to make sure the translation files are on the same version as the JS on the app. My intial approach was to run a static server, but it's not possible because of Compilation error with gradle 7 and react native latest version 0.69 futurepress/react-native-static-server#115, so I just included
i18n
on the mobile webpack bundleSolution: https://github.com/Reckless-Satoshi/robosats/pull/247/files#diff-a7def86cc36a2178b4ee07b000c53d49e04068db4bc85967c0758578a2f37700R44
Using the
request
function I manage to do XHR requests and obtain the base64 of external files.Solution: https://github.com/Reckless-Satoshi/robosats/pull/247/files#diff-ab78113fffebdaf893575b9bdd85086680e9553cf9f9f10bec0a1dc0e11e1c35R55
After Refactor avatars #251 it was way easier to asynchronously manage the image
src
load, I also implemented an in-memory cache to avoid loading the image every time thesrc
is requested (only for the Android build).Solution: https://github.com/Reckless-Satoshi/robosats/pull/247/files#diff-35aa11cfb6d388c4d5c62abbc4b3bc0281ea8d19bc1ec800f0a0f47a59fedbfbR47
PUT Request method Sifir-io/react-native-tor#51 We decided to not implement it.
Following this workaround seems to fix the issue React Native Tor on android freezes Sifir-io/react-native-tor#30 (comment) . At least for my case, it also increased considerably the general performance on Tor requests.
Webview android not saving cookies react-native-webview/react-native-webview#2643 I started working on it, but I ended up modifying +15 files on the web front-end, so I think it's better to just disable cookies on Android and fix it later. HEADS UP! Because of this, accessing the order page will fail, yet the requests are still being done
Changes to test on Web front-end
Remaining work for a fully functional Android app
Further Considerations
JavaBinder
error that repeats over and over and I couldn't find a solution for it, looks like something related to the build size