Skip to content

Commit

Permalink
Bug fix: CPS-830
Browse files Browse the repository at this point in the history
  • Loading branch information
linjie-firework committed May 23, 2024
1 parent 8f027ba commit 4ad9072
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,31 +64,32 @@ extension UIView {
view.viewType = .normal
}

let swiftUIImageLayerClassName = "SW1hZ2VMYXllcg==".decodeBase64String()
let swiftUITextLayerClassName = "Q0dEcmF3aW5nTGF5ZXI=".decodeBase64String()
let layerClassName = String(describing: type(of: self.layer))

if AppLanguageManager.shared.shouldHorizontalFlip,
layerClassName == swiftUITextLayerClassName ||
layerClassName == swiftUIImageLayerClassName {
view.viewType = .normal
}

DispatchQueue.main.async {
if AppLanguageManager.shared.shouldHorizontalFlip {
let swiftUIImageLayerClassName = "SW1hZ2VMYXllcg==".decodeBase64String()
let swiftUITextLayerClassName = "Q0dEcmF3aW5nTGF5ZXI=".decodeBase64String()
let layerClassName = String(describing: type(of: self.layer))
if layerClassName == swiftUITextLayerClassName {
view.viewType = .normal
} else if layerClassName == swiftUIImageLayerClassName {
var resultViewType = LayoutFlipViewType.normal
if let contents = self.layer.contents as? CFTypeRef,
CFGetTypeID(contents) == CGImage.typeID {
let image = self.layer.contents as! CGImage
for imageName in gNamesOfImagesWithDirection {
let imageWithDirection = UIImage(
named: imageName,
in: Bundle(for: FireworkVideoSDK.self),
compatibleWith: nil
)?.cgImage
if image == imageWithDirection {
resultViewType = .flip
break
}
}
if AppLanguageManager.shared.shouldHorizontalFlip,
layerClassName == swiftUIImageLayerClassName,
let contents = self.layer.contents as? CFTypeRef,
CFGetTypeID(contents) == CGImage.typeID {
let image = self.layer.contents as! CGImage
for imageName in gNamesOfImagesWithDirection {
let imageWithDirection = UIImage(
named: imageName,
in: Bundle(for: FireworkVideoSDK.self),
compatibleWith: nil
)?.cgImage
if image == imageWithDirection {
view.viewType = .flip
break
}
view.viewType = resultViewType
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ extension UIView {
cls: self,
originalSelector: #selector(UIView.snapshotView(afterScreenUpdates:)),
customSelector: #selector(UIView.fw_snapshotView(afterScreenUpdates:)))
Swizzle.swizzleSelector(
cls: self,
originalSelector: #selector(UIView.layoutSubviews),
customSelector: #selector(UIView.fw_layoutSubviews))
}

var viewType: LayoutFlipViewType {
Expand Down Expand Up @@ -137,6 +141,11 @@ extension UIView {
return view
}

@objc func fw_layoutSubviews() {
fw_layoutSubviews()
renewLayerTransformForceRecursively(false)
}

func renewLayerTransformForceRecursively(_ forceRecursively: Bool) {
if !isIOSSDKView {
return
Expand Down

0 comments on commit 4ad9072

Please sign in to comment.