You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[LINE developer account](https://developers.line.biz/console/) with a channel created.
7
+
Line SDK wrapper for React Native 🚀
22
8
23
-
## Migration from v1.x.x
9
+
-[LINE SDK v5 for iOS Swift](https://developers.line.biz/en/reference/ios-sdk-swift/), wrapped with [Swift](https://developer.apple.com/swift/).
10
+
-[LINE SDK v5 for Android](https://developers.line.biz/en/reference/android-sdk/), wrapped with [Kotlin](https://kotlinlang.org/).
24
11
25
-
If you are currently using `react-native-line-sdk` (v1.x.x):
12
+
## Requirements
26
13
27
-
1. Unlink the old library:
14
+
- Android `minSdkVersion` 24 or higher
15
+
- iOS minimum development target 13.0 or higher
16
+
-[LINE developer account](https://developers.line.biz/console/) with a channel created.
28
17
29
-
```
30
-
react-native unlink react-native-line-sdk
31
-
```
18
+
## Installation
32
19
33
-
2. Remove it from the `package.json`
34
-
3. Remove any line sdk's `*.aar` from `android/libs`
35
-
4. Remove from `android/app/build.gradle`:
20
+
```bash
21
+
$ npm install --save @xmartlabs/react-native-line
36
22
37
-
```
38
-
repositories {
39
-
flatDir {
40
-
dirs 'libs'
41
-
}
42
-
}
43
-
```
23
+
# --- or ---
44
24
45
-
Finally, follow the installation steps for the new version.
25
+
$ yarn add @xmartlabs/react-native-line
26
+
```
46
27
47
-
## Installation
28
+
## Expo Support
48
29
49
-
First, install the npm package with yarn. _Autolink_ is automatic.
30
+
If you're using Expo you need to add this plugins
50
31
51
-
```bash
52
-
yarn add @xmartlabs/react-native-line
32
+
```json
33
+
"plugins": [
34
+
...
35
+
[
36
+
"expo-build-properties", // This is required
37
+
{
38
+
"ios": {
39
+
"useFrameworks": "static"
40
+
}
41
+
}
42
+
],
43
+
[
44
+
"@xmartlabs/react-native-line",
45
+
{
46
+
"channelId": "YOUR_CHANNEL_ID"
47
+
}
48
+
]
49
+
],
53
50
```
54
51
55
-
### iOS Setup
52
+
⚠️ [iOS] if you're using other plugins it might cause conflict on `appDelegate.mm` file, please implement your own appDelegate mod if conflict occur
53
+
54
+
### Setup
56
55
57
-
#### Using Objective-C
56
+
#### iOS using Objective-C
58
57
59
58
Inside your `AppDelegate.m`, setup the line sdk by passing the channel id obtained.
60
59
61
-
1. Add `platform :ios, '11.0'` in `Podfile` line:1
60
+
1. Add `platform :ios, '13.0'` in `Podfile` line:1
62
61
2. Modify your info.plist like it says here [Configuring the Info.plist file](https://developers.line.biz/en/docs/line-login-sdks/ios-sdk/swift/setting-up-project/#config-infoplist-file)
63
62
3. Change your `AppDelegate.m` to match the following:
64
63
@@ -93,7 +92,7 @@ Inside your `AppDelegate.m`, setup the line sdk by passing the channel id obtain
93
92
}
94
93
```
95
94
96
-
#### Using Swift
95
+
#### iOS using Swift
97
96
98
97
1. Follow instructions in [Integrating LINE Login with your iOS app](https://developers.line.biz/en/docs/ios-sdk/swift/integrate-line-login/).
99
98
2. Change your `AppDelegate.m` to match the following:
Don't forget to add `application` function, as line's instructions indicate.
127
126
128
-
### Android Setup
127
+
####Android
129
128
130
129
1. Follow all the configuration steps in [Line's Android integration guide](https://developers.line.biz/en/docs/android-sdk/integrate-line-login/)
131
130
2. Add the string `line_channel_id` to your strings file with the the channel id that you have on your line console.
@@ -134,8 +133,7 @@ Don't forget to add `application` function, as line's instructions indicate.
134
133
<stringname="line_channel_id"translatable="false">Your channel id here</string>
135
134
```
136
135
137
-
3. Add `minSdkVersion = 17` in `android/build.gradle`
138
-
4. In your manifest add `xmlns:tools="http://schemas.android.com/tools"` in your `manifest` tag and also `tools:replace="android:allowBackup"` in your `application` tag
136
+
3. In your manifest add `xmlns:tools="http://schemas.android.com/tools"` in your `manifest` tag and also `tools:replace="android:allowBackup"` in your `application` tag
139
137
140
138
## API
141
139
@@ -166,15 +164,12 @@ The following objects are returned on the methods described above:
166
164
```typescript
167
165
{
168
166
/// The user ID of the current authorized user.
169
-
userID: String
170
-
167
+
userID: string
171
168
/// The display name of the current authorized user.
172
169
displayName: string
173
-
174
170
/// The profile image URL of the current authorized user. `null` if the user has not set a profile
175
171
/// image.
176
172
pictureURL?:string
177
-
178
173
/// The status message of the current authorized user. `null` if the user has not set a status message.
179
174
statusMessage?:string
180
175
}
@@ -185,14 +180,14 @@ The following objects are returned on the methods described above:
185
180
```typescript
186
181
{
187
182
/// The value of the access token.
188
-
access_token: String
183
+
access_token: string
189
184
/// The expiration time of the access token. It is calculated using `createdAt` and the validity period
190
185
/// of the access token. This value might not be the actual expiration time because this value depends
191
186
/// on the system time of the device when `createdAt` is determined.
192
-
expires_in: String
187
+
expires_in: string
193
188
/// The raw string value of the ID token bound to the access token. The value exists only if the access token
194
189
/// is obtained with the `.openID` permission.
195
-
id_token?:String
190
+
id_token?:string
196
191
}
197
192
```
198
193
@@ -201,13 +196,11 @@ The following objects are returned on the methods described above:
201
196
```typescript
202
197
{
203
198
// The channel ID bound to the access token.
204
-
client_id: String
205
-
199
+
client_id: string
206
200
/// The amount of time until the access token expires.
207
-
expires_in: String
208
-
201
+
expires_in: string
209
202
/// Valid permissions of the access token separated by spaces
210
-
scope: String
203
+
scope: string
211
204
}
212
205
```
213
206
@@ -218,7 +211,7 @@ The following objects are returned on the methods described above:
218
211
/// The access token obtained by the login process.
219
212
accessToken: AccessToken
220
213
/// The permissions bound to the `accessToken` object by the authorization process. Scope has them separated by spaces
221
-
scope: String
214
+
scope: string
222
215
/// Contains the user profile including the user ID, display name, and so on. The value exists only when the
223
216
/// `.profile` permission is set in the authorization request.
224
217
userProfile?:UserProfile
@@ -229,7 +222,7 @@ The following objects are returned on the methods described above:
229
222
friendshipStatusChanged?:boolean
230
223
/// The `nonce` value when requesting ID Token during login process. Use this value as a parameter when you
231
224
/// verify the ID Token against the LINE server. This value is `null` if `.openID` permission is not requested.
232
-
IDTokenNonce?:String
225
+
IDTokenNonce?:string
233
226
}
234
227
```
235
228
@@ -260,7 +253,6 @@ The following objects are returned on the methods described above:
260
253
EMAIL='email',
261
254
/// The permission to get an ID token in the login response.
262
255
OPEN_ID='openid',
263
-
264
256
/// The permission to get the user's profile including the user ID, display name, and the profile image
265
257
/// URL in the login response.
266
258
PROFILE='profile',
@@ -329,33 +321,6 @@ The following objects are returned on the methods described above:
329
321
}
330
322
```
331
323
332
-
## Expo Support
333
-
334
-
If you're using expo you can add this plugins
335
-
336
-
```
337
-
"plugins": [
338
-
...
339
-
// This is required, please add `expo-build-properties` to your project
340
-
[
341
-
"expo-build-properties",
342
-
{
343
-
"ios": {
344
-
"useFrameworks": "static"
345
-
}
346
-
}
347
-
],
348
-
[
349
-
"@xmartlabs/react-native-line",
350
-
{
351
-
"channelId": "YOUR_CHANNEL_ID"
352
-
}
353
-
]
354
-
],
355
-
```
356
-
357
-
⚠️ [iOS] if you're using other plugins it might cause conflict on `appDelegate.mm` file, please implement your own appDelegate mod if conflict occur
358
-
359
324
## Example
360
325
361
326
If you want to see `@xmartlabs/react-native-line` in action, just move into the [example](/example) folder and run `yarn ios`/`yarn android`. By seeing its source code, you will have a better understanding of the library usage.
0 commit comments