Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lindexi_gd
Uno
提交
4e38a24a
U
Uno
项目概览
lindexi_gd
/
Uno
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
Uno
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4e38a24a
编写于
4月 01, 2023
作者:
M
Martin Zikmund
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: Notify about CanGoBack, CanGoForward changes
上级
3fbd8fb5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
13 deletion
+12
-13
src/Uno.UI/UI/Xaml/Controls/WebView/Native/iOSmacOS/UnoWKWebView.iOSmacOS.cs
...Controls/WebView/Native/iOSmacOS/UnoWKWebView.iOSmacOS.cs
+12
-7
src/Uno.UI/UI/Xaml/Controls/WebView/README.md
src/Uno.UI/UI/Xaml/Controls/WebView/README.md
+0
-6
未找到文件。
src/Uno.UI/UI/Xaml/Controls/WebView/Native/iOSmacOS/UnoWKWebView.iOSmacOS.cs
浏览文件 @
4e38a24a
...
...
@@ -180,7 +180,7 @@ public partial class UnoWKWebView : WKWebView, INativeWebView, IWKScriptMessageH
}
_coreWebView
.
DocumentTitle
=
Title
;
_coreWebView
.
RaiseNavigationCompleted
(
destinationUrl
,
true
,
200
,
CoreWebView2WebErrorStatus
.
Unknown
);
RaiseNavigationCompleted
(
destinationUrl
,
true
,
200
,
CoreWebView2WebErrorStatus
.
Unknown
);
_lastNavigationData
=
destinationUrl
;
}
...
...
@@ -198,7 +198,7 @@ public partial class UnoWKWebView : WKWebView, INativeWebView, IWKScriptMessageH
}
var
targetString
=
target
?.
ToString
();
_coreWebView
.
RaiseNewWindowRequested
(
targetString
,
action
.
SourceFrame
?.
Request
?.
Url
?.
ToUri
(),
out
var
handled
);
RaiseNewWindowRequested
(
targetString
,
action
.
SourceFrame
?.
Request
?.
Url
?.
ToUri
(),
out
var
handled
);
if
(
handled
)
{
...
...
@@ -217,11 +217,11 @@ public partial class UnoWKWebView : WKWebView, INativeWebView, IWKScriptMessageH
#endif
{
OpenUrl
(
targetString
);
_coreWebView
.
RaiseNavigationCompleted
(
target
,
true
,
200
,
CoreWebView2WebErrorStatus
.
Unknown
);
RaiseNavigationCompleted
(
target
,
true
,
200
,
CoreWebView2WebErrorStatus
.
Unknown
);
}
else
{
_coreWebView
.
RaiseNavigationCompleted
(
target
,
false
,
400
,
CoreWebView2WebErrorStatus
.
Unknown
);
RaiseNavigationCompleted
(
target
,
false
,
400
,
CoreWebView2WebErrorStatus
.
Unknown
);
}
}
}
...
...
@@ -231,7 +231,6 @@ public partial class UnoWKWebView : WKWebView, INativeWebView, IWKScriptMessageH
private
void
OpenUrl
(
string
url
)
{
//TODO: CanGoBack and CanGoForward should be refreshed after navigation completed on both Android and iOS
var
nsUrl
=
new
NSUrl
(
url
);
//Opens the specified URL, launching the app that's registered to handle the scheme.
#if __IOS__
...
...
@@ -410,9 +409,15 @@ public partial class UnoWKWebView : WKWebView, INativeWebView, IWKScriptMessageH
return
;
}
_coreWebView
.
SetHistoryProperties
(
CanGoBack
,
CanGoForward
);
_coreWebView
.
RaiseNavigationStarting
(
uriString
,
out
cancel
);
}
private
void
RaiseNavigationCompleted
(
Uri
?
uri
,
bool
isSuccess
,
int
httpStatusCode
,
CoreWebView2WebErrorStatus
errorStatus
)
{
_coreWebView
.
SetHistoryProperties
(
CanGoBack
,
CanGoForward
);
_coreWebView
.
RaiseNavigationCompleted
(
uri
,
isSuccess
,
httpStatusCode
,
errorStatus
);
}
#if __IOS__
private
void
ParseUriAndLauchMailto
(
Uri
mailtoUri
)
...
...
@@ -553,7 +558,7 @@ public partial class UnoWKWebView : WKWebView, INativeWebView, IWKScriptMessageH
uri
=
webView
.
Url
?.
ToUri
()
??
new
Uri
(
_coreWebView
.
Source
);
// TODO:MZ: What if Source is invalid URI?
}
_coreWebView
.
RaiseNavigationCompleted
(
uri
,
false
,
0
,
status
);
// TODO:MZ: What HTTP Status code?
RaiseNavigationCompleted
(
uri
,
false
,
0
,
status
);
// TODO:MZ: What HTTP Status code?
}
_isCancelling
=
false
;
...
...
@@ -667,7 +672,7 @@ public partial class UnoWKWebView : WKWebView, INativeWebView, IWKScriptMessageH
this
.
Log
().
Error
(
$"The uri [
{
uri
}
] is invalid."
);
}
_coreWebView
.
RaiseNavigationCompleted
(
uri
,
false
,
404
,
CoreWebView2WebErrorStatus
.
UnexpectedError
);
RaiseNavigationCompleted
(
uri
,
false
,
404
,
CoreWebView2WebErrorStatus
.
UnexpectedError
);
}
}
...
...
src/Uno.UI/UI/Xaml/Controls/WebView/README.md
浏览文件 @
4e38a24a
...
...
@@ -40,9 +40,3 @@ At the end of the navigation, on `WebView` the either `NavigationCompleted` or `
In
`WebView`
, most the events include
`Uri`
, but
`WebView2`
uses a unique
`NavigationId`
instead.
For details on
`WebView2`
event behavior see: https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/navigation-events
## Navigation ID
As
`WebView2`
tracks each navigation via a unique identifier, we need to have a way to generate these IDs properly.
On iOS and macOS we use the
`WKNavigation`
which is a unique identifier of the load request for a webpage.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录