From c1778af5a3f220895f97f057229795ada9a717ad Mon Sep 17 00:00:00 2001 From: Azalea Gui Date: Tue, 24 Jan 2023 21:51:16 -0500 Subject: [PATCH] [+] Global scope async{} --- app/src/main/java/org/hydev/wearsync/Extensions.kt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/src/main/java/org/hydev/wearsync/Extensions.kt b/app/src/main/java/org/hydev/wearsync/Extensions.kt index a2b122a..8892317 100644 --- a/app/src/main/java/org/hydev/wearsync/Extensions.kt +++ b/app/src/main/java/org/hydev/wearsync/Extensions.kt @@ -14,11 +14,19 @@ import androidx.activity.result.contract.ActivityResultContracts import androidx.core.content.edit import androidx.preference.PreferenceManager import com.google.android.material.snackbar.Snackbar +import com.influxdb.client.InfluxDBClient +import com.influxdb.client.domain.DeletePredicateRequest import com.influxdb.client.domain.WritePrecision import com.influxdb.client.kotlin.InfluxDBClientKotlin import com.influxdb.client.kotlin.InfluxDBClientKotlinFactory import com.welie.blessed.BluetoothPeripheral +import kotlinx.coroutines.* +import kotlinx.coroutines.flow.Flow import java.lang.reflect.Modifier +import java.time.ZoneOffset +import java.util.* +import kotlin.coroutines.CoroutineContext +import kotlin.coroutines.EmptyCoroutineContext import kotlin.reflect.KProperty import kotlin.reflect.full.isSubclassOf @@ -32,6 +40,11 @@ typealias BluePeri = BluetoothPeripheral fun Context.blueMan() = getSysServ() +private val gScope = CoroutineScope(SupervisorJob() + Dispatchers.IO) +fun async(context: CoroutineContext = EmptyCoroutineContext, start: CoroutineStart = CoroutineStart.DEFAULT, block: suspend CoroutineScope.() -> Unit) = + gScope.launch(context, start, block) + + interface Prefs { var chosenDevice: String?