|
|
|
@ -54,6 +54,7 @@ import org.koitharu.kotatsu.core.util.ext.processLifecycleScope
|
|
|
|
import org.koitharu.kotatsu.core.util.ext.toBitmapOrNull
|
|
|
|
import org.koitharu.kotatsu.core.util.ext.toBitmapOrNull
|
|
|
|
import org.koitharu.kotatsu.parsers.model.MangaSource
|
|
|
|
import org.koitharu.kotatsu.parsers.model.MangaSource
|
|
|
|
import org.koitharu.kotatsu.parsers.network.CloudFlareHelper
|
|
|
|
import org.koitharu.kotatsu.parsers.network.CloudFlareHelper
|
|
|
|
|
|
|
|
import org.koitharu.kotatsu.parsers.util.mapToArray
|
|
|
|
import org.koitharu.kotatsu.parsers.util.runCatchingCancellable
|
|
|
|
import org.koitharu.kotatsu.parsers.util.runCatchingCancellable
|
|
|
|
import javax.inject.Inject
|
|
|
|
import javax.inject.Inject
|
|
|
|
import javax.inject.Provider
|
|
|
|
import javax.inject.Provider
|
|
|
|
@ -152,6 +153,15 @@ class CaptchaHandler @Inject constructor(
|
|
|
|
.setOnlyAlertOnce(true)
|
|
|
|
.setOnlyAlertOnce(true)
|
|
|
|
.setSmallIcon(R.drawable.ic_bot)
|
|
|
|
.setSmallIcon(R.drawable.ic_bot)
|
|
|
|
.setGroup(GROUP_CAPTCHA)
|
|
|
|
.setGroup(GROUP_CAPTCHA)
|
|
|
|
|
|
|
|
.setContentIntent(
|
|
|
|
|
|
|
|
PendingIntentCompat.getActivities(
|
|
|
|
|
|
|
|
context, GROUP_NOTIFICATION_ID,
|
|
|
|
|
|
|
|
exceptions.mapToArray { e ->
|
|
|
|
|
|
|
|
AppRouter.cloudFlareResolveIntent(context, e)
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
0, false,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
.setContentText(
|
|
|
|
.setContentText(
|
|
|
|
context.getString(
|
|
|
|
context.getString(
|
|
|
|
R.string.captcha_required_summary, context.getString(R.string.app_name),
|
|
|
|
R.string.captcha_required_summary, context.getString(R.string.app_name),
|
|
|
|
@ -172,7 +182,6 @@ class CaptchaHandler @Inject constructor(
|
|
|
|
|
|
|
|
|
|
|
|
private suspend fun buildNotification(exception: CloudFlareProtectedException): Notification {
|
|
|
|
private suspend fun buildNotification(exception: CloudFlareProtectedException): Notification {
|
|
|
|
val intent = AppRouter.cloudFlareResolveIntent(context, exception)
|
|
|
|
val intent = AppRouter.cloudFlareResolveIntent(context, exception)
|
|
|
|
.setData(exception.url.toUri())
|
|
|
|
|
|
|
|
val discardIntent = Intent(ACTION_DISCARD)
|
|
|
|
val discardIntent = Intent(ACTION_DISCARD)
|
|
|
|
.putExtra(AppRouter.KEY_SOURCE, exception.source.name)
|
|
|
|
.putExtra(AppRouter.KEY_SOURCE, exception.source.name)
|
|
|
|
.setData("source://${exception.source.name}".toUri())
|
|
|
|
.setData("source://${exception.source.name}".toUri())
|
|
|
|
|