make it compile with kotlin 1.4
This commit is contained in:
parent
59afd03f95
commit
11f00d1776
26 changed files with 50 additions and 3 deletions
|
@ -99,6 +99,7 @@ class MainActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
private lateinit var binding: ActivityMainBinding
|
private lateinit var binding: ActivityMainBinding
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
Iconify.with(FontAwesomeModule())
|
Iconify.with(FontAwesomeModule())
|
||||||
|
@ -359,6 +360,7 @@ class MainActivity : NoSplashAppCompatActivity() {
|
||||||
// Correct place for calling setUserStats() would be probably MainApp
|
// Correct place for calling setUserStats() would be probably MainApp
|
||||||
// but we need to have it called at least once a day. Thus this location
|
// but we need to have it called at least once a day. Thus this location
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
private fun setUserStats() {
|
private fun setUserStats() {
|
||||||
if (!fabricPrivacy.fabricEnabled()) return
|
if (!fabricPrivacy.fabricEnabled()) return
|
||||||
val closedLoopEnabled = if (constraintChecker.isClosedLoopAllowed().value()) "CLOSED_LOOP_ENABLED" else "CLOSED_LOOP_DISABLED"
|
val closedLoopEnabled = if (constraintChecker.isClosedLoopAllowed().value()) "CLOSED_LOOP_ENABLED" else "CLOSED_LOOP_DISABLED"
|
||||||
|
|
|
@ -7,8 +7,10 @@ import javax.inject.Inject
|
||||||
class RequestDexcomPermissionActivity : DialogAppCompatActivity() {
|
class RequestDexcomPermissionActivity : DialogAppCompatActivity() {
|
||||||
@Inject lateinit var dexcomPlugin: DexcomPlugin
|
@Inject lateinit var dexcomPlugin: DexcomPlugin
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
private val requestCode = "AndroidAPS <3".map { it.code }.sum()
|
private val requestCode = "AndroidAPS <3".map { it.code }.sum()
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
requestPermissions(arrayOf(DexcomPlugin.PERMISSION), requestCode)
|
requestPermissions(arrayOf(DexcomPlugin.PERMISSION), requestCode)
|
||||||
|
|
|
@ -58,6 +58,7 @@ class OpenAPSAMAFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
|
||||||
|
@ -90,6 +91,7 @@ class OpenAPSAMAFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
private fun updateGUI() {
|
private fun updateGUI() {
|
||||||
if (_binding == null) return
|
if (_binding == null) return
|
||||||
openAPSAMAPlugin.lastAPSResult?.let { lastAPSResult ->
|
openAPSAMAPlugin.lastAPSResult?.let { lastAPSResult ->
|
||||||
|
|
|
@ -59,6 +59,7 @@ class OpenAPSSMBFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
disposable += rxBus
|
disposable += rxBus
|
||||||
|
@ -90,6 +91,7 @@ class OpenAPSSMBFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
fun updateGUI() {
|
fun updateGUI() {
|
||||||
if (_binding == null) return
|
if (_binding == null) return
|
||||||
openAPSSMBPlugin.lastAPSResult?.let { lastAPSResult ->
|
openAPSSMBPlugin.lastAPSResult?.let { lastAPSResult ->
|
||||||
|
|
|
@ -120,6 +120,7 @@ class ObjectivesPlugin @Inject constructor(
|
||||||
sp.putBoolean(R.string.key_objectiveusescale, false)
|
sp.putBoolean(R.string.key_objectiveusescale, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
fun completeObjectives(activity: FragmentActivity, request: String) {
|
fun completeObjectives(activity: FragmentActivity, request: String) {
|
||||||
val requestCode = sp.getString(R.string.key_objectives_request_code, "")
|
val requestCode = sp.getString(R.string.key_objectives_request_code, "")
|
||||||
var url = sp.getString(R.string.key_nsclientinternal_url, "").lowercase(Locale.getDefault())
|
var url = sp.getString(R.string.key_nsclientinternal_url, "").lowercase(Locale.getDefault())
|
||||||
|
|
|
@ -5,7 +5,6 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin
|
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin
|
import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.services.NSClientService
|
|
||||||
import info.nightscout.androidaps.utils.T
|
import info.nightscout.androidaps.utils.T
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ -30,6 +29,7 @@ class Objective3 @Inject constructor(injector: HasAndroidInjector) : Objective(i
|
||||||
override fun specialActionEnabled(): Boolean =
|
override fun specialActionEnabled(): Boolean =
|
||||||
nsClientPlugin.nsClientService?.isConnected == true && nsClientPlugin.nsClientService?.hasWriteAuth == true
|
nsClientPlugin.nsClientService?.isConnected == true && nsClientPlugin.nsClientService?.hasWriteAuth == true
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
override fun specialAction(activity: FragmentActivity, input: String) {
|
override fun specialAction(activity: FragmentActivity, input: String) {
|
||||||
objectivesPlugin.completeObjectives(activity, input)
|
objectivesPlugin.completeObjectives(activity, input)
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,6 +152,7 @@ class SignatureVerifierPlugin @Inject constructor(
|
||||||
return sb.toString()
|
return sb.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
fun singleCharUnMap(shortHash: String): String {
|
fun singleCharUnMap(shortHash: String): String {
|
||||||
val array = ByteArray(shortHash.length)
|
val array = ByteArray(shortHash.length)
|
||||||
val sb = StringBuilder()
|
val sb = StringBuilder()
|
||||||
|
|
|
@ -67,6 +67,7 @@ class FoodFragment : DaggerFragment() {
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
|
@ -128,6 +129,7 @@ class FoodFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
disposable.add(rxBus
|
disposable.add(rxBus
|
||||||
|
@ -139,6 +141,7 @@ class FoodFragment : DaggerFragment() {
|
||||||
swapAdapter()
|
swapAdapter()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
private fun swapAdapter() {
|
private fun swapAdapter() {
|
||||||
disposable += repository
|
disposable += repository
|
||||||
.getFoodData()
|
.getFoodData()
|
||||||
|
@ -199,6 +202,7 @@ class FoodFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
private fun filterData() {
|
private fun filterData() {
|
||||||
val textFilter = binding.filter.text.toString()
|
val textFilter = binding.filter.text.toString()
|
||||||
val categoryFilter = binding.category.selectedItem?.toString()
|
val categoryFilter = binding.category.selectedItem?.toString()
|
||||||
|
|
|
@ -113,6 +113,7 @@ class NSClientService : DaggerService() {
|
||||||
var latestDateInReceivedData: Long = 0
|
var latestDateInReceivedData: Long = 0
|
||||||
|
|
||||||
@SuppressLint("WakelockTimeout")
|
@SuppressLint("WakelockTimeout")
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
wakeLock = (getSystemService(Context.POWER_SERVICE) as PowerManager).newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "AndroidAPS:NSClientService")
|
wakeLock = (getSystemService(Context.POWER_SERVICE) as PowerManager).newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "AndroidAPS:NSClientService")
|
||||||
|
@ -236,6 +237,7 @@ class NSClientService : DaggerService() {
|
||||||
return START_STICKY
|
return START_STICKY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
fun initialize() {
|
fun initialize() {
|
||||||
dataCounter = 0
|
dataCounter = 0
|
||||||
readPreferences()
|
readPreferences()
|
||||||
|
@ -650,6 +652,7 @@ class NSClientService : DaggerService() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
fun restart() {
|
fun restart() {
|
||||||
destroy()
|
destroy()
|
||||||
initialize()
|
initialize()
|
||||||
|
|
|
@ -2,8 +2,10 @@ package info.nightscout.androidaps.plugins.general.openhumans
|
||||||
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
fun String.isAllowedKey() = if (startsWith("ConfigBuilder_")) true else allowedKeys.contains(this.uppercase(Locale.ROOT))
|
fun String.isAllowedKey() = if (startsWith("ConfigBuilder_")) true else allowedKeys.contains(this.uppercase(Locale.ROOT))
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
private val allowedKeys = """
|
private val allowedKeys = """
|
||||||
absorption
|
absorption
|
||||||
absorption_maxtime
|
absorption_maxtime
|
||||||
|
|
|
@ -28,6 +28,7 @@ class OHUploadWorker(context: Context, workerParameters: WorkerParameters)
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var resourceHelper: ResourceHelper
|
lateinit var resourceHelper: ResourceHelper
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
override fun createWork(): Single<Result> = Single.defer {
|
override fun createWork(): Single<Result> = Single.defer {
|
||||||
|
|
||||||
// Here we inject every time we create work
|
// Here we inject every time we create work
|
||||||
|
|
|
@ -439,6 +439,7 @@ class OpenHumansUploader @Inject constructor(
|
||||||
notificationManager.notify(FAILURE_NOTIFICATION_ID, notification)
|
notificationManager.notify(FAILURE_NOTIFICATION_ID, notification)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
fun uploadDataSegmentally(): Completable =
|
fun uploadDataSegmentally(): Completable =
|
||||||
uploadData(UPLOAD_SEGMENT_SIZE)
|
uploadData(UPLOAD_SEGMENT_SIZE)
|
||||||
.repeatUntil { databaseHelper.getOHQueueSize() == 0L }
|
.repeatUntil { databaseHelper.getOHQueueSize() == 0L }
|
||||||
|
@ -452,6 +453,7 @@ class OpenHumansUploader @Inject constructor(
|
||||||
aapsLogger.error(LTag.OHUPLOADER, "Segmental upload exceptional", it)
|
aapsLogger.error(LTag.OHUPLOADER, "Segmental upload exceptional", it)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
@Suppress("SameParameterValue")
|
@Suppress("SameParameterValue")
|
||||||
private fun uploadData(maxEntries: Long): Completable = gatherData(maxEntries)
|
private fun uploadData(maxEntries: Long): Completable = gatherData(maxEntries)
|
||||||
.flatMap { data -> refreshAccessTokensIfNeeded().map { accessToken -> accessToken to data } }
|
.flatMap { data -> refreshAccessTokensIfNeeded().map { accessToken -> accessToken to data } }
|
||||||
|
@ -494,6 +496,7 @@ class OpenHumansUploader @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
private fun gatherData(maxEntries: Long) = Single.defer {
|
private fun gatherData(maxEntries: Long) = Single.defer {
|
||||||
val items = databaseHelper.getAllOHQueueItems(maxEntries)
|
val items = databaseHelper.getAllOHQueueItems(maxEntries)
|
||||||
val baos = ByteArrayOutputStream()
|
val baos = ByteArrayOutputStream()
|
||||||
|
|
|
@ -181,6 +181,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("SpellCheckingInspection")
|
@Suppress("SpellCheckingInspection")
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
override fun doWork(): Result {
|
override fun doWork(): Result {
|
||||||
val bundle = dataWorker.pickupBundle(inputData.getLong(DataWorker.STORE_KEY, -1))
|
val bundle = dataWorker.pickupBundle(inputData.getLong(DataWorker.STORE_KEY, -1))
|
||||||
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
?: return Result.failure(workDataOf("Error" to "missing input data"))
|
||||||
|
@ -223,6 +224,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
fun processSms(receivedSms: Sms) {
|
fun processSms(receivedSms: Sms) {
|
||||||
if (!isEnabled(PluginType.GENERAL)) {
|
if (!isEnabled(PluginType.GENERAL)) {
|
||||||
aapsLogger.debug(LTag.SMS, "Ignoring SMS. Plugin disabled.")
|
aapsLogger.debug(LTag.SMS, "Ignoring SMS. Plugin disabled.")
|
||||||
|
@ -334,6 +336,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
||||||
receivedSms.processed = true
|
receivedSms.processed = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
private fun processLOOP(divided: Array<String>, receivedSms: Sms) {
|
private fun processLOOP(divided: Array<String>, receivedSms: Sms) {
|
||||||
when (divided[1].uppercase(Locale.getDefault())) {
|
when (divided[1].uppercase(Locale.getDefault())) {
|
||||||
"DISABLE", "STOP" -> {
|
"DISABLE", "STOP" -> {
|
||||||
|
@ -453,6 +456,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
private fun processNSCLIENT(divided: Array<String>, receivedSms: Sms) {
|
private fun processNSCLIENT(divided: Array<String>, receivedSms: Sms) {
|
||||||
if (divided[1].uppercase(Locale.getDefault()) == "RESTART") {
|
if (divided[1].uppercase(Locale.getDefault()) == "RESTART") {
|
||||||
rxBus.send(EventNSClientRestart())
|
rxBus.send(EventNSClientRestart())
|
||||||
|
@ -462,6 +466,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
||||||
sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.wrongformat)))
|
sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.wrongformat)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
private fun processHELP(divided: Array<String>, receivedSms: Sms) {
|
private fun processHELP(divided: Array<String>, receivedSms: Sms) {
|
||||||
when {
|
when {
|
||||||
divided.size == 1 -> {
|
divided.size == 1 -> {
|
||||||
|
@ -544,6 +549,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
private fun processPROFILE(divided: Array<String>, receivedSms: Sms) { // load profiles
|
private fun processPROFILE(divided: Array<String>, receivedSms: Sms) { // load profiles
|
||||||
val anInterface = activePlugin.activeProfileSource
|
val anInterface = activePlugin.activeProfileSource
|
||||||
val store = anInterface.profile
|
val store = anInterface.profile
|
||||||
|
@ -597,6 +603,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
||||||
receivedSms.processed = true
|
receivedSms.processed = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
private fun processBASAL(divided: Array<String>, receivedSms: Sms) {
|
private fun processBASAL(divided: Array<String>, receivedSms: Sms) {
|
||||||
if (divided[1].uppercase(Locale.getDefault()) == "CANCEL" || divided[1].uppercase(Locale.getDefault()) == "STOP") {
|
if (divided[1].uppercase(Locale.getDefault()) == "CANCEL" || divided[1].uppercase(Locale.getDefault()) == "STOP") {
|
||||||
val passCode = generatePassCode()
|
val passCode = generatePassCode()
|
||||||
|
@ -713,6 +720,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
private fun processEXTENDED(divided: Array<String>, receivedSms: Sms) {
|
private fun processEXTENDED(divided: Array<String>, receivedSms: Sms) {
|
||||||
if (divided[1].uppercase(Locale.getDefault()) == "CANCEL" || divided[1].uppercase(Locale.getDefault()) == "STOP") {
|
if (divided[1].uppercase(Locale.getDefault()) == "CANCEL" || divided[1].uppercase(Locale.getDefault()) == "STOP") {
|
||||||
val passCode = generatePassCode()
|
val passCode = generatePassCode()
|
||||||
|
@ -879,6 +887,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
||||||
return retVal
|
return retVal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
private fun processCARBS(divided: Array<String>, receivedSms: Sms) {
|
private fun processCARBS(divided: Array<String>, receivedSms: Sms) {
|
||||||
var grams = SafeParse.stringToInt(divided[1])
|
var grams = SafeParse.stringToInt(divided[1])
|
||||||
var time = dateUtil.now()
|
var time = dateUtil.now()
|
||||||
|
@ -922,6 +931,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
private fun processTARGET(divided: Array<String>, receivedSms: Sms) {
|
private fun processTARGET(divided: Array<String>, receivedSms: Sms) {
|
||||||
val isMeal = divided[1].equals("MEAL", ignoreCase = true)
|
val isMeal = divided[1].equals("MEAL", ignoreCase = true)
|
||||||
val isActivity = divided[1].equals("ACTIVITY", ignoreCase = true)
|
val isActivity = divided[1].equals("ACTIVITY", ignoreCase = true)
|
||||||
|
|
|
@ -17,6 +17,7 @@ class JSONFormatter @Inject constructor(
|
||||||
private val aapsLogger: AAPSLogger
|
private val aapsLogger: AAPSLogger
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
fun format(jsonString: String?): Spanned {
|
fun format(jsonString: String?): Spanned {
|
||||||
jsonString ?: return fromHtml("")
|
jsonString ?: return fromHtml("")
|
||||||
val visitor = JsonVisitor(1, '\t')
|
val visitor = JsonVisitor(1, '\t')
|
||||||
|
|
|
@ -11,6 +11,7 @@ import org.junit.Assert
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
class SignatureVerifierPluginTest : TestBase() {
|
class SignatureVerifierPluginTest : TestBase() {
|
||||||
|
|
||||||
@Mock lateinit var resourceHelper: ResourceHelper
|
@Mock lateinit var resourceHelper: ResourceHelper
|
||||||
|
|
|
@ -57,6 +57,7 @@ import java.util.*
|
||||||
SmsManager::class, CommandQueue::class, LocalProfilePlugin::class, DateUtil::class,
|
SmsManager::class, CommandQueue::class, LocalProfilePlugin::class, DateUtil::class,
|
||||||
OneTimePassword::class, UserEntryLogger::class, LoopPlugin::class,
|
OneTimePassword::class, UserEntryLogger::class, LoopPlugin::class,
|
||||||
AppRepository::class, DateUtil::class, AutosensDataStore::class)
|
AppRepository::class, DateUtil::class, AutosensDataStore::class)
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
||||||
|
|
||||||
@Mock lateinit var sp: SP
|
@Mock lateinit var sp: SP
|
||||||
|
@ -66,7 +67,6 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
|
||||||
@Mock lateinit var loopPlugin: LoopPlugin
|
@Mock lateinit var loopPlugin: LoopPlugin
|
||||||
@Mock lateinit var virtualPumpPlugin: VirtualPumpPlugin
|
@Mock lateinit var virtualPumpPlugin: VirtualPumpPlugin
|
||||||
@Mock lateinit var localProfilePlugin: LocalProfilePlugin
|
@Mock lateinit var localProfilePlugin: LocalProfilePlugin
|
||||||
@Mock lateinit var treatmentService: TreatmentService
|
|
||||||
@Mock lateinit var otp: OneTimePassword
|
@Mock lateinit var otp: OneTimePassword
|
||||||
@Mock lateinit var xdripCalibrations: XdripCalibrations
|
@Mock lateinit var xdripCalibrations: XdripCalibrations
|
||||||
@Mock lateinit var uel: UserEntryLogger
|
@Mock lateinit var uel: UserEntryLogger
|
||||||
|
|
|
@ -18,6 +18,7 @@ fun ByteArray.toHex() : String{
|
||||||
return result.toString()
|
return result.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
fun String.hexStringToByteArray(): ByteArray {
|
fun String.hexStringToByteArray(): ByteArray {
|
||||||
|
|
||||||
val result = ByteArray(length / 2)
|
val result = ByteArray(length / 2)
|
||||||
|
|
|
@ -105,6 +105,7 @@ class EncryptedPrefsFormat @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
override fun loadPreferences(file: File, masterPassword: String?): Prefs {
|
override fun loadPreferences(file: File, masterPassword: String?): Prefs {
|
||||||
|
|
||||||
val entries: MutableMap<String, String> = mutableMapOf()
|
val entries: MutableMap<String, String> = mutableMapOf()
|
||||||
|
|
|
@ -6,6 +6,7 @@ class PinStrengthValidator(val _customErrorMessage: String?) : Validator(_custom
|
||||||
|
|
||||||
val regex = "[0-9]{3,6}".toRegex()
|
val regex = "[0-9]{3,6}".toRegex()
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
override fun isValid(editText: EditText): Boolean {
|
override fun isValid(editText: EditText): Boolean {
|
||||||
return try {
|
return try {
|
||||||
val value = editText.text.toString()
|
val value = editText.text.toString()
|
||||||
|
|
|
@ -22,7 +22,7 @@ import java.io.File
|
||||||
@PowerMockIgnore("javax.crypto.*")
|
@PowerMockIgnore("javax.crypto.*")
|
||||||
@RunWith(PowerMockRunner::class)
|
@RunWith(PowerMockRunner::class)
|
||||||
@PrepareForTest(File::class)
|
@PrepareForTest(File::class)
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
class EncryptedPrefsFormatTest : TestBase() {
|
class EncryptedPrefsFormatTest : TestBase() {
|
||||||
|
|
||||||
@Mock lateinit var resourceHelper: ResourceHelper
|
@Mock lateinit var resourceHelper: ResourceHelper
|
||||||
|
|
|
@ -141,6 +141,7 @@ class DanaRSPlugin @Inject constructor(
|
||||||
commandQueue.readStatus("DeviceChanged", null)
|
commandQueue.readStatus("DeviceChanged", null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
override fun connect(reason: String) {
|
override fun connect(reason: String) {
|
||||||
aapsLogger.debug(LTag.PUMP, "RS connect from: $reason")
|
aapsLogger.debug(LTag.PUMP, "RS connect from: $reason")
|
||||||
if (danaRSService != null && mDeviceAddress != "" && mDeviceName != "") {
|
if (danaRSService != null && mDeviceAddress != "" && mDeviceName != "") {
|
||||||
|
|
|
@ -33,6 +33,7 @@ class EnterPinActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
private lateinit var binding: DanarsEnterPinActivityBinding
|
private lateinit var binding: DanarsEnterPinActivityBinding
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
binding = DanarsEnterPinActivityBinding.inflate(layoutInflater)
|
binding = DanarsEnterPinActivityBinding.inflate(layoutInflater)
|
||||||
|
|
|
@ -60,6 +60,7 @@ abstract class DanaRS_Packet_History_(
|
||||||
return request
|
return request
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
override fun handleMessage(data: ByteArray) {
|
override fun handleMessage(data: ByteArray) {
|
||||||
val error: Int
|
val error: Int
|
||||||
totalCount = 0
|
totalCount = 0
|
||||||
|
|
|
@ -86,6 +86,7 @@ class BLEComm @Inject internal constructor(
|
||||||
private var uartWrite: BluetoothGattCharacteristic? = null
|
private var uartWrite: BluetoothGattCharacteristic? = null
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
fun connect(from: String, address: String?): Boolean {
|
fun connect(from: String, address: String?): Boolean {
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "Initializing BLEComm.")
|
aapsLogger.debug(LTag.PUMPBTCOMM, "Initializing BLEComm.")
|
||||||
if (bluetoothManager == null) {
|
if (bluetoothManager == null) {
|
||||||
|
@ -176,6 +177,7 @@ class BLEComm @Inject internal constructor(
|
||||||
bluetoothGatt = null
|
bluetoothGatt = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
private val mGattCallback: BluetoothGattCallback = object : BluetoothGattCallback() {
|
private val mGattCallback: BluetoothGattCallback = object : BluetoothGattCallback() {
|
||||||
override fun onConnectionStateChange(gatt: BluetoothGatt, status: Int, newState: Int) {
|
override fun onConnectionStateChange(gatt: BluetoothGatt, status: Int, newState: Int) {
|
||||||
onConnectionStateChangeSynchronized(gatt, newState) // call it synchronized
|
onConnectionStateChangeSynchronized(gatt, newState) // call it synchronized
|
||||||
|
@ -323,6 +325,7 @@ class BLEComm @Inject internal constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
private fun readDataParsing(receivedData: ByteArray) {
|
private fun readDataParsing(receivedData: ByteArray) {
|
||||||
//aapsLogger.debug(LTag.PUMPBTCOMM, "readDataParsing")
|
//aapsLogger.debug(LTag.PUMPBTCOMM, "readDataParsing")
|
||||||
var startSignatureFound = false
|
var startSignatureFound = false
|
||||||
|
@ -449,6 +452,7 @@ class BLEComm @Inject internal constructor(
|
||||||
writeCharacteristicNoResponse(uartWriteBTGattChar, bytes)
|
writeCharacteristicNoResponse(uartWriteBTGattChar, bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
// 1st packet response
|
// 1st packet response
|
||||||
private fun processConnectResponse(decryptedBuffer: ByteArray) {
|
private fun processConnectResponse(decryptedBuffer: ByteArray) {
|
||||||
// response OK v1
|
// response OK v1
|
||||||
|
|
|
@ -97,6 +97,7 @@ class DanaRSService : DaggerService() {
|
||||||
val isConnecting: Boolean
|
val isConnecting: Boolean
|
||||||
get() = bleComm.isConnecting
|
get() = bleComm.isConnecting
|
||||||
|
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
fun connect(from: String, address: String): Boolean {
|
fun connect(from: String, address: String): Boolean {
|
||||||
return bleComm.connect(from, address)
|
return bleComm.connect(from, address)
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ class DanaRSPacketHistoryAlarmTest : DanaRSTestBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@kotlin.ExperimentalStdlibApi
|
||||||
fun runTest() {
|
fun runTest() {
|
||||||
val packet = DanaRS_Packet_History_Alarm(packetInjector, 0)
|
val packet = DanaRS_Packet_History_Alarm(packetInjector, 0)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue