Skip to content

Commit

Permalink
Merge pull request #41 from taskrabbit/rm/rn0.62-update-podspec
Browse files Browse the repository at this point in the history
Updates to support Cocoapods for RN 0.62
  • Loading branch information
robertmurray authored Jan 31, 2020
2 parents 1931f05 + d1eda87 commit 5a21967
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 19 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) TaskRabbit, Inc. and its affiliates.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
55 changes: 39 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,38 @@ Simple module that allows displaying Zopim Chat from Zendesk for React Native.

## VERSIONS

For RN version higher than 0.30 use version >= 0.1.x
For RN version higher than 0.59 use version >= 0.3.0

For RN version lower than 0.30 use version 0.0.2.
For RN version lower than 0.59 use version <= 0.2.2

Since version 0.2.0 `department` is set to `ZDCPreChatDataRequiredEditable`.
## Known Issues

## Known issues

I could not find how to make the import for iOS work properly since I'm using Cocoapods for Zendesk, if you have a suggestion that would be great.

## Getting started
## Getting Started

Follow the instructions to install the SDK for [iOS](https://developer.zendesk.com/embeddables/docs/ios-chat-sdk/introduction) and [Android](https://developer.zendesk.com/embeddables/docs/android-chat-sdk/introduction).

### Manual install

1. With npm:

`npm install react-native-zendesk-chat --save`

or with yarn:

`yarn add react-native-zendesk-chat`

#### iOS
1. `npm install react-native-zendesk-chat --save`
2. In Xcode, drag and drop `node_modules/react-native-zendesk-chat/RNZendeskChat.m` and `node_modules/react-native-zendesk-chat/RNZendeskChat.h` into your project.

2. Add a reference to your Podfile:

`pod 'RNZendeskChat', :git => 'https://github.com/robertmurray/react-native-zendesk-chat.git'`

then run pod install: `(cd ios; pod install)`

or manually:

In Xcode, drag and drop `node_modules/react-native-zendesk-chat/RNZendeskChat.m` and `node_modules/react-native-zendesk-chat/RNZendeskChat.h` into your project.

3. Configure `ZDCChat` in `AppDelegate.m`:

```
Expand All @@ -31,10 +45,11 @@ Follow the instructions to install the SDK for [iOS](https://developer.zendesk.c
```

#### Android
1. `npm install react-native-zendesk-chat --save`

2. Open up `android/app/main/java/[...]/MainApplication.java`
- Add `import com.taskrabbit.zendesk.*;` to the imports at the top of the file
- Add `new RNZendeskChatPackage(this)` to the list returned by the `getPackages()` method

- Add `import com.taskrabbit.zendesk.*;` to the imports at the top of the file
- Add `new RNZendeskChatPackage(this)` to the list returned by the `getPackages()` method

3. Append the following lines to `android/settings.gradle`:

Expand All @@ -57,9 +72,13 @@ ZopimChat.init("YOUR_ZENDESK_ACCOUNT_KEY").build();

## Usage

In your code add `import ZendeskChat from 'react-native-zendesk-chat';`.
In your code add:

```
import ZendeskChat from 'react-native-zendesk-chat
...
ZendeskChat.startChat({
name: user.full_name,
email: user.email,
Expand All @@ -71,5 +90,9 @@ ZendeskChat.startChat({

## TODO

* Allow setting form configuration from JS
* Add examples
- Allow setting form configuration from JS
- Add examples

## License

React Native is MIT licensed, as found in the [LICENSE](https://github.com/taskrabbit/react-native-zendesk-chat/LICENSE) file.
22 changes: 22 additions & 0 deletions RNZendeskChat.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
require 'json'

package = JSON.parse(File.read(File.join(__dir__, 'package.json')))

Pod::Spec.new do |s|
s.name = "RNZendeskChat"
s.version = package['version']
s.summary = package['description']
s.license = package['license']
s.authors = package['author']
s.homepage = package['homepage']
s.platform = :ios, "10"
s.source = { :git => "https://github.com/taskrabbit/react-native-zendesk-chat.git", :tag => "v#{s.version}" }
s.source_files = "ios/*.{h,m}"
s.static_framework = true

s.framework = 'Foundation'
s.framework = 'UIKit'

s.dependency 'React'
s.dependency 'ZDCChat'
end
2 changes: 1 addition & 1 deletion ios/RNZendeskChatModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ @implementation RNZendeskChatModule
if (options[@"phone"]) {
visitor.phone = options[@"phone"];
}
visitor.shouldPersist = options[@"shouldPersist"] || NO;
visitor.shouldPersist = [options[@"shouldPersist"] boolValue] || NO;
}];
}

Expand Down
13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-zendesk-chat",
"version": "0.2.2",
"version": "0.3.0",
"description": "React Native Wrapper around Zopim Zendesk Chat",
"main": "index.js",
"repository": {
Expand All @@ -16,6 +16,15 @@
"android",
"react-component"
],
"homepage": "https://github.com/taskrabbit/react-native-zendesk-chat.git",
"bugs": "https://github.com/taskrabbit/react-native-zendesk-chat/issues",
"author": "jrichardlai",
"license": "MIT"
"contributors": [
"Robert Murray <[email protected]>"
],
"license": "MIT",
"peerDependencies": {
"react": "^16.11.0",
"react-native": "^0.60.0"
}
}
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


0 comments on commit 5a21967

Please sign in to comment.