@react-native-kakao/channel 2.2.3 → 2.2.5
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/android/src/main/java/net/mjstudio/rnkakao/channel/RNCKakaoChannelModule.kt +135 -136
- package/android/src/main/java/net/mjstudio/rnkakao/channel/RNCKakaoChannelPackage.kt +4 -6
- package/android/src/newarch/KakaoChannelSpec.kt +3 -2
- package/android/src/oldarch/KakaoChannelSpec.kt +43 -42
- package/package.json +4 -4
|
@@ -18,166 +18,165 @@ import net.mjstudio.rnkakao.core.util.putS
|
|
|
18
18
|
import net.mjstudio.rnkakao.core.util.rejectWith
|
|
19
19
|
import net.mjstudio.rnkakao.core.util.unix
|
|
20
20
|
|
|
21
|
-
class RNCKakaoChannelModule internal constructor(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
21
|
+
class RNCKakaoChannelModule internal constructor(
|
|
22
|
+
context: ReactApplicationContext,
|
|
23
|
+
) : KakaoChannelSpec(context) {
|
|
24
|
+
override fun getName(): String = NAME
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
@ReactMethod
|
|
27
|
+
override fun followChannel(
|
|
28
|
+
channelPublicId: String,
|
|
29
|
+
promise: Promise,
|
|
30
|
+
) = onMain {
|
|
31
|
+
val context =
|
|
32
|
+
currentActivity ?: run {
|
|
33
|
+
promise.rejectWith(ActivityNotFoundException())
|
|
34
|
+
return@onMain
|
|
35
|
+
}
|
|
37
36
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
37
|
+
TalkApiClient.instance.followChannel(context, channelPublicId) { followChannelResult, error ->
|
|
38
|
+
if (error != null) {
|
|
39
|
+
promise.rejectWith(error)
|
|
40
|
+
} else if (followChannelResult == null) {
|
|
41
|
+
promise.rejectWith(RNCKakaoResponseNotFoundException("followChannelResult"))
|
|
42
|
+
} else {
|
|
43
|
+
promise.resolve(followChannelResult.success)
|
|
46
44
|
}
|
|
47
45
|
}
|
|
46
|
+
}
|
|
48
47
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
@ReactMethod
|
|
49
|
+
override fun addChannel(
|
|
50
|
+
channelPublicId: String,
|
|
51
|
+
promise: Promise,
|
|
52
|
+
) = onMain {
|
|
53
|
+
val context =
|
|
54
|
+
currentActivity ?: run {
|
|
55
|
+
promise.rejectWith(ActivityNotFoundException())
|
|
56
|
+
return@onMain
|
|
57
|
+
}
|
|
59
58
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
59
|
+
TalkApiClient.instance.addChannel(context, channelPublicId) { error ->
|
|
60
|
+
if (error != null) {
|
|
61
|
+
promise.rejectWith(error)
|
|
62
|
+
} else {
|
|
63
|
+
promise.resolve(42)
|
|
66
64
|
}
|
|
67
65
|
}
|
|
66
|
+
}
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
68
|
+
@ReactMethod
|
|
69
|
+
override fun getAddChannelUrl(
|
|
70
|
+
channelPublicId: String,
|
|
71
|
+
promise: Promise,
|
|
72
|
+
) = onMain {
|
|
73
|
+
runCatching {
|
|
74
|
+
val url = TalkApiClient.instance.addChannelUrl(channelPublicId)
|
|
75
|
+
promise.resolve(url.toString())
|
|
76
|
+
}.onFailure {
|
|
77
|
+
promise.rejectWith(it)
|
|
80
78
|
}
|
|
79
|
+
}
|
|
81
80
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
runCatching {
|
|
93
|
-
val url = TalkApiClient.instance.addChannelUrl(channelPublicId)
|
|
94
|
-
KakaoCustomTabsClient.openWithDefault(context, url)
|
|
95
|
-
promise.resolve(url.toString())
|
|
96
|
-
}.onFailure {
|
|
97
|
-
promise.rejectWith(it)
|
|
81
|
+
@ReactMethod
|
|
82
|
+
override fun openAddChannelUrl(
|
|
83
|
+
channelPublicId: String,
|
|
84
|
+
promise: Promise,
|
|
85
|
+
) = onMain {
|
|
86
|
+
val context =
|
|
87
|
+
currentActivity ?: run {
|
|
88
|
+
promise.rejectWith(ActivityNotFoundException())
|
|
89
|
+
return@onMain
|
|
98
90
|
}
|
|
91
|
+
runCatching {
|
|
92
|
+
val url = TalkApiClient.instance.addChannelUrl(channelPublicId)
|
|
93
|
+
KakaoCustomTabsClient.openWithDefault(context, url)
|
|
94
|
+
promise.resolve(url.toString())
|
|
95
|
+
}.onFailure {
|
|
96
|
+
promise.rejectWith(it)
|
|
99
97
|
}
|
|
98
|
+
}
|
|
100
99
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
100
|
+
@ReactMethod
|
|
101
|
+
override fun chatChannel(
|
|
102
|
+
channelPublicId: String,
|
|
103
|
+
promise: Promise,
|
|
104
|
+
) = onMain {
|
|
105
|
+
val context =
|
|
106
|
+
currentActivity ?: run {
|
|
107
|
+
promise.rejectWith(ActivityNotFoundException())
|
|
108
|
+
return@onMain
|
|
109
|
+
}
|
|
111
110
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
111
|
+
TalkApiClient.instance.chatChannel(context, channelPublicId) { error ->
|
|
112
|
+
if (error != null) {
|
|
113
|
+
promise.rejectWith(error)
|
|
114
|
+
} else {
|
|
115
|
+
promise.resolve(42)
|
|
118
116
|
}
|
|
119
117
|
}
|
|
118
|
+
}
|
|
120
119
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
120
|
+
@ReactMethod
|
|
121
|
+
override fun getChatChannelUrl(
|
|
122
|
+
channelPublicId: String,
|
|
123
|
+
promise: Promise,
|
|
124
|
+
) = onMain {
|
|
125
|
+
runCatching {
|
|
126
|
+
val url = TalkApiClient.instance.chatChannelUrl(channelPublicId)
|
|
127
|
+
promise.resolve(url.toString())
|
|
128
|
+
}.onFailure {
|
|
129
|
+
promise.rejectWith(it)
|
|
132
130
|
}
|
|
131
|
+
}
|
|
133
132
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
runCatching {
|
|
145
|
-
val url = TalkApiClient.instance.chatChannelUrl(channelPublicId)
|
|
146
|
-
KakaoCustomTabsClient.openWithDefault(context, url)
|
|
147
|
-
promise.resolve(url.toString())
|
|
148
|
-
}.onFailure {
|
|
149
|
-
promise.rejectWith(it)
|
|
133
|
+
@ReactMethod
|
|
134
|
+
override fun openChatChannelUrl(
|
|
135
|
+
channelPublicId: String,
|
|
136
|
+
promise: Promise,
|
|
137
|
+
) = onMain {
|
|
138
|
+
val context =
|
|
139
|
+
currentActivity ?: run {
|
|
140
|
+
promise.rejectWith(ActivityNotFoundException())
|
|
141
|
+
return@onMain
|
|
150
142
|
}
|
|
143
|
+
runCatching {
|
|
144
|
+
val url = TalkApiClient.instance.chatChannelUrl(channelPublicId)
|
|
145
|
+
KakaoCustomTabsClient.openWithDefault(context, url)
|
|
146
|
+
promise.resolve(url.toString())
|
|
147
|
+
}.onFailure {
|
|
148
|
+
promise.rejectWith(it)
|
|
151
149
|
}
|
|
150
|
+
}
|
|
152
151
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
152
|
+
@ReactMethod
|
|
153
|
+
override fun channels(
|
|
154
|
+
channelPublicIds: ReadableArray?,
|
|
155
|
+
promise: Promise,
|
|
156
|
+
) = onMain {
|
|
157
|
+
TalkApiClient.instance.channels(publicIds = channelPublicIds?.filterIsInstance<String>()) { relations, error ->
|
|
158
|
+
if (error != null) {
|
|
159
|
+
promise.rejectWith(error)
|
|
160
|
+
} else if (relations?.channels == null) {
|
|
161
|
+
promise.rejectWith(RNCKakaoResponseNotFoundException("channels"))
|
|
162
|
+
} else {
|
|
163
|
+
promise.resolve(
|
|
164
|
+
argArr().pushMapList(
|
|
165
|
+
relations.channels!!.map {
|
|
166
|
+
argMap().apply {
|
|
167
|
+
putS("uuid", it.uuid)
|
|
168
|
+
putS("encodedId", it.encodedId)
|
|
169
|
+
putS("relation", it.relation.name.lowercase())
|
|
170
|
+
putL("updateAt", it.updatedAt?.unix)
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
),
|
|
174
|
+
)
|
|
177
175
|
}
|
|
178
176
|
}
|
|
177
|
+
}
|
|
179
178
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
179
|
+
companion object {
|
|
180
|
+
const val NAME = "RNCKakaoChannel"
|
|
183
181
|
}
|
|
182
|
+
}
|
|
@@ -10,16 +10,15 @@ class RNCKakaoChannelPackage : TurboReactPackage() {
|
|
|
10
10
|
override fun getModule(
|
|
11
11
|
name: String,
|
|
12
12
|
reactContext: ReactApplicationContext,
|
|
13
|
-
): NativeModule?
|
|
14
|
-
|
|
13
|
+
): NativeModule? =
|
|
14
|
+
if (name == RNCKakaoChannelModule.NAME) {
|
|
15
15
|
RNCKakaoChannelModule(reactContext)
|
|
16
16
|
} else {
|
|
17
17
|
null
|
|
18
18
|
}
|
|
19
|
-
}
|
|
20
19
|
|
|
21
|
-
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider
|
|
22
|
-
|
|
20
|
+
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider =
|
|
21
|
+
ReactModuleInfoProvider {
|
|
23
22
|
val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
|
|
24
23
|
val isTurboModule: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
|
|
25
24
|
moduleInfos[RNCKakaoChannelModule.NAME] =
|
|
@@ -33,5 +32,4 @@ class RNCKakaoChannelPackage : TurboReactPackage() {
|
|
|
33
32
|
)
|
|
34
33
|
moduleInfos
|
|
35
34
|
}
|
|
36
|
-
}
|
|
37
35
|
}
|
|
@@ -2,5 +2,6 @@ package net.mjstudio.rnkakao.channel
|
|
|
2
2
|
|
|
3
3
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
4
4
|
|
|
5
|
-
abstract class KakaoChannelSpec internal constructor(
|
|
6
|
-
|
|
5
|
+
abstract class KakaoChannelSpec internal constructor(
|
|
6
|
+
context: ReactApplicationContext,
|
|
7
|
+
) : NativeKakaoChannelSpec(context)
|
|
@@ -5,45 +5,46 @@ import com.facebook.react.bridge.ReactApplicationContext
|
|
|
5
5
|
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
6
6
|
import com.facebook.react.bridge.ReadableArray
|
|
7
7
|
|
|
8
|
-
abstract class KakaoChannelSpec internal constructor(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
8
|
+
abstract class KakaoChannelSpec internal constructor(
|
|
9
|
+
context: ReactApplicationContext,
|
|
10
|
+
) : ReactContextBaseJavaModule(context) {
|
|
11
|
+
abstract fun followChannel(
|
|
12
|
+
channelPublicId: String,
|
|
13
|
+
promise: Promise,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
abstract fun addChannel(
|
|
17
|
+
channelPublicId: String,
|
|
18
|
+
promise: Promise,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
abstract fun getAddChannelUrl(
|
|
22
|
+
channelPublicId: String,
|
|
23
|
+
promise: Promise,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
abstract fun openAddChannelUrl(
|
|
27
|
+
channelPublicId: String,
|
|
28
|
+
promise: Promise,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
abstract fun chatChannel(
|
|
32
|
+
channelPublicId: String,
|
|
33
|
+
promise: Promise,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
abstract fun getChatChannelUrl(
|
|
37
|
+
channelPublicId: String,
|
|
38
|
+
promise: Promise,
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
abstract fun openChatChannelUrl(
|
|
42
|
+
channelPublicId: String,
|
|
43
|
+
promise: Promise,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
abstract fun channels(
|
|
47
|
+
channelPublicIds: ReadableArray?,
|
|
48
|
+
promise: Promise,
|
|
49
|
+
)
|
|
50
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-kakao/channel",
|
|
3
3
|
"description": "React Native Kakao Channel SDK",
|
|
4
|
-
"version": "2.2.
|
|
4
|
+
"version": "2.2.5",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
7
7
|
"types": "lib/typescript/src/index.d.ts",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@react-native-kakao/core": "2.2.
|
|
65
|
+
"@react-native-kakao/core": "2.2.5",
|
|
66
66
|
"@types/invariant": "^2",
|
|
67
67
|
"@types/jest": "^29.5.5",
|
|
68
68
|
"@types/react": "^18.2.44",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"typescript": "5.1.6"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@react-native-kakao/core": "2.2.
|
|
77
|
+
"@react-native-kakao/core": "2.2.5",
|
|
78
78
|
"react": "*",
|
|
79
79
|
"react-native": "*"
|
|
80
80
|
},
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"dependencies": {
|
|
114
114
|
"@mj-studio/js-util": "^1.0.34"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "0ecf72a2948e71f464fbc27f7369f13b77916cbd"
|
|
117
117
|
}
|