Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Cookie Manager for React Native

This module was ported from [joeferraro/react-native-cookies](https://github.com/joeferraro/react-native-cookies). This would not exist without the work of the original author, [Joe Ferraro](https://github.com/joeferraro).

## Important notices & Breaking Changes
- v1.1.1 >= will be published to `@react-native-community/cookies`. `@react-native-community/react-native-cookies` is now deprecated as of v1.1.1.

## Maintainers
- [Jason Safaiyeh](https://github.com/safaiyeh) ([Twitter @safaiyeh](https://twitter.com/safaiyeh)) from [Sumo Logic](https://www.sumologic.com)

Expand All @@ -15,7 +18,7 @@ Currently lacking support for Windows, Web, and Expo. Support for these platform
## Installation

```
yarn add @react-native-community/react-native-cookies
yarn add @react-native-community/cookies
```


Expand All @@ -24,7 +27,7 @@ yarn add @react-native-community/react-native-cookies
### Automatic (recommended)

```
react-native link @react-native-community/react-native-cookies
react-native link @react-native-community/cookies
```

### Manual
Expand All @@ -34,29 +37,29 @@ If automatic linking does not work, you can manually link this library by follow
#### iOS

1. Open your project in Xcode, right click on `Libraries` and click `Add
Files to "Your Project Name"` Look under `node_modules/@react-native-community/react-native-cookies/ios` and add `RNCookieManagerIOS.xcodeproj`.
Files to "Your Project Name"` Look under `node_modules/@react-native-community/cookies/ios` and add `RNCookieManagerIOS.xcodeproj`.
2. Add `libRNCookieManagerIOS.a` to `Build Phases -> Link Binary With Libraries.
3. Clean and rebuild your project

#### Android

Run `react-native link` to link the react-native-cookies library.
Run `react-native link` to link the cookies library.

Or if you have trouble, make the following additions to the given files manually:

**android/settings.gradle**

```gradle
include ':@react-native-community_react-native-cookies'
project(':@react-native-community_react-native-cookies').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/react-native-cookies/android')
include ':@react-native-community_cookies'
project(':@react-native-community_cookies').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/cookies/android')
```

**android/app/build.gradle**

```gradle
dependencies {
...
implementation project(':@react-native-community_react-native-cookies')
implementation project(':@react-native-community_cookies')
}
```

Expand Down Expand Up @@ -85,7 +88,7 @@ protected List<ReactPackage> getPackages() {
## Usage

```javascript
import CookieManager from '@react-native-community/react-native-cookies';
import CookieManager from '@react-native-community/cookies';

// set a cookie (IOS ONLY)
CookieManager.set({
Expand Down Expand Up @@ -156,7 +159,7 @@ To use this _CookieManager_ with WebKit-Support we extended the interface with t

##### Usage
```javascript
import CookieManager from '@react-native-community/react-native-cookies';
import CookieManager from '@react-native-community/cookies';

const useWebKit = true;

Expand Down
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare module "@react-native-community/react-native-cookies" {
declare module "@react-native-community/cookies" {
export interface Cookie {
name: string;
value: string;
Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ let CookieManager;
if (Platform.OS === 'ios') {
invariant(
RNCookieManagerIOS,
'react-native-cookies: Add RNCookieManagerIOS.h and RNCookieManagerIOS.m to your Xcode project',
'@react-native-community/cookies: Add RNCookieManagerIOS.h and RNCookieManagerIOS.m to your Xcode project',
);
CookieManager = RNCookieManagerIOS;
} else if (Platform.OS === 'android') {
invariant(
RNCookieManagerAndroid,
'react-native-cookies: Import libraries to android "react-native link react-native-cookies"',
'@react-native-community/cookies: Import libraries to android "react-native link @react-native-community/cookies"',
);
CookieManager = RNCookieManagerAndroid;
} else {
invariant(
CookieManager,
'react-native-cookies: Invalid platform. This library only supports Android and iOS.',
'@react-native-community/cookies: Invalid platform. This library only supports Android and iOS.',
);
}

Expand Down
2 changes: 1 addition & 1 deletion ios/react-native-cookies.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Pod::Spec.new do |s|
s.homepage = package['homepage']
s.license = package['license']
s.author = "safaiyeh"
s.source = { :git => "git@github.com:react-native-community/react-native-cookies.git", :tag => "v#{s.version}" }
s.source = { :git => "git@github.com:react-native-community/cookies.git", :tag => "v#{s.version}" }
s.requires_arc = true
s.platform = :ios, "7.0"
s.preserve_paths = "*.framework"
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@react-native-community/react-native-cookies",
"name": "@react-native-community/cookies",
"version": "1.1.1",
"description": "Cookie Manager for React Native",
"repository": {
"type": "git",
"url": "git+https://github.com/react-native-community/react-native-cookies.git",
"baseUrl": "https://github.com/react-native-community/react-native-cookies"
"url": "git+https://github.com/react-native-community/cookies.git",
"baseUrl": "https://github.com/react-native-community/cookies"
},
"keywords": [
"react native",
Expand All @@ -23,9 +23,9 @@
"licenseFilename": "LICENSE",
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/react-native-community/react-native-cookies/issues"
"url": "https://github.com/react-native-community/cookies/issues"
},
"homepage": "https://github.com/react-native-community/react-native-cookies#readme",
"homepage": "https://github.com/react-native-community/cookies#readme",
"main": "index.js",
"types": "index.d.ts",
"scripts": {
Expand Down