Skip to content

Commit b197929

Browse files
authored
Added readme and licence files (#3)
1 parent b5332df commit b197929

File tree

3 files changed

+110
-3
lines changed

3 files changed

+110
-3
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2017 XMARTLABS
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 88 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,88 @@
1-
# WIP
2-
## React native LINE
1+
# React native LINE
2+
iOS and Android Native wrapper for Line's MobileSDK.
3+
4+
## Requirements
5+
- React native `0.48.+`.
6+
- LineSDK iOS `4.0.3` and Android `4.0.6`.
7+
8+
## Installation
9+
First, install the npm package and link it to your Android and iOS projects with react-native link.
10+
```bash
11+
npm install react-native-line
12+
react-native link react-native-line
13+
```
14+
### iOS Setup
15+
Follow all the configuration steps in [Line's iOS integration guide](https://developers.line.me/en/docs/line-login/ios/integrate-line-login/)
16+
17+
### Android Setup
18+
1. Follow all the configuration steps in [Line's Android integration guide](https://developers.line.me/en/docs/line-login/android/integrate-line-login/)
19+
2. Add the string `line_channel_id` to your strings file with the the channel id that you have on your line console.
20+
```xml
21+
<string name="line_channel_id" translatable="false">Your channel id here</string>
22+
```
23+
3. Download the line Android SDK [here](https://developers.line.me/en/docs/line-login/downloads/) and save it on a new folder named `libs` under your `app` folder on your android project.
24+
4. Add the following to your app's build.gradle:
25+
```gradle
26+
repositories {
27+
flatDir {
28+
dirs 'libs'
29+
}
30+
}
31+
```
32+
33+
## Usage
34+
First, require the `LineLogin` module:
35+
```javascript
36+
import LineLogin from 'react-native-line'
37+
```
38+
Then, you can start using all the functions that are available:
39+
40+
1. `login = () => Promise<{Profile, AccessToken}>`: Starts the login flow of Line's SDK (Opens the apps if it's installed and defaults to the browser otherwise.)`
41+
42+
2. `loginWithPermissions = (permissions) => Promise<{Profile, AccessToken}>`: **iOS ONLY** Works as the `login` function but you can provide custom permissions settings.
43+
44+
3. `currentAccessToken = () => Promise<AccessToken>`: Returns the current access token for the currently logged in user.
45+
46+
4. `getUserProfile = () => Promise<Profile>`: Returns the profile of the currently logged in user.
47+
48+
5. `logout = () => Promise<Void>`: Logs out the currently logged in user.
49+
50+
Example:
51+
```javascript
52+
LineLogin.login()
53+
.then((user) => {
54+
console.log(user.profile.displayName)
55+
})
56+
.catch((err) => {
57+
console.log(err)
58+
})
59+
```
60+
61+
### Return values
62+
The following objects are returned on the methods described above:
63+
1. Profile:
64+
```typescript
65+
{
66+
displayName: String,
67+
userID: String,
68+
statusMessage: String,
69+
pictureURL: String?,
70+
}
71+
```
72+
2. AccessToken:
73+
```typescript
74+
{
75+
accessToken: String,
76+
expirationDate: String,
77+
}
78+
```
79+
80+
## Example
81+
To see more of `react-native-line` in action you can check out the source in the `example` folder.
82+
83+
## Authors
84+
- [Santiago Fernandez](https://github.com/santiagofm)
85+
- [Mauricio Cousillas](https://github.com/mcousillas6)
86+
87+
## License
88+
`react-native-line` is available under the MIT license. See the LICENCE file for more info.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-line",
3-
"version": "0.0.1",
3+
"version": "1.0.0",
44
"description": "react native line",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)