mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
actions java 11 -> 17 & fixed parent job is cancelling message
This commit is contained in:
parent
9755bbacb9
commit
da6577e587
6 changed files with 74 additions and 62 deletions
4
.github/workflows/build_to_archive.yml
vendored
4
.github/workflows/build_to_archive.yml
vendored
|
@ -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
|
||||
|
|
4
.github/workflows/generate_dokka.yml
vendored
4
.github/workflows/generate_dokka.yml
vendored
|
@ -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
|
||||
|
|
4
.github/workflows/prerelease.yml
vendored
4
.github/workflows/prerelease.yml
vendored
|
@ -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
|
||||
|
|
4
.github/workflows/pull_request.yml
vendored
4
.github/workflows/pull_request.yml
vendored
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -370,6 +370,7 @@ class HomeViewModel : ViewModel() {
|
|||
|
||||
else -> Unit
|
||||
}
|
||||
onGoingLoad = null
|
||||
}
|
||||
|
||||
fun click(callback: SearchClickCallback) {
|
||||
|
|
Loading…
Reference in a new issue