feat: improved notifications with actions (#481)

This commit is contained in:
Zane Schepke 2024-12-09 22:38:55 -05:00 committed by GitHub
parent 670d9d680c
commit c5b42b55c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
27 changed files with 312 additions and 233 deletions

View File

@ -204,5 +204,10 @@
<action android:name="com.wireguard.android.action.REFRESH_TUNNEL_STATES" /> <action android:name="com.wireguard.android.action.REFRESH_TUNNEL_STATES" />
</intent-filter> </intent-filter>
</receiver> </receiver>
<receiver
android:name=".receiver.NotificationActionReceiver"
android:exported="false"
android:permission="${applicationId}.permission.CONTROL_TUNNELS">
</receiver>
</application> </application>
</manifest> </manifest>

View File

@ -2,6 +2,8 @@ package com.zaneschepke.wireguardautotunnel.module
import android.content.Context import android.content.Context
import com.zaneschepke.logcatter.LogReader import com.zaneschepke.logcatter.LogReader
import com.zaneschepke.wireguardautotunnel.service.notification.NotificationService
import com.zaneschepke.wireguardautotunnel.service.notification.WireGuardNotification
import com.zaneschepke.logcatter.LogcatReader import com.zaneschepke.logcatter.LogcatReader
import dagger.Module import dagger.Module
import dagger.Provides import dagger.Provides
@ -27,4 +29,10 @@ class AppModule {
fun provideLogCollect(@ApplicationContext context: Context): LogReader { fun provideLogCollect(@ApplicationContext context: Context): LogReader {
return LogcatReader.init(storageDir = context.filesDir.absolutePath) return LogcatReader.init(storageDir = context.filesDir.absolutePath)
} }
@Singleton
@Provides
fun provideNotificationService(@ApplicationContext context: Context): NotificationService {
return WireGuardNotification(context)
}
} }

View File

@ -4,8 +4,6 @@ import com.zaneschepke.wireguardautotunnel.service.network.EthernetService
import com.zaneschepke.wireguardautotunnel.service.network.MobileDataService import com.zaneschepke.wireguardautotunnel.service.network.MobileDataService
import com.zaneschepke.wireguardautotunnel.service.network.NetworkService import com.zaneschepke.wireguardautotunnel.service.network.NetworkService
import com.zaneschepke.wireguardautotunnel.service.network.WifiService import com.zaneschepke.wireguardautotunnel.service.network.WifiService
import com.zaneschepke.wireguardautotunnel.service.notification.NotificationService
import com.zaneschepke.wireguardautotunnel.service.notification.WireGuardNotification
import dagger.Binds import dagger.Binds
import dagger.Module import dagger.Module
import dagger.hilt.InstallIn import dagger.hilt.InstallIn
@ -15,10 +13,6 @@ import dagger.hilt.android.scopes.ServiceScoped
@Module @Module
@InstallIn(ServiceComponent::class) @InstallIn(ServiceComponent::class)
abstract class ServiceModule { abstract class ServiceModule {
@Binds
@ServiceScoped
abstract fun provideNotificationService(wireGuardNotification: WireGuardNotification): NotificationService
@Binds @Binds
@ServiceScoped @ServiceScoped
abstract fun provideWifiService(wifiService: WifiService): NetworkService<WifiService> abstract fun provideWifiService(wifiService: WifiService): NetworkService<WifiService>

View File

@ -10,6 +10,7 @@ import com.wireguard.android.util.ToolsInstaller
import com.zaneschepke.wireguardautotunnel.data.repository.AppDataRepository import com.zaneschepke.wireguardautotunnel.data.repository.AppDataRepository
import com.zaneschepke.wireguardautotunnel.data.repository.TunnelConfigRepository import com.zaneschepke.wireguardautotunnel.data.repository.TunnelConfigRepository
import com.zaneschepke.wireguardautotunnel.service.foreground.ServiceManager import com.zaneschepke.wireguardautotunnel.service.foreground.ServiceManager
import com.zaneschepke.wireguardautotunnel.service.notification.NotificationService
import com.zaneschepke.wireguardautotunnel.service.tunnel.TunnelService import com.zaneschepke.wireguardautotunnel.service.tunnel.TunnelService
import com.zaneschepke.wireguardautotunnel.service.tunnel.WireGuardTunnel import com.zaneschepke.wireguardautotunnel.service.tunnel.WireGuardTunnel
import dagger.Module import dagger.Module
@ -76,6 +77,7 @@ class TunnelModule {
@ApplicationScope applicationScope: CoroutineScope, @ApplicationScope applicationScope: CoroutineScope,
@IoDispatcher ioDispatcher: CoroutineDispatcher, @IoDispatcher ioDispatcher: CoroutineDispatcher,
serviceManager: ServiceManager, serviceManager: ServiceManager,
notificationService: NotificationService,
): TunnelService { ): TunnelService {
return WireGuardTunnel( return WireGuardTunnel(
amneziaBackend, amneziaBackend,
@ -85,12 +87,17 @@ class TunnelModule {
applicationScope, applicationScope,
ioDispatcher, ioDispatcher,
serviceManager, serviceManager,
notificationService,
) )
} }
@Singleton @Singleton
@Provides @Provides
fun provideServiceManager(@ApplicationContext context: Context): ServiceManager { fun provideServiceManager(
return ServiceManager.getInstance(context) @ApplicationContext context: Context,
@IoDispatcher ioDispatcher: CoroutineDispatcher,
appDataRepository: AppDataRepository,
): ServiceManager {
return ServiceManager(context, ioDispatcher, appDataRepository)
} }
} }

View File

@ -5,8 +5,8 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import com.zaneschepke.wireguardautotunnel.data.repository.TunnelConfigRepository import com.zaneschepke.wireguardautotunnel.data.repository.TunnelConfigRepository
import com.zaneschepke.wireguardautotunnel.module.ApplicationScope import com.zaneschepke.wireguardautotunnel.module.ApplicationScope
import com.zaneschepke.wireguardautotunnel.service.foreground.ServiceManager
import com.zaneschepke.wireguardautotunnel.service.tunnel.TunnelService import com.zaneschepke.wireguardautotunnel.service.tunnel.TunnelService
import com.zaneschepke.wireguardautotunnel.util.extensions.requestTunnelTileServiceStateUpdate
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@ -26,6 +26,9 @@ class KernelReceiver : BroadcastReceiver() {
@Inject @Inject
lateinit var tunnelConfigRepository: TunnelConfigRepository lateinit var tunnelConfigRepository: TunnelConfigRepository
@Inject
lateinit var serviceManager: ServiceManager
override fun onReceive(context: Context, intent: Intent) { override fun onReceive(context: Context, intent: Intent) {
val action = intent.action ?: return val action = intent.action ?: return
applicationScope.launch { applicationScope.launch {
@ -37,7 +40,7 @@ class KernelReceiver : BroadcastReceiver() {
tunnelConfigRepository.save(it.copy(isActive = true)) tunnelConfigRepository.save(it.copy(isActive = true))
} }
} }
context.requestTunnelTileServiceStateUpdate() serviceManager.updateTunnelTile()
} }
} }
} }

