diff --git a/README.md b/README.md index 763f04e..b58f940 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,7 @@ Line SDK wrapper for React Native 🚀
- @xmartlabs/react-native-line v4 + @xmartlabs/react-native-line v5 ```objectivec #import "react_native_line-Swift.h" @@ -148,39 +148,69 @@ Line SDK wrapper for React Native 🚀 ``` +## Migration guides + +### v3 → v4 + +1. A `setup` function has been added and needs to be called before using the library. + ```typescript + Line.setup({ channelId: 'YOUR_CHANNEL_ID' }) + ``` + +2. The `getBotFriendshipStatus` function is now called `getFriendshipStatus`. + +3. The `refreshToken` function is now called `refreshAccessToken`. + +### v4 → v5 + +1. The file name in the `AppDelegate` import has changed. + ```objectivec + - #import "RNLine-Swift.h" + + + #import "react_native_line-Swift.h" + ``` + +2. The `login` function now expects an empty object as a default value. + ```typescript + - Line.login() + + + Line.login({}) + ``` + ## Usage -1. Import the `LineLogin` module: +1. Import the `Line` module: ```typescript - import LineLogin from '@xmartlabs/react-native-line' + import Line from '@xmartlabs/react-native-line' ``` 2. Initialize the module with the `setup` method: ```typescript useEffect(() => { - LineLogin.setup({ channelId: 'YOUR_CHANNEL_ID' }) + Line.setup({ channelId: 'YOUR_CHANNEL_ID' }) }, []) ``` 3. Login with the `login` method: ```typescript - LineLogin.login({}) + Line.login({}) ``` ## API | Function | Description | | -------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `login(args?: LoginArguments): Promise` | Starts the login flow of Line's SDK (Opens the apps if it's installed and defaults to the browser otherwise). It accepts the same argumements as the LineSDK, in an object `{ key: value }`, defaults the same way as LineSDK too. | -| `getCurrentAccessToken(): Promise` | Returns the current access token for the currently logged in user. | -| `getProfile(): Promise` | Returns the profile of the currently logged in user. | -| `logout(): Promise` | Logs out the currently logged in user. | -| `refreshToken(): Promise` | Refreshes the access token and returns it. | -| `verifyAccessToken(): Promise` | Verifies the access token and returns it. | -| `getBotFriendshipStatus(): Promise` | Gets bot friendship status if [configured](https://developers.line.biz/en/docs/ios-sdk/swift/link-a-bot/). | +| `login(params: LoginParams): Promise` | Starts the login flow of Line's SDK (Opens the apps if it's installed and defaults to the browser otherwise). It accepts the same argumements as the LineSDK, in an object `{ key: value }`, defaults the same way as LineSDK too. | +| `getCurrentAccessToken(): Promise` | Returns the access token of the current user. | +| `getProfile(): Promise` | Returns the current user profile information. | +| `logout(): Promise` | Revokes the access token of the current user. | +| `refreshAccessToken(): Promise` | Refreshes the access token of the current user. | +| `setup(params: SetupParams): Promise` | Initializes the Line SDK. | +| `verifyAccessToken(): Promise` | Checks whether the access token of the current user is valid. | +| `getFriendshipStatus(): Promise` | Gets the friendship status between the LINE Official Account (which is linked to the current channel) and the user if [configured](https://developers.line.biz/en/docs/line-login-sdks/ios-sdk/swift/link-a-bot/). | ## Example diff --git a/android/build.gradle b/android/build.gradle index 8074594..1d0897a 100755 --- a/android/build.gradle +++ b/android/build.gradle @@ -32,7 +32,7 @@ android { minSdkVersion safeExtGet("minSdkVersion", 24) targetSdkVersion safeExtGet("targetSdkVersion", 35) versionCode 1 - versionName "4.1.0" + versionName "5.0.0" } sourceSets { diff --git a/example/package-lock.json b/example/package-lock.json index f717b4f..01d19a4 100644 --- a/example/package-lock.json +++ b/example/package-lock.json @@ -43,7 +43,7 @@ }, "..": { "name": "@xmartlabs/react-native-line", - "version": "4.1.0", + "version": "5.0.0", "license": "MIT", "devDependencies": { "@expo/config-plugins": "^9.0.17", diff --git a/package-lock.json b/package-lock.json index 0e0d55e..0ad684e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@xmartlabs/react-native-line", - "version": "4.1.0", + "version": "5.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@xmartlabs/react-native-line", - "version": "4.1.0", + "version": "5.0.0", "license": "MIT", "devDependencies": { "@expo/config-plugins": "^9.0.17", diff --git a/package.json b/package.json index 868eca9..bfb3d00 100755 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "author": "Xmartlabs ", "main": "dist/index.js", "types": "dist/index.d.ts", - "version": "4.1.0", + "version": "5.0.0", "homepage": "https://github.com/xmartlabs/react-native-line#readme", "keywords": [ "auth",