mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Version 11.9
This commit is contained in:
@@ -104,7 +104,7 @@ final class WebAppWebView: WKWebView {
|
||||
return UIEdgeInsets(top: self.customInsets.top, left: self.customInsets.left, bottom: self.customInsets.bottom, right: self.customInsets.right)
|
||||
}
|
||||
|
||||
init(account: Account) {
|
||||
init(userScripts: [WKUserScript] = [], account: Account) {
|
||||
let configuration = WKWebViewConfiguration()
|
||||
|
||||
if #available(iOS 17.0, *) {
|
||||
@@ -146,6 +146,10 @@ final class WebAppWebView: WKWebView {
|
||||
let videoScript = WKUserScript(source: videoSource, injectionTime: .atDocumentStart, forMainFrameOnly: false)
|
||||
contentController.addUserScript(videoScript)
|
||||
|
||||
for userScript in userScripts {
|
||||
contentController.addUserScript(userScript)
|
||||
}
|
||||
|
||||
configuration.userContentController = contentController
|
||||
|
||||
configuration.allowsInlineMediaPlayback = true
|
||||
@@ -268,6 +272,9 @@ final class WebAppWebView: WKWebView {
|
||||
})
|
||||
}
|
||||
|
||||
// MARK: Swiftgram
|
||||
public private(set) var monkeyClickerActive = false
|
||||
|
||||
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
|
||||
let result = super.hitTest(point, with: event)
|
||||
self.lastTouchTimestamp = CACurrentMediaTime()
|
||||
@@ -282,3 +289,16 @@ final class WebAppWebView: WKWebView {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Swiftgram
|
||||
extension WebAppWebView {
|
||||
|
||||
public func toggleClicker(enableJS: String, disableJS: String) {
|
||||
if self.monkeyClickerActive {
|
||||
self.evaluateJavaScript(disableJS, completionHandler: nil)
|
||||
} else {
|
||||
self.evaluateJavaScript(enableJS, completionHandler: nil)
|
||||
}
|
||||
self.monkeyClickerActive = !self.monkeyClickerActive
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user