actions java 11 -> 17 & fixed parent job is cancelling message

This commit is contained in:
LagradOst 2023-07-19 18:47:22 +02:00
parent 9755bbacb9
commit da6577e587
6 changed files with 74 additions and 62 deletions

View File

@ -32,10 +32,10 @@ jobs:
private_key: ${{ secrets.GH_APP_KEY }}
repository: "recloudstream/cloudstream-archive"
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '11'
java-version: '17'
distribution: 'adopt'
- name: Grant execute permission for gradlew
run: chmod +x gradlew

View File

@ -42,10 +42,10 @@ jobs:
cd $GITHUB_WORKSPACE/dokka/
rm -rf "./-cloudstream"
- name: Setup JDK 11
- name: Setup JDK 17
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17
- name: Setup Android SDK
uses: android-actions/setup-android@v2

View File

@ -24,10 +24,10 @@ jobs:
private_key: ${{ secrets.GH_APP_KEY }}
repository: "recloudstream/secrets"
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '11'
java-version: '17'
distribution: 'adopt'
- name: Grant execute permission for gradlew
run: chmod +x gradlew

View File

@ -7,10 +7,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '11'
java-version: '17'
distribution: 'adopt'
- name: Grant execute permission for gradlew
run: chmod +x gradlew

View File

@ -129,19 +129,14 @@ fun CoroutineScope.launchSafe(
return this.launch(context, start, obj)
}
suspend fun <T> safeApiCall(
apiCall: suspend () -> T,
fun<T> throwAbleToResource(
throwable: Throwable
): Resource<T> {
return withContext(Dispatchers.IO) {
try {
Resource.Success(apiCall.invoke())
} catch (throwable: Throwable) {
logError(throwable)
when (throwable) {
return when (throwable) {
is NullPointerException -> {
for (line in throwable.stackTrace) {
if (line?.fileName?.endsWith("provider.kt", ignoreCase = true) == true) {
return@withContext Resource.Failure(
return Resource.Failure(
false,
null,
null,
@ -168,7 +163,7 @@ suspend fun <T> safeApiCall(
)
}
is UnknownHostException -> {
Resource.Failure(true, null, null, "Cannot connect to server, try again later.")
Resource.Failure(true, null, null, "Cannot connect to server, try again later.\n${throwable.message}")
}
is ErrorLoadingException -> {
Resource.Failure(
@ -189,8 +184,24 @@ suspend fun <T> safeApiCall(
(throwable.message ?: "SSLHandshakeException") + "\nTry a VPN or DNS."
)
}
is CancellationException -> {
throwable.cause?.let {
throwAbleToResource(it)
} ?: safeFail(throwable)
}
else -> safeFail(throwable)
}
}
suspend fun <T> safeApiCall(
apiCall: suspend () -> T,
): Resource<T> {
return withContext(Dispatchers.IO) {
try {
Resource.Success(apiCall.invoke())
} catch (throwable: Throwable) {
logError(throwable)
throwAbleToResource(throwable)
}
}
}

View File

@ -370,6 +370,7 @@ class HomeViewModel : ViewModel() {
else -> Unit
}
onGoingLoad = null
}
fun click(callback: SearchClickCallback) {