feat: add api configuration settings

This commit is contained in:
Stefan Zollinger
2024-04-16 18:22:05 +02:00
parent 803ff2e41a
commit 83b120b1ce
9 changed files with 231 additions and 22 deletions

View File

@@ -1,5 +1,6 @@
package com.logitech.vc.kirbytest
import SettingsRepository
import android.annotation.SuppressLint
import android.bluetooth.BluetoothDevice
import android.bluetooth.BluetoothDevice.BOND_BONDED
@@ -38,9 +39,11 @@ class KirbyDevice(
private val connectionManager: ConnectionManager,
private val bleDevice: BluetoothDevice,
private val loggerDb: LoggerContract.LoggerDb,
private val settingsRepository: SettingsRepository,
private val onStateChange: (device: KirbyDevice) -> Unit,
) : BleListener(bleDevice.address), DeviceListEntry {
private val queue: RequestQueue = Volley.newRequestQueue(context)
@@ -164,10 +167,11 @@ class KirbyDevice(
}
private fun publishMeasurement(payload: String) {
val accessKey = BuildConfig.API_KEY
val url = BuildConfig.API_BASE_URL
val settings = settingsRepository.readSettings()
val accessKey = settings.apiKey
val url = settings.apiUrl
if(url.isEmpty()) {
if(url.isEmpty() || accessKey.isEmpty()) {
return
}