1
mirror of https://github.com/revanced/revanced-patcher synced 2025-09-06 16:38:50 +02:00

Compare commits

..

8 Commits

Author SHA1 Message Date
semantic-release-bot
79d70cff4b chore(release): 2.2.0-dev.2 [skip ci]
# [2.2.0-dev.2](https://github.com/revanced/revanced-patcher/compare/v2.2.0-dev.1...v2.2.0-dev.2) (2022-07-02)

### Features

* streams overload for `XmlFileHolder` ([6f72c4c](6f72c4c4c0))
2022-07-02 15:46:16 +00:00
oSumAtrIX
6f72c4c4c0 feat: streams overload for XmlFileHolder 2022-07-02 17:44:08 +02:00
oSumAtrIX
c8eedac4d9 refactor: members of ResourceData 2022-07-02 16:22:19 +02:00
semantic-release-bot
60a8278ae8 chore(release): 2.2.0-dev.1 [skip ci]
# [2.2.0-dev.1](https://github.com/revanced/revanced-patcher/compare/v2.1.2...v2.2.0-dev.1) (2022-07-02)

### Features

* remove deprecated functions ([ada5a03](ada5a033de))
2022-07-02 02:23:32 +00:00
oSumAtrIX
ada5a033de feat: remove deprecated functions 2022-07-02 04:21:20 +02:00
semantic-release-bot
109b8a296d chore(release): 2.1.2 [skip ci]
## [2.1.2](https://github.com/revanced/revanced-patcher/compare/v2.1.1...v2.1.2) (2022-06-29)

### Bug Fixes

* invert fingerprint resolution condition of `customFingerprint` ([e2faf4c](e2faf4ca9b))
2022-06-29 23:37:37 +00:00
oSumAtrIX
e2faf4ca9b fix: invert fingerprint resolution condition of customFingerprint 2022-06-30 01:36:25 +02:00
oSumAtrIX
2134182a0e refactor: declare data parameter internal 2022-06-29 19:55:23 +02:00
5 changed files with 40 additions and 15 deletions

View File

@@ -1,3 +1,24 @@
# [2.2.0-dev.2](https://github.com/revanced/revanced-patcher/compare/v2.2.0-dev.1...v2.2.0-dev.2) (2022-07-02)
### Features
* streams overload for `XmlFileHolder` ([6f72c4c](https://github.com/revanced/revanced-patcher/commit/6f72c4c4c051e48c8d03d2a7b2cfc1c53028ed86))
# [2.2.0-dev.1](https://github.com/revanced/revanced-patcher/compare/v2.1.2...v2.2.0-dev.1) (2022-07-02)
### Features
* remove deprecated functions ([ada5a03](https://github.com/revanced/revanced-patcher/commit/ada5a033de3cf94e7255ec2d522520f86431f001))
## [2.1.2](https://github.com/revanced/revanced-patcher/compare/v2.1.1...v2.1.2) (2022-06-29)
### Bug Fixes
* invert fingerprint resolution condition of `customFingerprint` ([e2faf4c](https://github.com/revanced/revanced-patcher/commit/e2faf4ca9b6de23300b20ab471ee9dc365b04339))
## [2.1.1](https://github.com/revanced/revanced-patcher/compare/v2.1.0...v2.1.1) (2022-06-28) ## [2.1.1](https://github.com/revanced/revanced-patcher/compare/v2.1.0...v2.1.1) (2022-06-28)
# [2.1.0](https://github.com/revanced/revanced-patcher/compare/v2.0.4...v2.1.0) (2022-06-28) # [2.1.0](https://github.com/revanced/revanced-patcher/compare/v2.0.4...v2.1.0) (2022-06-28)

View File

@@ -1,2 +1,2 @@
kotlin.code.style = official kotlin.code.style = official
version = 2.1.1 version = 2.2.0-dev.2

View File

@@ -4,31 +4,35 @@ import app.revanced.patcher.data.Data
import org.w3c.dom.Document import org.w3c.dom.Document
import java.io.Closeable import java.io.Closeable
import java.io.File import java.io.File
import java.io.InputStream
import java.io.OutputStream
import javax.xml.parsers.DocumentBuilderFactory import javax.xml.parsers.DocumentBuilderFactory
import javax.xml.transform.TransformerFactory import javax.xml.transform.TransformerFactory
import javax.xml.transform.dom.DOMSource import javax.xml.transform.dom.DOMSource
import javax.xml.transform.stream.StreamResult import javax.xml.transform.stream.StreamResult
class ResourceData(private val resourceCacheDirectory: File) : Data, Iterable<File> { class ResourceData(private val resourceCacheDirectory: File) : Data, Iterable<File> {
operator fun get(path: String) = resourceCacheDirectory.resolve(path)
val xmlEditor = XmlFileHolder() val xmlEditor = XmlFileHolder()
operator fun get(path: String) = resourceCacheDirectory.resolve(path)
override fun iterator() = resourceCacheDirectory.walkTopDown().iterator() override fun iterator() = resourceCacheDirectory.walkTopDown().iterator()
inner class XmlFileHolder { inner class XmlFileHolder {
operator fun get(inputStream: InputStream, outputStream: OutputStream) =
DomFileEditor(inputStream, outputStream)
operator fun get(path: String) = DomFileEditor(this@ResourceData[path]) operator fun get(path: String) = DomFileEditor(this@ResourceData[path])
} }
@Deprecated("Use operator getter instead of resolve function", ReplaceWith("get(path)"))
fun resolve(path: String) = get(path)
@Deprecated("Use operator getter on xmlEditor instead of getXmlEditor function", ReplaceWith("xmlEditor[path]"))
fun getXmlEditor(path: String) = xmlEditor[path]
} }
class DomFileEditor internal constructor(private val domFile: File) : Closeable { class DomFileEditor internal constructor(inputStream: InputStream, private val outputStream: OutputStream) : Closeable {
val file: Document = DocumentBuilderFactory.newInstance().newDocumentBuilder() constructor(file: File) : this(file.inputStream(), file.outputStream())
.parse(domFile).also(Document::normalize)
val file: Document =
DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inputStream).also(Document::normalize)
override fun close() =
TransformerFactory.newInstance().newTransformer().transform(DOMSource(file), StreamResult(outputStream))
override fun close() = TransformerFactory.newInstance().newTransformer()
.transform(DOMSource(file), StreamResult(domFile.outputStream()))
} }

View File

@@ -48,7 +48,7 @@ data class MethodFingerprintResult(
val method: Method, val method: Method,
val classDef: ClassDef, val classDef: ClassDef,
val patternScanResult: PatternScanResult?, val patternScanResult: PatternScanResult?,
val data: BytecodeData internal val data: BytecodeData
) { ) {
/** /**
* Returns a mutable clone of [classDef] * Returns a mutable clone of [classDef]

View File

@@ -68,7 +68,7 @@ object MethodFingerprintUtils {
) )
) return false ) return false
if (methodFingerprint.customFingerprint != null && methodFingerprint.customFingerprint!!(context)) if (methodFingerprint.customFingerprint != null && !methodFingerprint.customFingerprint!!(context))
return false return false
if (methodFingerprint.strings != null) { if (methodFingerprint.strings != null) {