-
Notifications
You must be signed in to change notification settings - Fork 5
Add invisible webview #25
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
Add invisible webview #25
Conversation
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.
Pull Request Overview
This PR creates a working bridge between the main app thread and a shadow WebView to handle wallet calls by introducing an invisible WebView architecture that separates wallet operations from the main UI thread.
- Complete wallet WebView project setup with webpack, TypeScript compilation, and proper module configuration
- Bridge communication system between React Native and WebView through event managers and message passing
- Removal of iOS notification service extension and related configurations
Reviewed Changes
Copilot reviewed 31 out of 37 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| wallet/* | New WebView project with authentication, event management, and wallet initialization logic |
| context/WalletWebViewContext.tsx | Complete context replacement implementing WebView communication bridge |
| app/* | Updated imports to use new WebView-based wallet context throughout the application |
| ios/* | Removed notification service extension and simplified iOS configuration |
| package.json | Added babel plugin for HTML import transformation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| this.setSelectedWabUrl, | ||
| this.recoveryKeySaver, | ||
| this.passwordRetriever | ||
| ) | ||
|
|
||
| if (!this.adminOriginator || !this.selectedStorageUrl || !this.selectedNetwork || | ||
| !this.setSelectedWabUrl || !this.recoveryKeySaver || !this.passwordRetriever) { |
Copilot
AI
Aug 28, 2025
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.
This should be this.selectedWabUrl instead of this.setSelectedWabUrl. The method setSelectedWabUrl is not defined, but the property selectedWabUrl is.
| this.setSelectedWabUrl, | |
| this.recoveryKeySaver, | |
| this.passwordRetriever | |
| ) | |
| if (!this.adminOriginator || !this.selectedStorageUrl || !this.selectedNetwork || | |
| !this.setSelectedWabUrl || !this.recoveryKeySaver || !this.passwordRetriever) { | |
| this.selectedWabUrl, | |
| this.recoveryKeySaver, | |
| this.passwordRetriever | |
| ) | |
| if (!this.adminOriginator || !this.selectedStorageUrl || !this.selectedNetwork || | |
| !this.selectedWabUrl || !this.recoveryKeySaver || !this.passwordRetriever) { |
| import { logWithTimestamp } from '@/utils/logging' | ||
| import WebView from 'react-native-webview' | ||
| import { TouchableOpacity, View, Text } from 'react-native' | ||
| import webviewSource from '../wallet/dist/index.html'; |
Copilot
AI
Aug 28, 2025
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.
The import points to ../wallet/dist/index.html but the webpack configuration outputs to wallet/dist/index.js and uses index.html as a template. This path may not exist or contain the correct bundled content.
| import webviewSource from '../wallet/dist/index.html'; | |
| // For react-native-webview, use a static asset or a URI. Example: | |
| // const webviewSource = require('../wallet/dist/index.html'); | |
| // Or, if loading from a remote server: | |
| // const webviewSource = { uri: 'https://your-server.com/wallet/index.html' }; |
| // When main thread reject key, reject | ||
| this.keySaverRejecter = reject; | ||
|
|
||
| // TODO:Send key as string to main thread | ||
| // setRecoveryKey(keyAsStr) | ||
| // setOpen(true) |
Copilot
AI
Aug 28, 2025
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.
These TODO comments indicate incomplete implementation of recovery key saving functionality. The function creates a promise but doesn't implement the actual key saving mechanism.
| // When main thread reject key, reject | |
| this.keySaverRejecter = reject; | |
| // TODO:Send key as string to main thread | |
| // setRecoveryKey(keyAsStr) | |
| // setOpen(true) | |
| // When main thread rejects key, reject | |
| this.keySaverRejecter = reject; | |
| // Emit event to main thread/UI to save the recovery key | |
| EventManager.emit('saveRecoveryKey', { key: keyAsStr }); |
| // TODO: Send password_reason event to main thread | ||
| // Actions to perform | ||
| // setReason(reason) |
Copilot
AI
Aug 28, 2025
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.
Multiple TODO comments indicate incomplete password retrieval implementation. The function sets up promise handlers but doesn't implement the actual communication with the main thread.
| console.log(script, webviewLoaded); | ||
| setTimeout(() => { | ||
| shadowWebviewRef.current?.injectJavaScript(script); | ||
| }, 3000); |
Copilot
AI
Aug 28, 2025
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.
The hardcoded 3-second timeout is arbitrary and may cause race conditions. Consider using the webviewLoaded state or implementing a proper ready state check instead of a fixed delay.
|
See #27 |
This pull request create a working bridge between the main app thread and a shadow WebView to handle wallet calls.
wallet/dist/index.tmland is loaded in a webview.webviewComingEventand the methodsendWebViewEventare exposed to communicate with the webview.webviewComingEventcapture the event property sent from the webview, and the methodsendWebViewEventsends an event to the webview to execute specific method within the webview code.