Update gradle and trying to fix widget

This commit is contained in:
Oupson 2021-05-09 20:29:52 +02:00
parent 730a7edc0e
commit ba281b5979
8 changed files with 24 additions and 8 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="CompilerConfiguration"> <component name="CompilerConfiguration">
<bytecodeTargetLevel target="1.8" /> <bytecodeTargetLevel target="11" />
</component> </component>
</project> </project>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
</set>
</option>
</component>
</project>

View File

@ -205,7 +205,9 @@ class TaoWidget : AppWidgetProvider() {
appWidgetIds: IntArray appWidgetIds: IntArray
) { ) {
GlobalScope.launch(coroutineContext) { 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 // There may be multiple widgets active, so update all of them
for (appWidgetId in appWidgetIds) { for (appWidgetId in appWidgetIds) {
updateAppWidget(context, appWidgetManager, appWidgetId, taoRestApi) updateAppWidget(context, appWidgetManager, appWidgetId, taoRestApi)

View File

@ -7,7 +7,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { 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" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong

View File

@ -45,5 +45,5 @@ dependencies {
implementation "io.ktor:ktor-client-serialization:$ktor_version" implementation "io.ktor:ktor-client-serialization:$ktor_version"
implementation "io.ktor:ktor-client-core:$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"
} }

View File

@ -1,7 +1,7 @@
package fr.oupson.common.api package fr.oupson.common.api
import io.ktor.client.* 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.features.json.*
import io.ktor.client.request.* import io.ktor.client.request.*
import io.ktor.client.request.forms.* import io.ktor.client.request.forms.*
@ -11,8 +11,12 @@ import kotlinx.coroutines.withContext
import kotlin.coroutines.CoroutineContext import kotlin.coroutines.CoroutineContext
class TaoRestApi(private val httpClient: HttpClient) { class TaoRestApi(private val httpClient: HttpClient) {
constructor() : this(HttpClient(CIO) { constructor() : this(HttpClient(Android) {
install(JsonFeature) install(JsonFeature)
engine {
connectTimeout = 10_1000
socketTimeout = 10_000
}
}) })
var requestContext: CoroutineContext = Dispatchers.IO var requestContext: CoroutineContext = Dispatchers.IO

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists 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