react-native-windows 0.74.41 → 0.74.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Microsoft.ReactNative/CompositionComponentView.idl +0 -5
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +0 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +0 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +0 -4
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +0 -26
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +0 -2
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +2 -56
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +0 -10
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +1 -1
- package/Microsoft.ReactNative/packages.lock.json +48 -48
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems.filters +1 -3
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/WinUI.props +1 -1
- package/Shared/Networking/WinRTWebSocketResource.cpp +82 -101
- package/Shared/Networking/WinRTWebSocketResource.h +91 -7
- package/package.json +1 -1
|
@@ -89,11 +89,6 @@ namespace Microsoft.ReactNative.Composition
|
|
|
89
89
|
Microsoft.ReactNative.ViewProps ViewProps { get; };
|
|
90
90
|
};
|
|
91
91
|
|
|
92
|
-
// Some other interfaces we could consider implementing/exposing
|
|
93
|
-
// Use ifdef USE_EXPERIMENTAL_WINUI3 to add these
|
|
94
|
-
// Microsoft.UI.Content.IContentLink // Use ifdef USE_EXPERIMENTAL_WINUI3
|
|
95
|
-
// Microsoft.UI.Content.IContentSiteBridge
|
|
96
|
-
// Microsoft.UI.Content.IContentSiteBridge2 // Use ifdef USE_EXPERIMENTAL_WINUI3
|
|
97
92
|
[experimental]
|
|
98
93
|
[webhosthidden]
|
|
99
94
|
runtimeclass ContentIslandComponentView : ViewComponentView {
|
|
@@ -28,12 +28,10 @@ CompositionDynamicAutomationProvider::CompositionDynamicAutomationProvider(
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
32
31
|
CompositionDynamicAutomationProvider::CompositionDynamicAutomationProvider(
|
|
33
32
|
const winrt::Microsoft::ReactNative::Composition::ComponentView &componentView,
|
|
34
33
|
const winrt::Microsoft::UI::Content::ChildSiteLink &childSiteLink) noexcept
|
|
35
34
|
: m_view{componentView}, m_childSiteLink{childSiteLink} {}
|
|
36
|
-
#endif // USE_EXPERIMENTAL_WINUI3
|
|
37
35
|
|
|
38
36
|
HRESULT __stdcall CompositionDynamicAutomationProvider::Navigate(
|
|
39
37
|
NavigateDirection direction,
|
|
@@ -41,7 +39,6 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::Navigate(
|
|
|
41
39
|
if (pRetVal == nullptr)
|
|
42
40
|
return E_POINTER;
|
|
43
41
|
|
|
44
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
45
42
|
if (m_childSiteLink) {
|
|
46
43
|
if (direction == NavigateDirection_FirstChild || direction == NavigateDirection_LastChild) {
|
|
47
44
|
auto fragment = m_childSiteLink.AutomationProvider().try_as<IRawElementProviderFragment>();
|
|
@@ -49,7 +46,6 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::Navigate(
|
|
|
49
46
|
return S_OK;
|
|
50
47
|
}
|
|
51
48
|
}
|
|
52
|
-
#endif // USE_EXPERIMENTAL_WINUI3
|
|
53
49
|
|
|
54
50
|
return UiaNavigateHelper(m_view.view(), direction, *pRetVal);
|
|
55
51
|
}
|
|
@@ -25,11 +25,9 @@ class CompositionDynamicAutomationProvider : public winrt::implements<
|
|
|
25
25
|
CompositionDynamicAutomationProvider(
|
|
26
26
|
const winrt::Microsoft::ReactNative::Composition::ComponentView &componentView) noexcept;
|
|
27
27
|
|
|
28
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
29
28
|
CompositionDynamicAutomationProvider(
|
|
30
29
|
const winrt::Microsoft::ReactNative::Composition::ComponentView &componentView,
|
|
31
30
|
const winrt::Microsoft::UI::Content::ChildSiteLink &childContentLink) noexcept;
|
|
32
|
-
#endif // USE_EXPERIMENTAL_WINUI3
|
|
33
31
|
|
|
34
32
|
// inherited via IRawElementProviderFragment
|
|
35
33
|
virtual HRESULT __stdcall Navigate(NavigateDirection direction, IRawElementProviderFragment **pRetVal) override;
|
|
@@ -92,10 +90,8 @@ class CompositionDynamicAutomationProvider : public winrt::implements<
|
|
|
92
90
|
private:
|
|
93
91
|
::Microsoft::ReactNative::ReactTaggedView m_view;
|
|
94
92
|
std::vector<winrt::com_ptr<IRawElementProviderSimple>> m_selectionItems;
|
|
95
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
96
93
|
// Non-null when this UIA node is the peer of a ContentIslandComponentView.
|
|
97
94
|
winrt::Microsoft::UI::Content::ChildSiteLink m_childSiteLink{nullptr};
|
|
98
|
-
#endif
|
|
99
95
|
};
|
|
100
96
|
|
|
101
97
|
} // namespace winrt::Microsoft::ReactNative::implementation
|
|
@@ -174,7 +174,6 @@ HRESULT __stdcall CompositionRootAutomationProvider::get_FragmentRoot(IRawElemen
|
|
|
174
174
|
|
|
175
175
|
*pRetVal = nullptr;
|
|
176
176
|
|
|
177
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
178
177
|
if (m_island) {
|
|
179
178
|
auto parentRoot = m_island.FragmentRootAutomationProvider();
|
|
180
179
|
auto spFragment = parentRoot.try_as<IRawElementProviderFragmentRoot>();
|
|
@@ -183,7 +182,6 @@ HRESULT __stdcall CompositionRootAutomationProvider::get_FragmentRoot(IRawElemen
|
|
|
183
182
|
return S_OK;
|
|
184
183
|
}
|
|
185
184
|
}
|
|
186
|
-
#endif
|
|
187
185
|
|
|
188
186
|
return S_OK;
|
|
189
187
|
}
|
|
@@ -290,7 +288,6 @@ HRESULT __stdcall CompositionRootAutomationProvider::Navigate(
|
|
|
290
288
|
}
|
|
291
289
|
}
|
|
292
290
|
} else if (direction == NavigateDirection_Parent) {
|
|
293
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
294
291
|
if (m_island) {
|
|
295
292
|
auto parent = m_island.ParentAutomationProvider();
|
|
296
293
|
auto spFragment = parent.try_as<IRawElementProviderFragment>();
|
|
@@ -299,7 +296,6 @@ HRESULT __stdcall CompositionRootAutomationProvider::Navigate(
|
|
|
299
296
|
return S_OK;
|
|
300
297
|
}
|
|
301
298
|
}
|
|
302
|
-
#endif
|
|
303
299
|
}
|
|
304
300
|
|
|
305
301
|
*pRetVal = nullptr;
|
|
@@ -44,7 +44,6 @@ ContentIslandComponentView::ContentIslandComponentView(
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
void ContentIslandComponentView::OnMounted() noexcept {
|
|
47
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
48
47
|
m_childSiteLink = winrt::Microsoft::UI::Content::ChildSiteLink::Create(
|
|
49
48
|
rootComponentView()->parentContentIsland(),
|
|
50
49
|
winrt::Microsoft::ReactNative::Composition::Experimental::CompositionContextHelper::InnerVisual(Visual())
|
|
@@ -84,21 +83,17 @@ void ContentIslandComponentView::OnMounted() noexcept {
|
|
|
84
83
|
}));
|
|
85
84
|
view = view.Parent();
|
|
86
85
|
}
|
|
87
|
-
#endif
|
|
88
86
|
}
|
|
89
87
|
|
|
90
88
|
void ContentIslandComponentView::OnUnmounted() noexcept {
|
|
91
89
|
m_layoutMetricChangedRevokers.clear();
|
|
92
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
93
90
|
if (m_navigationHostDepartFocusRequestedToken && m_navigationHost) {
|
|
94
91
|
m_navigationHost.DepartFocusRequested(m_navigationHostDepartFocusRequestedToken);
|
|
95
92
|
m_navigationHostDepartFocusRequestedToken = {};
|
|
96
93
|
}
|
|
97
|
-
#endif
|
|
98
94
|
}
|
|
99
95
|
|
|
100
96
|
void ContentIslandComponentView::ParentLayoutChanged() noexcept {
|
|
101
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
102
97
|
if (m_layoutChangePosted)
|
|
103
98
|
return;
|
|
104
99
|
|
|
@@ -114,30 +109,21 @@ void ContentIslandComponentView::ParentLayoutChanged() noexcept {
|
|
|
114
109
|
strongThis->m_layoutChangePosted = false;
|
|
115
110
|
}
|
|
116
111
|
});
|
|
117
|
-
#endif
|
|
118
112
|
}
|
|
119
113
|
|
|
120
114
|
winrt::IInspectable ContentIslandComponentView::EnsureUiaProvider() noexcept {
|
|
121
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
122
115
|
if (m_uiaProvider == nullptr) {
|
|
123
116
|
m_uiaProvider = winrt::make<winrt::Microsoft::ReactNative::implementation::CompositionDynamicAutomationProvider>(
|
|
124
117
|
*get_strong(), m_childSiteLink);
|
|
125
118
|
}
|
|
126
119
|
return m_uiaProvider;
|
|
127
|
-
#else
|
|
128
|
-
return Super::EnsureUiaProvider();
|
|
129
|
-
#endif
|
|
130
120
|
}
|
|
131
121
|
|
|
132
122
|
bool ContentIslandComponentView::focusable() const noexcept {
|
|
133
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
134
123
|
// We don't have a way to check to see if the ContentIsland has focusable content,
|
|
135
124
|
// so we'll always return true. We'll have to handle the case where the content doesn't have
|
|
136
125
|
// focusable content in the OnGotFocus handler.
|
|
137
126
|
return true;
|
|
138
|
-
#else
|
|
139
|
-
return Super::focusable();
|
|
140
|
-
#endif
|
|
141
127
|
}
|
|
142
128
|
|
|
143
129
|
// Helper to convert a FocusNavigationDirection to a FocusNavigationReason.
|
|
@@ -156,17 +142,12 @@ winrt::Microsoft::UI::Input::FocusNavigationReason GetFocusNavigationReason(
|
|
|
156
142
|
|
|
157
143
|
void ContentIslandComponentView::onGotFocus(
|
|
158
144
|
const winrt::Microsoft::ReactNative::Composition::Input::RoutedEventArgs &args) noexcept {
|
|
159
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
160
145
|
auto gotFocusEventArgs = args.as<winrt::Microsoft::ReactNative::implementation::GotFocusEventArgs>();
|
|
161
146
|
const auto navigationReason = GetFocusNavigationReason(gotFocusEventArgs->Direction());
|
|
162
147
|
m_navigationHost.NavigateFocus(winrt::Microsoft::UI::Input::FocusNavigationRequest::Create(navigationReason));
|
|
163
|
-
#else
|
|
164
|
-
return Super::onGotFocus(args);
|
|
165
|
-
#endif // USE_EXPERIMENTAL_WINUI3
|
|
166
148
|
}
|
|
167
149
|
|
|
168
150
|
ContentIslandComponentView::~ContentIslandComponentView() noexcept {
|
|
169
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
170
151
|
if (m_navigationHostDepartFocusRequestedToken && m_navigationHost) {
|
|
171
152
|
m_navigationHost.DepartFocusRequested(m_navigationHostDepartFocusRequestedToken);
|
|
172
153
|
m_navigationHostDepartFocusRequestedToken = {};
|
|
@@ -189,7 +170,6 @@ ContentIslandComponentView::~ContentIslandComponentView() noexcept {
|
|
|
189
170
|
m_previousSiblingAutomationProviderRequestedToken = {};
|
|
190
171
|
}
|
|
191
172
|
}
|
|
192
|
-
#endif // USE_EXPERIMENTAL_WINUI3
|
|
193
173
|
if (m_islandToConnect) {
|
|
194
174
|
m_islandToConnect.Close();
|
|
195
175
|
}
|
|
@@ -212,31 +192,26 @@ void ContentIslandComponentView::UnmountChildComponentView(
|
|
|
212
192
|
void ContentIslandComponentView::updateLayoutMetrics(
|
|
213
193
|
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
214
194
|
facebook::react::LayoutMetrics const &oldLayoutMetrics) noexcept {
|
|
215
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
216
195
|
if (m_childSiteLink) {
|
|
217
196
|
m_childSiteLink.ActualSize({layoutMetrics.frame.size.width, layoutMetrics.frame.size.height});
|
|
218
197
|
ParentLayoutChanged();
|
|
219
198
|
}
|
|
220
|
-
#endif
|
|
221
199
|
base_type::updateLayoutMetrics(layoutMetrics, oldLayoutMetrics);
|
|
222
200
|
}
|
|
223
201
|
|
|
224
202
|
void ContentIslandComponentView::Connect(const winrt::Microsoft::UI::Content::ContentIsland &contentIsland) noexcept {
|
|
225
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
226
203
|
if (m_childSiteLink) {
|
|
227
204
|
m_islandToConnect = nullptr;
|
|
228
205
|
m_childSiteLink.Connect(contentIsland);
|
|
229
206
|
} else {
|
|
230
207
|
m_islandToConnect = contentIsland;
|
|
231
208
|
}
|
|
232
|
-
#endif // USE_EXPERIMENTAL_WINUI3
|
|
233
209
|
}
|
|
234
210
|
|
|
235
211
|
void ContentIslandComponentView::prepareForRecycle() noexcept {
|
|
236
212
|
Super::prepareForRecycle();
|
|
237
213
|
}
|
|
238
214
|
|
|
239
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
240
215
|
void ContentIslandComponentView::ConfigureChildSiteLinkAutomation() noexcept {
|
|
241
216
|
// This automation mode must be set before connecting the child ContentIsland.
|
|
242
217
|
// It puts the child content into a mode where it won't own its own framework root. Instead, the child island's
|
|
@@ -288,6 +263,5 @@ void ContentIslandComponentView::ConfigureChildSiteLinkAutomation() noexcept {
|
|
|
288
263
|
args.Handled(true);
|
|
289
264
|
});
|
|
290
265
|
}
|
|
291
|
-
#endif // USE_EXPERIMENTAL_WINUI3
|
|
292
266
|
|
|
293
267
|
} // namespace winrt::Microsoft::ReactNative::Composition::implementation
|
|
@@ -61,7 +61,6 @@ struct ContentIslandComponentView : ContentIslandComponentViewT<ContentIslandCom
|
|
|
61
61
|
winrt::event_token m_mountedToken;
|
|
62
62
|
winrt::event_token m_unmountedToken;
|
|
63
63
|
std::vector<winrt::Microsoft::ReactNative::ComponentView::LayoutMetricsChanged_revoker> m_layoutMetricChangedRevokers;
|
|
64
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
65
64
|
winrt::Microsoft::UI::Content::ChildSiteLink m_childSiteLink{nullptr};
|
|
66
65
|
winrt::Microsoft::UI::Input::InputFocusNavigationHost m_navigationHost{nullptr};
|
|
67
66
|
winrt::event_token m_navigationHostDepartFocusRequestedToken{};
|
|
@@ -72,7 +71,6 @@ struct ContentIslandComponentView : ContentIslandComponentViewT<ContentIslandCom
|
|
|
72
71
|
winrt::event_token m_parentAutomationProviderRequestedToken{};
|
|
73
72
|
winrt::event_token m_nextSiblingAutomationProviderRequestedToken{};
|
|
74
73
|
winrt::event_token m_previousSiblingAutomationProviderRequestedToken{};
|
|
75
|
-
#endif
|
|
76
74
|
};
|
|
77
75
|
|
|
78
76
|
} // namespace winrt::Microsoft::ReactNative::Composition::implementation
|
package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp
CHANGED
|
@@ -56,12 +56,10 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
56
56
|
m_window = nullptr;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
60
59
|
if (m_popUp) {
|
|
61
60
|
m_popUp.Close();
|
|
62
61
|
m_popUp = nullptr;
|
|
63
62
|
}
|
|
64
|
-
#endif
|
|
65
63
|
}
|
|
66
64
|
|
|
67
65
|
void InitializePortalViewComponent(
|
|
@@ -139,11 +137,7 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
139
137
|
}
|
|
140
138
|
|
|
141
139
|
void AdjustWindowSize(const winrt::Microsoft::ReactNative::LayoutMetrics &layoutMetrics) noexcept {
|
|
142
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
143
140
|
if (!m_popUp) {
|
|
144
|
-
#else
|
|
145
|
-
if (!m_window) {
|
|
146
|
-
#endif
|
|
147
141
|
return;
|
|
148
142
|
}
|
|
149
143
|
|
|
@@ -159,20 +153,12 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
159
153
|
int32_t yCor = static_cast<int32_t>(
|
|
160
154
|
(parentRC.top + parentRC.bottom - layoutMetrics.Frame.Height * layoutMetrics.PointScaleFactor) / 2);
|
|
161
155
|
|
|
162
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
163
156
|
winrt::Windows::Graphics::RectInt32 rect2{
|
|
164
157
|
(int)xCor,
|
|
165
158
|
(int)yCor,
|
|
166
159
|
static_cast<int32_t>(layoutMetrics.Frame.Width * (layoutMetrics.PointScaleFactor)),
|
|
167
160
|
static_cast<int32_t>(layoutMetrics.Frame.Height * (layoutMetrics.PointScaleFactor))};
|
|
168
161
|
m_popUp.MoveAndResize(rect2);
|
|
169
|
-
#else
|
|
170
|
-
// Adjust window position and size
|
|
171
|
-
m_window.ResizeClient(
|
|
172
|
-
{static_cast<int32_t>(layoutMetrics.Frame.Width * (layoutMetrics.PointScaleFactor)),
|
|
173
|
-
static_cast<int32_t>(layoutMetrics.Frame.Height * (layoutMetrics.PointScaleFactor))});
|
|
174
|
-
m_window.Move({xCor, yCor});
|
|
175
|
-
#endif
|
|
176
162
|
};
|
|
177
163
|
|
|
178
164
|
void ShowOnUIThread(const winrt::Microsoft::ReactNative::ComponentView &view) {
|
|
@@ -182,7 +168,6 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
182
168
|
m_showQueued = false;
|
|
183
169
|
EnsureModalCreated(view);
|
|
184
170
|
|
|
185
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
186
171
|
if (m_popUp) {
|
|
187
172
|
m_bridge.Enable();
|
|
188
173
|
m_popUp.Show();
|
|
@@ -198,7 +183,6 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
198
183
|
eventEmitter->onShow(eventArgs);
|
|
199
184
|
}
|
|
200
185
|
}
|
|
201
|
-
#endif
|
|
202
186
|
|
|
203
187
|
if (m_window && !m_window.IsVisible()) {
|
|
204
188
|
m_bridge.Enable();
|
|
@@ -224,11 +208,9 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
224
208
|
m_window.Hide();
|
|
225
209
|
}
|
|
226
210
|
|
|
227
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
228
211
|
if (m_popUp) {
|
|
229
212
|
m_popUp.Hide();
|
|
230
213
|
}
|
|
231
|
-
#endif
|
|
232
214
|
|
|
233
215
|
// dispatch onDismiss event
|
|
234
216
|
if (auto eventEmitter = EventEmitter()) {
|
|
@@ -252,11 +234,9 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
252
234
|
return;
|
|
253
235
|
}
|
|
254
236
|
|
|
255
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
256
237
|
if (m_popUp) {
|
|
257
238
|
return;
|
|
258
239
|
}
|
|
259
|
-
#endif
|
|
260
240
|
// get the root hwnd
|
|
261
241
|
m_prevWindowID =
|
|
262
242
|
winrt::Microsoft::ReactNative::ReactCoreInjection::GetTopLevelWindowId(view.ReactContext().Properties());
|
|
@@ -266,14 +246,13 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
266
246
|
|
|
267
247
|
auto portal = view.as<winrt::Microsoft::ReactNative::Composition::PortalComponentView>();
|
|
268
248
|
|
|
269
|
-
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
270
249
|
m_bridge = winrt::Microsoft::UI::Content::DesktopChildSiteBridge::Create(
|
|
271
250
|
view.Parent().as<winrt::Microsoft::ReactNative::Composition::ComponentView>().Compositor(),
|
|
272
251
|
winrt::Microsoft::UI::GetWindowIdFromWindow(m_parentHwnd));
|
|
273
252
|
m_reactNativeIsland = winrt::Microsoft::ReactNative::ReactNativeIsland::CreatePortal(portal);
|
|
274
253
|
auto contentIsland = m_reactNativeIsland.Island();
|
|
275
254
|
|
|
276
|
-
m_popUp =
|
|
255
|
+
m_popUp = winrt::Microsoft::UI::Content::DesktopPopupSiteBridge::Create(contentIsland);
|
|
277
256
|
m_popUp.Connect(contentIsland);
|
|
278
257
|
|
|
279
258
|
// set the top-level windows as the new hwnd
|
|
@@ -291,37 +270,6 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
291
270
|
}
|
|
292
271
|
});
|
|
293
272
|
|
|
294
|
-
#else
|
|
295
|
-
auto presenter = winrt::Microsoft::UI::Windowing::OverlappedPresenter::CreateForDialog();
|
|
296
|
-
presenter.SetBorderAndTitleBar(true, false);
|
|
297
|
-
presenter.IsModal(true);
|
|
298
|
-
|
|
299
|
-
m_window = winrt::Microsoft::UI::Windowing::AppWindow::Create(
|
|
300
|
-
presenter, winrt::Microsoft::UI::GetWindowIdFromWindow(m_parentHwnd));
|
|
301
|
-
|
|
302
|
-
// set the top-level windows as the new hwnd
|
|
303
|
-
winrt::Microsoft::ReactNative::ReactCoreInjection::SetTopLevelWindowId(
|
|
304
|
-
view.ReactContext().Properties(),
|
|
305
|
-
reinterpret_cast<uint64_t>(winrt::Microsoft::UI::GetWindowFromWindowId(m_window.Id())));
|
|
306
|
-
|
|
307
|
-
// create a react native island - code taken from CompositionHwndHost
|
|
308
|
-
m_bridge = winrt::Microsoft::UI::Content::DesktopChildSiteBridge::Create(
|
|
309
|
-
view.Parent().as<winrt::Microsoft::ReactNative::Composition::ComponentView>().Compositor(), m_window.Id());
|
|
310
|
-
m_reactNativeIsland = winrt::Microsoft::ReactNative::ReactNativeIsland::CreatePortal(portal);
|
|
311
|
-
auto contentIsland = m_reactNativeIsland.Island();
|
|
312
|
-
|
|
313
|
-
auto navHost = winrt::Microsoft::UI::Input::InputFocusNavigationHost::GetForSiteBridge(m_bridge);
|
|
314
|
-
m_departFocusToken = navHost.DepartFocusRequested(
|
|
315
|
-
[wkView = winrt::make_weak(view)](
|
|
316
|
-
const auto &sender, const winrt::Microsoft::UI::Input::FocusNavigationRequestEventArgs &args) {
|
|
317
|
-
if (auto strongView = wkView.get()) {
|
|
318
|
-
TrySetFocus(strongView.Parent());
|
|
319
|
-
}
|
|
320
|
-
});
|
|
321
|
-
m_bridge.Connect(contentIsland);
|
|
322
|
-
|
|
323
|
-
#endif
|
|
324
|
-
|
|
325
273
|
m_bridge.ResizePolicy(winrt::Microsoft::UI::Content::ContentSizePolicy::ResizeContentToParentWindow);
|
|
326
274
|
|
|
327
275
|
m_islandStateChangedToken =
|
|
@@ -390,9 +338,7 @@ struct ModalHostView : public winrt::implements<ModalHostView, winrt::Windows::F
|
|
|
390
338
|
winrt::Microsoft::ReactNative::IComponentState m_state{nullptr};
|
|
391
339
|
winrt::Microsoft::UI::Content::DesktopChildSiteBridge m_bridge{nullptr};
|
|
392
340
|
winrt::Microsoft::ReactNative::ReactNativeIsland m_reactNativeIsland{nullptr};
|
|
393
|
-
|
|
394
|
-
winrt::Microsoft::UI::Content::PopupWindowSiteBridge m_popUp{nullptr};
|
|
395
|
-
#endif
|
|
341
|
+
winrt::Microsoft::UI::Content::DesktopPopupSiteBridge m_popUp{nullptr};
|
|
396
342
|
};
|
|
397
343
|
|
|
398
344
|
void RegisterWindowsModalHostNativeComponent(
|
|
@@ -893,16 +893,6 @@ winrt::Microsoft::UI::Content::ContentIsland ReactNativeIsland::Island() {
|
|
|
893
893
|
if (args.DidLayoutDirectionChange()) {
|
|
894
894
|
pThis->Arrange(pThis->m_layoutConstraints, pThis->m_viewportOffset);
|
|
895
895
|
}
|
|
896
|
-
#ifndef USE_EXPERIMENTAL_WINUI3 // Use this in place of Connected/Disconnected events for now. -- Its not quite what we
|
|
897
|
-
// want, but it will do for now.
|
|
898
|
-
if (args.DidSiteVisibleChange()) {
|
|
899
|
-
if (island.IsSiteVisible()) {
|
|
900
|
-
pThis->OnMounted();
|
|
901
|
-
} else {
|
|
902
|
-
pThis->OnUnmounted();
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
#endif
|
|
906
896
|
}
|
|
907
897
|
});
|
|
908
898
|
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
@@ -154,7 +154,7 @@ struct ReactNativeIsland
|
|
|
154
154
|
bool m_isJSViewAttached{false};
|
|
155
155
|
bool m_hasRenderedVisual{false};
|
|
156
156
|
bool m_showingLoadingUI{false};
|
|
157
|
-
bool m_mounted{
|
|
157
|
+
bool m_mounted{true};
|
|
158
158
|
winrt::weak_ref<winrt::Microsoft::ReactNative::Composition::PortalComponentView> m_portal{nullptr};
|
|
159
159
|
IReactDispatcher m_uiDispatcher{nullptr};
|
|
160
160
|
winrt::IInspectable m_uiaProvider{nullptr};
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
},
|
|
33
33
|
"Microsoft.WindowsAppSDK": {
|
|
34
34
|
"type": "Direct",
|
|
35
|
-
"requested": "[1.
|
|
36
|
-
"resolved": "1.
|
|
37
|
-
"contentHash": "
|
|
35
|
+
"requested": "[1.7.250401001, )",
|
|
36
|
+
"resolved": "1.7.250401001",
|
|
37
|
+
"contentHash": "kPsJ2LZoo3Xs/6FtIWMZRGnQ2ZMx9zDa0ZpqRGz1qwZr0gwwlXZJTmngaA1Ym2AHmIa05NtX2jEE2He8CzfhTg==",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"Microsoft.Web.WebView2": "1.0.
|
|
39
|
+
"Microsoft.Web.WebView2": "1.0.2903.40",
|
|
40
40
|
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
|
|
41
41
|
}
|
|
42
42
|
},
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
},
|
|
53
53
|
"Microsoft.Web.WebView2": {
|
|
54
54
|
"type": "Transitive",
|
|
55
|
-
"resolved": "1.0.
|
|
56
|
-
"contentHash": "
|
|
55
|
+
"resolved": "1.0.2903.40",
|
|
56
|
+
"contentHash": "THrzYAnJgE3+cNH+9Epr44XjoZoRELdVpXlWGPs6K9C9G6TqyDfVCeVAR/Er8ljLitIUX5gaSkPsy9wRhD1sgQ=="
|
|
57
57
|
},
|
|
58
58
|
"Microsoft.Windows.SDK.BuildTools": {
|
|
59
59
|
"type": "Transitive",
|
|
@@ -87,120 +87,120 @@
|
|
|
87
87
|
"native,Version=v0.0/win10-arm": {
|
|
88
88
|
"Microsoft.WindowsAppSDK": {
|
|
89
89
|
"type": "Direct",
|
|
90
|
-
"requested": "[1.
|
|
91
|
-
"resolved": "1.
|
|
92
|
-
"contentHash": "
|
|
90
|
+
"requested": "[1.7.250401001, )",
|
|
91
|
+
"resolved": "1.7.250401001",
|
|
92
|
+
"contentHash": "kPsJ2LZoo3Xs/6FtIWMZRGnQ2ZMx9zDa0ZpqRGz1qwZr0gwwlXZJTmngaA1Ym2AHmIa05NtX2jEE2He8CzfhTg==",
|
|
93
93
|
"dependencies": {
|
|
94
|
-
"Microsoft.Web.WebView2": "1.0.
|
|
94
|
+
"Microsoft.Web.WebView2": "1.0.2903.40",
|
|
95
95
|
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"Microsoft.Web.WebView2": {
|
|
99
99
|
"type": "Transitive",
|
|
100
|
-
"resolved": "1.0.
|
|
101
|
-
"contentHash": "
|
|
100
|
+
"resolved": "1.0.2903.40",
|
|
101
|
+
"contentHash": "THrzYAnJgE3+cNH+9Epr44XjoZoRELdVpXlWGPs6K9C9G6TqyDfVCeVAR/Er8ljLitIUX5gaSkPsy9wRhD1sgQ=="
|
|
102
102
|
}
|
|
103
103
|
},
|
|
104
104
|
"native,Version=v0.0/win10-arm-aot": {
|
|
105
105
|
"Microsoft.WindowsAppSDK": {
|
|
106
106
|
"type": "Direct",
|
|
107
|
-
"requested": "[1.
|
|
108
|
-
"resolved": "1.
|
|
109
|
-
"contentHash": "
|
|
107
|
+
"requested": "[1.7.250401001, )",
|
|
108
|
+
"resolved": "1.7.250401001",
|
|
109
|
+
"contentHash": "kPsJ2LZoo3Xs/6FtIWMZRGnQ2ZMx9zDa0ZpqRGz1qwZr0gwwlXZJTmngaA1Ym2AHmIa05NtX2jEE2He8CzfhTg==",
|
|
110
110
|
"dependencies": {
|
|
111
|
-
"Microsoft.Web.WebView2": "1.0.
|
|
111
|
+
"Microsoft.Web.WebView2": "1.0.2903.40",
|
|
112
112
|
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
|
|
113
113
|
}
|
|
114
114
|
},
|
|
115
115
|
"Microsoft.Web.WebView2": {
|
|
116
116
|
"type": "Transitive",
|
|
117
|
-
"resolved": "1.0.
|
|
118
|
-
"contentHash": "
|
|
117
|
+
"resolved": "1.0.2903.40",
|
|
118
|
+
"contentHash": "THrzYAnJgE3+cNH+9Epr44XjoZoRELdVpXlWGPs6K9C9G6TqyDfVCeVAR/Er8ljLitIUX5gaSkPsy9wRhD1sgQ=="
|
|
119
119
|
}
|
|
120
120
|
},
|
|
121
121
|
"native,Version=v0.0/win10-arm64-aot": {
|
|
122
122
|
"Microsoft.WindowsAppSDK": {
|
|
123
123
|
"type": "Direct",
|
|
124
|
-
"requested": "[1.
|
|
125
|
-
"resolved": "1.
|
|
126
|
-
"contentHash": "
|
|
124
|
+
"requested": "[1.7.250401001, )",
|
|
125
|
+
"resolved": "1.7.250401001",
|
|
126
|
+
"contentHash": "kPsJ2LZoo3Xs/6FtIWMZRGnQ2ZMx9zDa0ZpqRGz1qwZr0gwwlXZJTmngaA1Ym2AHmIa05NtX2jEE2He8CzfhTg==",
|
|
127
127
|
"dependencies": {
|
|
128
|
-
"Microsoft.Web.WebView2": "1.0.
|
|
128
|
+
"Microsoft.Web.WebView2": "1.0.2903.40",
|
|
129
129
|
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
|
|
130
130
|
}
|
|
131
131
|
},
|
|
132
132
|
"Microsoft.Web.WebView2": {
|
|
133
133
|
"type": "Transitive",
|
|
134
|
-
"resolved": "1.0.
|
|
135
|
-
"contentHash": "
|
|
134
|
+
"resolved": "1.0.2903.40",
|
|
135
|
+
"contentHash": "THrzYAnJgE3+cNH+9Epr44XjoZoRELdVpXlWGPs6K9C9G6TqyDfVCeVAR/Er8ljLitIUX5gaSkPsy9wRhD1sgQ=="
|
|
136
136
|
}
|
|
137
137
|
},
|
|
138
138
|
"native,Version=v0.0/win10-x64": {
|
|
139
139
|
"Microsoft.WindowsAppSDK": {
|
|
140
140
|
"type": "Direct",
|
|
141
|
-
"requested": "[1.
|
|
142
|
-
"resolved": "1.
|
|
143
|
-
"contentHash": "
|
|
141
|
+
"requested": "[1.7.250401001, )",
|
|
142
|
+
"resolved": "1.7.250401001",
|
|
143
|
+
"contentHash": "kPsJ2LZoo3Xs/6FtIWMZRGnQ2ZMx9zDa0ZpqRGz1qwZr0gwwlXZJTmngaA1Ym2AHmIa05NtX2jEE2He8CzfhTg==",
|
|
144
144
|
"dependencies": {
|
|
145
|
-
"Microsoft.Web.WebView2": "1.0.
|
|
145
|
+
"Microsoft.Web.WebView2": "1.0.2903.40",
|
|
146
146
|
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
|
|
147
147
|
}
|
|
148
148
|
},
|
|
149
149
|
"Microsoft.Web.WebView2": {
|
|
150
150
|
"type": "Transitive",
|
|
151
|
-
"resolved": "1.0.
|
|
152
|
-
"contentHash": "
|
|
151
|
+
"resolved": "1.0.2903.40",
|
|
152
|
+
"contentHash": "THrzYAnJgE3+cNH+9Epr44XjoZoRELdVpXlWGPs6K9C9G6TqyDfVCeVAR/Er8ljLitIUX5gaSkPsy9wRhD1sgQ=="
|
|
153
153
|
}
|
|
154
154
|
},
|
|
155
155
|
"native,Version=v0.0/win10-x64-aot": {
|
|
156
156
|
"Microsoft.WindowsAppSDK": {
|
|
157
157
|
"type": "Direct",
|
|
158
|
-
"requested": "[1.
|
|
159
|
-
"resolved": "1.
|
|
160
|
-
"contentHash": "
|
|
158
|
+
"requested": "[1.7.250401001, )",
|
|
159
|
+
"resolved": "1.7.250401001",
|
|
160
|
+
"contentHash": "kPsJ2LZoo3Xs/6FtIWMZRGnQ2ZMx9zDa0ZpqRGz1qwZr0gwwlXZJTmngaA1Ym2AHmIa05NtX2jEE2He8CzfhTg==",
|
|
161
161
|
"dependencies": {
|
|
162
|
-
"Microsoft.Web.WebView2": "1.0.
|
|
162
|
+
"Microsoft.Web.WebView2": "1.0.2903.40",
|
|
163
163
|
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
|
|
164
164
|
}
|
|
165
165
|
},
|
|
166
166
|
"Microsoft.Web.WebView2": {
|
|
167
167
|
"type": "Transitive",
|
|
168
|
-
"resolved": "1.0.
|
|
169
|
-
"contentHash": "
|
|
168
|
+
"resolved": "1.0.2903.40",
|
|
169
|
+
"contentHash": "THrzYAnJgE3+cNH+9Epr44XjoZoRELdVpXlWGPs6K9C9G6TqyDfVCeVAR/Er8ljLitIUX5gaSkPsy9wRhD1sgQ=="
|
|
170
170
|
}
|
|
171
171
|
},
|
|
172
172
|
"native,Version=v0.0/win10-x86": {
|
|
173
173
|
"Microsoft.WindowsAppSDK": {
|
|
174
174
|
"type": "Direct",
|
|
175
|
-
"requested": "[1.
|
|
176
|
-
"resolved": "1.
|
|
177
|
-
"contentHash": "
|
|
175
|
+
"requested": "[1.7.250401001, )",
|
|
176
|
+
"resolved": "1.7.250401001",
|
|
177
|
+
"contentHash": "kPsJ2LZoo3Xs/6FtIWMZRGnQ2ZMx9zDa0ZpqRGz1qwZr0gwwlXZJTmngaA1Ym2AHmIa05NtX2jEE2He8CzfhTg==",
|
|
178
178
|
"dependencies": {
|
|
179
|
-
"Microsoft.Web.WebView2": "1.0.
|
|
179
|
+
"Microsoft.Web.WebView2": "1.0.2903.40",
|
|
180
180
|
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
|
|
181
181
|
}
|
|
182
182
|
},
|
|
183
183
|
"Microsoft.Web.WebView2": {
|
|
184
184
|
"type": "Transitive",
|
|
185
|
-
"resolved": "1.0.
|
|
186
|
-
"contentHash": "
|
|
185
|
+
"resolved": "1.0.2903.40",
|
|
186
|
+
"contentHash": "THrzYAnJgE3+cNH+9Epr44XjoZoRELdVpXlWGPs6K9C9G6TqyDfVCeVAR/Er8ljLitIUX5gaSkPsy9wRhD1sgQ=="
|
|
187
187
|
}
|
|
188
188
|
},
|
|
189
189
|
"native,Version=v0.0/win10-x86-aot": {
|
|
190
190
|
"Microsoft.WindowsAppSDK": {
|
|
191
191
|
"type": "Direct",
|
|
192
|
-
"requested": "[1.
|
|
193
|
-
"resolved": "1.
|
|
194
|
-
"contentHash": "
|
|
192
|
+
"requested": "[1.7.250401001, )",
|
|
193
|
+
"resolved": "1.7.250401001",
|
|
194
|
+
"contentHash": "kPsJ2LZoo3Xs/6FtIWMZRGnQ2ZMx9zDa0ZpqRGz1qwZr0gwwlXZJTmngaA1Ym2AHmIa05NtX2jEE2He8CzfhTg==",
|
|
195
195
|
"dependencies": {
|
|
196
|
-
"Microsoft.Web.WebView2": "1.0.
|
|
196
|
+
"Microsoft.Web.WebView2": "1.0.2903.40",
|
|
197
197
|
"Microsoft.Windows.SDK.BuildTools": "10.0.22621.756"
|
|
198
198
|
}
|
|
199
199
|
},
|
|
200
200
|
"Microsoft.Web.WebView2": {
|
|
201
201
|
"type": "Transitive",
|
|
202
|
-
"resolved": "1.0.
|
|
203
|
-
"contentHash": "
|
|
202
|
+
"resolved": "1.0.2903.40",
|
|
203
|
+
"contentHash": "THrzYAnJgE3+cNH+9Epr44XjoZoRELdVpXlWGPs6K9C9G6TqyDfVCeVAR/Er8ljLitIUX5gaSkPsy9wRhD1sgQ=="
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
}
|
|
@@ -149,9 +149,6 @@
|
|
|
149
149
|
<ClInclude Include="$(TurboModule_SourcePath)\ReactCommon\TurboModule.h">
|
|
150
150
|
<Filter>TurboModule</Filter>
|
|
151
151
|
</ClInclude>
|
|
152
|
-
<ClInclude Include="$(TurboModule_SourcePath)\ReactCommon\LongLivedObject.h">
|
|
153
|
-
<Filter>TurboModule</Filter>
|
|
154
|
-
</ClInclude>
|
|
155
152
|
<ClInclude Include="$(TurboModule_SourcePath)\ReactCommon\TurboModuleUtils.h">
|
|
156
153
|
<Filter>TurboModule</Filter>
|
|
157
154
|
</ClInclude>
|
|
@@ -171,6 +168,7 @@
|
|
|
171
168
|
<ClInclude Include="$(NodeApiDir)js_native_api.h" />
|
|
172
169
|
<ClInclude Include="$(NodeApiDir)js_native_api_types.h" />
|
|
173
170
|
<ClInclude Include="$(NodeApiDir)js_runtime_api.h" />
|
|
171
|
+
<ClInclude Include="$(Bridging_SourcePath)\LongLivedObject.h" />
|
|
174
172
|
</ItemGroup>
|
|
175
173
|
<ItemGroup>
|
|
176
174
|
<Filter Include="JSI">
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
12
12
|
<PropertyGroup>
|
|
13
|
-
<ReactNativeWindowsVersion>0.74.
|
|
13
|
+
<ReactNativeWindowsVersion>0.74.43</ReactNativeWindowsVersion>
|
|
14
14
|
<ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
|
|
15
15
|
<ReactNativeWindowsMinor>74</ReactNativeWindowsMinor>
|
|
16
|
-
<ReactNativeWindowsPatch>
|
|
16
|
+
<ReactNativeWindowsPatch>43</ReactNativeWindowsPatch>
|
|
17
17
|
<ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
|
|
18
|
-
<ReactNativeWindowsCommitId>
|
|
18
|
+
<ReactNativeWindowsCommitId>0de32f17b3b6b02f1ac60e17ef47a426b7445868</ReactNativeWindowsCommitId>
|
|
19
19
|
</PropertyGroup>
|
|
20
20
|
</Project>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<WinUI3ExperimentalVersion Condition="'$(WinUI3ExperimentalVersion)'==''">1.7.250127003-experimental3</WinUI3ExperimentalVersion>
|
|
10
10
|
<!-- This value is also used by the CLI, see /packages/@react-native-windows/cli/.../autolinkWindows.ts -->
|
|
11
11
|
<WinUI3Version Condition="'$(WinUI3Version)'=='' AND '$(UseExperimentalWinUI3)'=='true'">$(WinUI3ExperimentalVersion)</WinUI3Version>
|
|
12
|
-
<WinUI3Version Condition="'$(WinUI3Version)'==''">1.
|
|
12
|
+
<WinUI3Version Condition="'$(WinUI3Version)'==''">1.7.250401001</WinUI3Version>
|
|
13
13
|
</PropertyGroup>
|
|
14
14
|
|
|
15
15
|
<PropertyGroup Label="WinUI2x versioning">
|
|
@@ -89,7 +89,6 @@ DispatchQueue GetCurrentOrSerialQueue() noexcept {
|
|
|
89
89
|
|
|
90
90
|
return queue;
|
|
91
91
|
}
|
|
92
|
-
|
|
93
92
|
} // namespace
|
|
94
93
|
|
|
95
94
|
namespace Microsoft::React::Networking {
|
|
@@ -104,7 +103,6 @@ WinRTWebSocketResource2::WinRTWebSocketResource2(
|
|
|
104
103
|
: m_socket{std::move(socket)},
|
|
105
104
|
m_writer(std::move(writer)),
|
|
106
105
|
m_readyState{ReadyState::Connecting},
|
|
107
|
-
m_connectPerformed{CreateEvent(/*attributes*/ nullptr, /*manual reset*/ true, /*state*/ false, /*name*/ nullptr)},
|
|
108
106
|
m_callingQueue{callingQueue} {
|
|
109
107
|
for (const auto &certException : certExceptions) {
|
|
110
108
|
m_socket.Control().IgnorableServerCertificateErrors().Append(certException);
|
|
@@ -221,125 +219,112 @@ void WinRTWebSocketResource2::OnClosed(IWebSocket const &sender, IWebSocketClose
|
|
|
221
219
|
|
|
222
220
|
fire_and_forget WinRTWebSocketResource2::PerformConnect(Uri &&uri) noexcept {
|
|
223
221
|
auto self = shared_from_this();
|
|
224
|
-
auto
|
|
222
|
+
auto movedUri = std::move(uri);
|
|
225
223
|
|
|
226
224
|
co_await resume_in_queue(self->m_backgroundQueue);
|
|
227
225
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
SetEvent(self->m_connectPerformed.get());
|
|
226
|
+
co_await self->m_sequencer.QueueTaskAsync(
|
|
227
|
+
[self = self->shared_from_this(), coUri = std::move(movedUri)]() -> IAsyncAction {
|
|
228
|
+
auto coSelf = self->shared_from_this();
|
|
229
|
+
|
|
230
|
+
auto async = coSelf->m_socket.ConnectAsync(coUri);
|
|
231
|
+
co_await lessthrow_await_adapter<IAsyncAction>{async};
|
|
232
|
+
|
|
233
|
+
auto result = async.ErrorCode();
|
|
234
|
+
try {
|
|
235
|
+
if (result >= 0) { // Non-failing HRESULT
|
|
236
|
+
coSelf->m_readyState = ReadyState::Open;
|
|
237
|
+
|
|
238
|
+
co_await resume_in_queue(coSelf->m_callingQueue);
|
|
239
|
+
if (coSelf->m_connectHandler) {
|
|
240
|
+
coSelf->m_connectHandler();
|
|
241
|
+
}
|
|
242
|
+
} else {
|
|
243
|
+
coSelf->Fail(std::move(result), ErrorType::Connection);
|
|
244
|
+
}
|
|
245
|
+
} catch (hresult_error const &e) {
|
|
246
|
+
coSelf->Fail(e, ErrorType::Connection);
|
|
247
|
+
} catch (std::exception const &e) {
|
|
248
|
+
coSelf->Fail(e.what(), ErrorType::Connection);
|
|
249
|
+
}
|
|
250
|
+
});
|
|
254
251
|
}
|
|
255
252
|
|
|
256
253
|
fire_and_forget WinRTWebSocketResource2::PerformClose() noexcept {
|
|
257
254
|
auto self = shared_from_this();
|
|
258
255
|
|
|
259
|
-
co_await resume_on_signal(self->m_connectPerformed.get());
|
|
260
|
-
|
|
261
256
|
co_await resume_in_queue(self->m_backgroundQueue);
|
|
262
257
|
|
|
263
|
-
|
|
264
|
-
|
|
258
|
+
co_await self->m_sequencer.QueueTaskAsync([self = self->shared_from_this()]() -> IAsyncAction {
|
|
259
|
+
auto coSelf = self->shared_from_this();
|
|
265
260
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
261
|
+
try {
|
|
262
|
+
coSelf->m_socket.Close(static_cast<uint16_t>(coSelf->m_closeCode), winrt::to_hstring(coSelf->m_closeReason));
|
|
263
|
+
coSelf->m_readyState = ReadyState::Closing;
|
|
264
|
+
} catch (winrt::hresult_invalid_argument const &e) {
|
|
265
|
+
coSelf->Fail(e, ErrorType::Close);
|
|
266
|
+
} catch (hresult_error const &e) {
|
|
267
|
+
coSelf->Fail(e, ErrorType::Close);
|
|
268
|
+
} catch (const std::exception &e) {
|
|
269
|
+
coSelf->Fail(e.what(), ErrorType::Close);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
co_return;
|
|
273
|
+
});
|
|
276
274
|
}
|
|
277
275
|
|
|
278
|
-
fire_and_forget WinRTWebSocketResource2::
|
|
276
|
+
fire_and_forget WinRTWebSocketResource2::EnqueueWrite(string &&message, bool isBinary) noexcept {
|
|
279
277
|
auto self = shared_from_this();
|
|
280
278
|
string coMessage = std::move(message);
|
|
281
279
|
|
|
282
|
-
co_await resume_in_queue(self->m_backgroundQueue); // Ensure writes happen sequentially
|
|
283
|
-
self->m_outgoingMessages.emplace(std::move(coMessage), isBinary);
|
|
284
|
-
|
|
285
|
-
co_await resume_on_signal(self->m_connectPerformed.get());
|
|
286
|
-
|
|
287
280
|
co_await resume_in_queue(self->m_backgroundQueue);
|
|
288
281
|
|
|
289
|
-
co_await self->
|
|
290
|
-
|
|
282
|
+
co_await self->m_sequencer.QueueTaskAsync(
|
|
283
|
+
[self = self->shared_from_this(), message = std::move(coMessage), isBinary]() -> IAsyncAction {
|
|
284
|
+
auto coSelf = self->shared_from_this();
|
|
285
|
+
auto coMessage = std::move(message);
|
|
291
286
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
co_await resume_in_queue(m_backgroundQueue);
|
|
287
|
+
co_await coSelf->PerformWrite(std::move(coMessage), isBinary);
|
|
288
|
+
});
|
|
289
|
+
}
|
|
296
290
|
|
|
291
|
+
IAsyncAction WinRTWebSocketResource2::PerformWrite(string &&message, bool isBinary) noexcept {
|
|
297
292
|
auto self = shared_from_this();
|
|
298
293
|
|
|
299
|
-
|
|
300
|
-
if (
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
size_t length = 0;
|
|
305
|
-
string messageLocal;
|
|
306
|
-
bool isBinaryLocal;
|
|
307
|
-
try {
|
|
308
|
-
std::tie(messageLocal, isBinaryLocal) = self->m_outgoingMessages.front();
|
|
309
|
-
self->m_outgoingMessages.pop();
|
|
310
|
-
if (isBinaryLocal) {
|
|
311
|
-
self->m_socket.Control().MessageType(SocketMessageType::Binary);
|
|
312
|
-
|
|
313
|
-
auto buffer = CryptographicBuffer::DecodeFromBase64String(winrt::to_hstring(messageLocal));
|
|
314
|
-
if (buffer) {
|
|
315
|
-
length = buffer.Length();
|
|
316
|
-
self->m_writer.WriteBuffer(buffer);
|
|
317
|
-
}
|
|
318
|
-
} else {
|
|
319
|
-
self->m_socket.Control().MessageType(SocketMessageType::Utf8);
|
|
294
|
+
try {
|
|
295
|
+
if (isBinary) {
|
|
296
|
+
self->m_socket.Control().MessageType(SocketMessageType::Binary);
|
|
320
297
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
CheckedReinterpretCast<const uint8_t *>(messageLocal.c_str()) + messageLocal.length());
|
|
325
|
-
self->m_writer.WriteBytes(view);
|
|
298
|
+
auto buffer = CryptographicBuffer::DecodeFromBase64String(winrt::to_hstring(message));
|
|
299
|
+
if (buffer) {
|
|
300
|
+
self->m_writer.WriteBuffer(buffer);
|
|
326
301
|
}
|
|
327
|
-
}
|
|
328
|
-
self->
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
302
|
+
} else {
|
|
303
|
+
self->m_socket.Control().MessageType(SocketMessageType::Utf8);
|
|
304
|
+
|
|
305
|
+
winrt::array_view<const uint8_t> view(
|
|
306
|
+
CheckedReinterpretCast<const uint8_t *>(message.c_str()),
|
|
307
|
+
CheckedReinterpretCast<const uint8_t *>(message.c_str()) + message.length());
|
|
308
|
+
self->m_writer.WriteBytes(view);
|
|
333
309
|
}
|
|
310
|
+
} catch (hresult_error const &e) { // TODO: Remove after fixing unit tests exceptions.
|
|
311
|
+
self->Fail(e, ErrorType::Send);
|
|
312
|
+
} catch (const std::exception &e) {
|
|
313
|
+
self->Fail(e.what(), ErrorType::Send);
|
|
314
|
+
}
|
|
334
315
|
|
|
335
|
-
|
|
336
|
-
|
|
316
|
+
co_await resume_in_queue(self->m_backgroundQueue);
|
|
317
|
+
// If an exception occurred, abort write process.
|
|
318
|
+
if (self->m_readyState != ReadyState::Open) {
|
|
319
|
+
co_return;
|
|
320
|
+
}
|
|
337
321
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
322
|
+
auto async = self->m_writer.StoreAsync();
|
|
323
|
+
co_await lessthrow_await_adapter<DataWriterStoreOperation>{async};
|
|
324
|
+
|
|
325
|
+
auto result = async.ErrorCode();
|
|
326
|
+
if (result < 0) {
|
|
327
|
+
self->Fail(std::move(result), ErrorType::Send);
|
|
343
328
|
}
|
|
344
329
|
}
|
|
345
330
|
|
|
@@ -393,11 +378,7 @@ void WinRTWebSocketResource2::Connect(string &&url, const Protocols &protocols,
|
|
|
393
378
|
m_socket.SetRequestHeader(L"Origin", std::move(origin));
|
|
394
379
|
}
|
|
395
380
|
} catch (hresult_error const &e) {
|
|
396
|
-
Fail(e, ErrorType::Connection);
|
|
397
|
-
|
|
398
|
-
SetEvent(m_connectPerformed.get());
|
|
399
|
-
|
|
400
|
-
return;
|
|
381
|
+
return Fail(e, ErrorType::Connection);
|
|
401
382
|
}
|
|
402
383
|
|
|
403
384
|
PerformConnect(std::move(uri));
|
|
@@ -406,11 +387,11 @@ void WinRTWebSocketResource2::Connect(string &&url, const Protocols &protocols,
|
|
|
406
387
|
void WinRTWebSocketResource2::Ping() noexcept {}
|
|
407
388
|
|
|
408
389
|
void WinRTWebSocketResource2::Send(string &&message) noexcept {
|
|
409
|
-
|
|
390
|
+
EnqueueWrite(std::move(message), false);
|
|
410
391
|
}
|
|
411
392
|
|
|
412
393
|
void WinRTWebSocketResource2::SendBinary(string &&base64String) noexcept {
|
|
413
|
-
|
|
394
|
+
EnqueueWrite(std::move(base64String), true);
|
|
414
395
|
}
|
|
415
396
|
|
|
416
397
|
void WinRTWebSocketResource2::Close(CloseCode code, const string &reason) noexcept {
|
|
@@ -18,17 +18,101 @@ namespace Microsoft::React::Networking {
|
|
|
18
18
|
|
|
19
19
|
class WinRTWebSocketResource2 : public IWebSocketResource,
|
|
20
20
|
public std::enable_shared_from_this<WinRTWebSocketResource2> {
|
|
21
|
-
winrt::Windows::Networking::Sockets::IMessageWebSocket m_socket;
|
|
22
|
-
|
|
23
21
|
///
|
|
24
|
-
//
|
|
22
|
+
// See https://devblogs.microsoft.com/oldnewthing/20250328-00/?p=111016
|
|
25
23
|
///
|
|
26
|
-
|
|
24
|
+
struct TaskSequencer {
|
|
25
|
+
TaskSequencer() = default;
|
|
26
|
+
TaskSequencer(const TaskSequencer &) = delete;
|
|
27
|
+
void operator=(const TaskSequencer &) = delete;
|
|
28
|
+
|
|
29
|
+
private:
|
|
30
|
+
using CoroHandle = std::experimental::coroutine_handle<>;
|
|
31
|
+
|
|
32
|
+
struct Suspender {
|
|
33
|
+
CoroHandle m_handle;
|
|
34
|
+
|
|
35
|
+
bool await_ready() const noexcept {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
void await_suspend(CoroHandle h) noexcept {
|
|
40
|
+
m_handle = h;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
void await_resume() const noexcept {}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
static void *Completed() {
|
|
47
|
+
return reinterpret_cast<void *>(1);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
struct ChainedTask {
|
|
51
|
+
private:
|
|
52
|
+
std::atomic<void *> m_next;
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
ChainedTask(void *state = nullptr) : m_next(state) {}
|
|
56
|
+
|
|
57
|
+
void ContinueWith(CoroHandle h) {
|
|
58
|
+
if (m_next.exchange(h.address(), std::memory_order_acquire) != nullptr) {
|
|
59
|
+
h();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
void Complete() {
|
|
64
|
+
auto resumeAddress = m_next.exchange(Completed());
|
|
65
|
+
if (resumeAddress) {
|
|
66
|
+
CoroHandle::from_address(resumeAddress).resume();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
27
70
|
|
|
71
|
+
struct Completer {
|
|
72
|
+
std::shared_ptr<ChainedTask> m_chain;
|
|
73
|
+
|
|
74
|
+
~Completer() {
|
|
75
|
+
m_chain->Complete();
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
winrt::slim_mutex m_mutex;
|
|
80
|
+
std::shared_ptr<ChainedTask> m_latest = std::make_shared<ChainedTask>(Completed());
|
|
81
|
+
|
|
82
|
+
public:
|
|
83
|
+
template <typename Maker>
|
|
84
|
+
auto QueueTaskAsync(Maker &&maker) -> decltype(maker()) {
|
|
85
|
+
auto node = std::make_shared<ChainedTask>();
|
|
86
|
+
Suspender suspend;
|
|
87
|
+
|
|
88
|
+
using Async = decltype(maker());
|
|
89
|
+
auto task = [&node, &suspend, &maker]() -> Async {
|
|
90
|
+
Completer completer{node};
|
|
91
|
+
auto localMaker = std::forward<Maker>(maker);
|
|
92
|
+
auto context = winrt::apartment_context();
|
|
93
|
+
|
|
94
|
+
co_await suspend;
|
|
95
|
+
co_await context;
|
|
96
|
+
|
|
97
|
+
co_return co_await localMaker();
|
|
98
|
+
}();
|
|
99
|
+
|
|
100
|
+
{
|
|
101
|
+
winrt::slim_lock_guard guard(m_mutex);
|
|
102
|
+
m_latest.swap(node);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
node->ContinueWith(suspend.m_handle);
|
|
106
|
+
|
|
107
|
+
return task;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
winrt::Windows::Networking::Sockets::IMessageWebSocket m_socket;
|
|
28
112
|
ReadyState m_readyState;
|
|
113
|
+
TaskSequencer m_sequencer;
|
|
29
114
|
Mso::DispatchQueue m_callingQueue;
|
|
30
115
|
Mso::DispatchQueue m_backgroundQueue;
|
|
31
|
-
std::queue<std::pair<std::string, bool>> m_outgoingMessages;
|
|
32
116
|
CloseCode m_closeCode{CloseCode::Normal};
|
|
33
117
|
std::string m_closeReason;
|
|
34
118
|
|
|
@@ -52,9 +136,9 @@ class WinRTWebSocketResource2 : public IWebSocketResource,
|
|
|
52
136
|
winrt::Windows::Networking::Sockets::IWebSocketClosedEventArgs const &args);
|
|
53
137
|
|
|
54
138
|
winrt::fire_and_forget PerformConnect(winrt::Windows::Foundation::Uri &&uri) noexcept;
|
|
55
|
-
winrt::fire_and_forget
|
|
139
|
+
winrt::fire_and_forget EnqueueWrite(std::string &&message, bool isBinary) noexcept;
|
|
140
|
+
winrt::Windows::Foundation::IAsyncAction PerformWrite(std::string &&message, bool isBinary) noexcept;
|
|
56
141
|
winrt::fire_and_forget PerformClose() noexcept;
|
|
57
|
-
winrt::Windows::Foundation::IAsyncAction SendPendingMessages() noexcept;
|
|
58
142
|
|
|
59
143
|
WinRTWebSocketResource2(
|
|
60
144
|
winrt::Windows::Networking::Sockets::IMessageWebSocket &&socket,
|