fix: f-droid build warnings

This commit is contained in:
Zane Schepke 2023-09-15 13:03:35 -04:00
parent 6c30c6bae6
commit 413b9a37df
3 changed files with 18 additions and 5 deletions

View File

@ -30,6 +30,14 @@ android {
vectorDrawables {
useSupportLibrary = true
}
javaCompileOptions {
annotationProcessorOptions {
arguments += mapOf(
"room.schemaLocation" to "$projectDir/schemas",
"room.incremental" to "true"
)
}
}
}
buildTypes {

View File

@ -6,7 +6,7 @@ import androidx.room.TypeConverters
import com.zaneschepke.wireguardautotunnel.repository.model.Settings
import com.zaneschepke.wireguardautotunnel.repository.model.TunnelConfig
@Database(entities = [Settings::class, TunnelConfig::class], version = 1)
@Database(entities = [Settings::class, TunnelConfig::class], version = 1, exportSchema = true)
@TypeConverters(DatabaseListConverters::class)
abstract class AppDatabase : RoomDatabase() {
abstract fun settingDao(): SettingsDoa

View File

@ -81,13 +81,18 @@ class TunnelControlTile : TileService() {
private suspend fun determineTileTunnel() : TunnelConfig? {
var tunnelConfig : TunnelConfig? = null;
val settings = settingsRepo.getAll()
if (!settings.isNullOrEmpty()) {
if (settings.isNotEmpty()) {
val setting = settings.first()
tunnelConfig = if (setting.defaultTunnel != null) {
TunnelConfig.from(setting.defaultTunnel!!);
} else {
val config = configRepo.getAll()?.first();
config;
val configs = configRepo.getAll();
val config = if(configs.isNotEmpty()) {
configs.first();
} else {
null
}
config
}
}
return tunnelConfig;
@ -97,7 +102,7 @@ class TunnelControlTile : TileService() {
private fun attemptWatcherServiceToggle(tunnelConfig : String) {
scope.launch {
val settings = settingsRepo.getAll()
if (!settings.isNullOrEmpty()) {
if (settings.isNotEmpty()) {
val setting = settings.first()
if(setting.isAutoTunnelEnabled) {
ServiceManager.toggleWatcherServiceForeground(this@TunnelControlTile, tunnelConfig)