@react-native-ohos/cookies 6.3.0-rc.1 → 6.3.0

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.
Files changed (44) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +14 -14
  3. package/harmony/rn_cookies/BuildProfile.ets +16 -16
  4. package/harmony/rn_cookies/build-profile.json5 +28 -28
  5. package/harmony/rn_cookies/hvigorfile.ts +6 -6
  6. package/harmony/rn_cookies/obfuscation-rules.txt +17 -17
  7. package/harmony/rn_cookies/oh-package.json5 +11 -11
  8. package/harmony/rn_cookies/src/main/cpp/CMakeLists.txt +9 -9
  9. package/harmony/rn_cookies/src/main/cpp/CookiesPackage.h +19 -19
  10. package/harmony/rn_cookies/src/main/cpp/CookiesTurboModule.cpp +57 -57
  11. package/harmony/rn_cookies/src/main/cpp/CookiesTurboModule.h +25 -25
  12. package/harmony/rn_cookies/src/main/cpp/generated/RNOH/generated/BaseReactNativeCookiesPackage.h +72 -72
  13. package/harmony/rn_cookies/src/main/cpp/generated/RNOH/generated/turbo_modules/RTNCookies.cpp +21 -21
  14. package/harmony/rn_cookies/src/main/cpp/generated/RNOH/generated/turbo_modules/RTNCookies.h +16 -16
  15. package/harmony/rn_cookies/src/main/cpp/generated/react/renderer/components/react_native_cookies/ComponentDescriptors.h +24 -24
  16. package/harmony/rn_cookies/src/main/cpp/generated/react/renderer/components/react_native_cookies/EventEmitters.cpp +16 -16
  17. package/harmony/rn_cookies/src/main/cpp/generated/react/renderer/components/react_native_cookies/EventEmitters.h +17 -17
  18. package/harmony/rn_cookies/src/main/cpp/generated/react/renderer/components/react_native_cookies/Props.cpp +19 -19
  19. package/harmony/rn_cookies/src/main/cpp/generated/react/renderer/components/react_native_cookies/Props.h +18 -18
  20. package/harmony/rn_cookies/src/main/cpp/generated/react/renderer/components/react_native_cookies/ShadowNodes.cpp +17 -17
  21. package/harmony/rn_cookies/src/main/cpp/generated/react/renderer/components/react_native_cookies/ShadowNodes.h +23 -23
  22. package/harmony/rn_cookies/src/main/cpp/generated/react/renderer/components/react_native_cookies/States.cpp +16 -16
  23. package/harmony/rn_cookies/src/main/cpp/generated/react/renderer/components/react_native_cookies/States.h +18 -18
  24. package/harmony/rn_cookies/src/main/ets/CookiesModule.ts +177 -177
  25. package/harmony/rn_cookies/src/main/ets/CookiesPackage.ts +26 -26
  26. package/harmony/rn_cookies/src/main/ets/Logger.ets +63 -63
  27. package/harmony/rn_cookies/src/main/ets/generated/components/ts.ts +5 -5
  28. package/harmony/rn_cookies/src/main/ets/generated/index.ets +5 -5
  29. package/harmony/rn_cookies/src/main/ets/generated/ts.ts +6 -6
  30. package/harmony/rn_cookies/src/main/ets/generated/turboModules/RTNCookies.ts +26 -26
  31. package/harmony/rn_cookies/src/main/ets/generated/turboModules/ts.ts +5 -5
  32. package/harmony/rn_cookies/src/main/module.json5 +11 -11
  33. package/harmony/rn_cookies/src/main/resources/base/element/string.json +8 -8
  34. package/harmony/rn_cookies/src/main/resources/en_US/element/string.json +8 -8
  35. package/harmony/rn_cookies/src/main/resources/zh_CN/element/string.json +8 -8
  36. package/harmony/rn_cookies/src/test/List.test.ets +4 -4
  37. package/harmony/rn_cookies/src/test/LocalUnit.test.ets +32 -32
  38. package/harmony/rn_cookies/ts.ts +1 -1
  39. package/harmony/rn_cookies.har +0 -0
  40. package/index.d.ts +42 -42
  41. package/index.js +62 -62
  42. package/package.json +54 -54
  43. package/react-native-cookies.podspec +18 -18
  44. package/src/NativeRTNCookies.tsx +60 -60