View File

@ -0,0 +1,36 @@
package com.zaneschepke.wireguardautotunnel.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.zaneschepke.wireguardautotunnel.module.ApplicationScope
import com.zaneschepke.wireguardautotunnel.service.foreground.ServiceManager
import com.zaneschepke.wireguardautotunnel.service.notification.NotificationAction
import com.zaneschepke.wireguardautotunnel.service.tunnel.TunnelService
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch
import javax.inject.Inject
@AndroidEntryPoint
class NotificationActionReceiver : BroadcastReceiver() {
@Inject
lateinit var serviceManager: ServiceManager
@Inject
lateinit var tunnelService: TunnelService
@Inject
@ApplicationScope
lateinit var applicationScope: CoroutineScope
override fun onReceive(context: Context, intent: Intent) {
applicationScope.launch {
when (intent.action) {
NotificationAction.AUTO_TUNNEL_OFF.name -> serviceManager.stopAutoTunnel()
NotificationAction.TUNNEL_OFF.name -> tunnelService.stopTunnel()
}
}
}
}

View File

@ -3,20 +3,25 @@ package com.zaneschepke.wireguardautotunnel.service.foreground
import android.app.Service import android.app.Service
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import com.zaneschepke.wireguardautotunnel.data.repository.AppDataRepository
import com.zaneschepke.wireguardautotunnel.service.foreground.autotunnel.AutoTunnelService import com.zaneschepke.wireguardautotunnel.service.foreground.autotunnel.AutoTunnelService
import com.zaneschepke.wireguardautotunnel.util.SingletonHolder import com.zaneschepke.wireguardautotunnel.service.tile.AutoTunnelControlTile
import com.zaneschepke.wireguardautotunnel.service.tile.TunnelControlTile
import com.zaneschepke.wireguardautotunnel.util.extensions.requestAutoTunnelTileServiceUpdate
import com.zaneschepke.wireguardautotunnel.util.extensions.requestTunnelTileServiceStateUpdate import com.zaneschepke.wireguardautotunnel.util.extensions.requestTunnelTileServiceStateUpdate
import jakarta.inject.Inject import jakarta.inject.Inject
import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.update import kotlinx.coroutines.flow.update
import kotlinx.coroutines.withContext
import timber.log.Timber import timber.log.Timber
@OptIn(ExperimentalCoroutinesApi::class) @OptIn(ExperimentalCoroutinesApi::class)
class ServiceManager class ServiceManager
@Inject constructor(private val context: Context) { @Inject constructor(private val context: Context, private val ioDispatcher: CoroutineDispatcher, private val appDataRepository: AppDataRepository) {
private val _autoTunnelActive = MutableStateFlow(false) private val _autoTunnelActive = MutableStateFlow(false)
@ -24,8 +29,8 @@ class ServiceManager
var autoTunnelService = CompletableDeferred<AutoTunnelService>() var autoTunnelService = CompletableDeferred<AutoTunnelService>()
var backgroundService = CompletableDeferred<TunnelBackgroundService>() var backgroundService = CompletableDeferred<TunnelBackgroundService>()
var autoTunnelTile = CompletableDeferred<AutoTunnelControlTile>()
companion object : SingletonHolder<ServiceManager, Context>(::ServiceManager) var tunnelControlTile = CompletableDeferred<TunnelControlTile>()
private fun <T : Service> startService(cls: Class<T>, background: Boolean) { private fun <T : Service> startService(cls: Class<T>, background: Boolean) {
runCatching { runCatching {
@ -39,12 +44,15 @@ class ServiceManager
} }
suspend fun startAutoTunnel(background: Boolean) { suspend fun startAutoTunnel(background: Boolean) {
val settings = appDataRepository.settings.getSettings()
appDataRepository.settings.save(settings.copy(isAutoTunnelEnabled = true))
if (autoTunnelService.isCompleted) return _autoTunnelActive.update { true } if (autoTunnelService.isCompleted) return _autoTunnelActive.update { true }
kotlin.runCatching { kotlin.runCatching {
startService(AutoTunnelService::class.java, background) startService(AutoTunnelService::class.java, background)
autoTunnelService.await() autoTunnelService.await()
autoTunnelService.getCompleted().start() autoTunnelService.getCompleted().start()
_autoTunnelActive.update { true } _autoTunnelActive.update { true }
updateAutoTunnelTile()
}.onFailure { }.onFailure {
Timber.e(it) Timber.e(it)
} }
@ -70,17 +78,41 @@ class ServiceManager
} }
} }
fun stopAutoTunnel() { suspend fun toggleAutoTunnel(background: Boolean) {
if (!autoTunnelService.isCompleted) return withContext(ioDispatcher) {
if (_autoTunnelActive.value) return@withContext stopAutoTunnel()
startAutoTunnel(background)
}
}
fun updateAutoTunnelTile() {
if (autoTunnelTile.isCompleted) {
autoTunnelTile.getCompleted().updateTileState()
} else {
context.requestAutoTunnelTileServiceUpdate()
}
}
fun updateTunnelTile() {
if (tunnelControlTile.isCompleted) {
tunnelControlTile.getCompleted().updateTileState()
} else {
context.requestTunnelTileServiceStateUpdate()
}
}
suspend fun stopAutoTunnel() {
withContext(ioDispatcher) {
val settings = appDataRepository.settings.getSettings()
appDataRepository.settings.save(settings.copy(isAutoTunnelEnabled = false))
if (!autoTunnelService.isCompleted) return@withContext
runCatching { runCatching {
autoTunnelService.getCompleted().stop() autoTunnelService.getCompleted().stop()
_autoTunnelActive.update { false } _autoTunnelActive.update { false }
updateAutoTunnelTile()
}.onFailure { }.onFailure {
Timber.e(it) Timber.e(it)
} }
} }
fun requestTunnelTileUpdate() {
context.requestTunnelTileServiceStateUpdate()
} }
} }

View File

