expo-line-login 0.2.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +73 -0
  2. package/android/.gradle/8.0/checksums/checksums.lock +0 -0
  3. package/android/.gradle/8.0/dependencies-accessors/dependencies-accessors.lock +0 -0
  4. package/android/.gradle/8.0/dependencies-accessors/gc.properties +0 -0
  5. package/android/.gradle/8.0/fileChanges/last-build.bin +0 -0
  6. package/android/.gradle/8.0/fileHashes/fileHashes.lock +0 -0
  7. package/android/.gradle/8.0/gc.properties +0 -0
  8. package/android/.gradle/8.1.1/checksums/checksums.lock +0 -0
  9. package/android/.gradle/8.1.1/dependencies-accessors/dependencies-accessors.lock +0 -0
  10. package/android/.gradle/8.1.1/dependencies-accessors/gc.properties +0 -0
  11. package/android/.gradle/8.1.1/fileChanges/last-build.bin +0 -0
  12. package/android/.gradle/8.1.1/fileHashes/fileHashes.lock +0 -0
  13. package/android/.gradle/8.1.1/gc.properties +0 -0
  14. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  15. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  16. package/android/.gradle/config.properties +2 -0
  17. package/android/.gradle/vcs-1/gc.properties +0 -0
  18. package/android/.idea/gradle.xml +12 -0
  19. package/android/.idea/migrations.xml +10 -0
  20. package/android/.idea/misc.xml +10 -0
  21. package/android/.idea/vcs.xml +6 -0
  22. package/android/build.gradle +2 -1
  23. package/android/local.properties +8 -0
  24. package/android/src/main/AndroidManifest.xml +2 -1
  25. package/android/src/main/java/dev/stanma/line/ExpoLineLoginModule.kt +147 -3
  26. package/build/ExpoLineLogin.types.d.ts +7 -0
  27. package/build/ExpoLineLogin.types.d.ts.map +1 -0
  28. package/build/ExpoLineLogin.types.js +2 -0
  29. package/build/ExpoLineLogin.types.js.map +1 -0
  30. package/build/ExpoLineLoginModule.web.d.ts +7 -0
  31. package/build/ExpoLineLoginModule.web.d.ts.map +1 -0
  32. package/build/ExpoLineLoginModule.web.js +12 -0
  33. package/build/ExpoLineLoginModule.web.js.map +1 -0
  34. package/build/ExpoLineLoginView.d.ts +4 -0
  35. package/build/ExpoLineLoginView.d.ts.map +1 -0
  36. package/build/ExpoLineLoginView.js +7 -0
  37. package/build/ExpoLineLoginView.js.map +1 -0
  38. package/build/ExpoLineLoginView.web.d.ts +4 -0
  39. package/build/ExpoLineLoginView.web.d.ts.map +1 -0
  40. package/build/ExpoLineLoginView.web.js +6 -0
  41. package/build/ExpoLineLoginView.web.js.map +1 -0
  42. package/package.json +1 -1
  43. package/plugin/build/index.js +6 -12
  44. package/plugin/src/index.ts +6 -17
  45. package/src/types/index.ts +3 -3
