Loading front/Elivia/app/src/main/java/com/poc/elivia/MainActivity.kt +1 −1 Original line number Original line Diff line number Diff line Loading @@ -23,7 +23,7 @@ class MainActivity : AppCompatActivity() { val userTextInput: EditText = findViewById(R.id.userTextInput) val userTextInput: EditText = findViewById(R.id.userTextInput) val client = OkHttpClient(); val client = OkHttpClient(); val ipAddress = "192.168.0.14" val ipAddress = "172.20.10.5" val request: Request = Request.Builder().url("ws://${ipAddress}:8080/websocket").build() val request: Request = Request.Builder().url("ws://${ipAddress}:8080/websocket").build() val listener = LeonWebSocket(chat, plugins, this) val listener = LeonWebSocket(chat, plugins, this) val ws: WebSocket = client.newWebSocket(request, listener) val ws: WebSocket = client.newWebSocket(request, listener) Loading front/Elivia/app/src/main/java/com/poc/elivia/plugin/core/PluginManager.kt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -30,6 +30,7 @@ class PluginManager(context: Context, activity: Activity, view: LeonView) { } } private fun openAppPluginManager(data: JSONObject) { private fun openAppPluginManager(data: JSONObject) { Log.d("Leon", "${data["appname"]}") val appName = data["appname"] as String val appName = data["appname"] as String openApp.run(appName) openApp.run(appName) Loading front/Elivia/app/src/main/java/com/poc/elivia/socket/LeonWebSocket.kt +6 −1 Original line number Original line Diff line number Diff line Loading @@ -36,7 +36,11 @@ class LeonWebSocket(view: LeonView, plugins: PluginManager, activity: Activity): mainActivity.runOnUiThread { mainActivity.runOnUiThread { chat.addOliviaBubble(oliviaResponse) chat.addOliviaBubble(oliviaResponse) } } pluginManager.run(pluginName, obj["data"] as JSONObject) val data = obj["data"] as JSONObject if (data.length() == 0) { return ; } pluginManager.run(pluginName, data) } } override fun onMessage(webSocket: WebSocket, bytes: ByteString) { override fun onMessage(webSocket: WebSocket, bytes: ByteString) { Loading @@ -50,6 +54,7 @@ class LeonWebSocket(view: LeonView, plugins: PluginManager, activity: Activity): override fun onFailure(webSocket: WebSocket, t: Throwable, response: Response?) { override fun onFailure(webSocket: WebSocket, t: Throwable, response: Response?) { Log.d("LeonWebSocket", "WebSocket failure : [${t.message}]") Log.d("LeonWebSocket", "WebSocket failure : [${t.message}]") webSocket.close(1000,"Socket off") } } fun onSend(webSocket: WebSocket, content: String) { fun onSend(webSocket: WebSocket, content: String) { Loading Loading
front/Elivia/app/src/main/java/com/poc/elivia/MainActivity.kt +1 −1 Original line number Original line Diff line number Diff line Loading @@ -23,7 +23,7 @@ class MainActivity : AppCompatActivity() { val userTextInput: EditText = findViewById(R.id.userTextInput) val userTextInput: EditText = findViewById(R.id.userTextInput) val client = OkHttpClient(); val client = OkHttpClient(); val ipAddress = "192.168.0.14" val ipAddress = "172.20.10.5" val request: Request = Request.Builder().url("ws://${ipAddress}:8080/websocket").build() val request: Request = Request.Builder().url("ws://${ipAddress}:8080/websocket").build() val listener = LeonWebSocket(chat, plugins, this) val listener = LeonWebSocket(chat, plugins, this) val ws: WebSocket = client.newWebSocket(request, listener) val ws: WebSocket = client.newWebSocket(request, listener) Loading
front/Elivia/app/src/main/java/com/poc/elivia/plugin/core/PluginManager.kt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -30,6 +30,7 @@ class PluginManager(context: Context, activity: Activity, view: LeonView) { } } private fun openAppPluginManager(data: JSONObject) { private fun openAppPluginManager(data: JSONObject) { Log.d("Leon", "${data["appname"]}") val appName = data["appname"] as String val appName = data["appname"] as String openApp.run(appName) openApp.run(appName) Loading
front/Elivia/app/src/main/java/com/poc/elivia/socket/LeonWebSocket.kt +6 −1 Original line number Original line Diff line number Diff line Loading @@ -36,7 +36,11 @@ class LeonWebSocket(view: LeonView, plugins: PluginManager, activity: Activity): mainActivity.runOnUiThread { mainActivity.runOnUiThread { chat.addOliviaBubble(oliviaResponse) chat.addOliviaBubble(oliviaResponse) } } pluginManager.run(pluginName, obj["data"] as JSONObject) val data = obj["data"] as JSONObject if (data.length() == 0) { return ; } pluginManager.run(pluginName, data) } } override fun onMessage(webSocket: WebSocket, bytes: ByteString) { override fun onMessage(webSocket: WebSocket, bytes: ByteString) { Loading @@ -50,6 +54,7 @@ class LeonWebSocket(view: LeonView, plugins: PluginManager, activity: Activity): override fun onFailure(webSocket: WebSocket, t: Throwable, response: Response?) { override fun onFailure(webSocket: WebSocket, t: Throwable, response: Response?) { Log.d("LeonWebSocket", "WebSocket failure : [${t.message}]") Log.d("LeonWebSocket", "WebSocket failure : [${t.message}]") webSocket.close(1000,"Socket off") } } fun onSend(webSocket: WebSocket, content: String) { fun onSend(webSocket: WebSocket, content: String) { Loading