copymanga: fix crash on low android sdk level (#5571)
This commit is contained in:
parent
73fbab2402
commit
ede14d3f88
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'CopyManga'
|
extName = 'CopyManga'
|
||||||
pkgNameSuffix = 'zh.copymanga'
|
pkgNameSuffix = 'zh.copymanga'
|
||||||
extClass = '.CopyManga'
|
extClass = '.CopyManga'
|
||||||
extVersionCode = 4
|
extVersionCode = 5
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
|
|
@ -23,12 +23,13 @@ import org.json.JSONObject
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
import java.time.LocalDate
|
import java.text.SimpleDateFormat
|
||||||
import java.time.ZoneId
|
import java.util.Date
|
||||||
import java.time.format.DateTimeFormatter
|
import java.util.Locale
|
||||||
import javax.crypto.Cipher
|
import javax.crypto.Cipher
|
||||||
import javax.crypto.spec.IvParameterSpec
|
import javax.crypto.spec.IvParameterSpec
|
||||||
import javax.crypto.spec.SecretKeySpec
|
import javax.crypto.spec.SecretKeySpec
|
||||||
|
import kotlin.collections.ArrayList
|
||||||
|
|
||||||
class CopyManga : ConfigurableSource, HttpSource() {
|
class CopyManga : ConfigurableSource, HttpSource() {
|
||||||
|
|
||||||
|
@ -346,9 +347,13 @@ class CopyManga : ConfigurableSource, HttpSource() {
|
||||||
return bytes
|
return bytes
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun stringToUnixTimestamp(string: String, pattern: String = "yyyy-MM-dd", timeZone: String = "CTT"): Long {
|
private fun stringToUnixTimestamp(string: String, pattern: String = "yyyy-MM-dd", locale: Locale = Locale.CHINA): Long {
|
||||||
val date = LocalDate.parse(string, DateTimeFormatter.ofPattern(pattern))
|
return try {
|
||||||
return date.atStartOfDay(ZoneId.of(timeZone)).toInstant().epochSecond
|
val time = SimpleDateFormat(pattern, locale).parse(string)?.time
|
||||||
|
if (time != null) time / 1000 else Date().time / 1000
|
||||||
|
} catch (ex: Exception) {
|
||||||
|
Date().time / 1000
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// thanks to unpacker toolsite, http://matthewfl.com/unPacker.html
|
// thanks to unpacker toolsite, http://matthewfl.com/unPacker.html
|
||||||
|
|
Loading…
Reference in New Issue