|
@@ -1,6 +1,9 @@
|
|
|
package com.example.modifier.ui.login
|
|
package com.example.modifier.ui.login
|
|
|
|
|
|
|
|
import android.content.Context
|
|
import android.content.Context
|
|
|
|
|
+import android.content.DialogInterface
|
|
|
|
|
+import android.content.Intent
|
|
|
|
|
+import android.provider.Settings
|
|
|
import android.util.Log
|
|
import android.util.Log
|
|
|
import androidx.datastore.core.DataStore
|
|
import androidx.datastore.core.DataStore
|
|
|
import androidx.datastore.preferences.core.Preferences
|
|
import androidx.datastore.preferences.core.Preferences
|
|
@@ -9,10 +12,12 @@ import androidx.datastore.preferences.core.stringPreferencesKey
|
|
|
import androidx.datastore.preferences.preferencesDataStore
|
|
import androidx.datastore.preferences.preferencesDataStore
|
|
|
import androidx.lifecycle.MutableLiveData
|
|
import androidx.lifecycle.MutableLiveData
|
|
|
import androidx.lifecycle.ViewModel
|
|
import androidx.lifecycle.ViewModel
|
|
|
|
|
+import com.example.modifier.Utils
|
|
|
import com.example.modifier.http.request.LoginRequest
|
|
import com.example.modifier.http.request.LoginRequest
|
|
|
import com.example.modifier.http.response.ErrorResponse
|
|
import com.example.modifier.http.response.ErrorResponse
|
|
|
import com.example.modifier.http.response.LoginResponse
|
|
import com.example.modifier.http.response.LoginResponse
|
|
|
import com.example.modifier.model.ServerConfig
|
|
import com.example.modifier.model.ServerConfig
|
|
|
|
|
+import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
|
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
|
|
import dagger.hilt.android.qualifiers.ApplicationContext
|
|
import dagger.hilt.android.qualifiers.ApplicationContext
|
|
|
import io.ktor.client.HttpClient
|
|
import io.ktor.client.HttpClient
|
|
@@ -26,10 +31,13 @@ import io.ktor.http.ContentType
|
|
|
import io.ktor.http.HttpStatusCode
|
|
import io.ktor.http.HttpStatusCode
|
|
|
import io.ktor.http.contentType
|
|
import io.ktor.http.contentType
|
|
|
import io.ktor.serialization.kotlinx.json.json
|
|
import io.ktor.serialization.kotlinx.json.json
|
|
|
|
|
+import kotlinx.coroutines.Dispatchers
|
|
|
|
|
+import kotlinx.coroutines.delay
|
|
|
import kotlinx.coroutines.flow.MutableStateFlow
|
|
import kotlinx.coroutines.flow.MutableStateFlow
|
|
|
import kotlinx.coroutines.flow.StateFlow
|
|
import kotlinx.coroutines.flow.StateFlow
|
|
|
import kotlinx.coroutines.flow.asStateFlow
|
|
import kotlinx.coroutines.flow.asStateFlow
|
|
|
import kotlinx.coroutines.flow.map
|
|
import kotlinx.coroutines.flow.map
|
|
|
|
|
+import kotlinx.coroutines.withContext
|
|
|
import kotlinx.serialization.json.Json
|
|
import kotlinx.serialization.json.Json
|
|
|
import javax.inject.Inject
|
|
import javax.inject.Inject
|
|
|
|
|
|
|
@@ -111,4 +119,8 @@ class LoginViewModel @Inject constructor() : ViewModel() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ suspend fun checkRootAccess() {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|