package/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # Expo Line Login
2
+ ## Installation
3
+ ```bash
4
+ npx expo install expo-line-login
5
+ ```
6
+ ## Prerequisites
7
+ - Please create a Line Login channel and get the channel ID from [Line Developer Console](https://developers.line.biz/console/).
8
+ - Please add your app schema and package name into the "App settings" fields in the "LINE Login" section of the [Line Developer Console](https://developers.line.biz/console/).
9
+ - Please add the following config in your app.json
10
+ ```json
11
+ {
12
+ "expo": {
13
+ "plugins": [
14
+ [
15
+ "expo-line-login", {
16
+ "channelId": "YOUR_CHANNEL_ID", // repleace with your channel ID
17
+ }
18
+ ]
19
+ ]
20
+ }
21
+ }
22
+ ```
23
+
24
+ ## Usage
25
+ ### Login
26
+ ```js
27
+ import {
28
+ login,
29
+ LoginPermission,
30
+ BotPrompt,
31
+ } from 'expo-line-login';
32
+
33
+ const result = await login({
34
+ [
35
+ LoginPermission.PROFILE,
36
+ LoginPermission.OPEN_ID,
37
+ LoginPermission.EMAIL,
38
+ ],
39
+ BotPrompt.NORMAL,
40
+ });
41
+ console.log(result);
42
+ ```
43
+
44
+ ### Get Profile
45
+ ```js
46
+ import { getProfile } from 'expo-line-login';
47
+
48
+ const profile = await getProfile();
49
+ console.log(profile);
50
+ ```
51
+
52
+ ### Logout
53
+ ```js
54
+ import { logout } from 'expo-line-login';
55
+
56
+ await logout();
57
+ ```
58
+
59
+ ### Get Access Token
60
+ ```js
61
+ import { getAccessToken } from 'expo-line-login';
62
+
63
+ const accessToken = await getAccessToken();
64
+ console.log(accessToken);
65
+ ```
66
+
67
+ ### Get Friendship Status
68
+ ```js
69
+ import { lineGetBotFriendshipStatus } from 'expo-line-login';
70
+
71
+ const friendshipStatus = await lineGetBotFriendshipStatus();
72
+ console.log(friendshipStatus);
73
+ ```
File without changes
File without changes
@@ -0,0 +1,2 @@
1
+ #Thu Dec 28 10:36:11 CST 2023
2
+ gradle.version=8.1.1
@@ -0,0 +1,2 @@
1
+ #Thu Dec 28 10:38:19 CST 2023
2
+ java.home=/Applications/Android Studio.app/Contents/jbr/Contents/Home
File without changes
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="GradleSettings">
4
+ <option name="linkedExternalProjectsSettings">
5
+ <GradleProjectSettings>
6
+ <option name="externalProjectPath" value="$PROJECT_DIR$" />
7
+ <option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
8
+ <option name="resolveExternalAnnotations" value="false" />
9
+ </GradleProjectSettings>
10
+ </option>
11
+ </component>
12
+ </project>
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectMigrations">
4
+ <option name="MigrateToGradleLocalJavaHome">
5
+ <set>
6
+ <option value="$PROJECT_DIR$" />
7
+ </set>
8
+ </option>
9
+ </component>
10
+ </project>
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ExternalStorageConfigurationManager" enabled="true" />
4
+ <component name="ProjectRootManager">
5
+ <output url="file://$PROJECT_DIR$/build/classes" />
6
+ </component>
7
+ <component name="ProjectType">
8
+ <option name="id" value="Android" />
9
+ </component>
10
+ </project>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
5
+ </component>
6
+ </project>
@@ -64,7 +64,7 @@ android {
64
64
 
65
65
  namespace "dev.stanma.line"
66
66
  defaultConfig {
67
- minSdkVersion safeExtGet("minSdkVersion", 21)
67
+ minSdkVersion safeExtGet("minSdkVersion", 24)
68
68
  targetSdkVersion safeExtGet("targetSdkVersion", 33)
69
69
  versionCode 1
70
70
  versionName "0.1.0"
@@ -86,4 +86,5 @@ repositories {
86
86
  dependencies {
87
87
  implementation project(':expo-modules-core')
88
88
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
89
+ implementation "com.linecorp.linesdk:linesdk:latest.release"
89
90
  }
@@ -0,0 +1,8 @@
1
+ ## This file must *NOT* be checked into Version Control Systems,
2
+ # as it contains information specific to your local configuration.
3
+ #
4
+ # Location of the SDK. This is only used by Gradle.
5
+ # For customization when using a Version Control System, please read the
6
+ # header note.
7
+ #Thu Dec 28 10:38:19 CST 2023
8
+ sdk.dir=/Users/admin/Library/Android/sdk
@@ -1,2 +1,3 @@
1
- <manifest>
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ <uses-permission android:name="android.permission.INTERNET" />
2
3
  </manifest>
@@ -1,16 +1,160 @@
1
1
  package dev.stanma.line
2
2
 
3
+ import android.content.Context
4
+ import android.content.pm.ApplicationInfo
5
+ import android.content.pm.PackageManager
6
+ import expo.modules.kotlin.Promise
3
7
  import expo.modules.kotlin.modules.Module
4
8
  import expo.modules.kotlin.modules.ModuleDefinition
9
+ import com.linecorp.linesdk.*
10
+ import com.linecorp.linesdk.api.LineApiClient
11
+ import com.linecorp.linesdk.api.LineApiClientBuilder
12
+ import com.linecorp.linesdk.auth.LineAuthenticationConfig
13
+ import com.linecorp.linesdk.auth.LineAuthenticationParams
14
+ import com.linecorp.linesdk.auth.LineLoginApi
15
+ import com.linecorp.linesdk.auth.LineLoginResult
16
+ import expo.modules.kotlin.exception.Exceptions
5
17
 
6
18
  class ExpoLineLoginModule : Module() {
7
- // Each module class must implement the definition function. The definition consists of components
8
- // that describes the module's functionality and behavior.
9
- // See https://docs.expo.dev/modules/module-api for more details about available components.
19
+ private val LOGIN_REQUEST_CODE = 1;
20
+ private var loginPromise: Promise? = null;
21
+
22
+ private lateinit var context: Context;
23
+ private var applicationInfo: ApplicationInfo? = null;
10
24
  override fun definition() = ModuleDefinition {
11
25
  // Sets the name of the module that JavaScript code will use to refer to the module. Takes a string as an argument.
12
26
  // Can be inferred from module's class name, but it's recommended to set it explicitly for clarity.
13
27
  // The module will be accessible from `requireNativeModule('ExpoLineLogin')` in JavaScript.
14
28
  Name("ExpoLineLogin")
29
+
30
+ OnCreate {
31
+ context = appContext.reactContext ?: throw Exceptions.ReactContextLost();
32
+ applicationInfo = context.packageManager?.getApplicationInfo(context.packageName.toString(), PackageManager.GET_META_DATA);
33
+ }
34
+
35
+
36
+
37
+ AsyncFunction("login") { scopes: List<String>, botPrompt: String, promise: Promise ->
38
+ val channelId = applicationInfo?.metaData?.getInt("line.sdk.channelId").toString()
39
+ val loginConfig = LineAuthenticationConfig.Builder(channelId).build()
40
+
41
+ val authenticationParams = LineAuthenticationParams.Builder()
42
+ .scopes(Scope.convertToScopeList(scopes))
43
+ .apply {
44
+ botPrompt(LineAuthenticationParams.BotPrompt.valueOf(botPrompt))
45
+ }
46
+ .build()
47
+
48
+ val currentActivity = appContext.currentActivity
49
+ val context: Context = appContext.reactContext ?: throw Exceptions.ReactContextLost()
50
+
51
+ val loginIntent = LineLoginApi.getLoginIntent(
52
+ context,
53
+ loginConfig,
54
+ authenticationParams
55
+ )
56
+
57
+ currentActivity?.startActivityForResult(loginIntent, LOGIN_REQUEST_CODE)
58
+ loginPromise = promise
59
+ }
60
+
61
+ OnActivityResult {_, (requestCode, resultCode, data) ->
62
+ if (requestCode == LOGIN_REQUEST_CODE) {
63
+ val result: LineLoginResult = LineLoginApi.getLoginResultFromIntent(data)
64
+
65
+ when (result.responseCode) {
66
+ LineApiResponseCode.SUCCESS -> {
67
+ val resultDict = mapOf(
68
+ "friendshipStatusChanged" to result.friendshipStatusChanged,
69
+ "scope" to result.lineCredential?.scopes?.let {
70
+ Scope.join(it)
71
+ },
72
+ "IDTokenNonce" to result.lineIdToken?.nonce,
73
+ "accessToken" to mapOf(
74
+ "access_token" to result.lineCredential?.accessToken?.tokenString,
75
+ "expires_in" to result.lineCredential?.accessToken?.expiresInMillis,
76
+ "id_token" to result.lineIdToken?.rawString,
77
+ "createdAt" to result.lineCredential?.accessToken?.issuedClientTimeMillis,
78
+ ),
79
+ "userProfile" to mapOf(
80
+ "displayName" to result.lineProfile?.displayName,
81
+ "userId" to result.lineProfile?.userId,
82
+ "pictureUrl" to result.lineProfile?.pictureUrl,
83
+ ),
84
+ )
85
+
86
+ loginPromise?.resolve(resultDict)
87
+ loginPromise = null
88
+ }
89
+ LineApiResponseCode.CANCEL -> {
90
+ loginPromise?.reject(result.responseCode.name, result.errorData.message, Exception(result.errorData.message))
91
+ loginPromise = null
92
+ }
93
+ else -> {
94
+ loginPromise?.reject(result.responseCode.name, result.errorData.message, Exception(result.errorData.message))
95
+ loginPromise = null
96
+ }
97
+ }
98
+
99
+ loginPromise = null
100
+ }
101
+ }
102
+
103
+ AsyncFunction("logout") { promise: Promise ->
104
+ val channelId = applicationInfo?.metaData?.getInt("line.sdk.channelId").toString()
105
+ val client: LineApiClient = LineApiClientBuilder(context, channelId).build()
106
+ val logoutRes = client.logout()
107
+ if (logoutRes.isSuccess) {
108
+ promise.resolve(null)
109
+ } else {
110
+ promise.reject(logoutRes.responseCode.name, logoutRes.errorData.message, Exception(logoutRes.errorData.message))
111
+ }
112
+ }
113
+
114
+ AsyncFunction("getProfile") { promise: Promise ->
115
+ val channelId = applicationInfo?.metaData?.getInt("line.sdk.channelId").toString()
116
+ val client: LineApiClient = LineApiClientBuilder(context, channelId).build()
117
+ val profileRes = client.profile
118
+ if (profileRes.isSuccess) {
119
+ val profile = profileRes.responseData
120
+ val resultDict = mapOf(
121
+ "displayName" to profile.displayName,
122
+ "userId" to profile.userId,
123
+ "pictureUrl" to profile.pictureUrl,
124
+ )
125
+ promise.resolve(resultDict)
126
+ } else {
127
+ promise.reject(profileRes.responseCode.name, profileRes.errorData.message, Exception(profileRes.errorData.message))
128
+ }
129
+ }
130
+
131
+ AsyncFunction("getAccessToken") { promise: Promise ->
132
+ val channelId = applicationInfo?.metaData?.getInt("line.sdk.channelId").toString()
133
+ val client: LineApiClient = LineApiClientBuilder(context, channelId).build()
134
+ val accessTokenRes = client.currentAccessToken
135
+ if (accessTokenRes.isSuccess) {
136
+ val accessToken = accessTokenRes.responseData
137
+ val resultDict = mapOf(
138
+ "access_token" to accessToken.tokenString,
139
+ "expires_in" to accessToken.expiresInMillis,
140
+ "createdAt" to accessToken.issuedClientTimeMillis,
141
+ )
142
+ promise.resolve(resultDict)
143
+ } else {
144
+ promise.reject(accessTokenRes.responseCode.name, accessTokenRes.errorData.message, Exception(accessTokenRes.errorData.message))
145
+ }
146
+ }
147
+
148
+ AsyncFunction("getBotFriendshipStatus") {promise: Promise ->
149
+ val channelId = applicationInfo?.metaData?.getInt("line.sdk.channelId").toString()
150
+ val client: LineApiClient = LineApiClientBuilder(context, channelId).build()
151
+ val botFriendshipStatusRes = client.friendshipStatus
152
+ if (botFriendshipStatusRes.isSuccess) {
153
+ val botFriendshipStatus = botFriendshipStatusRes.responseData
154
+ promise.resolve(botFriendshipStatus.isFriend)
155
+ } else {
156
+ promise.reject(botFriendshipStatusRes.responseCode.name, botFriendshipStatusRes.errorData.message, Exception(botFriendshipStatusRes.errorData.message))
157
+ }
158
+ }
15
159
  }
16
160
  }
@@ -0,0 +1,7 @@
1
+ export type ChangeEventPayload = {
2
+ value: string;
3
+ };
4
+ export type ExpoLineLoginViewProps = {
5
+ name: string;
6
+ };
7
+ //# sourceMappingURL=ExpoLineLogin.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoLineLogin.types.d.ts","sourceRoot":"","sources":["../src/ExpoLineLogin.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ExpoLineLogin.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoLineLogin.types.js","sourceRoot":"","sources":["../src/ExpoLineLogin.types.ts"],"names":[],"mappings":"","sourcesContent":["export type ChangeEventPayload = {\n value: string;\n};\n\nexport type ExpoLineLoginViewProps = {\n name: string;\n};\n"]}
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ PI: number;
3
+ setValueAsync(value: string): Promise<void>;
4
+ hello(): string;
5
+ };
6
+ export default _default;
7
+ //# sourceMappingURL=ExpoLineLoginModule.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoLineLoginModule.web.d.ts","sourceRoot":"","sources":["../src/ExpoLineLoginModule.web.ts"],"names":[],"mappings":";;yBAM6B,MAAM,GAAG,QAAQ,IAAI,CAAC;;;AAFnD,wBAQE"}
@@ -0,0 +1,12 @@
1
+ import { EventEmitter } from 'expo-modules-core';
2
+ const emitter = new EventEmitter({});
3
+ export default {
4
+ PI: Math.PI,
5
+ async setValueAsync(value) {
6
+ emitter.emit('onChange', { value });
7
+ },
8
+ hello() {
9
+ return 'Hello world! 👋';
10
+ },
11
+ };
12
+ //# sourceMappingURL=ExpoLineLoginModule.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoLineLoginModule.web.js","sourceRoot":"","sources":["../src/ExpoLineLoginModule.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,EAAS,CAAC,CAAC;AAE5C,eAAe;IACb,EAAE,EAAE,IAAI,CAAC,EAAE;IACX,KAAK,CAAC,aAAa,CAAC,KAAa;QAC/B,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACtC,CAAC;IACD,KAAK;QACH,OAAO,iBAAiB,CAAC;IAC3B,CAAC;CACF,CAAC","sourcesContent":["import { EventEmitter } from 'expo-modules-core';\n\nconst emitter = new EventEmitter({} as any);\n\nexport default {\n PI: Math.PI,\n async setValueAsync(value: string): Promise<void> {\n emitter.emit('onChange', { value });\n },\n hello() {\n return 'Hello world! 👋';\n },\n};\n"]}
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import { ExpoLineLoginViewProps } from './ExpoLineLogin.types';
3
+ export default function ExpoLineLoginView(props: ExpoLineLoginViewProps): React.JSX.Element;
4
+ //# sourceMappingURL=ExpoLineLoginView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoLineLoginView.d.ts","sourceRoot":"","sources":["../src/ExpoLineLoginView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAK/D,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,qBAEtE"}
@@ -0,0 +1,7 @@
1
+ import { requireNativeViewManager } from 'expo-modules-core';
2
+ import * as React from 'react';
3
+ const NativeView = requireNativeViewManager('ExpoLineLogin');
4
+ export default function ExpoLineLoginView(props) {
5
+ return React.createElement(NativeView, { ...props });
6
+ }
7
+ //# sourceMappingURL=ExpoLineLoginView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoLineLoginView.js","sourceRoot":"","sources":["../src/ExpoLineLoginView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,UAAU,GACd,wBAAwB,CAAC,eAAe,CAAC,CAAC;AAE5C,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,KAA6B;IACrE,OAAO,oBAAC,UAAU,OAAK,KAAK,GAAI,CAAC;AACnC,CAAC","sourcesContent":["import { requireNativeViewManager } from 'expo-modules-core';\nimport * as React from 'react';\n\nimport { ExpoLineLoginViewProps } from './ExpoLineLogin.types';\n\nconst NativeView: React.ComponentType<ExpoLineLoginViewProps> =\n requireNativeViewManager('ExpoLineLogin');\n\nexport default function ExpoLineLoginView(props: ExpoLineLoginViewProps) {\n return <NativeView {...props} />;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import { ExpoLineLoginViewProps } from './ExpoLineLogin.types';
3
+ export default function ExpoLineLoginView(props: ExpoLineLoginViewProps): React.JSX.Element;
4
+ //# sourceMappingURL=ExpoLineLoginView.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoLineLoginView.web.d.ts","sourceRoot":"","sources":["../src/ExpoLineLoginView.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,qBAMtE"}
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ export default function ExpoLineLoginView(props) {
3
+ return (React.createElement("div", null,
4
+ React.createElement("span", null, props.name)));
5
+ }
6
+ //# sourceMappingURL=ExpoLineLoginView.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoLineLoginView.web.js","sourceRoot":"","sources":["../src/ExpoLineLoginView.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,KAA6B;IACrE,OAAO,CACL;QACE,kCAAO,KAAK,CAAC,IAAI,CAAQ,CACrB,CACP,CAAC;AACJ,CAAC","sourcesContent":["import * as React from 'react';\n\nimport { ExpoLineLoginViewProps } from './ExpoLineLogin.types';\n\nexport default function ExpoLineLoginView(props: ExpoLineLoginViewProps) {\n return (\n <div>\n <span>{props.name}</span>\n </div>\n );\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-line-login",
3
- "version": "0.2.0",
3
+ "version": "1.0.1",
4
4
  "description": "Integrate LINE login to Expo App",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -6,14 +6,11 @@ const withMyApiKey = (config, { channelId, universalLink }) => {
6
6
  config = (0, config_plugins_1.withInfoPlist)(config, (config) => {
7
7
  config.modResults["LINE_CHANNEL_ID"] = channelId;
8
8
  // push scheme to CFBundleURLSchemes
9
- config.modResults["CFBundleURLTypes"] = [
10
- {
11
- CFBundleURLSchemes: [
12
- ...config.ios?.infoPlist?.CFBundleURLTypes?.[0]?.CFBundleURLSchemes,
13
- `line3rdp.${ios_1.BundleIdentifier.getBundleIdentifier(config)}`,
14
- ],
15
- },
16
- ];
9
+ config.modResults["CFBundleURLTypes"]?.push({
10
+ CFBundleURLSchemes: [
11
+ `line3rdp.${ios_1.BundleIdentifier.getBundleIdentifier(config)}`,
12
+ ],
13
+ });
17
14
  config.modResults["LSApplicationQueriesSchemes"] = ["lineauth2"];
18
15
  if (universalLink) {
19
16
  config.modResults["LINE_UNIVERSAL_LINK_URL"] = universalLink;
@@ -22,10 +19,7 @@ const withMyApiKey = (config, { channelId, universalLink }) => {
22
19
  });
23
20
  config = (0, config_plugins_1.withAndroidManifest)(config, (config) => {
24
21
  const mainApplication = config_plugins_1.AndroidConfig.Manifest.getMainApplicationOrThrow(config.modResults);
25
- config_plugins_1.AndroidConfig.Manifest.addMetaDataItemToMainApplication(mainApplication, "LINE_CHANNEL_ID", channelId);
26
- if (universalLink) {
27
- config_plugins_1.AndroidConfig.Manifest.addMetaDataItemToMainApplication(mainApplication, "LINE_UNIVERSAL_LINK_URL", universalLink);
28
- }
22
+ config_plugins_1.AndroidConfig.Manifest.addMetaDataItemToMainApplication(mainApplication, "line.sdk.channelId", channelId);
29
23
  return config;
30
24
  });
31
25
  return config;
@@ -13,14 +13,11 @@ const withMyApiKey: ConfigPlugin<{
13
13
  config = withInfoPlist(config, (config) => {
14
14
  config.modResults["LINE_CHANNEL_ID"] = channelId;
15
15
  // push scheme to CFBundleURLSchemes
16
- config.modResults["CFBundleURLTypes"] = [
17
- {
18
- CFBundleURLSchemes: [
19
- ...config.ios?.infoPlist?.CFBundleURLTypes?.[0]?.CFBundleURLSchemes,
20
- `line3rdp.${BundleIdentifier.getBundleIdentifier(config)}`,
21
- ],
22
- },
23
- ];
16
+ config.modResults["CFBundleURLTypes"]?.push({
17
+ CFBundleURLSchemes: [
18
+ `line3rdp.${BundleIdentifier.getBundleIdentifier(config)}`,
19
+ ],
20
+ });
24
21
  config.modResults["LSApplicationQueriesSchemes"] = ["lineauth2"];
25
22
 
26
23
  if (universalLink) {
@@ -37,18 +34,10 @@ const withMyApiKey: ConfigPlugin<{
37
34
 
38
35
  AndroidConfig.Manifest.addMetaDataItemToMainApplication(
39
36
  mainApplication,
40
- "LINE_CHANNEL_ID",
37
+ "line.sdk.channelId",
41
38
  channelId,
42
39
  );
43
40
 
44
- if (universalLink) {
45
- AndroidConfig.Manifest.addMetaDataItemToMainApplication(
46
- mainApplication,
47
- "LINE_UNIVERSAL_LINK_URL",
48
- universalLink,
49
- );
50
- }
51
-
52
41
  return config;
53
42
  });
54
43
 
@@ -1,7 +1,7 @@
1
1
  export interface AccessToken {
2
- token_type: string;
3
- scope: string;
4
- refresh_token: string;
2
+ token_type?: string;
3
+ scope?: string;
4
+ refresh_token?: string;
5
5
  createdAt: number;
6
6
  access_token: string;
7
7
  id_token?: string;