Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2a9777c

Browse files
Merge pull request #5806 from EdgeApp/jon/fix/ramps-approve-abort
Require onClose for fiat/ramps webviews
2 parents c2dcf5d + dd85625 commit 2a9777c

File tree

7 files changed

+22
-5
lines changed

7 files changed

+22
-5
lines changed

‎src/plugins/gui/fiatPlugin.tsx‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,15 @@ export const executePlugin = async (params: {
192192
showToastSpinner,
193193
openWebView: async (params): Promise<void> => {
194194
maybeNavigateToCorrectTabScene()
195-
navigation.navigate('guiPluginWebView', params)
195+
// Ensure onClose is provided per route type. For legacy callers, default to noop.
196+
navigation.navigate('guiPluginWebView', {
197+
...params,
198+
onClose:
199+
params.onClose ??
200+
(() => {
201+
// TODO: Audit close handling for non-ramp plugin callers
202+
})
203+
})
196204
},
197205

198206
openExternalWebView: async (params): Promise<void> => {

‎src/plugins/gui/providers/kadoProvider.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,8 @@ export const kadoProvider: FiatProviderFactory = {
779779
if (direction === 'buy') {
780780
await showUi.openWebView({
781781
url: url.href,
782-
onMessage
782+
onMessage,
783+
onClose: () => {}
783784
})
784785
return
785786
}
@@ -1026,6 +1027,7 @@ export const kadoProvider: FiatProviderFactory = {
10261027
}
10271028
await showUi.openWebView({
10281029
url: url.href,
1030+
onClose: () => {},
10291031
onMessage,
10301032
onUrlChange: newUrl => {
10311033
onUrlChangeAsync(newUrl).catch((error: unknown) => {

‎src/plugins/gui/providers/moonpayProvider.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,8 @@ export const moonpayProvider: FiatProviderFactory = {
870870
}
871871
await showUi.openWebView({
872872
url: urlObj.href,
873-
onUrlChange
873+
onUrlChange,
874+
onClose: () => {}
874875
})
875876
}
876877
await openWebView()

‎src/plugins/gui/providers/paybisProvider.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1079,7 +1079,8 @@ export const paybisProvider: FiatProviderFactory = {
10791079
}
10801080
await showUi.openWebView({
10811081
url: webviewUrl,
1082-
onUrlChange
1082+
onUrlChange,
1083+
onClose: () => {}
10831084
})
10841085
}
10851086
await openWebView()

‎src/plugins/gui/scenes/FiatPluginWebView.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import type { BuySellTabSceneProps } from '../../../types/routerTypes'
1010
export interface FiatPluginOpenWebViewParams {
1111
url: string
1212
injectedJs?: string
13-
onClose?: (() => boolean) | (() => void)
13+
onClose: (() => boolean) | (() => void)
1414
onMessage?: (message: string, injectJs: (js: string) => void) => void
1515
onUrlChange?: (url: string) => void | Promise<void>
1616
}

‎src/plugins/ramps/moonpay/moonpayRampPlugin.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,9 @@ export const moonpayRampPlugin: RampPluginFactory = (
915915
await new Promise<void>((resolve, reject) => {
916916
navigation.navigate('guiPluginWebView', {
917917
url: urlObj.href,
918+
onClose: () => {
919+
resolve()
920+
},
918921
onUrlChange: async (uri: string): Promise<void> => {
919922
console.log('Moonpay WebView url change: ' + uri)
920923

‎src/plugins/ramps/paybis/paybisRampPlugin.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,6 +1216,8 @@ export const paybisRampPlugin: RampPluginFactory = (
12161216
const openWebView = async (): Promise<void> => {
12171217
navigation.navigate('guiPluginWebView', {
12181218
url: webviewUrl,
1219+
// No pending promise to resolve
1220+
onClose: () => {},
12191221
onUrlChange: newUrl => {
12201222
handleUrlChange(newUrl).catch((error: unknown) => {
12211223
showError(error)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /