-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathQuirkSettings.cpp
More file actions
172 lines (133 loc) · 6.68 KB
/
Copy pathQuirkSettings.cpp
File metadata and controls
172 lines (133 loc) · 6.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#include "pch.h"
#include "QuirkSettings.h"
#include "QuirkSettings.g.cpp"
#include "QuirkSettings.h"
#include "React.h"
#include "ReactPropertyBag.h"
namespace winrt::Microsoft::ReactNative::implementation {
QuirkSettings::QuirkSettings() noexcept {}
winrt::Microsoft::ReactNative::ReactPropertyId<bool> MatchAndroidAndIOSStretchBehaviorProperty() noexcept {
static winrt::Microsoft::ReactNative::ReactPropertyId<bool> propId{
L"ReactNative.QuirkSettings", L"MatchAndroidAndIOSyStretchBehavior"};
return propId;
}
/*static*/ void QuirkSettings::SetMatchAndroidAndIOSStretchBehavior(
winrt::Microsoft::ReactNative::ReactPropertyBag properties,
bool value) noexcept {
properties.Set(MatchAndroidAndIOSStretchBehaviorProperty(), value);
}
winrt::Microsoft::ReactNative::ReactPropertyId<bool> UseWebFlexBasisBehaviorProperty() noexcept {
static winrt::Microsoft::ReactNative::ReactPropertyId<bool> propId{
L"ReactNative.QuirkSettings", L"UseWebFlexBasisBehavior"};
return propId;
}
/*static*/ void QuirkSettings::SetUseWebFlexBasisBehavior(
winrt::Microsoft::ReactNative::ReactPropertyBag properties,
bool value) noexcept {
properties.Set(UseWebFlexBasisBehaviorProperty(), value);
}
winrt::Microsoft::ReactNative::ReactPropertyId<bool> AcceptSelfSignedCertsProperty() noexcept {
winrt::Microsoft::ReactNative::ReactPropertyId<bool> propId{
L"ReactNative.QuirkSettings", L"Networking.AcceptSelfSigned"};
return propId;
}
winrt::Microsoft::ReactNative::ReactPropertyId<winrt::Microsoft::ReactNative::BackNavigationHandlerKind>
EnableBackHandlerKindProperty() noexcept {
winrt::Microsoft::ReactNative::ReactPropertyId<winrt::Microsoft::ReactNative::BackNavigationHandlerKind> propId{
L"ReactNative.QuirkSettings", L"EnableBackHandler"};
return propId;
}
winrt::Microsoft::ReactNative::ReactPropertyId<bool> MapWindowDeactivatedToAppStateInactiveProperty() noexcept {
static winrt::Microsoft::ReactNative::ReactPropertyId<bool> propId{
L"ReactNative.QuirkSettings", L"MapWindowDeactivatedToAppStateInactiveProperty"};
return propId;
}
/*static*/ void QuirkSettings::SetMapWindowDeactivatedToAppStateInactive(
winrt::Microsoft::ReactNative::ReactPropertyBag properties,
bool value) noexcept {
properties.Set(MapWindowDeactivatedToAppStateInactiveProperty(), value);
}
winrt::Microsoft::ReactNative::ReactPropertyId<bool> SuppressWindowFocusOnViewFocusProperty() noexcept {
winrt::Microsoft::ReactNative::ReactPropertyId<bool> propId{
L"ReactNative.QuirkSettings", L"SuppressWindowFocusOnViewFocus"};
return propId;
}
winrt::Microsoft::ReactNative::ReactPropertyId<bool> UseRuntimeSchedulerProperty() noexcept {
winrt::Microsoft::ReactNative::ReactPropertyId<bool> propId{L"ReactNative.QuirkSettings", L"UseRuntimeScheduler"};
return propId;
}
winrt::Microsoft::ReactNative::ReactPropertyId<bool> UseRunOnQueueSyncProperty() noexcept {
winrt::Microsoft::ReactNative::ReactPropertyId<bool> propId{L"ReactNative.QuirkSettings", L"UseRunOnQueueSync"};
return propId;
}
#pragma region IDL interface
/*static*/ void QuirkSettings::SetMatchAndroidAndIOSStretchBehavior(
winrt::Microsoft::ReactNative::ReactInstanceSettings settings,
bool value) noexcept {
SetMatchAndroidAndIOSStretchBehavior(ReactPropertyBag(settings.Properties()), value);
}
/*static*/ void QuirkSettings::SetUseWebFlexBasisBehavior(
winrt::Microsoft::ReactNative::ReactInstanceSettings settings,
bool value) noexcept {
SetUseWebFlexBasisBehavior(ReactPropertyBag(settings.Properties()), value);
}
/*static*/ void QuirkSettings::SetAcceptSelfSigned(
winrt::Microsoft::ReactNative::ReactInstanceSettings settings,
bool value) noexcept {
ReactPropertyBag(settings.Properties()).Set(AcceptSelfSignedCertsProperty(), value);
}
/*static*/ void QuirkSettings::SetBackHandlerKind(
winrt::Microsoft::ReactNative::ReactInstanceSettings settings,
winrt::Microsoft::ReactNative::BackNavigationHandlerKind kind) noexcept {
ReactPropertyBag(settings.Properties()).Set(EnableBackHandlerKindProperty(), kind);
}
/*static*/ void QuirkSettings::SetMapWindowDeactivatedToAppStateInactive(
winrt::Microsoft::ReactNative::ReactInstanceSettings settings,
bool value) noexcept {
SetMapWindowDeactivatedToAppStateInactive(ReactPropertyBag(settings.Properties()), value);
}
/*static*/ void QuirkSettings::SetSuppressWindowFocusOnViewFocus(
winrt::Microsoft::ReactNative::ReactInstanceSettings settings,
bool value) noexcept {
ReactPropertyBag(settings.Properties()).Set(SuppressWindowFocusOnViewFocusProperty(), value);
}
/*static*/ void QuirkSettings::SetUseRuntimeScheduler(
winrt::Microsoft::ReactNative::ReactInstanceSettings settings,
bool value) noexcept {
ReactPropertyBag(settings.Properties()).Set(UseRuntimeSchedulerProperty(), value);
}
/*static*/ void QuirkSettings::SetUseRunOnQueueSync(
winrt::Microsoft::ReactNative::ReactInstanceSettings settings,
bool value) noexcept {
ReactPropertyBag(settings.Properties()).Set(UseRunOnQueueSyncProperty(), value);
}
#pragma endregion IDL interface
/*static*/ bool QuirkSettings::GetMatchAndroidAndIOSStretchBehavior(ReactPropertyBag properties) noexcept {
return properties.Get(MatchAndroidAndIOSStretchBehaviorProperty()).value_or(true);
}
/*static*/ bool QuirkSettings::GetUseWebFlexBasisBehavior(ReactPropertyBag properties) noexcept {
return properties.Get(UseWebFlexBasisBehaviorProperty()).value_or(false);
}
/*static*/ bool QuirkSettings::GetAcceptSelfSigned(ReactPropertyBag properties) noexcept {
return properties.Get(AcceptSelfSignedCertsProperty()).value_or(false);
}
/*static*/ winrt::Microsoft::ReactNative::BackNavigationHandlerKind QuirkSettings::GetBackHandlerKind(
ReactPropertyBag properties) noexcept {
return properties.Get(EnableBackHandlerKindProperty())
.value_or(winrt::Microsoft::ReactNative::BackNavigationHandlerKind::JavaScript);
}
/*static*/ bool QuirkSettings::GetMapWindowDeactivatedToAppStateInactive(ReactPropertyBag properties) noexcept {
return properties.Get(MapWindowDeactivatedToAppStateInactiveProperty()).value_or(false);
}
/*static*/ bool QuirkSettings::GetSuppressWindowFocusOnViewFocus(ReactPropertyBag properties) noexcept {
return properties.Get(SuppressWindowFocusOnViewFocusProperty()).value_or(false);
}
/*static*/ bool QuirkSettings::GetUseRuntimeScheduler(ReactPropertyBag properties) noexcept {
return properties.Get(UseRuntimeSchedulerProperty()).value_or(true);
}
/*static*/ bool QuirkSettings::GetUseRunOnQueueSync(ReactPropertyBag properties) noexcept {
return properties.Get(UseRunOnQueueSyncProperty()).value_or(false);
}
} // namespace winrt::Microsoft::ReactNative::implementation