Refined network configuration and login UI

The login screen now labels the server input as "Server-Domain", and the network provider has been updated to automatically prepend the HTTPS protocol. The database version has been incremented, and a network security configuration has been added to allow user certificates for debugging. Additionally, the encrypted shared preferences storage name was updated.
This commit is contained in:
2026-03-03 16:30:21 +01:00
parent f3f83b7ca9
commit 37d8e8cc74
6 changed files with 13 additions and 5 deletions

View File

@@ -9,7 +9,7 @@
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:usesCleartextTraffic="true" android:networkSecurityConfig="@xml/network_security_config"
android:theme="@style/Theme.ShapPlanner"> android:theme="@style/Theme.ShapPlanner">
<activity <activity
android:name=".activities.MainActivity" android:name=".activities.MainActivity"

View File

@@ -12,7 +12,7 @@ class TokenStorage(context: Context) {
private val prefs = EncryptedSharedPreferences.create( private val prefs = EncryptedSharedPreferences.create(
context, context,
"wg_token_prefs", "wg_token_prefs2",
masterKey, masterKey,
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV, EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM

View File

@@ -8,7 +8,7 @@ import retrofit2.converter.gson.GsonConverterFactory
object RetrofitProvider { object RetrofitProvider {
fun create(serverUrl: String): APIService { fun create(serverUrl: String): APIService {
val base = if (serverUrl.endsWith("/")) serverUrl else "$serverUrl/" val base = if (serverUrl.endsWith("/")) "https://$serverUrl" else "https://$serverUrl/"
val logger = HttpLoggingInterceptor().apply { level = HttpLoggingInterceptor.Level.BASIC } val logger = HttpLoggingInterceptor().apply { level = HttpLoggingInterceptor.Level.BASIC }

View File

@@ -7,7 +7,7 @@ import androidx.room.RoomDatabase
import de.miaurizius.shap_planner.entities.Account import de.miaurizius.shap_planner.entities.Account
import de.miaurizius.shap_planner.entities.AccountDao import de.miaurizius.shap_planner.entities.AccountDao
@Database(entities = [Account::class], version = 3) @Database(entities = [Account::class], version = 4)
abstract class AppDatabase : RoomDatabase() { abstract class AppDatabase : RoomDatabase() {
abstract fun accountDao(): AccountDao abstract fun accountDao(): AccountDao
companion object { companion object {

View File

@@ -39,7 +39,7 @@ fun LoginScreen(onLogin: (String, String, String) -> Unit, onBack: (() -> Unit)?
TextField( TextField(
value = serverUrl, value = serverUrl,
onValueChange = { serverUrl = it }, onValueChange = { serverUrl = it },
label = { Text("Server-URL") } label = { Text("Server-Domain") }
) )
Spacer(modifier = Modifier.height(8.dp)) Spacer(modifier = Modifier.height(8.dp))

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<debug-overrides>
<trust-anchors>
<certificates src="user" />
</trust-anchors>
</debug-overrides>
</network-security-config>