@react-native-kakao/navi 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.
@@ -27,62 +27,61 @@ import net.mjstudio.rnkakao.core.util.getDoubleElseNull
27
27
  import net.mjstudio.rnkakao.core.util.onMain
28
28
  import net.mjstudio.rnkakao.core.util.rejectWith
29
29
 
30
- class RNCKakaoNaviModule internal constructor(context: ReactApplicationContext) :
31
- KakaoNaviSpec(context) {
32
- override fun getName(): String {
33
- return NAME
34
- }
30
+ class RNCKakaoNaviModule internal constructor(
31
+ context: ReactApplicationContext,
32
+ ) : KakaoNaviSpec(context) {
33
+ override fun getName(): String = NAME
35
34
 
36
- override fun navigateOrShareTo(
37
- destination: ReadableMap,
38
- option: ReadableMap?,
39
- viaList: ReadableArray?,
40
- openWebInstallUrlIfNaviAppNotAvailable: Boolean?,
41
- isShare: Boolean?,
42
- promise: Promise,
43
- ) = onMain {
44
- val context =
45
- currentActivity ?: run {
46
- promise.rejectWith(ActivityNotFoundException())
47
- return@onMain
48
- }
35
+ override fun navigateOrShareTo(
36
+ destination: ReadableMap,
37
+ option: ReadableMap?,
38
+ viaList: ReadableArray?,
39
+ openWebInstallUrlIfNaviAppNotAvailable: Boolean?,
40
+ isShare: Boolean?,
41
+ promise: Promise,
42
+ ) = onMain {
43
+ val context =
44
+ currentActivity ?: run {
45
+ promise.rejectWith(ActivityNotFoundException())
46
+ return@onMain
47
+ }
49
48
 
50
- if (NaviClient.instance.isKakaoNaviInstalled(reactApplicationContext)) {
51
- if (isShare == true) {
52
- context.startActivity(
53
- NaviClient.instance.shareDestinationIntent(
54
- destination.toLocation(),
55
- option?.toOption(),
56
- viaList?.filterIsReadableMap()?.map { it.toLocation() },
57
- ),
58
- )
59
- } else {
60
- context.startActivity(
61
- NaviClient.instance.navigateIntent(
62
- destination.toLocation(),
63
- option?.toOption(),
64
- viaList?.filterIsReadableMap()?.map { it.toLocation() },
65
- ),
66
- )
67
- }
68
- promise.resolve(true)
69
- } else if (openWebInstallUrlIfNaviAppNotAvailable == true) {
49
+ if (NaviClient.instance.isKakaoNaviInstalled(reactApplicationContext)) {
50
+ if (isShare == true) {
70
51
  context.startActivity(
71
- Intent(
72
- Intent.ACTION_VIEW,
73
- Uri.parse(Constants.WEB_NAVI_INSTALL),
74
- ).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP),
52
+ NaviClient.instance.shareDestinationIntent(
53
+ destination.toLocation(),
54
+ option?.toOption(),
55
+ viaList?.filterIsReadableMap()?.map { it.toLocation() },
56
+ ),
75
57
  )
76
- promise.resolve(false)
77
58
  } else {
78
- promise.resolve(false)
59
+ context.startActivity(
60
+ NaviClient.instance.navigateIntent(
61
+ destination.toLocation(),
62
+ option?.toOption(),
63
+ viaList?.filterIsReadableMap()?.map { it.toLocation() },
64
+ ),
65
+ )
79
66
  }
67
+ promise.resolve(true)
68
+ } else if (openWebInstallUrlIfNaviAppNotAvailable == true) {
69
+ context.startActivity(
70
+ Intent(
71
+ Intent.ACTION_VIEW,
72
+ Uri.parse(Constants.WEB_NAVI_INSTALL),
73
+ ).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP),
74
+ )
75
+ promise.resolve(false)
76
+ } else {
77
+ promise.resolve(false)
80
78
  }
79
+ }
81
80
 
82
- companion object {
83
- const val NAME = "RNCKakaoNavi"
84
- }
81
+ companion object {
82
+ const val NAME = "RNCKakaoNavi"
85
83
  }
84
+ }
86
85
 
87
86
  private fun ReadableMap.toLocation() =
88
87
  Location(
@@ -10,16 +10,15 @@ class RNCKakaoNaviPackage : TurboReactPackage() {
10
10
  override fun getModule(
11
11
  name: String,
12
12
  reactContext: ReactApplicationContext,
13
- ): NativeModule? {
14
- return if (name == RNCKakaoNaviModule.NAME) {
13
+ ): NativeModule? =
14
+ if (name == RNCKakaoNaviModule.NAME) {
15
15
  RNCKakaoNaviModule(reactContext)
16
16
  } else {
17
17
  null
18
18
  }
19
- }
20
19
 
21
- override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
22
- return ReactModuleInfoProvider {
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[RNCKakaoNaviModule.NAME] =
@@ -33,5 +32,4 @@ class RNCKakaoNaviPackage : TurboReactPackage() {
33
32
  )
34
33
  moduleInfos
35
34
  }
36
- }
37
35
  }
@@ -2,5 +2,6 @@ package net.mjstudio.rnkakao.navi
2
2
 
3
3
  import com.facebook.react.bridge.ReactApplicationContext
4
4
 
5
- abstract class KakaoNaviSpec internal constructor(context: ReactApplicationContext) :
6
- NativeKakaoNaviSpec(context)
5
+ abstract class KakaoNaviSpec internal constructor(
6
+ context: ReactApplicationContext,
7
+ ) : NativeKakaoNaviSpec(context)
@@ -6,14 +6,15 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule
6
6
  import com.facebook.react.bridge.ReadableArray
7
7
  import com.facebook.react.bridge.ReadableMap
8
8
 
9
- abstract class KakaoNaviSpec internal constructor(context: ReactApplicationContext) :
10
- ReactContextBaseJavaModule(context) {
11
- abstract fun navigateOrShareTo(
12
- destination: ReadableMap,
13
- option: ReadableMap?,
14
- viaList: ReadableArray?,
15
- openWebInstallUrlIfNaviAppNotAvailable: Boolean?,
16
- isShare: Boolean?,
17
- promise: Promise,
18
- )
19
- }
9
+ abstract class KakaoNaviSpec internal constructor(
10
+ context: ReactApplicationContext,
11
+ ) : ReactContextBaseJavaModule(context) {
12
+ abstract fun navigateOrShareTo(
13
+ destination: ReadableMap,
14
+ option: ReadableMap?,
15
+ viaList: ReadableArray?,
16
+ openWebInstallUrlIfNaviAppNotAvailable: Boolean?,
17
+ isShare: Boolean?,
18
+ promise: Promise,
19
+ )
20
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-native-kakao/navi",
3
3
  "description": "React Native Kakao Navi SDK",
4
- "version": "2.2.3",
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.3",
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.3",
77
+ "@react-native-kakao/core": "2.2.5",
78
78
  "react": "*",
79
79
  "react-native": "*"
80
80
  },
@@ -110,7 +110,7 @@
110
110
  "javaPackageName": "net.mjstudio.rnkakao.navi"
111
111
  }
112
112
  },
113
- "gitHead": "2ed9d6e300920b7056a8f539ab11a2592e0064a2",
113
+ "gitHead": "0ecf72a2948e71f464fbc27f7369f13b77916cbd",
114
114
  "dependencies": {
115
115
  "@mj-studio/js-util": "1.1.3"
116
116
  }