expo-line-login 1.0.3 → 1.1.0
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.
- package/LICENSE +21 -0
- package/android/build.gradle +23 -63
- package/build/index.d.ts.map +1 -1
- package/build/index.js +31 -5
- package/build/index.js.map +1 -1
- package/build/types/index.d.ts +3 -3
- package/build/types/index.d.ts.map +1 -1
- package/build/types/index.js.map +1 -1
- package/ios/ExpoLineLoginModule.swift +7 -7
- package/package.json +4 -4
- package/plugin/tsconfig.tsbuildinfo +1 -0
- package/src/index.ts +29 -8
- package/android/.gradle/8.0/checksums/checksums.lock +0 -0
- package/android/.gradle/8.0/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/8.0/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/8.0/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.0/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.0/gc.properties +0 -0
- package/android/.gradle/8.1.1/checksums/checksums.lock +0 -0
- package/android/.gradle/8.1.1/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/8.1.1/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/8.1.1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.1.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.1.1/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/config.properties +0 -2
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/gradle.xml +0 -12
- package/android/.idea/migrations.xml +0 -10
- package/android/.idea/misc.xml +0 -10
- package/android/.idea/vcs.xml +0 -6
- package/android/local.properties +0 -8
- package/build/ExpoLineLogin.types.d.ts +0 -7
- package/build/ExpoLineLogin.types.d.ts.map +0 -1
- package/build/ExpoLineLogin.types.js +0 -2
- package/build/ExpoLineLogin.types.js.map +0 -1
- package/build/ExpoLineLoginModule.web.d.ts +0 -7
- package/build/ExpoLineLoginModule.web.d.ts.map +0 -1
- package/build/ExpoLineLoginModule.web.js +0 -12
- package/build/ExpoLineLoginModule.web.js.map +0 -1
- package/build/ExpoLineLoginView.d.ts +0 -4
- package/build/ExpoLineLoginView.d.ts.map +0 -1
- package/build/ExpoLineLoginView.js +0 -7
- package/build/ExpoLineLoginView.js.map +0 -1
- package/build/ExpoLineLoginView.web.d.ts +0 -4
- package/build/ExpoLineLoginView.web.d.ts.map +0 -1
- package/build/ExpoLineLoginView.web.js +0 -6
- package/build/ExpoLineLoginView.web.js.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Stan Ma
|
|
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.
|
package/android/build.gradle
CHANGED
|
@@ -1,90 +1,50 @@
|
|
|
1
1
|
apply plugin: 'com.android.library'
|
|
2
|
-
apply plugin: 'kotlin-android'
|
|
3
|
-
apply plugin: 'maven-publish'
|
|
4
2
|
|
|
5
3
|
group = 'dev.stanma.line'
|
|
6
4
|
version = '0.1.0'
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
ext.kotlinVersion()
|
|
24
|
-
} else {
|
|
25
|
-
ext.safeExtGet("kotlinVersion", "1.8.10")
|
|
6
|
+
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
7
|
+
apply from: expoModulesCorePlugin
|
|
8
|
+
applyKotlinExpoModulesCorePlugin()
|
|
9
|
+
useCoreDependencies()
|
|
10
|
+
useExpoPublishing()
|
|
11
|
+
|
|
12
|
+
def useManagedAndroidSdkVersions = false
|
|
13
|
+
|
|
14
|
+
if (useManagedAndroidSdkVersions) {
|
|
15
|
+
useDefaultAndroidSdkVersions()
|
|
16
|
+
} else {
|
|
17
|
+
buildscript {
|
|
18
|
+
// Simple helper that allows the root project to override versions declared by this library.
|
|
19
|
+
ext.safeExtGet = { prop, fallback ->
|
|
20
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
26
21
|
}
|
|
27
22
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
dependencies {
|
|
34
|
-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}")
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
afterEvaluate {
|
|
39
|
-
publishing {
|
|
40
|
-
publications {
|
|
41
|
-
release(MavenPublication) {
|
|
42
|
-
from components.release
|
|
43
|
-
}
|
|
23
|
+
project.android {
|
|
24
|
+
compileSdkVersion safeExtGet("compileSdkVersion", 34)
|
|
25
|
+
defaultConfig {
|
|
26
|
+
minSdkVersion safeExtGet("minSdkVersion", 24)
|
|
27
|
+
targetSdkVersion safeExtGet("targetSdkVersion", 34)
|
|
44
28
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
29
|
+
|
|
30
|
+
lintOptions {
|
|
31
|
+
abortOnError false
|
|
49
32
|
}
|
|
50
33
|
}
|
|
51
34
|
}
|
|
52
35
|
|
|
53
36
|
android {
|
|
54
|
-
compileSdkVersion safeExtGet("compileSdkVersion", 33)
|
|
55
|
-
|
|
56
|
-
compileOptions {
|
|
57
|
-
sourceCompatibility JavaVersion.VERSION_17
|
|
58
|
-
targetCompatibility JavaVersion.VERSION_17
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
kotlinOptions {
|
|
62
|
-
jvmTarget = JavaVersion.VERSION_17.majorVersion
|
|
63
|
-
}
|
|
64
|
-
|
|
65
37
|
namespace "dev.stanma.line"
|
|
66
38
|
defaultConfig {
|
|
67
|
-
minSdkVersion safeExtGet("minSdkVersion", 24)
|
|
68
|
-
targetSdkVersion safeExtGet("targetSdkVersion", 33)
|
|
69
39
|
versionCode 1
|
|
70
40
|
versionName "0.1.0"
|
|
71
41
|
}
|
|
72
42
|
lintOptions {
|
|
73
43
|
abortOnError false
|
|
74
44
|
}
|
|
75
|
-
publishing {
|
|
76
|
-
singleVariant("release") {
|
|
77
|
-
withSourcesJar()
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
repositories {
|
|
83
|
-
mavenCentral()
|
|
84
45
|
}
|
|
85
46
|
|
|
86
47
|
dependencies {
|
|
87
48
|
implementation project(':expo-modules-core')
|
|
88
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
|
|
89
49
|
implementation "com.linecorp.linesdk:linesdk:latest.release"
|
|
90
50
|
}
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAElE,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,OAAO,WAAW;CACnB;AAED,oBAAY,SAAS;IACnB,MAAM,WAAW;IACjB,UAAU,eAAe;CAC1B;AAED,eAAO,MAAM,KAAK,GAChB,QAAQ,eAAe,EAAE,EACzB,WAAW,SAAS,KACnB,OAAO,CAAC,WAAW,CASrB,CAAC;AAEF,eAAO,MAAM,MAAM,oBAMlB,CAAC;AAEF,eAAO,MAAM,UAAU,QAAa,OAAO,CAAC,aAAa,CAMxD,CAAC;AAEF,eAAO,MAAM,cAAc,QAAa,OAAO,CAAC,WAAW,CAM1D,CAAC;AAEF,eAAO,MAAM,sBAAsB,QAAa,OAAO,CAAC,OAAO,CAM9D,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Import the native module. On web, it will be resolved to ExpoLineLogin.web.ts
|
|
2
2
|
// and on native platforms to ExpoLineLogin.ts
|
|
3
|
+
import { CodedError } from "expo-modules-core";
|
|
3
4
|
import ExpoLineLoginModule from "./ExpoLineLoginModule";
|
|
4
5
|
export var LoginPermission;
|
|
5
6
|
(function (LoginPermission) {
|
|
@@ -13,18 +14,43 @@ export var BotPrompt;
|
|
|
13
14
|
BotPrompt["AGGRESSIVE"] = "aggressive";
|
|
14
15
|
})(BotPrompt || (BotPrompt = {}));
|
|
15
16
|
export const login = async (scopes, botPrompt) => {
|
|
16
|
-
|
|
17
|
+
try {
|
|
18
|
+
return await ExpoLineLoginModule.login(scopes.map((scope) => scope.toString()), botPrompt.toString());
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
throw new CodedError(error?.code ?? "UNKNOWN_ERROR", error?.message ?? "Unknown error");
|
|
22
|
+
}
|
|
17
23
|
};
|
|
18
24
|
export const logout = async () => {
|
|
19
|
-
|
|
25
|
+
try {
|
|
26
|
+
return await ExpoLineLoginModule.logout();
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
throw new CodedError(error?.code ?? "UNKNOWN_ERROR", error?.message ?? "Unknown error");
|
|
30
|
+
}
|
|
20
31
|
};
|
|
21
32
|
export const getProfile = async () => {
|
|
22
|
-
|
|
33
|
+
try {
|
|
34
|
+
return await ExpoLineLoginModule.getProfile();
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
throw new CodedError(error?.code ?? "UNKNOWN_ERROR", error?.message ?? "Unknown error");
|
|
38
|
+
}
|
|
23
39
|
};
|
|
24
40
|
export const getAccessToken = async () => {
|
|
25
|
-
|
|
41
|
+
try {
|
|
42
|
+
return await ExpoLineLoginModule.getAccessToken();
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
throw new CodedError(error?.code ?? "UNKNOWN_ERROR", error?.message ?? "Unknown error");
|
|
46
|
+
}
|
|
26
47
|
};
|
|
27
48
|
export const getBotFriendshipStatus = async () => {
|
|
28
|
-
|
|
49
|
+
try {
|
|
50
|
+
return await ExpoLineLoginModule.getBotFriendshipStatus();
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
throw new CodedError(error?.code ?? "UNKNOWN_ERROR", error?.message ?? "Unknown error");
|
|
54
|
+
}
|
|
29
55
|
};
|
|
30
56
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,8CAA8C;AAC9C,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AAGxD,MAAM,CAAN,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,kCAAe,CAAA;IACf,sCAAmB,CAAA;IACnB,qCAAkB,CAAA;AACpB,CAAC,EAJW,eAAe,KAAf,eAAe,QAI1B;AAED,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAAiB,CAAA;IACjB,sCAAyB,CAAA;AAC3B,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,EACxB,MAAyB,EACzB,SAAoB,EACE,EAAE;IACxB,OAAO,MAAM,mBAAmB,CAAC,KAAK,CACpC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,EACvC,SAAS,CAAC,QAAQ,EAAE,CACrB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,8CAA8C;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AAGxD,MAAM,CAAN,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,kCAAe,CAAA;IACf,sCAAmB,CAAA;IACnB,qCAAkB,CAAA;AACpB,CAAC,EAJW,eAAe,KAAf,eAAe,QAI1B;AAED,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAAiB,CAAA;IACjB,sCAAyB,CAAA;AAC3B,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,EACxB,MAAyB,EACzB,SAAoB,EACE,EAAE;IACxB,IAAI,CAAC;QACH,OAAO,MAAM,mBAAmB,CAAC,KAAK,CACpC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,EACvC,SAAS,CAAC,QAAQ,EAAE,CACrB,CAAC;IACJ,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,IAAI,UAAU,CAAC,KAAK,EAAE,IAAI,IAAI,eAAe,EAAE,KAAK,EAAE,OAAO,IAAI,eAAe,CAAC,CAAC;IAC1F,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,IAAI,EAAE;IAC/B,IAAI,CAAC;QACH,OAAO,MAAM,mBAAmB,CAAC,MAAM,EAAE,CAAC;IAC5C,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,IAAI,UAAU,CAAC,KAAK,EAAE,IAAI,IAAI,eAAe,EAAE,KAAK,EAAE,OAAO,IAAI,eAAe,CAAC,CAAC;IAC1F,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,IAA4B,EAAE;IAC3D,IAAI,CAAC;QACH,OAAO,MAAM,mBAAmB,CAAC,UAAU,EAAE,CAAC;IAChD,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,IAAI,UAAU,CAAC,KAAK,EAAE,IAAI,IAAI,eAAe,EAAE,KAAK,EAAE,OAAO,IAAI,eAAe,CAAC,CAAC;IAC1F,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,IAA0B,EAAE;IAC7D,IAAI,CAAC;QACH,OAAO,MAAM,mBAAmB,CAAC,cAAc,EAAE,CAAC;IACpD,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,IAAI,UAAU,CAAC,KAAK,EAAE,IAAI,IAAI,eAAe,EAAE,KAAK,EAAE,OAAO,IAAI,eAAe,CAAC,CAAC;IAC1F,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,IAAsB,EAAE;IACjE,IAAI,CAAC;QACH,OAAO,MAAM,mBAAmB,CAAC,sBAAsB,EAAE,CAAC;IAC5D,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,IAAI,UAAU,CAAC,KAAK,EAAE,IAAI,IAAI,eAAe,EAAE,KAAK,EAAE,OAAO,IAAI,eAAe,CAAC,CAAC;IAC1F,CAAC;AACH,CAAC,CAAC","sourcesContent":["// Import the native module. On web, it will be resolved to ExpoLineLogin.web.ts\n// and on native platforms to ExpoLineLogin.ts\nimport { CodedError } from \"expo-modules-core\";\nimport ExpoLineLoginModule from \"./ExpoLineLoginModule\";\nimport { LoginResult, ProfileResult, AccessToken } from \"./types\";\n\nexport enum LoginPermission {\n EMAIL = \"email\",\n PROFILE = \"profile\",\n OPEN_ID = \"openid\",\n}\n\nexport enum BotPrompt {\n NORMAL = \"normal\",\n AGGRESSIVE = \"aggressive\",\n}\n\nexport const login = async (\n scopes: LoginPermission[],\n botPrompt: BotPrompt,\n): Promise<LoginResult> => {\n try {\n return await ExpoLineLoginModule.login(\n scopes.map((scope) => scope.toString()),\n botPrompt.toString(),\n );\n } catch (error: any) {\n throw new CodedError(error?.code ?? \"UNKNOWN_ERROR\", error?.message ?? \"Unknown error\");\n }\n};\n\nexport const logout = async () => {\n try {\n return await ExpoLineLoginModule.logout();\n } catch (error: any) {\n throw new CodedError(error?.code ?? \"UNKNOWN_ERROR\", error?.message ?? \"Unknown error\");\n }\n};\n\nexport const getProfile = async (): Promise<ProfileResult> => {\n try {\n return await ExpoLineLoginModule.getProfile();\n } catch (error: any) {\n throw new CodedError(error?.code ?? \"UNKNOWN_ERROR\", error?.message ?? \"Unknown error\");\n }\n};\n\nexport const getAccessToken = async (): Promise<AccessToken> => {\n try {\n return await ExpoLineLoginModule.getAccessToken();\n } catch (error: any) {\n throw new CodedError(error?.code ?? \"UNKNOWN_ERROR\", error?.message ?? \"Unknown error\");\n }\n};\n\nexport const getBotFriendshipStatus = async (): Promise<boolean> => {\n try {\n return await ExpoLineLoginModule.getBotFriendshipStatus();\n } catch (error: any) {\n throw new CodedError(error?.code ?? \"UNKNOWN_ERROR\", error?.message ?? \"Unknown error\");\n }\n};\n"]}
|
package/build/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,WAAW;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
package/build/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"","sourcesContent":["export interface AccessToken {\n token_type
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"","sourcesContent":["export interface AccessToken {\n token_type?: string;\n scope?: string;\n refresh_token?: string;\n createdAt: number;\n access_token: string;\n id_token?: string;\n expires_in: number;\n}\n\ninterface UserProfile {\n pictureUrl: string;\n userId: string;\n displayName: string;\n}\n\nexport interface LoginResult {\n friendshipStatusChanged?: boolean;\n scope: string;\n IDTokenNonce?: string;\n accessToken: AccessToken;\n userProfile?: UserProfile;\n}\n\nexport interface ProfileResult {\n displayName: string;\n pictureUrl: string;\n userId: string;\n}\n"]}
|
|
@@ -7,9 +7,6 @@ enum BotPromptType: String, Enumerable {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
public class ExpoLineLoginModule: Module {
|
|
10
|
-
// Each module class must implement the definition function. The definition consists of components
|
|
11
|
-
// that describes the module's functionality and behavior.
|
|
12
|
-
// See https://docs.expo.dev/modules/module-api for more details about available components.
|
|
13
10
|
public func definition() -> ModuleDefinition {
|
|
14
11
|
Name("ExpoLineLogin")
|
|
15
12
|
|
|
@@ -32,9 +29,12 @@ public class ExpoLineLoginModule: Module {
|
|
|
32
29
|
let valueJson = try value.toJSON()
|
|
33
30
|
promise.resolve(valueJson)
|
|
34
31
|
} catch {
|
|
35
|
-
promise.reject(
|
|
32
|
+
promise.reject("JSON_PARSE_FAILED", "Error in Parse to JSON")
|
|
36
33
|
}
|
|
37
34
|
case .failure(let error):
|
|
35
|
+
if error.isUserCancelled {
|
|
36
|
+
promise.reject("ERR_USER_CANCELLED", "User cancel the login process")
|
|
37
|
+
}
|
|
38
38
|
promise.reject(error)
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -58,7 +58,7 @@ public class ExpoLineLoginModule: Module {
|
|
|
58
58
|
let profileJson = try profile.toJSON()
|
|
59
59
|
promise.resolve(profileJson)
|
|
60
60
|
} catch {
|
|
61
|
-
promise.reject(
|
|
61
|
+
promise.reject("JSON_PARSE_FAILED", "Error in Parse to JSON")
|
|
62
62
|
}
|
|
63
63
|
case .failure(let error):
|
|
64
64
|
promise.reject(error)
|
|
@@ -71,10 +71,10 @@ public class ExpoLineLoginModule: Module {
|
|
|
71
71
|
do {
|
|
72
72
|
promise.resolve(try token.toJSON())
|
|
73
73
|
} catch {
|
|
74
|
-
promise.reject(
|
|
74
|
+
promise.reject("JSON_PARSE_FAILED", "Error in Parse to JSON")
|
|
75
75
|
}
|
|
76
76
|
} else {
|
|
77
|
-
promise.reject(
|
|
77
|
+
promise.reject("GET_TOKEN_FAILED", "Failed to Get AccessToken")
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-line-login",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Integrate LINE login to Expo App",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"homepage": "https://github.com/stanma9107/expo-line-login#readme",
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@types/react": "^
|
|
33
|
-
"expo-module-scripts": "^
|
|
34
|
-
"expo-modules-core": "^
|
|
32
|
+
"@types/react": "^19.2.8",
|
|
33
|
+
"expo-module-scripts": "^5.0.8",
|
|
34
|
+
"expo-modules-core": "^3.0.29",
|
|
35
35
|
"husky": "^8.0.3"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["./src/index.ts"],"version":"5.9.3"}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Import the native module. On web, it will be resolved to ExpoLineLogin.web.ts
|
|
2
2
|
// and on native platforms to ExpoLineLogin.ts
|
|
3
|
+
import { CodedError } from "expo-modules-core";
|
|
3
4
|
import ExpoLineLoginModule from "./ExpoLineLoginModule";
|
|
4
5
|
import { LoginResult, ProfileResult, AccessToken } from "./types";
|
|
5
6
|
|
|
@@ -18,24 +19,44 @@ export const login = async (
|
|
|
18
19
|
scopes: LoginPermission[],
|
|
19
20
|
botPrompt: BotPrompt,
|
|
20
21
|
): Promise<LoginResult> => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
try {
|
|
23
|
+
return await ExpoLineLoginModule.login(
|
|
24
|
+
scopes.map((scope) => scope.toString()),
|
|
25
|
+
botPrompt.toString(),
|
|
26
|
+
);
|
|
27
|
+
} catch (error: any) {
|
|
28
|
+
throw new CodedError(error?.code ?? "UNKNOWN_ERROR", error?.message ?? "Unknown error");
|
|
29
|
+
}
|
|
25
30
|
};
|
|
26
31
|
|
|
27
32
|
export const logout = async () => {
|
|
28
|
-
|
|
33
|
+
try {
|
|
34
|
+
return await ExpoLineLoginModule.logout();
|
|
35
|
+
} catch (error: any) {
|
|
36
|
+
throw new CodedError(error?.code ?? "UNKNOWN_ERROR", error?.message ?? "Unknown error");
|
|
37
|
+
}
|
|
29
38
|
};
|
|
30
39
|
|
|
31
40
|
export const getProfile = async (): Promise<ProfileResult> => {
|
|
32
|
-
|
|
41
|
+
try {
|
|
42
|
+
return await ExpoLineLoginModule.getProfile();
|
|
43
|
+
} catch (error: any) {
|
|
44
|
+
throw new CodedError(error?.code ?? "UNKNOWN_ERROR", error?.message ?? "Unknown error");
|
|
45
|
+
}
|
|
33
46
|
};
|
|
34
47
|
|
|
35
48
|
export const getAccessToken = async (): Promise<AccessToken> => {
|
|
36
|
-
|
|
49
|
+
try {
|
|
50
|
+
return await ExpoLineLoginModule.getAccessToken();
|
|
51
|
+
} catch (error: any) {
|
|
52
|
+
throw new CodedError(error?.code ?? "UNKNOWN_ERROR", error?.message ?? "Unknown error");
|
|
53
|
+
}
|
|
37
54
|
};
|
|
38
55
|
|
|
39
56
|
export const getBotFriendshipStatus = async (): Promise<boolean> => {
|
|
40
|
-
|
|
57
|
+
try {
|
|
58
|
+
return await ExpoLineLoginModule.getBotFriendshipStatus();
|
|
59
|
+
} catch (error: any) {
|
|
60
|
+
throw new CodedError(error?.code ?? "UNKNOWN_ERROR", error?.message ?? "Unknown error");
|
|
61
|
+
}
|
|
41
62
|
};
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
File without changes
|
package/android/.idea/gradle.xml
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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>
|
package/android/.idea/misc.xml
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
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>
|
package/android/.idea/vcs.xml
DELETED
package/android/local.properties
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoLineLoginModule.web.d.ts","sourceRoot":"","sources":["../src/ExpoLineLoginModule.web.ts"],"names":[],"mappings":";;yBAM6B,MAAM,GAAG,QAAQ,IAAI,CAAC;;;AAFnD,wBAQE"}
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"]}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,7 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"]}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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"]}
|