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:
@@ -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"
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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 }
|
||||||
|
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -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))
|
||||||
|
|
||||||
|
|||||||
8
app/src/main/res/xml/network_security_config.xml
Normal file
8
app/src/main/res/xml/network_security_config.xml
Normal 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>
|
||||||
Reference in New Issue
Block a user