Убрано падение на восклицательных знаках.

This commit is contained in:
Денис Либит
2024-10-24 13:00:42 +03:00
parent e03858df19
commit b9797b65ea
4 changed files with 191 additions and 8 deletions

176
.gitignore vendored Normal file
View File

@@ -0,0 +1,176 @@
# Created by https://www.toptal.com/developers/gitignore/api/macos,xcode,swift,objective-c,swiftpackagemanager
# Edit at https://www.toptal.com/developers/gitignore?templates=macos,xcode,swift,objective-c,swiftpackagemanager
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### macOS Patch ###
# iCloud generated files
*.icloud
### Objective-C ###
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## User settings
xcuserdata/
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
build/
DerivedData/
*.moved-aside
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
## Obj-C/Swift specific
*.hmap
## App packaging
*.ipa
*.dSYM.zip
*.dSYM
# CocoaPods
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
# Pods/
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace
# Carthage
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts
Carthage/Build/
# fastlane
# It is recommended to not store the screenshots in the git repo.
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output
# Code Injection
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode
iOSInjectionProject/
### Objective-C Patch ###
### Swift ###
# Xcode
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## Playgrounds
timeline.xctimeline
playground.xcworkspace
# Swift Package Manager
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
# Package.resolved
# *.xcodeproj
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
# hence it is not needed unless you have added a package configuration file to your project
# .swiftpm
.build/
# CocoaPods
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
# Pods/
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace
# Carthage
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts
# Accio dependency management
Dependencies/
.accio/
# fastlane
# It is recommended to not store the screenshots in the git repo.
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control
# Code Injection
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode
### SwiftPackageManager ###
Packages
xcuserdata
*.xcodeproj
### Xcode ###
## Xcode 8 and earlier
### Xcode Patch ###
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
!*.xcodeproj/project.xcworkspace/
!*.xcworkspace/contents.xcworkspacedata
/*.gcno
**/xcshareddata/WorkspaceSettings.xcsettings
# End of https://www.toptal.com/developers/gitignore/api/macos,xcode,swift,objective-c,swiftpackagemanager

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

View File

@@ -7,7 +7,7 @@
// //
import UIKit import UIKit
import WebKit @preconcurrency import WebKit
import AVFoundation import AVFoundation
open class ChatController: UIViewController, WKNavigationDelegate, WKScriptMessageHandler { open class ChatController: UIViewController, WKNavigationDelegate, WKScriptMessageHandler {
@@ -31,7 +31,7 @@ open class ChatController: UIViewController, WKNavigationDelegate, WKScriptMessa
private static let method_destroy = "destroy" private static let method_destroy = "destroy"
private static let method_pageLoaded = "pageLoaded" private static let method_pageLoaded = "pageLoaded"
public var chatView: WKWebView! public var chatView: WKWebView?
private var callJs: Array<String>! private var callJs: Array<String>!
private var didFinish: Bool = false private var didFinish: Bool = false
private var widgetUrl: String = "" private var widgetUrl: String = ""
@@ -150,7 +150,7 @@ open class ChatController: UIViewController, WKNavigationDelegate, WKScriptMessa
frame = (parent?.view.bounds)! frame = (parent?.view.bounds)!
} }
chatView = WKWebView(frame: frame, configuration: config) chatView = WKWebView(frame: frame, configuration: config)
chatView.navigationDelegate = self chatView?.navigationDelegate = self
view = chatView view = chatView
} }
@@ -213,7 +213,7 @@ open class ChatController: UIViewController, WKNavigationDelegate, WKScriptMessa
} }
private func callJs(_ script: String) { private func callJs(_ script: String) {
chatView.evaluateJavaScript(script) chatView?.evaluateJavaScript(script)
} }
private func toJson(_ jsonObj: AnyObject) -> String { private func toJson(_ jsonObj: AnyObject) -> String {
@@ -319,8 +319,8 @@ open class ChatController: UIViewController, WKNavigationDelegate, WKScriptMessa
if url == nil { if url == nil {
url = URL(string: widgetUrl) url = URL(string: widgetUrl)
} }
chatView.load(URLRequest(url: url!)) chatView?.load(URLRequest(url: url!))
chatView.allowsBackForwardNavigationGestures = true chatView?.allowsBackForwardNavigationGestures = true
} }
public func injectCss(style: String) { public func injectCss(style: String) {
@@ -456,7 +456,7 @@ open class ChatController: UIViewController, WKNavigationDelegate, WKScriptMessa
super.viewDidDisappear(animated) super.viewDidDisappear(animated)
if animated && chatView != nil { if animated && chatView != nil {
chatView.stopLoading() chatView?.stopLoading()
callJsDestroy() callJsDestroy()
chatView = nil chatView = nil
} }

View File

@@ -1,6 +1,6 @@
import Foundation import Foundation
class ChatDateFormatter : DateFormatter { class ChatDateFormatter : DateFormatter, @unchecked Sendable {
override init() { override init() {
super.init() super.init()