diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 61a9130..fb7f4a8 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index d5d35ec..860da66 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..797acea --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/java/fr/oupson/taotoolbox/receivers/TaoWidget.kt b/app/src/main/java/fr/oupson/taotoolbox/receivers/TaoWidget.kt index 24e6f0d..102f869 100644 --- a/app/src/main/java/fr/oupson/taotoolbox/receivers/TaoWidget.kt +++ b/app/src/main/java/fr/oupson/taotoolbox/receivers/TaoWidget.kt @@ -205,7 +205,9 @@ class TaoWidget : AppWidgetProvider() { appWidgetIds: IntArray ) { GlobalScope.launch(coroutineContext) { - val taoRestApi = TaoRestApi() + val taoRestApi = TaoRestApi().also { + it.requestContext = this.coroutineContext + } // There may be multiple widgets active, so update all of them for (appWidgetId in appWidgetIds) { updateAppWidget(context, appWidgetManager, appWidgetId, taoRestApi) diff --git a/build.gradle b/build.gradle index 8dcfd25..c5dbb51 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.3' + classpath 'com.android.tools.build:gradle:4.2.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong diff --git a/common/build.gradle b/common/build.gradle index a13b163..4b51c5a 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -45,5 +45,5 @@ dependencies { implementation "io.ktor:ktor-client-serialization:$ktor_version" implementation "io.ktor:ktor-client-core:$ktor_version" - implementation "io.ktor:ktor-client-cio:$ktor_version" + implementation "io.ktor:ktor-client-android:$ktor_version" } \ No newline at end of file diff --git a/common/src/main/java/fr/oupson/common/api/TaoRestApi.kt b/common/src/main/java/fr/oupson/common/api/TaoRestApi.kt index 75665bb..b850a06 100644 --- a/common/src/main/java/fr/oupson/common/api/TaoRestApi.kt +++ b/common/src/main/java/fr/oupson/common/api/TaoRestApi.kt @@ -1,7 +1,7 @@ package fr.oupson.common.api import io.ktor.client.* -import io.ktor.client.engine.cio.* +import io.ktor.client.engine.android.* import io.ktor.client.features.json.* import io.ktor.client.request.* import io.ktor.client.request.forms.* @@ -11,8 +11,12 @@ import kotlinx.coroutines.withContext import kotlin.coroutines.CoroutineContext class TaoRestApi(private val httpClient: HttpClient) { - constructor() : this(HttpClient(CIO) { + constructor() : this(HttpClient(Android) { install(JsonFeature) + engine { + connectTimeout = 10_1000 + socketTimeout = 10_000 + } }) var requestContext: CoroutineContext = Dispatchers.IO diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 21b28f4..98619f1 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip