Loading data/src/main/java/foundation/e/apps/data/playstore/utils/GplayInternalExceptionAdapter.kt +21 −17 Original line number Diff line number Diff line Loading @@ -24,25 +24,29 @@ fun Throwable.isGplayInternalAppNotFound(): Boolean { } fun Throwable.gplayInternalExceptionHttpStatus(): Int? { if (this !is GooglePlayException) return null return when (this) { is GooglePlayException.NotFound -> code.takeIf { it > 0 } is GooglePlayException.Server -> code.takeIf { it > 0 } else -> null } is GooglePlayException.AuthException -> code is GooglePlayException.AppNotPurchased -> code is GooglePlayException.AppRemoved -> code is GooglePlayException.AppNotSupported -> code is GooglePlayException.EmptyDownloads -> code is GooglePlayException.NotFound -> code is GooglePlayException.Server -> code is GooglePlayException.Unknown -> code }.takeIf { it > 0 } } fun Throwable.gplayInternalExceptionReason(): String? { val resolvedReason = when (this) { is GooglePlayException.NotFound -> this.reason is GooglePlayException.AppNotPurchased -> this.reason is GooglePlayException.AppNotSupported -> this.reason is GooglePlayException.AppRemoved -> this.reason is GooglePlayException.AuthException -> this.reason is GooglePlayException.EmptyDownloads -> this.reason is GooglePlayException.Server -> this.reason is GooglePlayException.Unknown -> this.reason else -> localizedMessage } return resolvedReason?.takeIf { it.isNotBlank() } if (this !is GooglePlayException) return localizedMessage?.takeIf { it.isNotBlank() } return when (this) { is GooglePlayException.AuthException -> reason is GooglePlayException.AppNotPurchased -> reason is GooglePlayException.AppRemoved -> reason is GooglePlayException.AppNotSupported -> reason is GooglePlayException.EmptyDownloads -> reason is GooglePlayException.NotFound -> reason is GooglePlayException.Server -> reason is GooglePlayException.Unknown -> reason }.takeIf { it.isNotBlank() } } Loading
data/src/main/java/foundation/e/apps/data/playstore/utils/GplayInternalExceptionAdapter.kt +21 −17 Original line number Diff line number Diff line Loading @@ -24,25 +24,29 @@ fun Throwable.isGplayInternalAppNotFound(): Boolean { } fun Throwable.gplayInternalExceptionHttpStatus(): Int? { if (this !is GooglePlayException) return null return when (this) { is GooglePlayException.NotFound -> code.takeIf { it > 0 } is GooglePlayException.Server -> code.takeIf { it > 0 } else -> null } is GooglePlayException.AuthException -> code is GooglePlayException.AppNotPurchased -> code is GooglePlayException.AppRemoved -> code is GooglePlayException.AppNotSupported -> code is GooglePlayException.EmptyDownloads -> code is GooglePlayException.NotFound -> code is GooglePlayException.Server -> code is GooglePlayException.Unknown -> code }.takeIf { it > 0 } } fun Throwable.gplayInternalExceptionReason(): String? { val resolvedReason = when (this) { is GooglePlayException.NotFound -> this.reason is GooglePlayException.AppNotPurchased -> this.reason is GooglePlayException.AppNotSupported -> this.reason is GooglePlayException.AppRemoved -> this.reason is GooglePlayException.AuthException -> this.reason is GooglePlayException.EmptyDownloads -> this.reason is GooglePlayException.Server -> this.reason is GooglePlayException.Unknown -> this.reason else -> localizedMessage } return resolvedReason?.takeIf { it.isNotBlank() } if (this !is GooglePlayException) return localizedMessage?.takeIf { it.isNotBlank() } return when (this) { is GooglePlayException.AuthException -> reason is GooglePlayException.AppNotPurchased -> reason is GooglePlayException.AppRemoved -> reason is GooglePlayException.AppNotSupported -> reason is GooglePlayException.EmptyDownloads -> reason is GooglePlayException.NotFound -> reason is GooglePlayException.Server -> reason is GooglePlayException.Unknown -> reason }.takeIf { it.isNotBlank() } }