Browse Source

updated code of widgets

Khubaib 1 year ago
parent
commit
8ef2942370

+ 5 - 2
app/src/main/java/com/vpn/fastestvpnservice/utils/WireGuardService.kt

@@ -325,7 +325,9 @@ class WireGuardService : Service(), VpnStatus.StateListener {
                 applicationContext.startActivity(intent)
 
                 basePreferenceHelper.setConnectState(App.DISCONNECTED)
-
+                val widgetIntent = Intent(applicationContext, SimpleAppWidget::class.java)
+                widgetIntent.action = SimpleAppWidget.ACTION_DISCONNECT_VPN
+                applicationContext?.sendBroadcast(widgetIntent)
 
 //                App.connection_status = App.CONNECTION_STATE_DISCONNECTED
 //                MainActivity.vpnConnectionCallBacks?.onVpnDisconnected()
@@ -696,7 +698,8 @@ class WireGuardService : Service(), VpnStatus.StateListener {
                         Log.d("vpnConnectionCall ip w", "ACTION_VPN_NOT_CONNECTED widget $connectState")
                     }
                     CharonVpnService.ACTION_VPN_CONNECTING -> {
-                        Log.d("vpnConnectionCall ip w", "ACTION_VPN_CONNECTING widget")
+                        val connectState1 = basePreferenceHelper.getConnectState()
+                        Log.d("vpnConnectionCall ip w", "ACTION_VPN_CONNECTING widget $connectState1")
                         App.connection_status = App.CONNECTION_STATE_CONNECTING
                         MainActivity.vpnConnectionCallBacks?.onVpnConnecting()