Skip to content

Commit 1b60d72

Browse files
committed
Minor corrections for Android
1 parent dccf663 commit 1b60d72

File tree

4 files changed

+37
-37
lines changed

4 files changed

+37
-37
lines changed

android/src/main/java/com/drpogodin/reactnativestaticserver/ReactNativeStaticServerModule.kt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@ class ReactNativeStaticServerModule internal constructor(context: ReactApplicati
2424
// instance.
2525
private var server: Server? = null
2626
private var pendingPromise: Promise? = null
27-
val typedExportedConstants: Map<String, Any>
28-
get() {
29-
val constants: MutableMap<String, Any> = HashMap()
30-
constants["CRASHED"] = Server.CRASHED
31-
constants["IS_MAC_CATALYST"] = false
32-
constants["LAUNCHED"] = Server.LAUNCHED
33-
constants["TERMINATED"] = Server.TERMINATED
34-
return constants
35-
}
27+
28+
override fun getTypedExportedConstants(): Map<String, Any> {
29+
val constants: MutableMap<String, Any> = HashMap()
30+
constants["CRASHED"] = Server.CRASHED
31+
constants["IS_MAC_CATALYST"] = false
32+
constants["LAUNCHED"] = Server.LAUNCHED
33+
constants["TERMINATED"] = Server.TERMINATED
34+
return constants
35+
}
3636

3737
@ReactMethod
38-
fun getLocalIpAddress(promise: Promise) {
38+
override fun getLocalIpAddress(promise: Promise) {
3939
try {
4040
val en = NetworkInterface.getNetworkInterfaces()
4141
while (en.hasMoreElements()) {
@@ -63,7 +63,7 @@ class ReactNativeStaticServerModule internal constructor(context: ReactApplicati
6363
}
6464

6565
@ReactMethod
66-
fun start(
66+
override fun start(
6767
id: Double, // Server ID for backward communication with JS layer.
6868
configPath: String?,
6969
errlogPath: String?,
@@ -113,7 +113,7 @@ class ReactNativeStaticServerModule internal constructor(context: ReactApplicati
113113
}
114114

115115
@ReactMethod
116-
fun getOpenPort(address: String?, promise: Promise) {
116+
override fun getOpenPort(address: String?, promise: Promise) {
117117
try {
118118
val socket = ServerSocket(
119119
0, 0, InetAddress.getByName(address))
@@ -126,7 +126,7 @@ class ReactNativeStaticServerModule internal constructor(context: ReactApplicati
126126
}
127127

128128
@ReactMethod
129-
fun stop(promise: Promise?) {
129+
override fun stop(promise: Promise?) {
130130
Log.i(LOGTAG, "stop() triggered")
131131
try {
132132
sem.acquire()
@@ -146,12 +146,12 @@ class ReactNativeStaticServerModule internal constructor(context: ReactApplicati
146146
}
147147

148148
@ReactMethod
149-
fun addListener(eventName: String?) {
149+
override fun addListener(eventName: String?) {
150150
// NOOP
151151
}
152152

153153
@ReactMethod
154-
fun removeListeners(count: Double) {
154+
override fun removeListeners(count: Double) {
155155
// NOOP
156156
}
157157

android/src/newarch/ReactNativeStaticServerSpec.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ package com.drpogodin.reactnativestaticserver
22

33
import com.facebook.react.bridge.ReactApplicationContext
44

5-
internal abstract class ReactNativeStaticServerSpec(context: ReactApplicationContext?) : NativeReactNativeStaticServerSpec(context)
5+
abstract class ReactNativeStaticServerSpec(context: ReactApplicationContext?) : NativeReactNativeStaticServerSpec(context)

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "ReactNativeStaticServerExample",
2+
"name": "@dr.pogodin/react-native-static-server-example",
33
"version": "0.0.1",
44
"private": true,
55
"scripts": {

yarn.lock

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,6 +1787,26 @@ __metadata:
17871787
languageName: node
17881788
linkType: hard
17891789

1790+
"@dr.pogodin/react-native-static-server-example@workspace:example":
1791+
version: 0.0.0-use.local
1792+
resolution: "@dr.pogodin/react-native-static-server-example@workspace:example"
1793+
dependencies:
1794+
"@babel/core": ^7.23.3
1795+
"@babel/preset-env": ^7.23.3
1796+
"@babel/runtime": ^7.23.2
1797+
"@dr.pogodin/react-native-fs": ^2.22.0-alpha.0
1798+
"@react-native/babel-preset": ^0.73.18
1799+
"@react-native/metro-config": ^0.73.2
1800+
"@react-native/typescript-config": ^0.73.1
1801+
babel-plugin-module-resolver: ^5.0.0
1802+
pod-install: ^0.1.0
1803+
react: 18.2.0
1804+
react-native: 0.73.0
1805+
react-native-webview: ^13.6.2
1806+
react-native-windows: ^0.73.2
1807+
languageName: unknown
1808+
linkType: soft
1809+
17901810
"@dr.pogodin/react-native-static-server@workspace:.":
17911811
version: 0.0.0-use.local
17921812
resolution: "@dr.pogodin/react-native-static-server@workspace:."
@@ -3470,26 +3490,6 @@ __metadata:
34703490
languageName: node
34713491
linkType: hard
34723492

3473-
"ReactNativeStaticServerExample@workspace:example":
3474-
version: 0.0.0-use.local
3475-
resolution: "ReactNativeStaticServerExample@workspace:example"
3476-
dependencies:
3477-
"@babel/core": ^7.23.3
3478-
"@babel/preset-env": ^7.23.3
3479-
"@babel/runtime": ^7.23.2
3480-
"@dr.pogodin/react-native-fs": ^2.22.0-alpha.0
3481-
"@react-native/babel-preset": ^0.73.18
3482-
"@react-native/metro-config": ^0.73.2
3483-
"@react-native/typescript-config": ^0.73.1
3484-
babel-plugin-module-resolver: ^5.0.0
3485-
pod-install: ^0.1.0
3486-
react: 18.2.0
3487-
react-native: 0.73.0
3488-
react-native-webview: ^13.6.2
3489-
react-native-windows: ^0.73.2
3490-
languageName: unknown
3491-
linkType: soft
3492-
34933493
"abbrev@npm:^2.0.0":
34943494
version: 2.0.0
34953495
resolution: "abbrev@npm:2.0.0"

0 commit comments

Comments
 (0)