Compare commits

...

3 Commits

Author SHA1 Message Date
Mariya
da9a2296d6 Apk url for app update 2024-01-23 14:42:26 +05:30
Mariya
30fde87f95 Added version in login request 2024-01-22 13:12:06 +05:30
Mariya
47888172fd Added Branch for Api call version 2024-01-09 13:45:00 +05:30
4 changed files with 10 additions and 6 deletions

View File

@@ -8,5 +8,6 @@ data class LoginRequest(
val mode: String? = "", val mode: String? = "",
val password: String? = "", val password: String? = "",
val serialNumber: String? = "", val serialNumber: String? = "",
val username: String? = "" val username: String? = "",
val version: String? = "2.1.26"
) )

View File

@@ -58,11 +58,10 @@ class DashboardActivity : AppCompatActivity() {
hemocubeViewModel.deviceUpdate.observe(this) { result -> hemocubeViewModel.deviceUpdate.observe(this) { result ->
when (result) { when (result) {
is Result.Success -> { is Result.Success -> {
// Handle success
// val apkUrl = result.data // val apkUrl = result.data
val apkUrl = "https://dl.dropboxusercontent.com/s/fi/1c3nn7t0co431hicl3hrt/app-debug.apk?rlkey=e4uf13ty1dpcked614vy1aaqp&dl=0" val apkUrl = "https://dl.dropboxusercontent.com/s/fi/1c3nn7t0co431hicl3hrt/app-debug.apk?rlkey=e4uf13ty1dpcked614vy1aaqp&dl=0"
initiateUpdate(apkUrl) initiateUpdate(apkUrl.toString())
Log.d("ApI", "APK URL: $apkUrl") Log.d("ApI", "APK URL For App Update: $apkUrl")
Toast.makeText( Toast.makeText(
this, this,
"APK UPLOAD ${result.data}", "APK UPLOAD ${result.data}",
@@ -73,7 +72,7 @@ class DashboardActivity : AppCompatActivity() {
is Result.Error -> { is Result.Error -> {
result.exception.let { message -> result.exception.let { message ->
Toast.makeText(this, "An error occurred: $message", Toast.LENGTH_LONG) Toast.makeText(this, "An error occurred On Updating App: $message", Toast.LENGTH_LONG)
.show() .show()
} }

View File

@@ -52,6 +52,7 @@ class HomeFragment : Fragment() {
private val viewModel: TestRightViewModel by activityViewModels() private val viewModel: TestRightViewModel by activityViewModels()
private val hemoCubeViewModel: HemoCubeViewModel by activityViewModels() private val hemoCubeViewModel: HemoCubeViewModel by activityViewModels()
private lateinit var rvAdapter: UserListAdapter private lateinit var rvAdapter: UserListAdapter
private lateinit var sharedPreferences: SharedPreferences
private var batLevel: Int = private var batLevel: Int =
0 // Initialize with a default value, or obtain the actual battery level 0 // Initialize with a default value, or obtain the actual battery level
private lateinit var adapter: OfflineUserListAdapter private lateinit var adapter: OfflineUserListAdapter
@@ -240,6 +241,8 @@ class HomeFragment : Fragment() {
with(sharedPreference.edit()) { with(sharedPreference.edit()) {
putString(Constants.ACCESS_TOKEN, response.data.data?.accessToken) putString(Constants.ACCESS_TOKEN, response.data.data?.accessToken)
putString(Constants.NATS_TOKEN, response.data.data?.deviceUser?.natsToken) putString(Constants.NATS_TOKEN, response.data.data?.deviceUser?.natsToken)
putString(Constants.DEVICE_ID, response.data.data?.deviceUser?.deviceId?.toString())
apply() apply()
} }
} }
@@ -264,7 +267,7 @@ class HomeFragment : Fragment() {
private fun createDeviceRequestData(): DeviceUpdateRequest { private fun createDeviceRequestData(): DeviceUpdateRequest {
return DeviceUpdateRequest( return DeviceUpdateRequest(
serial_no = Constants.serialNumber serial_no = Constants.DEVICE_ID
) )
} }

View File

@@ -34,6 +34,7 @@ import com.example.hpostesting.data.model.updates.DeviceUpdateRequest
import com.example.hpostesting.data.repository.DatabaseRepository import com.example.hpostesting.data.repository.DatabaseRepository
import com.example.hpostesting.data.repository.Repository import com.example.hpostesting.data.repository.Repository
import com.example.hpostesting.domain.LogFileManager import com.example.hpostesting.domain.LogFileManager
import com.example.hpostesting.presentation.hemocube.HemoCubeFragmentDirections.Companion
import dagger.hilt.android.lifecycle.HiltViewModel import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.MediaType.Companion.toMediaTypeOrNull