Skip to content

Commit df45a96

Browse files
removed uiMessageWebviewUrlScheme
1 parent 1eea533 commit df45a96

File tree

4 files changed

+10
-18
lines changed

4 files changed

+10
-18
lines changed

example/app/connect.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ export default function Connect() {
3838
onLoaded={(_payload) => {
3939
console.log("Widget has loaded")
4040
}}
41+
onMemberConnected={(payload) => {
42+
console.log(`Member connected with payload: ${JSON.stringify(payload)}`)
43+
}}
4144
onStepChange={(payload) => {
4245
console.log(`Moving from ${payload.previous} to ${payload.current}`)
4346
}}

src/components/renderer.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ export function useWidgetRendererWithRef<Configuration>(
3737
return [ref, <View style={style} />]
3838
}
3939

40-
const scheme = props.uiMessageWebviewUrlScheme || "mx"
41-
const handler = makeRequestInterceptor(url, scheme, {
40+
const handler = makeRequestInterceptor(url, {
4241
onIntercept: (url) => {
4342
dispatchEvent(url, props)
4443
},

src/components/request_interceptor.ts

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ export enum Action {
1010
}
1111

1212
type Callbacks = {
13-
onIntercept?: (url: string) => void
13+
onIntercept: (url: string) => void
1414
}
1515

1616
class Interceptor {
17-
constructor(protected widgetUrl: string, protected uiMessageWebviewUrlScheme: string) {}
17+
constructor(protected widgetUrl: string) {}
1818

1919
action(request: WebViewNavigation): Action {
2020
if (request.url === this.widgetUrl) {
@@ -23,25 +23,16 @@ class Interceptor {
2323

2424
const { protocol } = parseUrl(request.url)
2525

26-
/* The `uiMessageWebviewUrlScheme` value will be something like "appscheme"
27-
* but the `url.protocol` will be "appscheme:", so we slice off the last
28-
* character so that we can compare them.
29-
*/
30-
const scheme = (protocol || "").slice(0, -1)
31-
if (scheme === this.uiMessageWebviewUrlScheme) {
26+
if (protocol === "mx:") {
3227
return Action.Intercept
3328
}
3429

3530
return Action.LoadInBrowser
3631
}
3732
}
3833

39-
export function makeRequestInterceptor(
40-
widgetUrl: string,
41-
uiMessageWebviewUrlScheme: string,
42-
callbacks: Callbacks,
43-
) {
44-
const interceptor = new Interceptor(widgetUrl, uiMessageWebviewUrlScheme)
34+
export function makeRequestInterceptor(widgetUrl: string, callbacks: Callbacks) {
35+
const interceptor = new Interceptor(widgetUrl)
4536

4637
return function (request: WebViewNavigation) {
4738
const action = interceptor.action(request)
@@ -50,7 +41,7 @@ export function makeRequestInterceptor(
5041
return true
5142

5243
case Action.Intercept:
53-
callbacks.onIntercept?.(request.url)
44+
callbacks.onIntercept(request.url)
5445
return false
5546

5647
case Action.LoadInBrowser:

src/sso/widget_configuration.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ export function getWidgetConfigurationFromProps(
8989
is_mobile_webview: true,
9090
mode: props.mode,
9191
ui_message_version: 4,
92-
ui_message_webview_url_scheme: props.uiMessageWebviewUrlScheme,
9392
update_credentials: props.updateCredentials,
9493
widget_type: props.widgetType,
9594
}

0 commit comments

Comments
 (0)