-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ui update with full config edit
feat: Change config screen UI to accommodate editing of all fields. Change config screen to allow the addition of new peers. Closes #31 Change main screen to denote primary tunnel with star. Change main screen tunnel options to allow changing tunnel to primary. feat: Change settings screen UI to improve usability. Closes #32 fix: Change application shortcuts to static shortcuts for the primary tunnel. Remove dynamic shortcuts. Closes #38 fix: Database changes from the previous version causing crashes. #40 #37 fix: bug on detail screen where tunnel name was not showing feat: Change button color when hovering on AndroidTV to improve visibility #36 fix: Change file importing method to fix bug on FireTV Closes #39 docs: update README with new screenshots
- Loading branch information
1 parent
ca3f3fd
commit c8f2cfd
Showing
53 changed files
with
1,616 additions
and
859 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,5 +27,4 @@ class TunnelModule { | |
fun provideVpnService(backend: Backend) : VpnService { | ||
return WireGuardTunnel(backend) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 43 additions & 19 deletions
62
app/src/main/java/com/zaneschepke/wireguardautotunnel/service/shortcut/ShortcutsActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,76 @@ | ||
package com.zaneschepke.wireguardautotunnel.service.shortcut | ||
|
||
import android.os.Bundle | ||
import androidx.appcompat.app.AppCompatActivity | ||
import com.zaneschepke.wireguardautotunnel.R | ||
import androidx.activity.ComponentActivity | ||
import com.zaneschepke.wireguardautotunnel.repository.SettingsDoa | ||
import com.zaneschepke.wireguardautotunnel.repository.TunnelConfigDao | ||
import com.zaneschepke.wireguardautotunnel.repository.model.Settings | ||
import com.zaneschepke.wireguardautotunnel.repository.model.TunnelConfig | ||
import com.zaneschepke.wireguardautotunnel.service.foreground.Action | ||
import com.zaneschepke.wireguardautotunnel.service.foreground.ServiceManager | ||
import com.zaneschepke.wireguardautotunnel.service.foreground.WireGuardTunnelService | ||
import com.zaneschepke.wireguardautotunnel.util.WgTunnelException | ||
import dagger.hilt.android.AndroidEntryPoint | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.launch | ||
import timber.log.Timber | ||
import javax.inject.Inject | ||
|
||
@AndroidEntryPoint | ||
class ShortcutsActivity : AppCompatActivity() { | ||
class ShortcutsActivity : ComponentActivity() { | ||
|
||
@Inject | ||
lateinit var settingsRepo : SettingsDoa | ||
|
||
@Inject | ||
lateinit var tunnelConfigRepo : TunnelConfigDao | ||
|
||
private val scope = CoroutineScope(Dispatchers.Main); | ||
|
||
private fun attemptWatcherServiceToggle(tunnelConfig : String) { | ||
scope.launch { | ||
val settings = settingsRepo.getAll() | ||
if (settings.isNotEmpty()) { | ||
val setting = settings.first() | ||
if(setting.isAutoTunnelEnabled) { | ||
ServiceManager.toggleWatcherServiceForeground(this@ShortcutsActivity, tunnelConfig) | ||
} | ||
val settings = getSettings() | ||
if(settings.isAutoTunnelEnabled) { | ||
ServiceManager.toggleWatcherServiceForeground(this@ShortcutsActivity, tunnelConfig) | ||
} | ||
} | ||
} | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
if(intent.getStringExtra(ShortcutsManager.CLASS_NAME_EXTRA_KEY) | ||
.equals(WireGuardTunnelService::class.java.name)) { | ||
|
||
intent.getStringExtra(getString(R.string.tunnel_extras_key))?.let { | ||
attemptWatcherServiceToggle(it) | ||
} | ||
when(intent.action){ | ||
Action.STOP.name -> ServiceManager.stopVpnService(this) | ||
Action.START.name -> intent.getStringExtra(getString(R.string.tunnel_extras_key)) | ||
?.let { ServiceManager.startVpnService(this, it) } | ||
if(intent.getStringExtra(CLASS_NAME_EXTRA_KEY) | ||
.equals(WireGuardTunnelService::class.java.simpleName)) { | ||
scope.launch { | ||
try { | ||
val settings = getSettings() | ||
val tunnelConfig = if(settings.defaultTunnel == null) { | ||
tunnelConfigRepo.getAll().first() | ||
} else { | ||
TunnelConfig.from(settings.defaultTunnel!!) | ||
} | ||
attemptWatcherServiceToggle(tunnelConfig.toString()) | ||
when(intent.action){ | ||
Action.STOP.name -> ServiceManager.stopVpnService(this@ShortcutsActivity) | ||
Action.START.name -> ServiceManager.startVpnService(this@ShortcutsActivity, tunnelConfig.toString()) | ||
} | ||
} catch (e : Exception) { | ||
Timber.e(e.message) | ||
} | ||
} | ||
} | ||
finish() | ||
} | ||
|
||
private suspend fun getSettings() : Settings { | ||
val settings = settingsRepo.getAll() | ||
return if (settings.isNotEmpty()) { | ||
settings.first() | ||
} else { | ||
throw WgTunnelException("Settings empty") | ||
} | ||
} | ||
companion object { | ||
const val CLASS_NAME_EXTRA_KEY = "className" | ||
} | ||
} |
75 changes: 0 additions & 75 deletions
75
app/src/main/java/com/zaneschepke/wireguardautotunnel/service/shortcut/ShortcutsManager.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.