@@ -1,8 +1,8 @@
1
- {
2
- "string": [
3
- {
4
- "name": "page_show",
5
- "value": "page from package"
6
- }
7
- ]
8
- }
1
+ {
2
+ "string": [
3
+ {
4
+ "name": "page_show",
5
+ "value": "page from package"
6
+ }
7
+ ]
8
+ }
@@ -1,8 +1,8 @@
1
- {
2
- "string": [
3
- {
4
- "name": "page_show",
5
- "value": "page from package"
6
- }
7
- ]
8
- }
1
+ {
2
+ "string": [
3
+ {
4
+ "name": "page_show",
5
+ "value": "page from package"
6
+ }
7
+ ]
8
+ }
@@ -1,8 +1,8 @@
1
- {
2
- "string": [
3
- {
4
- "name": "page_show",
5
- "value": "page from package"
6
- }
7
- ]
8
- }
1
+ {
2
+ "string": [
3
+ {
4
+ "name": "page_show",
5
+ "value": "page from package"
6
+ }
7
+ ]
8
+ }
@@ -1,5 +1,5 @@
1
- import localUnitTest from './LocalUnit.test';
2
-
3
- export default function testsuite() {
4
- localUnitTest();
1
+ import localUnitTest from './LocalUnit.test';
2
+
3
+ export default function testsuite() {
4
+ localUnitTest();
5
5
  }
@@ -1,33 +1,33 @@
1
- import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
2
-
3
- export default function localUnitTest() {
4
- describe('localUnitTest',() => {
5
- // Defines a test suite. Two parameters are supported: test suite name and test suite function.
6
- beforeAll(() => {
7
- // Presets an action, which is performed only once before all test cases of the test suite start.
8
- // This API supports only one parameter: preset action function.
9
- });
10
- beforeEach(() => {
11
- // Presets an action, which is performed before each unit test case starts.
12
- // The number of execution times is the same as the number of test cases defined by **it**.
13
- // This API supports only one parameter: preset action function.
14
- });
15
- afterEach(() => {
16
- // Presets a clear action, which is performed after each unit test case ends.
17
- // The number of execution times is the same as the number of test cases defined by **it**.
18
- // This API supports only one parameter: clear action function.
19
- });
20
- afterAll(() => {
21
- // Presets a clear action, which is performed after all test cases of the test suite end.
22
- // This API supports only one parameter: clear action function.
23
- });
24
- it('assertContain', 0, () => {
25
- // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
26
- let a = 'abc';
27
- let b = 'b';
28
- // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
29
- expect(a).assertContain(b);
30
- expect(a).assertEqual(a);
31
- });
32
- });
1
+ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
2
+
3
+ export default function localUnitTest() {
4
+ describe('localUnitTest',() => {
5
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
6
+ beforeAll(() => {
7
+ // Presets an action, which is performed only once before all test cases of the test suite start.
8
+ // This API supports only one parameter: preset action function.
9
+ });
10
+ beforeEach(() => {
11
+ // Presets an action, which is performed before each unit test case starts.
12
+ // The number of execution times is the same as the number of test cases defined by **it**.
13
+ // This API supports only one parameter: preset action function.
14
+ });
15
+ afterEach(() => {
16
+ // Presets a clear action, which is performed after each unit test case ends.
17
+ // The number of execution times is the same as the number of test cases defined by **it**.
18
+ // This API supports only one parameter: clear action function.
19
+ });
20
+ afterAll(() => {
21
+ // Presets a clear action, which is performed after all test cases of the test suite end.
22
+ // This API supports only one parameter: clear action function.
23
+ });
24
+ it('assertContain', 0, () => {
25
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
26
+ let a = 'abc';
27
+ let b = 'b';
28
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
29
+ expect(a).assertContain(b);
30
+ expect(a).assertEqual(a);
31
+ });
32
+ });
33
33
  }
@@ -1,2 +1,2 @@
1
- export * from './src/main/ets/CookiesModule';
1
+ export * from './src/main/ets/CookiesModule';
2
2
  export * from './src/main/ets/CookiesPackage';
Binary file
package/index.d.ts CHANGED
@@ -1,43 +1,43 @@
1
- declare module '@react-native-cookies/cookies' {
2
- export interface Cookie {
3
- name: string;
4
- value: string;
5
- path?: string;
6
- domain?: string;
7
- version?: string;
8
- expires?: string;
9
- secure?: boolean;
10
- httpOnly?: boolean;
11
- }
12
-
13
- export interface Cookies {
14
- [key: string]: Cookie;
15
- }
16
-
17
- export interface CookieManagerStatic {
18
- set(url: string, cookie: Cookie, useWebKit?: boolean): Promise<boolean>;
19
- setFromResponse(url: string, cookie: string): Promise<boolean>;
20
-
21
- get(url: string, useWebKit?: boolean): Promise<Cookies>;
22
- getFromResponse(url: string): Promise<Cookies>;
23
-
24
- clearAll(useWebKit?: boolean): Promise<boolean>;
25
-
26
- // Android only
27
- flush(): Promise<void>;
28
- removeSessionCookies(): Promise<boolean>;
29
-
30
- // iOS only
31
- getAll(useWebKit?: boolean): Promise<Cookies>;
32
- clearByName(
33
- url: string,
34
- name: string,
35
- useWebKit?: boolean,
36
- ): Promise<boolean>;
37
-
38
- }
39
-
40
- const CookieManager: CookieManagerStatic;
41
-
42
- export default CookieManager;
1
+ declare module '@react-native-cookies/cookies' {
2
+ export interface Cookie {
3
+ name: string;
4
+ value: string;
5
+ path?: string;
6
+ domain?: string;
7
+ version?: string;
8
+ expires?: string;
9
+ secure?: boolean;
10
+ httpOnly?: boolean;
11
+ }
12
+
13
+ export interface Cookies {
14
+ [key: string]: Cookie;
15
+ }
16
+
17
+ export interface CookieManagerStatic {
18
+ set(url: string, cookie: Cookie, useWebKit?: boolean): Promise<boolean>;
19
+ setFromResponse(url: string, cookie: string): Promise<boolean>;
20
+
21
+ get(url: string, useWebKit?: boolean): Promise<Cookies>;
22
+ getFromResponse(url: string): Promise<Cookies>;
23
+
24
+ clearAll(useWebKit?: boolean): Promise<boolean>;
25
+
26
+ // Android only
27
+ flush(): Promise<void>;
28
+ removeSessionCookies(): Promise<boolean>;
29
+
30
+ // iOS only
31
+ getAll(useWebKit?: boolean): Promise<Cookies>;
32
+ clearByName(
33
+ url: string,
34
+ name: string,
35
+ useWebKit?: boolean,
36
+ ): Promise<boolean>;
37
+
38
+ }
39
+
40
+ const CookieManager: CookieManagerStatic;
41
+
42
+ export default CookieManager;
43
43
  }
package/index.js CHANGED
@@ -1,62 +1,62 @@
1
- /**
2
- * Copyright (c) Joseph P. Ferraro
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file here: https://github.com/joeferraro/react-native-cookies/blob/master/LICENSE.md.
6
- */
7
-
8
- import { NativeModules, Platform } from 'react-native';
9
- import RTNCookies from './src/NativeRTNCookies';
10
- const invariant = require('invariant');
11
- const RNCookieManagerIOS = NativeModules.RNCookieManagerIOS;
12
- const RNCookieManagerAndroid = NativeModules.RNCookieManagerAndroid;
13
-
14
- let CookieManager;
15
- if (Platform.OS === 'ios') {
16
- invariant(
17
- RNCookieManagerIOS,
18
- '@react-native-community/cookies: Add RNCookieManagerIOS.h and RNCookieManagerIOS.m to your Xcode project',
19
- );
20
- CookieManager = RNCookieManagerIOS;
21
- } else if (Platform.OS === 'android') {
22
- invariant(
23
- RNCookieManagerAndroid,
24
- '@react-native-community/cookies: Import libraries to android "react-native link @react-native-community/cookies"',
25
- );
26
- CookieManager = RNCookieManagerAndroid;
27
- } else if (Platform.OS === 'harmony') {
28
- CookieManager = RTNCookies;
29
- } else {
30
- invariant(
31
- CookieManager,
32
- '@react-native-community/cookies: Invalid platform. This library only supports Android and iOS.',
33
- );
34
- }
35
-
36
-
37
- const functions = ['setFromResponse', 'getFromResponse'];
38
-
39
- module.exports = {
40
- getAll: (useWebKit = false) => CookieManager.getAll(useWebKit),
41
- clearAll: (useWebKit = false) => CookieManager.clearAll(useWebKit),
42
- get: (url, useWebKit = false) => CookieManager.get(url, useWebKit),
43
- set: (url, cookie, useWebKit = false) =>
44
- CookieManager.set(url, cookie, useWebKit),
45
- clearByName: (url, name, useWebKit = false) =>
46
- CookieManager.clearByName(url, name, useWebKit),
47
- flush: async () => {
48
- if (Platform.OS === 'android') {
49
- await CookieManager.flush();
50
- }
51
- },
52
- removeSessionCookies: async () => {
53
- if (Platform.OS === 'android' || Platform.OS === 'harmony') {
54
- return await CookieManager.removeSessionCookies();
55
- }
56
- },
57
-
58
- };
59
-
60
- for (var i = 0; i < functions.length; i++) {
61
- module.exports[functions[i]] = CookieManager[functions[i]];
62
- }
1
+ /**
2
+ * Copyright (c) Joseph P. Ferraro
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file here: https://github.com/joeferraro/react-native-cookies/blob/master/LICENSE.md.
6
+ */
7
+
8
+ import { NativeModules, Platform } from 'react-native';
9
+ import RTNCookies from './src/NativeRTNCookies';
10
+ const invariant = require('invariant');
11
+ const RNCookieManagerIOS = NativeModules.RNCookieManagerIOS;
12
+ const RNCookieManagerAndroid = NativeModules.RNCookieManagerAndroid;
13
+
14
+ let CookieManager;
15
+ if (Platform.OS === 'ios') {
16
+ invariant(
17
+ RNCookieManagerIOS,
18
+ '@react-native-community/cookies: Add RNCookieManagerIOS.h and RNCookieManagerIOS.m to your Xcode project',
19
+ );
20
+ CookieManager = RNCookieManagerIOS;
21
+ } else if (Platform.OS === 'android') {
22
+ invariant(
23
+ RNCookieManagerAndroid,
24
+ '@react-native-community/cookies: Import libraries to android "react-native link @react-native-community/cookies"',
25
+ );
26
+ CookieManager = RNCookieManagerAndroid;
27
+ } else if (Platform.OS === 'harmony') {
28
+ CookieManager = RTNCookies;
29
+ } else {
30
+ invariant(
31
+ CookieManager,
32
+ '@react-native-community/cookies: Invalid platform. This library only supports Android and iOS.',
33
+ );
34
+ }
35
+
36
+
37
+ const functions = ['setFromResponse', 'getFromResponse'];
38
+
39
+ module.exports = {
40
+ getAll: (useWebKit = false) => CookieManager.getAll(useWebKit),
41
+ clearAll: (useWebKit = false) => CookieManager.clearAll(useWebKit),
42
+ get: (url, useWebKit = false) => CookieManager.get(url, useWebKit),
43
+ set: (url, cookie, useWebKit = false) =>
44
+ CookieManager.set(url, cookie, useWebKit),
45
+ clearByName: (url, name, useWebKit = false) =>
46
+ CookieManager.clearByName(url, name, useWebKit),
47
+ flush: async () => {
48
+ if (Platform.OS === 'android') {
49
+ await CookieManager.flush();
50
+ }
51
+ },
52
+ removeSessionCookies: async () => {
53
+ if (Platform.OS === 'android' || Platform.OS === 'harmony') {
54
+ return await CookieManager.removeSessionCookies();
55
+ }
56
+ },
57
+
58
+ };
59
+
60
+ for (var i = 0; i < functions.length; i++) {
61
+ module.exports[functions[i]] = CookieManager[functions[i]];
62
+ }
package/package.json CHANGED
@@ -1,55 +1,55 @@
1
- {
2
- "name": "@react-native-ohos/cookies",
3
- "version": "6.3.0-rc.1",
4
- "description": "Cookie Manager for React Native",
5
- "repository": {
6
- "type": "git",
7
- "url": "git+https://gitcode.com/openharmony-sig/rntpc_cookies.git",
8
- "baseUrl": "https://gitcode.com/openharmony-sig/rntpc_cookies"
9
- },
10
- "keywords": [
11
- "react native",
12
- "react-native-component",
13
- "cookies",
14
- "webview"
15
- ],
16
- "files": [
17
- "harmony",
18
- "src",
19
- "index.d.ts",
20
- "react-native-cookies.podspec"
21
- ],
22
- "license": "MIT",
23
- "licenseFilename": "LICENSE",
24
- "readmeFilename": "README.md",
25
- "bugs": {
26
- "url": "https://gitcode.com/openharmony-sig/rntpc_cookies/issues"
27
- },
28
- "homepage": "https://gitcode.com/openharmony-sig/rntpc_cookies#readme",
29
- "main": "index.js",
30
- "types": "index.d.ts",
31
- "scripts": {
32
- "lint": "eslint index.js",
33
- "semantic-release": "semantic-release",
34
- "codegen-lib": "react-native codegen-lib-harmony --no-safety-check --npm-package-name react-native-cookies --cpp-output-path ./harmony/rn_cookies/src/main/cpp/generated --ets-output-path ./harmony/rn_cookies/src/main/ets/generated --turbo-modules-spec-paths ./src/NativeRTNCookies.tsx"
35
- },
36
- "dependencies": {
37
- "invariant": "^2.2.4"
38
- },
39
- "peerDependencies": {
40
- "react-native": ">= 0.60.2"
41
- },
42
- "devDependencies": {
43
- "react-native": "0.72.5",
44
- "@react-native-community/eslint-config": "^0.0.6",
45
- "@react-native-community/eslint-plugin": "^1.0.0",
46
- "@semantic-release/git": "^8.0.0",
47
- "eslint": "^6.8.0",
48
- "rtn-cookies": "file:rtn-cookies",
49
- "semantic-release": "*",
50
- "react-native-harmony-cli": "npm:@react-native-oh/react-native-harmony-cli@^0.0.27"
51
- },
52
- "harmony": {
53
- "alias": "@react-native-cookies/cookies"
54
- }
1
+ {
2
+ "name": "@react-native-ohos/cookies",
3
+ "version": "6.3.0",
4
+ "description": "Cookie Manager for React Native",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://gitcode.com/openharmony-sig/rntpc_cookies.git",
8
+ "baseUrl": "https://gitcode.com/openharmony-sig/rntpc_cookies"
9
+ },
10
+ "keywords": [
11
+ "react native",
12
+ "react-native-component",
13
+ "cookies",
14
+ "webview"
15
+ ],
16
+ "files": [
17
+ "harmony",
18
+ "src",
19
+ "index.d.ts",
20
+ "react-native-cookies.podspec"
21
+ ],
22
+ "license": "MIT",
23
+ "licenseFilename": "LICENSE",
24
+ "readmeFilename": "README.md",
25
+ "bugs": {
26
+ "url": "https://gitcode.com/openharmony-sig/rntpc_cookies/issues"
27
+ },
28
+ "homepage": "https://gitcode.com/openharmony-sig/rntpc_cookies#readme",
29
+ "main": "index.js",
30
+ "types": "index.d.ts",
31
+ "scripts": {
32
+ "lint": "eslint index.js",
33
+ "semantic-release": "semantic-release",
34
+ "codegen-lib": "react-native codegen-lib-harmony --no-safety-check --npm-package-name react-native-cookies --cpp-output-path ./harmony/rn_cookies/src/main/cpp/generated --ets-output-path ./harmony/rn_cookies/src/main/ets/generated --turbo-modules-spec-paths ./src/NativeRTNCookies.tsx"
35
+ },
36
+ "dependencies": {
37
+ "invariant": "^2.2.4"
38
+ },
39
+ "peerDependencies": {
40
+ "react-native": ">= 0.60.2"
41
+ },
42
+ "devDependencies": {
43
+ "react-native": "0.72.5",
44
+ "@react-native-community/eslint-config": "^0.0.6",
45
+ "@react-native-community/eslint-plugin": "^1.0.0",
46
+ "@semantic-release/git": "^8.0.0",
47
+ "eslint": "^6.8.0",
48
+ "rtn-cookies": "file:rtn-cookies",
49
+ "semantic-release": "*",
50
+ "react-native-harmony-cli": "npm:@react-native-oh/react-native-harmony-cli@^0.0.27"
51
+ },
52
+ "harmony": {
53
+ "alias": "@react-native-cookies/cookies"
54
+ }
55
55
  }
@@ -1,18 +1,18 @@
1
- require "json"
2
-
3
- package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
-
5
- Pod::Spec.new do |s|
6
- s.name = "react-native-cookies"
7
- s.version = package["version"]
8
- s.summary = package["description"]
9
- s.homepage = package["homepage"]
10
- s.license = package["license"]
11
- s.author = { package["author"]["name"] => package["author"]["email"] }
12
- s.source = { :git => "git@github.com:react-native-community/cookies.git", :tag => "v#{s.version}" }
13
- s.requires_arc = true
14
- s.platform = :ios, "7.0"
15
- s.preserve_paths = "*.framework"
16
- s.source_files = "ios/**/*.{h,m}"
17
- s.dependency "React-Core"
18
- end
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "react-native-cookies"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.author = { package["author"]["name"] => package["author"]["email"] }
12
+ s.source = { :git => "git@github.com:react-native-community/cookies.git", :tag => "v#{s.version}" }
13
+ s.requires_arc = true
14
+ s.platform = :ios, "7.0"
15
+ s.preserve_paths = "*.framework"
16
+ s.source_files = "ios/**/*.{h,m}"
17
+ s.dependency "React-Core"
18
+ end
@@ -1,61 +1,61 @@
1
- /*
2
- * Copyright (c) 2024 Huawei Device Co., Ltd.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- /*
18
- * Copyright (c) 2024 Huawei Device Co., Ltd.
19
- *
20
- * Licensed under the Apache License, Version 2.0 (the "License");
21
- * you may not use this file except in compliance with the License.
22
- * You may obtain a copy of the License at
23
- *
24
- * http://www.apache.org/licenses/LICENSE-2.0
25
- *
26
- * Unless required by applicable law or agreed to in writing, software
27
- * distributed under the License is distributed on an "AS IS" BASIS,
28
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29
- * See the License for the specific language governing permissions and
30
- * limitations under the License.
31
- */
32
-
33
- import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
34
- import { TurboModuleRegistry, NativeModules, Platform } from "react-native";
35
-
36
- export interface Cookie {
37
- name: string;
38
- value: string;
39
- path?: string;
40
- domain?: string;
41
- version?: string;
42
- expires?: string;
43
- secure?: boolean;
44
- httpOnly?: boolean;
45
- }
46
-
47
- export interface Cookies {
48
- [key: string]: Cookie;
49
- }
50
-
51
- export interface Spec extends TurboModule {
52
- clearAll(useWebKit: boolean): Promise<boolean>;
53
- get(url: string, useWebKit?: boolean): Promise<Cookies>;
54
- set(url: string, cookie: Cookie, useWebKit?: boolean): Promise<boolean>;
55
- clearByName(url: string, name: string, useWebKit?: boolean): Promise<boolean>;
56
- flush(): Promise<boolean>;
57
- removeSessionCookies(): Promise<boolean>;
58
- }
59
-
60
- const RTNCookies = TurboModuleRegistry.getEnforcing<Spec>('RTNCookies');
1
+ /*
2
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ /*
18
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
19
+ *
20
+ * Licensed under the Apache License, Version 2.0 (the "License");
21
+ * you may not use this file except in compliance with the License.
22
+ * You may obtain a copy of the License at
23
+ *
24
+ * http://www.apache.org/licenses/LICENSE-2.0
25
+ *
26
+ * Unless required by applicable law or agreed to in writing, software
27
+ * distributed under the License is distributed on an "AS IS" BASIS,
28
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29
+ * See the License for the specific language governing permissions and
30
+ * limitations under the License.
31
+ */
32
+
33
+ import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
34
+ import { TurboModuleRegistry, NativeModules, Platform } from "react-native";
35
+
36
+ export interface Cookie {
37
+ name: string;
38
+ value: string;
39
+ path?: string;
40
+ domain?: string;
41
+ version?: string;
42
+ expires?: string;
43
+ secure?: boolean;
44
+ httpOnly?: boolean;
45
+ }
46
+
47
+ export interface Cookies {
48
+ [key: string]: Cookie;
49
+ }
50
+
51
+ export interface Spec extends TurboModule {
52
+ clearAll(useWebKit: boolean): Promise<boolean>;
53
+ get(url: string, useWebKit?: boolean): Promise<Cookies>;
54
+ set(url: string, cookie: Cookie, useWebKit?: boolean): Promise<boolean>;
55
+ clearByName(url: string, name: string, useWebKit?: boolean): Promise<boolean>;
56
+ flush(): Promise<boolean>;
57
+ removeSessionCookies(): Promise<boolean>;
58
+ }
59
+
60
+ const RTNCookies = TurboModuleRegistry.getEnforcing<Spec>('RTNCookies');
61
61
  export default RTNCookies;