@@ -61,6 +61,23 @@ enum WKNavigationActionPolicyEnum {
61
61
cancel,
62
62
}
63
63
64
+ enum NSHttpCookiePropertyKeyEnum {
65
+ comment,
66
+ commentUrl,
67
+ discard,
68
+ domain,
69
+ expires,
70
+ maximumAge,
71
+ name,
72
+ originUrl,
73
+ path,
74
+ port,
75
+ sameSitePolicy,
76
+ secure,
77
+ value,
78
+ version,
79
+ }
80
+
64
81
class NSKeyValueObservingOptionsEnumData {
65
82
NSKeyValueObservingOptionsEnumData ({
66
83
this .value,
@@ -153,6 +170,29 @@ class WKWebsiteDataTypesEnumData {
153
170
}
154
171
}
155
172
173
+ class NSHttpCookiePropertyKeyEnumData {
174
+ NSHttpCookiePropertyKeyEnumData ({
175
+ this .value,
176
+ });
177
+
178
+ NSHttpCookiePropertyKeyEnum ? value;
179
+
180
+ Object encode () {
181
+ final Map <Object ?, Object ?> pigeonMap = < Object ? , Object ? > {};
182
+ pigeonMap['value' ] = value == null ? null : value! .index;
183
+ return pigeonMap;
184
+ }
185
+
186
+ static NSHttpCookiePropertyKeyEnumData decode (Object message) {
187
+ final Map <Object ?, Object ?> pigeonMap = message as Map <Object ?, Object ?>;
188
+ return NSHttpCookiePropertyKeyEnumData (
189
+ value: pigeonMap['value' ] != null
190
+ ? NSHttpCookiePropertyKeyEnum .values[pigeonMap['value' ]! as int ]
191
+ : null ,
192
+ );
193
+ }
194
+ }
195
+
156
196
class NSUrlRequestData {
157
197
NSUrlRequestData ({
158
198
required this .url,
@@ -221,6 +261,28 @@ class WKUserScriptData {
221
261
}
222
262
}
223
263
264
+ class NSHttpCookieData {
265
+ NSHttpCookieData ({
266
+ required this .properties,
267
+ });
268
+
269
+ Map <NSHttpCookiePropertyKeyEnumData ?, String ?> properties;
270
+
271
+ Object encode () {
272
+ final Map <Object ?, Object ?> pigeonMap = < Object ? , Object ? > {};
273
+ pigeonMap['properties' ] = properties;
274
+ return pigeonMap;
275
+ }
276
+
277
+ static NSHttpCookieData decode (Object message) {
278
+ final Map <Object ?, Object ?> pigeonMap = message as Map <Object ?, Object ?>;
279
+ return NSHttpCookieData (
280
+ properties: (pigeonMap['properties' ] as Map <Object ?, Object ?>? )!
281
+ .cast <NSHttpCookiePropertyKeyEnumData ?, String ?>(),
282
+ );
283
+ }
284
+ }
285
+
224
286
class _WKWebsiteDataStoreHostApiCodec extends StandardMessageCodec {
225
287
const _WKWebsiteDataStoreHostApiCodec ();
226
288
@override
@@ -283,6 +345,31 @@ class WKWebsiteDataStoreHostApi {
283
345
}
284
346
}
285
347
348
+ Future <void > createDefaultDataStore (int arg_instanceId) async {
349
+ final BasicMessageChannel <Object ?> channel = BasicMessageChannel <Object ?>(
350
+ 'dev.flutter.pigeon.WKWebsiteDataStoreHostApi.createDefaultDataStore' ,
351
+ codec,
352
+ binaryMessenger: _binaryMessenger);
353
+ final Map <Object ?, Object ?>? replyMap =
354
+ await channel.send (< Object ? > [arg_instanceId]) as Map <Object ?, Object ?>? ;
355
+ if (replyMap == null ) {
356
+ throw PlatformException (
357
+ code: 'channel-error' ,
358
+ message: 'Unable to establish connection on channel.' ,
359
+ );
360
+ } else if (replyMap['error' ] != null ) {
361
+ final Map <Object ?, Object ?> error =
362
+ (replyMap['error' ] as Map <Object ?, Object ?>? )! ;
363
+ throw PlatformException (
364
+ code: (error['code' ] as String ? )! ,
365
+ message: error['message' ] as String ? ,
366
+ details: error['details' ],
367
+ );
368
+ } else {
369
+ return ;
370
+ }
371
+ }
372
+
286
373
Future <bool > removeDataOfTypes (
287
374
int arg_instanceId,
288
375
List <WKWebsiteDataTypesEnumData ?> arg_dataTypes,
@@ -1787,3 +1874,97 @@ class WKUIDelegateHostApi {
1787
1874
}
1788
1875
}
1789
1876
}
1877
+
1878
+ class _WKHttpCookieStoreHostApiCodec extends StandardMessageCodec {
1879
+ const _WKHttpCookieStoreHostApiCodec ();
1880
+ @override
1881
+ void writeValue (WriteBuffer buffer, Object ? value) {
1882
+ if (value is NSHttpCookieData ) {
1883
+ buffer.putUint8 (128 );
1884
+ writeValue (buffer, value.encode ());
1885
+ } else if (value is NSHttpCookiePropertyKeyEnumData ) {
1886
+ buffer.putUint8 (129 );
1887
+ writeValue (buffer, value.encode ());
1888
+ } else {
1889
+ super .writeValue (buffer, value);
1890
+ }
1891
+ }
1892
+
1893
+ @override
1894
+ Object ? readValueOfType (int type, ReadBuffer buffer) {
1895
+ switch (type) {
1896
+ case 128 :
1897
+ return NSHttpCookieData .decode (readValue (buffer)! );
1898
+
1899
+ case 129 :
1900
+ return NSHttpCookiePropertyKeyEnumData .decode (readValue (buffer)! );
1901
+
1902
+ default :
1903
+ return super .readValueOfType (type, buffer);
1904
+ }
1905
+ }
1906
+ }
1907
+
1908
+ class WKHttpCookieStoreHostApi {
1909
+ /// Constructor for [WKHttpCookieStoreHostApi] . The [binaryMessenger] named argument is
1910
+ /// available for dependency injection. If it is left null, the default
1911
+ /// BinaryMessenger will be used which routes to the host platform.
1912
+ WKHttpCookieStoreHostApi ({BinaryMessenger ? binaryMessenger})
1913
+ : _binaryMessenger = binaryMessenger;
1914
+
1915
+ final BinaryMessenger ? _binaryMessenger;
1916
+
1917
+ static const MessageCodec <Object ?> codec = _WKHttpCookieStoreHostApiCodec ();
1918
+
1919
+ Future <void > createFromWebsiteDataStore (
1920
+ int arg_instanceId, int arg_websiteDataStoreInstanceId) async {
1921
+ final BasicMessageChannel <Object ?> channel = BasicMessageChannel <Object ?>(
1922
+ 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.createFromWebsiteDataStore' ,
1923
+ codec,
1924
+ binaryMessenger: _binaryMessenger);
1925
+ final Map <Object ?, Object ?>? replyMap = await channel
1926
+ .send (< Object ? > [arg_instanceId, arg_websiteDataStoreInstanceId])
1927
+ as Map <Object ?, Object ?>? ;
1928
+ if (replyMap == null ) {
1929
+ throw PlatformException (
1930
+ code: 'channel-error' ,
1931
+ message: 'Unable to establish connection on channel.' ,
1932
+ );
1933
+ } else if (replyMap['error' ] != null ) {
1934
+ final Map <Object ?, Object ?> error =
1935
+ (replyMap['error' ] as Map <Object ?, Object ?>? )! ;
1936
+ throw PlatformException (
1937
+ code: (error['code' ] as String ? )! ,
1938
+ message: error['message' ] as String ? ,
1939
+ details: error['details' ],
1940
+ );
1941
+ } else {
1942
+ return ;
1943
+ }
1944
+ }
1945
+
1946
+ Future <void > setCookie (
1947
+ int arg_instanceId, NSHttpCookieData arg_cookie) async {
1948
+ final BasicMessageChannel <Object ?> channel = BasicMessageChannel <Object ?>(
1949
+ 'dev.flutter.pigeon.WKHttpCookieStoreHostApi.setCookie' , codec,
1950
+ binaryMessenger: _binaryMessenger);
1951
+ final Map <Object ?, Object ?>? replyMap = await channel
1952
+ .send (< Object ? > [arg_instanceId, arg_cookie]) as Map <Object ?, Object ?>? ;
1953
+ if (replyMap == null ) {
1954
+ throw PlatformException (
1955
+ code: 'channel-error' ,
1956
+ message: 'Unable to establish connection on channel.' ,
1957
+ );
1958
+ } else if (replyMap['error' ] != null ) {
1959
+ final Map <Object ?, Object ?> error =
1960
+ (replyMap['error' ] as Map <Object ?, Object ?>? )! ;
1961
+ throw PlatformException (
1962
+ code: (error['code' ] as String ? )! ,
1963
+ message: error['message' ] as String ? ,
1964
+ details: error['details' ],
1965
+ );
1966
+ } else {
1967
+ return ;
1968
+ }
1969
+ }
1970
+ }
0 commit comments