|
@@ -769,9 +769,6 @@ fun HomeTV(
|
|
|
else colorResource(id = R.color.blue_text)
|
|
|
Button(
|
|
|
onClick = {
|
|
|
-// Toast.makeText(
|
|
|
-// context, "Smart onClick{}", Toast.LENGTH_SHORT
|
|
|
-// ).show()
|
|
|
// Log.d("test_button", "onClick Smart Connect ${smartServer?.server_name}")
|
|
|
// basePreferenceHelper.setSmartServerObject(smartServer)
|
|
|
// if (isConnect == App.CONNECTED) {
|
|
@@ -818,11 +815,42 @@ fun HomeTV(
|
|
|
isSmartButtonFocused = it.isFocused
|
|
|
}
|
|
|
// .focusable()
|
|
|
-// .clickable {
|
|
|
-// Toast.makeText(
|
|
|
-// context, "Smart clickable{}", Toast.LENGTH_SHORT
|
|
|
-// ).show()
|
|
|
-// }
|
|
|
+ .clickable {
|
|
|
+ Log.d("test_button", "onClick Smart Connect ${smartServer?.server_name}")
|
|
|
+ basePreferenceHelper.setSmartServerObject(smartServer)
|
|
|
+ if (isConnect == App.CONNECTED) {
|
|
|
+ Log.d("isConnect_State_vpn", "stopVPN")
|
|
|
+ val lastServer = basePreferenceHelper.getConnectedServer()
|
|
|
+ Log.d("test_conn_ser_obj", "smart => ${lastServer?.server_name} ${smartServer?.server_name}")
|
|
|
+ if (lastServer?.id != smartServer?.id) {
|
|
|
+ isServerDialog.value = true
|
|
|
+ if (smartServer != null) {
|
|
|
+ serverObj.value = smartServer
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ vpnConnectionsUtil.stopVpn()
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+// vpnConnectionsUtil.stopVpn()
|
|
|
+// Handler().postDelayed(Runnable {
|
|
|
+// vpnConnectionsUtil.startVpn()
|
|
|
+// }, 500)
|
|
|
+// homeViewModel.getIp()
|
|
|
+ }
|
|
|
+ else if (isConnect == App.CONNECTING) {
|
|
|
+ vpnConnectionsUtil.stopVpn()
|
|
|
+ }
|
|
|
+ else if (isConnect == App.DISCONNECTED) {
|
|
|
+ Log.d("isConnect_State_vpn", "startVPN")
|
|
|
+ basePreferenceHelper.setConnectedServer(smartServer)
|
|
|
+ if (smartServer != null) {
|
|
|
+ serverListViewModelSplash.setRecentlyConnectedServer(smartServer)
|
|
|
+ }
|
|
|
+ vpnConnectionsUtil.startVpn()
|
|
|
+ }
|
|
|
+ }
|
|
|
.fillMaxWidth()
|
|
|
.height(35.dp),
|
|
|
shape = RoundedCornerShape(16.dp),
|