From 61e375132188fb6aebc51dd99839bc3990aa3301 Mon Sep 17 00:00:00 2001 From: Zane Schepke Date: Sun, 31 Dec 2023 22:44:44 -0500 Subject: [PATCH] fix: start foreground Fixes issue where auto tunnel should be starting service foreground --- .github/workflows/android.yml | 2 +- .../receiver/NotificationActionReceiver.kt | 2 +- .../foreground/WireGuardConnectivityWatcherService.kt | 6 +++--- .../service/shortcut/ShortcutsActivity.kt | 2 +- buildSrc/src/main/kotlin/Constants.kt | 4 ++-- fastlane/metadata/android/en-US/changelogs/33200.txt | 8 ++++++++ 6 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 fastlane/metadata/android/en-US/changelogs/33200.txt diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index a1324e4..c361cde 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -70,7 +70,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: # fix hardcode changelog file name - body_path: ${{ github.workspace }}/fastlane/metadata/android/en-US/changelogs/33100.txt + body_path: ${{ github.workspace }}/fastlane/metadata/android/en-US/changelogs/33200.txt tag_name: ${{ github.ref_name }} name: Release ${{ github.ref_name }} draft: false diff --git a/app/src/main/java/com/zaneschepke/wireguardautotunnel/receiver/NotificationActionReceiver.kt b/app/src/main/java/com/zaneschepke/wireguardautotunnel/receiver/NotificationActionReceiver.kt index 0b9ec14..dfbd4c2 100644 --- a/app/src/main/java/com/zaneschepke/wireguardautotunnel/receiver/NotificationActionReceiver.kt +++ b/app/src/main/java/com/zaneschepke/wireguardautotunnel/receiver/NotificationActionReceiver.kt @@ -26,7 +26,7 @@ class NotificationActionReceiver : BroadcastReceiver() { if (settings.defaultTunnel != null) { ServiceManager.stopVpnService(context) delay(Constants.TOGGLE_TUNNEL_DELAY) - ServiceManager.startVpnService(context, settings.defaultTunnel.toString()) + ServiceManager.startVpnServiceForeground(context, settings.defaultTunnel.toString()) } } finally { cancel() diff --git a/app/src/main/java/com/zaneschepke/wireguardautotunnel/service/foreground/WireGuardConnectivityWatcherService.kt b/app/src/main/java/com/zaneschepke/wireguardautotunnel/service/foreground/WireGuardConnectivityWatcherService.kt index 8aa5e6a..715c7ef 100644 --- a/app/src/main/java/com/zaneschepke/wireguardautotunnel/service/foreground/WireGuardConnectivityWatcherService.kt +++ b/app/src/main/java/com/zaneschepke/wireguardautotunnel/service/foreground/WireGuardConnectivityWatcherService.kt @@ -311,7 +311,7 @@ class WireGuardConnectivityWatcherService : ForegroundService() { ((it.isEthernetConnected && it.settings.isTunnelOnEthernetEnabled && !it.isVpnConnected)) -> { - ServiceManager.startVpnService(this, it.settings.defaultTunnel!!) + ServiceManager.startVpnServiceForeground(this, it.settings.defaultTunnel!!) Timber.i("Condition 1 met") } (!it.isEthernetConnected && @@ -319,7 +319,7 @@ class WireGuardConnectivityWatcherService : ForegroundService() { !it.isWifiConnected && it.isMobileDataConnected && !it.isVpnConnected) -> { - ServiceManager.startVpnService(this, it.settings.defaultTunnel!!) + ServiceManager.startVpnServiceForeground(this, it.settings.defaultTunnel!!) Timber.i("Condition 2 met") } (!it.isEthernetConnected && @@ -334,7 +334,7 @@ class WireGuardConnectivityWatcherService : ForegroundService() { !it.settings.trustedNetworkSSIDs.contains(it.currentNetworkSSID) && it.settings.isTunnelOnWifiEnabled && (!it.isVpnConnected)) -> { - ServiceManager.startVpnService(this, it.settings.defaultTunnel!!) + ServiceManager.startVpnServiceForeground(this, it.settings.defaultTunnel!!) Timber.i("Condition 4 met") } (!it.isEthernetConnected && diff --git a/app/src/main/java/com/zaneschepke/wireguardautotunnel/service/shortcut/ShortcutsActivity.kt b/app/src/main/java/com/zaneschepke/wireguardautotunnel/service/shortcut/ShortcutsActivity.kt index 1b06d8d..6ab9c78 100644 --- a/app/src/main/java/com/zaneschepke/wireguardautotunnel/service/shortcut/ShortcutsActivity.kt +++ b/app/src/main/java/com/zaneschepke/wireguardautotunnel/service/shortcut/ShortcutsActivity.kt @@ -62,7 +62,7 @@ class ShortcutsActivity : ComponentActivity() { Action.STOP.name -> ServiceManager.stopVpnService( this@ShortcutsActivity ) - Action.START.name -> ServiceManager.startVpnService( + Action.START.name -> ServiceManager.startVpnServiceForeground( this@ShortcutsActivity, tunnelConfig.toString() ) diff --git a/buildSrc/src/main/kotlin/Constants.kt b/buildSrc/src/main/kotlin/Constants.kt index 8757403..398bc78 100644 --- a/buildSrc/src/main/kotlin/Constants.kt +++ b/buildSrc/src/main/kotlin/Constants.kt @@ -1,7 +1,7 @@ object Constants { - const val VERSION_NAME = "3.3.1" + const val VERSION_NAME = "3.3.2" const val JVM_TARGET = "17" - const val VERSION_CODE = 33100 + const val VERSION_CODE = 33200 const val TARGET_SDK = 34 const val MIN_SDK = 26 const val APP_ID = "com.zaneschepke.wireguardautotunnel" diff --git a/fastlane/metadata/android/en-US/changelogs/33200.txt b/fastlane/metadata/android/en-US/changelogs/33200.txt new file mode 100644 index 0000000..0d36a34 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/33200.txt @@ -0,0 +1,8 @@ +Enhancements: +- Refactor state management +- Improve AndroidTV navigation +- Improve auto-tunneling efficiency +- Improve navigation +- Auto-tunneling pause feature +- Fix foreground start auto-tunnel +- Many bugfixes