Skip to content

Commit e7c849a

Browse files
committed
deserializer and ui improvements
1 parent 1939106 commit e7c849a

File tree

8 files changed

+67
-2859
lines changed

8 files changed

+67
-2859
lines changed

example/ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ PODS:
226226
- React
227227
- RNGestureHandler (1.5.2):
228228
- React
229-
- RNLine (2.0.0):
229+
- RNLine (2.0.1):
230230
- LineSDKSwift (~> 5.0)
231231
- React
232232
- RNReanimated (1.4.0):
@@ -375,7 +375,7 @@ SPEC CHECKSUMS:
375375
ReactNativeLocalization: dbb269b27d8a84bb22b9c2cdec38ba780b51dd72
376376
RNCAsyncStorage: 44395cb9c7c1523104c2b499eb426ef7aff82bca
377377
RNGestureHandler: 946a7691e41df61e2c4b1884deab41a4cdc3afff
378-
RNLine: cd30f81208647017750cbfcf0223f57946652efe
378+
RNLine: 677e5a14ab348c2085452cdad1a2ac68795717d9
379379
RNReanimated: b2ab0b693dddd2339bd2f300e770f6302d2e960c
380380
RNScreens: 36f8c83e5e23b6bfd5b912148453d81e335573eb
381381
RNSVG: ce9d996113475209013317e48b05c21ee988d42e

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"react-navigation": "^4.0.10",
2424
"react-navigation-stack": "^1.9.3",
2525
"react-navigation-tabs": "^2.5.6",
26-
"@xmartlabs/react-native-line": "^2.0.0"
26+
"@xmartlabs/react-native-line": "^2.0.1"
2727
},
2828
"devDependencies": {
2929
"@babel/core": "^7.6.2",

example/src/navigation/TabNavigator.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ export const TabNavigator = createBottomTabNavigator(
1010
{
1111
[Route.UserTab]: {
1212
navigationOptions: {
13-
tabBarLabel: ({ tintColor }) => (
13+
tabBarIcon: ({ tintColor }) => (
1414
<Text style={{ color: tintColor }}>User</Text>
1515
),
1616
},
1717
screen: UserStack,
1818
},
1919
[Route.API]: {
2020
navigationOptions: {
21-
tabBarLabel: ({ tintColor }) => (
21+
tabBarIcon: ({ tintColor }) => (
2222
<Text style={{ color: tintColor }}>API</Text>
2323
),
2424
},
@@ -27,6 +27,9 @@ export const TabNavigator = createBottomTabNavigator(
2727
},
2828
{
2929
initialRouteName: Route.UserTab,
30+
tabBarOptions: {
31+
showLabel: false,
32+
},
3033
lazy: false,
3134
},
3235
)

example/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,10 +1087,10 @@
10871087
dependencies:
10881088
"@types/yargs-parser" "*"
10891089

1090-
"@xmartlabs/react-native-line@^2.0.0":
1091-
version "2.0.0"
1092-
resolved "https://registry.yarnpkg.com/@xmartlabs/react-native-line/-/react-native-line-2.0.0.tgz#d8e8834b65f88f10875bf16c6a20360aa67753d5"
1093-
integrity sha512-zCixb3o75hxEqqdUmA7lyS708btT0sz06Pz7MorndoAxPDr8EhzcytoutitW5k4Sl+bIXq3LiBvrCsEQ/KGtRA==
1090+
"@xmartlabs/react-native-line@^2.0.1":
1091+
version "2.0.1"
1092+
resolved "https://registry.yarnpkg.com/@xmartlabs/react-native-line/-/react-native-line-2.0.1.tgz#1b9879406aa7c5e1ebf7cde5bfa18939afb0ecd0"
1093+
integrity sha512-KD4+svfYw1jSAmc6bn0GirPc02UtVkz8ULnaLgVphkEKhHQcCqf56ZoLYXUwSVLvvNK2lV0EdegYu12ourCtSg==
10941094

10951095
abab@^2.0.0:
10961096
version "2.0.3"

src/deserializers/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const deserializeLoginResult = (data: any): LoginResult => ({
1111
accessToken: deserializeAccessToken(data.accessToken),
1212
friendshipStatusChanged: data.friendshipStatusChanged,
1313
scope: data.scope,
14-
userProfile: data.userProfile,
14+
userProfile: deserializeUserProfile(data.userProfile),
1515
})
1616

1717
export const deserializeAccessToken = (data: any): AccessToken => ({
@@ -24,7 +24,7 @@ export const deserializeUserProfile = (data: any): UserProfile => ({
2424
displayName: data.displayName,
2525
pictureURL: data.pictureURL ?? undefined,
2626
statusMessage: data.statusMessage ?? undefined,
27-
userID: data.userID,
27+
userID: data.userId ?? data.userID,
2828
})
2929

3030
export const deserializeVerifyAccessToken = (

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
refreshToken as LineSDKRefreshToken,
88
verifyAccessToken as LineSDKVerifyAccessToken,
99
} from './lineSDKWrapper'
10+
import { LoginArguments } from './types'
1011

1112
export {
1213
BotFriendshipStatus,
@@ -29,7 +30,7 @@ export default {
2930
getProfile() {
3031
return LineSDKGetProfile()
3132
},
32-
login(args = {}) {
33+
login(args: LoginArguments = {}) {
3334
return LineSDKLogin(args)
3435
},
3536
logout() {

src/lineSDKWrapper.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@ import {
1313
BotFriendshipStatus,
1414
LoginResult,
1515
UserProfile,
16+
LoginArguments,
1617
} from './types'
1718

1819
const { LineLogin } = NativeModules
1920

20-
export const getBotFriendshipStatus = async (): Promise<
21-
BotFriendshipStatus
22-
> => {
21+
export const getBotFriendshipStatus = async (): Promise<BotFriendshipStatus> => {
2322
const result = await LineLogin.getBotFriendshipStatus()
2423
const deserializedResult = deserializeBotFriendshipStatus(result)
2524
return deserializedResult
@@ -37,7 +36,9 @@ export const getProfile = async (): Promise<UserProfile> => {
3736
return deserializedResult
3837
}
3938

40-
export const login = async (args: any = {}): Promise<LoginResult> => {
39+
export const login = async (
40+
args: LoginArguments = {},
41+
): Promise<LoginResult> => {
4142
const result = await LineLogin.login(args)
4243
const deserializedResult = deserializeLoginResult(result)
4344
return deserializedResult

0 commit comments

Comments
 (0)