@ -7,6 +7,7 @@ import androidx.core.app.ServiceCompat
import androidx.lifecycle.LifecycleService import androidx.lifecycle.LifecycleService
import com.zaneschepke.wireguardautotunnel.R import com.zaneschepke.wireguardautotunnel.R
import com.zaneschepke.wireguardautotunnel.service.notification.NotificationService import com.zaneschepke.wireguardautotunnel.service.notification.NotificationService
import com.zaneschepke.wireguardautotunnel.service.notification.WireGuardNotification
import com.zaneschepke.wireguardautotunnel.util.Constants import com.zaneschepke.wireguardautotunnel.util.Constants
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.CompletableDeferred
@ -21,8 +22,6 @@ class TunnelBackgroundService : LifecycleService() {
@Inject @Inject
lateinit var serviceManager: ServiceManager lateinit var serviceManager: ServiceManager
private val foregroundId = 123
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
start() start()
@ -42,7 +41,7 @@ class TunnelBackgroundService : LifecycleService() {
fun start() { fun start() {
ServiceCompat.startForeground( ServiceCompat.startForeground(
this, this,
foregroundId, NotificationService.KERNEL_SERVICE_NOTIFICATION_ID,
createNotification(), createNotification(),
Constants.SYSTEM_EXEMPT_SERVICE_TYPE_ID, Constants.SYSTEM_EXEMPT_SERVICE_TYPE_ID,
) )
@ -60,8 +59,7 @@ class TunnelBackgroundService : LifecycleService() {
private fun createNotification(): Notification { private fun createNotification(): Notification {
return notificationService.createNotification( return notificationService.createNotification(
getString(R.string.vpn_channel_id), WireGuardNotification.NotificationChannels.VPN,
getString(R.string.vpn_channel_name),
getString(R.string.tunnel_running), getString(R.string.tunnel_running),
description = "", description = "",
) )

View File

@ -24,7 +24,9 @@ import com.zaneschepke.wireguardautotunnel.service.network.MobileDataService
import com.zaneschepke.wireguardautotunnel.service.network.NetworkService import com.zaneschepke.wireguardautotunnel.service.network.NetworkService
import com.zaneschepke.wireguardautotunnel.service.network.NetworkStatus import com.zaneschepke.wireguardautotunnel.service.network.NetworkStatus
import com.zaneschepke.wireguardautotunnel.service.network.WifiService import com.zaneschepke.wireguardautotunnel.service.network.WifiService
import com.zaneschepke.wireguardautotunnel.service.notification.NotificationAction
import com.zaneschepke.wireguardautotunnel.service.notification.NotificationService import com.zaneschepke.wireguardautotunnel.service.notification.NotificationService
import com.zaneschepke.wireguardautotunnel.service.notification.WireGuardNotification
import com.zaneschepke.wireguardautotunnel.service.tunnel.TunnelService import com.zaneschepke.wireguardautotunnel.service.tunnel.TunnelService
import com.zaneschepke.wireguardautotunnel.util.Constants import com.zaneschepke.wireguardautotunnel.util.Constants
import com.zaneschepke.wireguardautotunnel.util.extensions.TunnelConfigs import com.zaneschepke.wireguardautotunnel.util.extensions.TunnelConfigs
@ -53,7 +55,6 @@ import javax.inject.Provider
@AndroidEntryPoint @AndroidEntryPoint
class AutoTunnelService : LifecycleService() { class AutoTunnelService : LifecycleService() {
private val foregroundId = 122
@Inject @Inject
@AppShell @AppShell
@ -147,14 +148,16 @@ class AutoTunnelService : LifecycleService() {
private fun launchWatcherNotification(description: String = getString(R.string.monitoring_state_changes)) { private fun launchWatcherNotification(description: String = getString(R.string.monitoring_state_changes)) {
val notification = val notification =
notificationService.createNotification( notificationService.createNotification(
channelId = getString(R.string.watcher_channel_id), WireGuardNotification.NotificationChannels.AUTO_TUNNEL,
channelName = getString(R.string.watcher_channel_name),
title = getString(R.string.auto_tunnel_title), title = getString(R.string.auto_tunnel_title),
description = description, description = description,
actions = listOf(
notificationService.createNotificationAction(NotificationAction.AUTO_TUNNEL_OFF),
),
) )
ServiceCompat.startForeground( ServiceCompat.startForeground(
this, this,
foregroundId, NotificationService.AUTO_TUNNEL_NOTIFICATION_ID,
notification, notification,
Constants.SYSTEM_EXEMPT_SERVICE_TYPE_ID, Constants.SYSTEM_EXEMPT_SERVICE_TYPE_ID,
) )

View File

@ -0,0 +1,17 @@
package com.zaneschepke.wireguardautotunnel.service.notification
import android.content.Context
import com.zaneschepke.wireguardautotunnel.R
enum class NotificationAction {
TUNNEL_OFF,
AUTO_TUNNEL_OFF,
;
fun title(context: Context): String {
return when (this) {
TUNNEL_OFF -> context.getString(R.string.stop)
AUTO_TUNNEL_OFF -> context.getString(R.string.stop)
}
}
}

View File

@ -2,21 +2,32 @@ package com.zaneschepke.wireguardautotunnel.service.notification
import android.app.Notification import android.app.Notification
import android.app.NotificationManager import android.app.NotificationManager
import android.app.PendingIntent import android.content.Context
import androidx.core.app.NotificationCompat
import com.zaneschepke.wireguardautotunnel.service.notification.WireGuardNotification.NotificationChannels
interface NotificationService { interface NotificationService {
val context: Context
fun createNotification( fun createNotification(
channelId: String, channel: NotificationChannels,
channelName: String,
title: String = "", title: String = "",
action: PendingIntent? = null, actions: Collection<NotificationCompat.Action> = emptyList(),
actionText: String? = null, description: String = "",
description: String,
showTimestamp: Boolean = false, showTimestamp: Boolean = false,
importance: Int = NotificationManager.IMPORTANCE_HIGH, importance: Int = NotificationManager.IMPORTANCE_HIGH,
vibration: Boolean = false,
onGoing: Boolean = true, onGoing: Boolean = true,
lights: Boolean = true,
onlyAlertOnce: Boolean = true, onlyAlertOnce: Boolean = true,
): Notification ): Notification
fun createNotificationAction(action: NotificationAction): NotificationCompat.Action
fun remove(notificationId: Int)
fun show(notificationId: Int, notification: Notification)
companion object {
const val KERNEL_SERVICE_NOTIFICATION_ID = 123
const val AUTO_TUNNEL_NOTIFICATION_ID = 122
const val VPN_NOTIFICATION_ID = 100
}
} }

View File

@ -1,105 +1,134 @@
package com.zaneschepke.wireguardautotunnel.service.notification package com.zaneschepke.wireguardautotunnel.service.notification
import android.Manifest
import android.app.Notification import android.app.Notification
import android.app.NotificationChannel import android.app.NotificationChannel
import android.app.NotificationManager import android.app.NotificationManager
import android.app.PendingIntent import android.app.PendingIntent
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.pm.PackageManager
import android.graphics.Color import android.graphics.Color
import androidx.core.app.ActivityCompat
import androidx.core.app.NotificationCompat import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import com.zaneschepke.wireguardautotunnel.R import com.zaneschepke.wireguardautotunnel.R
import com.zaneschepke.wireguardautotunnel.ui.MainActivity import com.zaneschepke.wireguardautotunnel.receiver.NotificationActionReceiver
import dagger.hilt.android.qualifiers.ApplicationContext import dagger.hilt.android.qualifiers.ApplicationContext
import javax.inject.Inject import javax.inject.Inject
class WireGuardNotification class WireGuardNotification
@Inject @Inject
constructor( constructor(
@ApplicationContext private val context: Context, @ApplicationContext override val context: Context,
) : ) : NotificationService {
NotificationService {
private val notificationManager =
context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
private val watcherBuilder: NotificationCompat.Builder = enum class NotificationChannels {
VPN,
AUTO_TUNNEL,
}
private val notificationManager = NotificationManagerCompat.from(context)
override fun createNotification(
channel: NotificationChannels,
title: String,
actions: Collection<NotificationCompat.Action>,
description: String,
showTimestamp: Boolean,
importance: Int,
onGoing: Boolean,
onlyAlertOnce: Boolean,
): Notification {
notificationManager.createNotificationChannel(channel.asChannel())
return channel.asBuilder().apply {
actions.forEach {
addAction(it)
}
setContentTitle(title)
setContentText(description)
setOnlyAlertOnce(onlyAlertOnce)
setOngoing(onGoing)
setPriority(NotificationCompat.PRIORITY_HIGH)
setShowWhen(showTimestamp)
setSmallIcon(R.drawable.ic_launcher)
}.build()
}
override fun createNotificationAction(notificationAction: NotificationAction): NotificationCompat.Action {
val pendingIntent = PendingIntent.getBroadcast(
context,
0,
Intent(context, NotificationActionReceiver::class.java).apply {
action = notificationAction.name
},
PendingIntent.FLAG_IMMUTABLE,
)
return NotificationCompat.Action.Builder(
R.drawable.ic_launcher,
notificationAction.title(context).uppercase(),
pendingIntent,
).build()
}
override fun remove(notificationId: Int) {
notificationManager.cancel(notificationId)
}
override fun show(notificationId: Int, notification: Notification) {
with(notificationManager) {
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) {
return
}
notify(notificationId, notification)
}
}
fun NotificationChannels.asBuilder(): NotificationCompat.Builder {
return when (this) {
NotificationChannels.VPN -> {
NotificationCompat.Builder( NotificationCompat.Builder(
context, context,
context.getString(R.string.watcher_channel_id), context.getString(R.string.auto_tunnel_channel_id),
) )
private val tunnelBuilder: NotificationCompat.Builder = }
NotificationChannels.AUTO_TUNNEL -> {
NotificationCompat.Builder( NotificationCompat.Builder(
context, context,
context.getString(R.string.vpn_channel_id), context.getString(R.string.vpn_channel_id),
) )
}
}
}
override fun createNotification( fun NotificationChannels.asChannel(): NotificationChannel {
channelId: String, return when (this) {
channelName: String, NotificationChannels.VPN -> {
title: String,
action: PendingIntent?,
actionText: String?,
description: String,
showTimestamp: Boolean,
importance: Int,
vibration: Boolean,
onGoing: Boolean,
lights: Boolean,
onlyAlertOnce: Boolean,
): Notification {
val channel =
NotificationChannel( NotificationChannel(
channelId, context.getString(R.string.vpn_channel_id),
channelName, context.getString(R.string.vpn_channel_name),
importance, NotificationManager.IMPORTANCE_HIGH,
) ).apply {
.let { description = context.getString(R.string.vpn_channel_description)
it.description = title enableLights(true)
it.enableLights(lights) lightColor = Color.WHITE
it.lightColor = Color.RED enableVibration(false)
it.enableVibration(vibration) vibrationPattern = longArrayOf(100, 200, 300)
it.vibrationPattern = longArrayOf(100, 200, 300) }
it }
} NotificationChannels.AUTO_TUNNEL -> {
notificationManager.createNotificationChannel(channel) NotificationChannel(
val pendingIntent: PendingIntent = context.getString(R.string.auto_tunnel_channel_id),
Intent(context, MainActivity::class.java).let { notificationIntent -> context.getString(R.string.auto_tunnel_channel_name),
PendingIntent.getActivity( NotificationManager.IMPORTANCE_HIGH,
context, ).apply {
0, description = context.getString(R.string.auto_tunnel_channel_description)
notificationIntent, enableLights(true)
PendingIntent.FLAG_IMMUTABLE, lightColor = Color.WHITE
) enableVibration(false)
} vibrationPattern = longArrayOf(100, 200, 300)
val builder =
when (channelId) {
context.getString(R.string.watcher_channel_id) -> watcherBuilder
context.getString(R.string.vpn_channel_id) -> tunnelBuilder
else -> {
NotificationCompat.Builder(
context,
channelId,
)
} }
} }
return builder.let {
if (action != null && actionText != null) {
it.addAction(
NotificationCompat.Action.Builder(0, actionText, action).build(),
)
it.setAutoCancel(true)
}
it.setContentTitle(title)
.setContentText(description)
.setOnlyAlertOnce(onlyAlertOnce)
.setContentIntent(pendingIntent)
.setOngoing(onGoing)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setShowWhen(showTimestamp)
.setSmallIcon(R.drawable.ic_launcher)
.build()
} }
} }
} }

View File

@ -1,24 +1,18 @@
package com.zaneschepke.wireguardautotunnel.service.tile package com.zaneschepke.wireguardautotunnel.service.tile
import android.content.Intent
import android.os.IBinder
import android.service.quicksettings.Tile import android.service.quicksettings.Tile
import android.service.quicksettings.TileService import android.service.quicksettings.TileService
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.LifecycleRegistry
import androidx.lifecycle.lifecycleScope
import com.zaneschepke.wireguardautotunnel.data.repository.AppDataRepository import com.zaneschepke.wireguardautotunnel.data.repository.AppDataRepository
import com.zaneschepke.wireguardautotunnel.module.ApplicationScope import com.zaneschepke.wireguardautotunnel.module.ApplicationScope
import com.zaneschepke.wireguardautotunnel.service.foreground.ServiceManager import com.zaneschepke.wireguardautotunnel.service.foreground.ServiceManager
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import timber.log.Timber
import javax.inject.Inject import javax.inject.Inject
@AndroidEntryPoint @AndroidEntryPoint
class AutoTunnelControlTile : TileService(), LifecycleOwner { class AutoTunnelControlTile : TileService() {
@Inject @Inject
lateinit var appDataRepository: AppDataRepository lateinit var appDataRepository: AppDataRepository
@ -29,32 +23,26 @@ class AutoTunnelControlTile : TileService(), LifecycleOwner {
@ApplicationScope @ApplicationScope
lateinit var applicationScope: CoroutineScope lateinit var applicationScope: CoroutineScope
private val lifecycleRegistry: LifecycleRegistry = LifecycleRegistry(this)
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_CREATE) serviceManager.autoTunnelTile.complete(this)
}
override fun onStopListening() {
lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_STOP)
} }
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_DESTROY) serviceManager.autoTunnelTile = CompletableDeferred()
} }
override fun onStartListening() { override fun onStartListening() {
super.onStartListening() super.onStartListening()
lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_START) serviceManager.autoTunnelTile.complete(this)
lifecycleScope.launch { applicationScope.launch {
if (appDataRepository.tunnels.getAll().isEmpty()) return@launch setUnavailable() if (appDataRepository.tunnels.getAll().isEmpty()) return@launch setUnavailable()
updateTileState() updateTileState()
} }
} }
private fun updateTileState() { fun updateTileState() {
serviceManager.autoTunnelActive.value.let { serviceManager.autoTunnelActive.value.let {
if (it) setActive() else setInactive() if (it) setActive() else setInactive()
} }
@ -63,7 +51,7 @@ class AutoTunnelControlTile : TileService(), LifecycleOwner {
override fun onClick() { override fun onClick() {
super.onClick() super.onClick()
unlockAndRun { unlockAndRun {
lifecycleScope.launch { applicationScope.launch {
if (serviceManager.autoTunnelActive.value) { if (serviceManager.autoTunnelActive.value) {
serviceManager.stopAutoTunnel() serviceManager.stopAutoTunnel()
setInactive() setInactive()
@ -95,18 +83,4 @@ class AutoTunnelControlTile : TileService(), LifecycleOwner {
qsTile.updateTile() qsTile.updateTile()
} }
} }
/* This works around an annoying unsolved frameworks bug some people are hitting. */
override fun onBind(intent: Intent): IBinder? {
var ret: IBinder? = null
try {
ret = super.onBind(intent)
} catch (_: Throwable) {
Timber.e("Failed to bind to TunnelControlTile")
}
return ret
}
override val lifecycle: Lifecycle
get() = lifecycleRegistry
} }

View File

@ -1,27 +1,22 @@
package com.zaneschepke.wireguardautotunnel.service.tile package com.zaneschepke.wireguardautotunnel.service.tile
import android.content.Intent
import android.os.Build import android.os.Build
import android.os.IBinder
import android.service.quicksettings.Tile import android.service.quicksettings.Tile
import android.service.quicksettings.TileService import android.service.quicksettings.TileService
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.LifecycleRegistry
import androidx.lifecycle.lifecycleScope
import com.zaneschepke.wireguardautotunnel.data.domain.TunnelConfig import com.zaneschepke.wireguardautotunnel.data.domain.TunnelConfig
import com.zaneschepke.wireguardautotunnel.data.repository.AppDataRepository import com.zaneschepke.wireguardautotunnel.data.repository.AppDataRepository
import com.zaneschepke.wireguardautotunnel.module.ApplicationScope import com.zaneschepke.wireguardautotunnel.module.ApplicationScope
import com.zaneschepke.wireguardautotunnel.service.foreground.ServiceManager
import com.zaneschepke.wireguardautotunnel.service.tunnel.TunnelService import com.zaneschepke.wireguardautotunnel.service.tunnel.TunnelService
import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import timber.log.Timber
import javax.inject.Inject import javax.inject.Inject
import javax.inject.Provider import javax.inject.Provider
@AndroidEntryPoint @AndroidEntryPoint
class TunnelControlTile : TileService(), LifecycleOwner { class TunnelControlTile : TileService() {
@Inject @Inject
lateinit var appDataRepository: AppDataRepository lateinit var appDataRepository: AppDataRepository
@ -32,33 +27,29 @@ class TunnelControlTile : TileService(), LifecycleOwner {
@ApplicationScope @ApplicationScope
lateinit var applicationScope: CoroutineScope lateinit var applicationScope: CoroutineScope
private val lifecycleRegistry: LifecycleRegistry = LifecycleRegistry(this) @Inject
lateinit var serviceManager: ServiceManager
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_CREATE) serviceManager.tunnelControlTile.complete(this)
}
override fun onStopListening() {
lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_STOP)
} }
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_DESTROY) serviceManager.tunnelControlTile = CompletableDeferred()
} }
override fun onStartListening() { override fun onStartListening() {
super.onStartListening() super.onStartListening()
lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_START) serviceManager.tunnelControlTile.complete(this)
Timber.d("Updating tile!") applicationScope.launch {
lifecycleScope.launch {
if (appDataRepository.tunnels.getAll().isEmpty()) return@launch setUnavailable() if (appDataRepository.tunnels.getAll().isEmpty()) return@launch setUnavailable()
updateTileState() updateTileState()
} }
} }
private suspend fun updateTileState() { fun updateTileState() = applicationScope.launch {
val lastActive = appDataRepository.getStartTunnelConfig() val lastActive = appDataRepository.getStartTunnelConfig()
lastActive?.let { lastActive?.let {
updateTile(it) updateTile(it)
@ -68,7 +59,7 @@ class TunnelControlTile : TileService(), LifecycleOwner {
override fun onClick() { override fun onClick() {
super.onClick() super.onClick()
unlockAndRun { unlockAndRun {
lifecycleScope.launch { applicationScope.launch {
val lastActive = appDataRepository.getStartTunnelConfig() val lastActive = appDataRepository.getStartTunnelConfig()
lastActive?.let { tunnel -> lastActive?.let { tunnel ->
if (tunnel.isActive) { if (tunnel.isActive) {
@ -125,18 +116,4 @@ class TunnelControlTile : TileService(), LifecycleOwner {
} }
} }
} }
/* This works around an annoying unsolved frameworks bug some people are hitting. */
override fun onBind(intent: Intent): IBinder? {
var ret: IBinder? = null
try {
ret = super.onBind(intent)
} catch (_: Throwable) {
Timber.e("Failed to bind to TunnelControlTile")
}
return ret
}
override val lifecycle: Lifecycle
get() = lifecycleRegistry
} }

View File

@ -9,6 +9,8 @@ import com.zaneschepke.wireguardautotunnel.module.ApplicationScope
import com.zaneschepke.wireguardautotunnel.module.IoDispatcher import com.zaneschepke.wireguardautotunnel.module.IoDispatcher
import com.zaneschepke.wireguardautotunnel.module.Kernel import com.zaneschepke.wireguardautotunnel.module.Kernel
import com.zaneschepke.wireguardautotunnel.service.foreground.ServiceManager import com.zaneschepke.wireguardautotunnel.service.foreground.ServiceManager
import com.zaneschepke.wireguardautotunnel.service.notification.NotificationService
import com.zaneschepke.wireguardautotunnel.service.notification.WireGuardNotification
import com.zaneschepke.wireguardautotunnel.service.tunnel.statistics.AmneziaStatistics import com.zaneschepke.wireguardautotunnel.service.tunnel.statistics.AmneziaStatistics
import com.zaneschepke.wireguardautotunnel.service.tunnel.statistics.TunnelStatistics import com.zaneschepke.wireguardautotunnel.service.tunnel.statistics.TunnelStatistics
import com.zaneschepke.wireguardautotunnel.service.tunnel.statistics.WireGuardStatistics import com.zaneschepke.wireguardautotunnel.service.tunnel.statistics.WireGuardStatistics
@ -27,6 +29,9 @@ import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock import kotlinx.coroutines.sync.withLock
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import org.amnezia.awg.backend.Tunnel import org.amnezia.awg.backend.Tunnel
import com.zaneschepke.wireguardautotunnel.R
import com.zaneschepke.wireguardautotunnel.service.notification.NotificationAction
import com.zaneschepke.wireguardautotunnel.service.notification.NotificationService.Companion.VPN_NOTIFICATION_ID
import timber.log.Timber import timber.log.Timber
import javax.inject.Inject import javax.inject.Inject
import javax.inject.Provider import javax.inject.Provider
@ -41,6 +46,7 @@ constructor(
@ApplicationScope private val applicationScope: CoroutineScope, @ApplicationScope private val applicationScope: CoroutineScope,
@IoDispatcher private val ioDispatcher: CoroutineDispatcher, @IoDispatcher private val ioDispatcher: CoroutineDispatcher,
private val serviceManager: ServiceManager, private val serviceManager: ServiceManager,
private val notificationService: NotificationService,
) : TunnelService { ) : TunnelService {
private val _vpnState = MutableStateFlow(VpnState()) private val _vpnState = MutableStateFlow(VpnState())
@ -116,6 +122,16 @@ constructor(
setState(tunnelConfig, TunnelState.UP).onSuccess { setState(tunnelConfig, TunnelState.UP).onSuccess {
startActiveTunnelJobs() startActiveTunnelJobs()
if (it.isUp()) appDataRepository.tunnels.save(tunnelConfig.copy(isActive = true)) if (it.isUp()) appDataRepository.tunnels.save(tunnelConfig.copy(isActive = true))
with(notificationService) {
val notification = createNotification(
WireGuardNotification.NotificationChannels.VPN,
title = "${context.getString(R.string.tunnel_running)} - ${tunnelConfig.name}",
actions = listOf(
notificationService.createNotificationAction(NotificationAction.TUNNEL_OFF),
),
)
show(VPN_NOTIFICATION_ID, notification)
}
updateTunnelState(it, tunnelConfig) updateTunnelState(it, tunnelConfig)
} }
}.onFailure { }.onFailure {
@ -134,6 +150,7 @@ constructor(
setState(tunnelConfig, TunnelState.DOWN).onSuccess { setState(tunnelConfig, TunnelState.DOWN).onSuccess {
updateTunnelState(it, null) updateTunnelState(it, null)
onStop(tunnelConfig) onStop(tunnelConfig)
notificationService.remove(VPN_NOTIFICATION_ID)
stopBackgroundService() stopBackgroundService()
}.onFailure { }.onFailure {
Timber.e(it) Timber.e(it)
@ -161,9 +178,7 @@ constructor(
} }
callback() callback()
} }
is Backend -> { is Backend -> callback()
callback()
}
} }
} }
@ -181,9 +196,7 @@ constructor(
is org.amnezia.awg.backend.Backend -> { is org.amnezia.awg.backend.Backend -> {
backend.backendState.asBackendState() backend.backendState.asBackendState()
} }
is Backend -> { is Backend -> BackendState.SERVICE_ACTIVE
BackendState.SERVICE_ACTIVE
}
else -> BackendState.INACTIVE else -> BackendState.INACTIVE
} }
} }
@ -213,12 +226,12 @@ constructor(
private suspend fun startBackgroundService() { private suspend fun startBackgroundService() {
serviceManager.startBackgroundService() serviceManager.startBackgroundService()
serviceManager.requestTunnelTileUpdate() serviceManager.updateTunnelTile()
} }
private fun stopBackgroundService() { private fun stopBackgroundService() {
serviceManager.stopBackgroundService() serviceManager.stopBackgroundService()
serviceManager.requestTunnelTileUpdate() serviceManager.updateTunnelTile()
} }
private suspend fun onBeforeStart(background: Boolean) { private suspend fun onBeforeStart(background: Boolean) {
@ -320,14 +333,14 @@ constructor(
_vpnState.update { _vpnState.update {
it.copy(status = TunnelState.from(newState)) it.copy(status = TunnelState.from(newState))
} }
serviceManager.requestTunnelTileUpdate() serviceManager.updateTunnelTile()
} }
override fun onStateChange(state: State) { override fun onStateChange(state: State) {
_vpnState.update { _vpnState.update {
it.copy(status = TunnelState.from(state)) it.copy(status = TunnelState.from(state))
} }
serviceManager.requestTunnelTileUpdate() serviceManager.updateTunnelTile()
} }
companion object { companion object {

View File

@ -159,18 +159,7 @@ constructor(
} }
fun onToggleAutoTunnel() = viewModelScope.launch { fun onToggleAutoTunnel() = viewModelScope.launch {
val settings = appDataRepository.settings.getSettings() serviceManager.toggleAutoTunnel(false)
val toggled = !settings.isAutoTunnelEnabled
if (toggled) {
serviceManager.startAutoTunnel(false)
} else {
serviceManager.stopAutoTunnel()
}
appDataRepository.settings.save(
settings.copy(
isAutoTunnelEnabled = toggled,
),
)
} }
private suspend fun saveTunnelsFromZipUri(uri: Uri, context: Context) { private suspend fun saveTunnelsFromZipUri(uri: Uri, context: Context) {

View File

@ -81,7 +81,6 @@
<string name="version">Version</string> <string name="version">Version</string>
<string name="settings">Einstellungen</string> <string name="settings">Einstellungen</string>
<string name="support">Unterstützung</string> <string name="support">Unterstützung</string>
<string name="watcher_channel_id">Wächterkanal</string>
<string name="error_authentication_failed">Authentifizierung fehlgeschlagen</string> <string name="error_authentication_failed">Authentifizierung fehlgeschlagen</string>
<string name="export_configs">Konfigurationen exportieren</string> <string name="export_configs">Konfigurationen exportieren</string>
<string name="unknown_error">Unbekannter Fehler aufgetreten</string> <string name="unknown_error">Unbekannter Fehler aufgetreten</string>
@ -99,7 +98,6 @@
<string name="set_primary_tunnel">Als Primären Tunnel setzen</string> <string name="set_primary_tunnel">Als Primären Tunnel setzen</string>
<string name="vpn_channel_id">VPN Kanal</string> <string name="vpn_channel_id">VPN Kanal</string>
<string name="vpn_channel_name">VPN Benachrichtigungskanal</string> <string name="vpn_channel_name">VPN Benachrichtigungskanal</string>
<string name="watcher_channel_name">Wächterbenachrichtigungskanal</string>
<string name="turn_off_tunnel">Aktion erfordert deaktivierten Tunnel</string> <string name="turn_off_tunnel">Aktion erfordert deaktivierten Tunnel</string>
<string name="kernel">Kernel</string> <string name="kernel">Kernel</string>
<string name="use_kernel">Kernelmodul verwenden</string> <string name="use_kernel">Kernelmodul verwenden</string>

View File

@ -101,8 +101,6 @@
<string name="app_name">WG Tunnel</string> <string name="app_name">WG Tunnel</string>
<string name="vpn_channel_id">Canal VPN</string> <string name="vpn_channel_id">Canal VPN</string>
<string name="vpn_channel_name">Canal de notificación VPN</string> <string name="vpn_channel_name">Canal de notificación VPN</string>
<string name="watcher_channel_id">Canal del obvervador</string>
<string name="watcher_channel_name">Canal de notificación del obvervador</string>
<string name="prominent_background_location_message">La monitorización SSID Wi-Fi necesita de permiso de ubicación en segundo plano incluso si la app está cerrada. Mira el enlace a la Política de Privacidad en la pantalla de ayuda para más detalles.</string> <string name="prominent_background_location_message">La monitorización SSID Wi-Fi necesita de permiso de ubicación en segundo plano incluso si la app está cerrada. Mira el enlace a la Política de Privacidad en la pantalla de ayuda para más detalles.</string>
<string name="junk_packet_count">Recuento de paquetes basura</string> <string name="junk_packet_count">Recuento de paquetes basura</string>
<string name="junk_packet_minimum_size">Tamaño mínimo del paquete basura</string> <string name="junk_packet_minimum_size">Tamaño mínimo del paquete basura</string>

View File

@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="vpn_channel_id">Canal VPN</string> <string name="vpn_channel_id">Canal VPN</string>
<string name="watcher_channel_id">Canal de surveillance</string>
<string name="watcher_channel_name">Canal de notification de surveillance</string>
<string name="turn_off_tunnel">Cette action nécessite la désactivation du tunnel</string> <string name="turn_off_tunnel">Cette action nécessite la désactivation du tunnel</string>
<string name="no_tunnels">Aucun tunnel n\'a été ajouté pour le moment!</string> <string name="no_tunnels">Aucun tunnel n\'a été ajouté pour le moment!</string>
<string name="tunnels">Tunnels</string> <string name="tunnels">Tunnels</string>

View File

@ -6,7 +6,6 @@
<string name="kernel">Kernel</string> <string name="kernel">Kernel</string>
<string name="init_packet_junk_size">Ukuran sampah paket init</string> <string name="init_packet_junk_size">Ukuran sampah paket init</string>
<string name="app_name">WG Tunnel</string> <string name="app_name">WG Tunnel</string>
<string name="watcher_channel_name">Notifikasi Saluran Pengamat</string>
<string name="error_file_extension">File bukan .conf atau .zip</string> <string name="error_file_extension">File bukan .conf atau .zip</string>
<string name="turn_off_tunnel">Aksi memerlukan tunnel mati</string> <string name="turn_off_tunnel">Aksi memerlukan tunnel mati</string>
<string name="no_tunnels">Belum ada tunnel yang ditambahkan!</string> <string name="no_tunnels">Belum ada tunnel yang ditambahkan!</string>
@ -99,7 +98,6 @@
<string name="handshake">handshake</string> <string name="handshake">handshake</string>
<string name="vpn_channel_id">Saluran VPN</string> <string name="vpn_channel_id">Saluran VPN</string>
<string name="vpn_channel_name">Notifikasi Saluran VPN</string> <string name="vpn_channel_name">Notifikasi Saluran VPN</string>
<string name="watcher_channel_id">Saluran Pengamat</string>
<string name="prominent_background_location_message">Fitur ini memerlukan izin lokasi latar belakang untuk mengaktifkan pemantauan SSID Wi-Fi bahkan saat aplikasi ditutup. Untuk detail lebih lanjut, silakan lihat Kebijakan Privasi yang ditautkan di layar Dukungan.</string> <string name="prominent_background_location_message">Fitur ini memerlukan izin lokasi latar belakang untuk mengaktifkan pemantauan SSID Wi-Fi bahkan saat aplikasi ditutup. Untuk detail lebih lanjut, silakan lihat Kebijakan Privasi yang ditautkan di layar Dukungan.</string>
<string name="copy_public_key">Salin kunci publik</string> <string name="copy_public_key">Salin kunci publik</string>
<string name="base64_key">kunci base64</string> <string name="base64_key">kunci base64</string>

View File

@ -15,8 +15,6 @@
<string name="icon">Icoon</string> <string name="icon">Icoon</string>
<string name="include">Meenemen</string> <string name="include">Meenemen</string>
<string name="addresses">Adres</string> <string name="addresses">Adres</string>
<string name="watcher_channel_id">Watcher Kanaal</string>
<string name="watcher_channel_name">Watcher Notificatiekanaal</string>
<string name="peer">Peer (extern systeem)</string> <string name="peer">Peer (extern systeem)</string>
<string name="allowed_ips">Allowed IPs</string> <string name="allowed_ips">Allowed IPs</string>
<string name="always_on_vpn_support">Altijd-aan VPN toestaan</string> <string name="always_on_vpn_support">Altijd-aan VPN toestaan</string>

View File

@ -99,8 +99,6 @@
<string name="app_name">WG Tunnel</string> <string name="app_name">WG Tunnel</string>
<string name="vpn_channel_id">Canal de VPN</string> <string name="vpn_channel_id">Canal de VPN</string>
<string name="vpn_channel_name">Canal de notificações VPN</string> <string name="vpn_channel_name">Canal de notificações VPN</string>
<string name="watcher_channel_id">Canal de vigia</string>
<string name="watcher_channel_name">Canal de notificações de vigia</string>
<string name="prominent_background_location_message">Este recurso precisa de permissões de localização em segundo plano para ativar o monitoramento do SSID da rede Wi-Fi mesmo quando a aplicação está fechado. Para mais pormenores, por favor veja a Política de Privacidade no ecrã de Suporte.</string> <string name="prominent_background_location_message">Este recurso precisa de permissões de localização em segundo plano para ativar o monitoramento do SSID da rede Wi-Fi mesmo quando a aplicação está fechado. Para mais pormenores, por favor veja a Política de Privacidade no ecrã de Suporte.</string>
<string name="trusted_ssid_value_description">Envie o SSID</string> <string name="trusted_ssid_value_description">Envie o SSID</string>
<string name="add_tunnels_text">Adicionar a partir de ficheiro ou zip</string> <string name="add_tunnels_text">Adicionar a partir de ficheiro ou zip</string>

View File

@ -110,8 +110,6 @@
<string name="error_file_format">Formato de configuração inválido</string> <string name="error_file_format">Formato de configuração inválido</string>
<string name="vpn_channel_id">Canal de VPN</string> <string name="vpn_channel_id">Canal de VPN</string>
<string name="vpn_channel_name">Canal de notificações VPN</string> <string name="vpn_channel_name">Canal de notificações VPN</string>
<string name="watcher_channel_id">Canal de vigia</string>
<string name="watcher_channel_name">Canal de notificações de vigia</string>
<string name="db_name">wg-tunnel-db</string> <string name="db_name">wg-tunnel-db</string>
<string name="set_custom_ping_ip">Definir ip ping personalizado</string> <string name="set_custom_ping_ip">Definir ip ping personalizado</string>
<string name="vpn_denied_dialog_title">Permissão negada</string> <string name="vpn_denied_dialog_title">Permissão negada</string>

View File

@ -63,8 +63,6 @@
<string name="app_name">WG Tunnel</string> <string name="app_name">WG Tunnel</string>
<string name="vpn_channel_id">Канал VPN</string> <string name="vpn_channel_id">Канал VPN</string>
<string name="vpn_channel_name">Канал уведомлений VPN</string> <string name="vpn_channel_name">Канал уведомлений VPN</string>
<string name="watcher_channel_id">Канал наблюдателя</string>
<string name="watcher_channel_name">Канал уведомлений наблюдателя</string>
<string name="tunnels">Туннели</string> <string name="tunnels">Туннели</string>
<string name="okay">Хорошо</string> <string name="okay">Хорошо</string>
<string name="prominent_background_location_title">Фоновая передача местоположения</string> <string name="prominent_background_location_title">Фоновая передача местоположения</string>

View File

@ -3,8 +3,6 @@
<string name="app_name">WG Tunnel</string> <string name="app_name">WG Tunnel</string>
<string name="vpn_channel_id">VPN Kanalı</string> <string name="vpn_channel_id">VPN Kanalı</string>
<string name="vpn_channel_name">VPN Bildirim Kanalı</string> <string name="vpn_channel_name">VPN Bildirim Kanalı</string>
<string name="watcher_channel_id">İzleyici Kanalı</string>
<string name="watcher_channel_name">İzleyici Bildirim Kanalı</string>
<string name="github_url" translatable="false">https://github.com/zaneschepke/wgtunnel/issues</string> <string name="github_url" translatable="false">https://github.com/zaneschepke/wgtunnel/issues</string>
<string name="docs_url" translatable="false">https://zaneschepke.com/wgtunnel-docs/overview.html</string> <string name="docs_url" translatable="false">https://zaneschepke.com/wgtunnel-docs/overview.html</string>
<string name="privacy_policy_url" translatable="false">https://zaneschepke.com/wgtunnel-docs/privacypolicy.html</string> <string name="privacy_policy_url" translatable="false">https://zaneschepke.com/wgtunnel-docs/privacypolicy.html</string>

View File

@ -97,12 +97,10 @@
<string name="no_browser_detected">没有安装浏览器</string> <string name="no_browser_detected">没有安装浏览器</string>
<string name="incorrect_pin">密码不正确</string> <string name="incorrect_pin">密码不正确</string>
<string name="set_custom_ping_ip">自定义 Ping 的目标 ip</string> <string name="set_custom_ping_ip">自定义 Ping 的目标 ip</string>
<string name="watcher_channel_name">守护者通知频道</string>
<string name="vpn_channel_id">VPN 频道</string> <string name="vpn_channel_id">VPN 频道</string>
<string name="junk_packet_count">无效包计数</string> <string name="junk_packet_count">无效包计数</string>
<string name="app_name">WG Tunnel</string> <string name="app_name">WG Tunnel</string>
<string name="vpn_channel_name">VPN 通知频道</string> <string name="vpn_channel_name">VPN 通知频道</string>
<string name="watcher_channel_id">守护者频道</string>
<string name="open_issue">查看问题</string> <string name="open_issue">查看问题</string>
<string name="read_logs">查看日志</string> <string name="read_logs">查看日志</string>
<string name="auto">(自动)</string> <string name="auto">(自动)</string>

View File

@ -2,8 +2,6 @@
<string name="app_name">WG Tunnel</string> <string name="app_name">WG Tunnel</string>
<string name="vpn_channel_id">VPN Channel</string> <string name="vpn_channel_id">VPN Channel</string>
<string name="vpn_channel_name">VPN Notification Channel</string> <string name="vpn_channel_name">VPN Notification Channel</string>
<string name="watcher_channel_id">Watcher Channel</string>
<string name="watcher_channel_name">Watcher Notification Channel</string>
<string name="github_url" translatable="false">https://github.com/zaneschepke/wgtunnel/issues</string> <string name="github_url" translatable="false">https://github.com/zaneschepke/wgtunnel/issues</string>
<string name="docs_url" translatable="false">https://zaneschepke.com/wgtunnel-docs/overview.html</string> <string name="docs_url" translatable="false">https://zaneschepke.com/wgtunnel-docs/overview.html</string>
<string name="privacy_policy_url" translatable="false">https://zaneschepke.com/wgtunnel-docs/privacypolicy.html</string> <string name="privacy_policy_url" translatable="false">https://zaneschepke.com/wgtunnel-docs/privacypolicy.html</string>
@ -82,7 +80,7 @@
<string name="error_no_file_explorer">No file explorer installed</string> <string name="error_no_file_explorer">No file explorer installed</string>
<string name="error_invalid_code">Invalid QR code</string> <string name="error_invalid_code">Invalid QR code</string>
<string name="location_services_missing_message">The app is not detecting any location services enabled on your device. Depending on the device, this could cause the untrusted wifi feature to fail to read the wifi name. Would you like to continue anyways?</string> <string name="location_services_missing_message">The app is not detecting any location services enabled on your device. Depending on the device, this could cause the untrusted wifi feature to fail to read the wifi name. Would you like to continue anyways?</string>
<string name="auto_tunnel_title">Auto-tunnel Service</string> <string name="auto_tunnel_title">Auto-tunnel service</string>
<string name="delete_tunnel">Delete tunnel</string> <string name="delete_tunnel">Delete tunnel</string>
<string name="delete_tunnel_message">Are you sure you would like to delete this tunnel?</string> <string name="delete_tunnel_message">Are you sure you would like to delete this tunnel?</string>
<string name="yes">Yes</string> <string name="yes">Yes</string>
@ -187,4 +185,9 @@
<string name="kill_switch_options">Kill switch options</string> <string name="kill_switch_options">Kill switch options</string>
<string name="allow_lan_traffic">Allow LAN traffic</string> <string name="allow_lan_traffic">Allow LAN traffic</string>
<string name="bypass_lan_for_kill_switch">Bypass LAN for kill switch</string> <string name="bypass_lan_for_kill_switch">Bypass LAN for kill switch</string>
<string name="vpn_channel_description">A channel for VPN state notifications</string>
<string name="auto_tunnel_channel_id">Auto-tunnel Channel</string>
<string name="auto_tunnel_channel_name">Auto-tunnel Notification Channel</string>
<string name="auto_tunnel_channel_description">A channel for auto-tunnel state notifications</string>
<string name="stop">stop</string>
</resources> </resources>