react-native-firework-sdk 2.10.1 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/fireworksdk/bridge/components/storyblock/StoryBlockFragment.kt +18 -1
- package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +4 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModel.kt +0 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModelDeserializer.kt +0 -3
- package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModelSerializer.kt +0 -2
- package/android/src/main/java/com/fireworksdk/bridge/models/FWSdkInitResultModel.kt +6 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModel.kt +9 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModelDeserializer.kt +45 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWTrackPurchaseModelSerializer.kt +34 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedItemDetailsModel.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlaybackDetails.kt +1 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModel.kt +2 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelDeserializer.kt +4 -1
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelSerializer.kt +2 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModel.kt +8 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModelDeserializer.kt +23 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerLogoConfigurationModelSerializer.kt +18 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWEventName.kt +2 -0
- package/android/src/main/java/com/fireworksdk/bridge/models/enums/FWVideoPlayerLogoOption.kt +19 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/FWReactNativeSDK.kt +103 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWStoryBlockManager.kt +12 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +8 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/models/FireworkSDKInterface.kt +2 -0
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +22 -9
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +74 -122
- package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +34 -9
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWConfigUtil.kt +13 -0
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWFragmentUtil.kt +3 -3
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWGlobalDataUtil.kt +5 -2
- package/android/src/main/java/com/fireworksdk/bridge/utils/FWModelUtils.kt +64 -0
- package/ios/Components/ReplayBadgeConfiguration.swift +12 -0
- package/ios/Components/StoryBlock.swift +31 -0
- package/ios/Components/StoryBlockConfiguration.swift +1 -0
- package/ios/Components/StoryBlockManager.m +24 -0
- package/ios/Components/StoryBlockManager.swift +6 -3
- package/ios/Components/VideoFeed.swift +18 -3
- package/ios/Components/VideoFeedConfiguration.swift +1 -0
- package/ios/Components/VideoFeedManager.m +4 -1
- package/ios/Components/VideoFeedManager.swift +6 -3
- package/ios/Components/VideoPlayerConfiguration.swift +1 -0
- package/ios/FWReactNativeSDK.swift +14 -0
- package/ios/FireworkSdk.xcodeproj/project.pbxproj +4 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+CTA.swift +17 -15
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +1 -11
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.m +1 -0
- package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +80 -81
- package/ios/Modules/FireworkSDKModule/SDKInitOptions.swift +9 -5
- package/ios/Modules/Shopping/ShoppingModule.swift +10 -74
- package/lib/commonjs/FireworkSDK.js +30 -25
- package/lib/commonjs/FireworkSDK.js.map +1 -1
- package/lib/commonjs/VideoShopping.js +6 -12
- package/lib/commonjs/VideoShopping.js.map +1 -1
- package/lib/commonjs/components/StoryBlock.js +54 -3
- package/lib/commonjs/components/StoryBlock.js.map +1 -1
- package/lib/commonjs/components/VideoFeed.js +46 -4
- package/lib/commonjs/components/VideoFeed.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/FWNativeErrorAction.js +14 -0
- package/lib/commonjs/models/FWNativeErrorAction.js.map +1 -0
- package/lib/commonjs/models/ReplayBadgeConfiguration.js +2 -0
- package/lib/commonjs/models/ReplayBadgeConfiguration.js.map +1 -0
- package/lib/commonjs/modules/FireworkSDKModule.js.map +1 -1
- package/lib/module/FireworkSDK.js +29 -25
- package/lib/module/FireworkSDK.js.map +1 -1
- package/lib/module/VideoShopping.js +6 -12
- package/lib/module/VideoShopping.js.map +1 -1
- package/lib/module/components/StoryBlock.js +53 -3
- package/lib/module/components/StoryBlock.js.map +1 -1
- package/lib/module/components/VideoFeed.js +42 -4
- package/lib/module/components/VideoFeed.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/FWNativeErrorAction.js +7 -0
- package/lib/module/models/FWNativeErrorAction.js.map +1 -0
- package/lib/module/models/ReplayBadgeConfiguration.js +2 -0
- package/lib/module/models/ReplayBadgeConfiguration.js.map +1 -0
- package/lib/module/modules/FireworkSDKModule.js.map +1 -1
- package/lib/typescript/VideoShopping.d.ts +2 -2
- package/lib/typescript/components/StoryBlock.d.ts +18 -1
- package/lib/typescript/components/VideoFeed.d.ts +7 -1
- package/lib/typescript/index.d.ts +2 -2
- package/lib/typescript/models/FWEvents.d.ts +26 -3
- package/lib/typescript/models/FWNativeErrorAction.d.ts +4 -0
- package/lib/typescript/models/FeedItemDetails.d.ts +6 -1
- package/lib/typescript/models/ReplayBadgeConfiguration.d.ts +7 -0
- package/lib/typescript/models/StoryBlockConfiguration.d.ts +6 -1
- package/lib/typescript/models/VideoFeedConfiguration.d.ts +6 -0
- package/lib/typescript/models/VideoPlayerConfiguration.d.ts +6 -1
- package/lib/typescript/modules/FireworkSDKModule.d.ts +1 -0
- package/package.json +1 -5
- package/react-native-firework-sdk.podspec +3 -5
- package/src/FireworkSDK.ts +27 -24
- package/src/VideoShopping.ts +9 -11
- package/src/components/StoryBlock.tsx +69 -7
- package/src/components/VideoFeed.tsx +57 -12
- package/src/index.ts +2 -0
- package/src/models/FWEvents.ts +28 -3
- package/src/models/FWNativeErrorAction.ts +4 -0
- package/src/models/FeedItemDetails.ts +7 -1
- package/src/models/ReplayBadgeConfiguration.ts +7 -0
- package/src/models/StoryBlockConfiguration.ts +6 -1
- package/src/models/VideoFeedConfiguration.ts +6 -0
- package/src/models/VideoPlayerConfiguration.ts +6 -1
- package/src/modules/FireworkSDKModule.ts +1 -0
- package/FireworkVideoUI.xcframework/Info.plist +0 -40
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/FireworkVideoUI +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Headers/FireworkVideoUI-Swift.h +0 -280
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Headers/FireworkVideoUI.h +0 -18
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Info.plist +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.abi.json +0 -1313
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.private.swiftinterface +0 -42
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftinterface +0 -42
- package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/module.modulemap +0 -11
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/FireworkVideoUI +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Headers/FireworkVideoUI-Swift.h +0 -556
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Headers/FireworkVideoUI.h +0 -18
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Info.plist +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.abi.json +0 -1313
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +0 -42
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftinterface +0 -42
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.abi.json +0 -1313
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +0 -42
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +0 -42
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/module.modulemap +0 -11
- package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/_CodeSignature/CodeResources +0 -245
- package/ios/FireworkVideoUI/FireworkVideoUI/FireworkVideoUI.docc/FireworkVideoUI.md +0 -13
- package/ios/FireworkVideoUI/FireworkVideoUI/FireworkVideoUI.h +0 -18
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/AppLanguageManager.swift +0 -154
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/Bundle+AppLanguage.swift +0 -73
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/NumberFormatter+AppLanguage.swift +0 -25
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/URLSession+AppLanguage.swift +0 -52
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIImageView+AppLanguage.swift +0 -60
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UILabel+AppLanguage.swift +0 -98
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextField+AppLanguage.swift +0 -97
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextView+AppLanguage.swift +0 -97
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIView+AppLanguage.swift +0 -71
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIViewController+AppLanguage.swift +0 -48
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIWindow+AppLanguage.swift +0 -26
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/LanguageUtil.swift +0 -43
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/Foundation/NSObject+LayoutFlip.swift +0 -42
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/CALayer+LayoutFlip.swift +0 -149
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/UILabel+LayoutFlip.swift +0 -35
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/UIView+LayoutFlip.swift +0 -202
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/LayoutFlipManager.swift +0 -59
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/DispatchQueue+Once.swift +0 -32
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/String+Base64.swift +0 -18
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/UIKit/UIView+UIHierarchy.swift +0 -46
- package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Swizzle.swift +0 -37
- package/ios/FireworkVideoUI/FireworkVideoUI.xcodeproj/project.pbxproj +0 -766
- package/ios/FireworkVideoUI/FireworkVideoUI.xcworkspace/contents.xcworkspacedata +0 -10
- package/ios/FireworkVideoUI/FireworkVideoUI.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/FireworkVideoUI/FireworkVideoUITests/FireworkVideoUITests.swift +0 -37
- package/ios/FireworkVideoUI/Podfile +0 -15
- package/ios/FireworkVideoUI/Podfile.lock +0 -16
- package/ios/scripts/react_native_firework_sdk_pods.rb +0 -27
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// CALayer+LayoutFlip.swift
|
|
3
|
-
//
|
|
4
|
-
// Created by linjie jiang on 4/25/23.
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
import UIKit
|
|
8
|
-
|
|
9
|
-
extension CALayer {
|
|
10
|
-
private struct AssociatedKeys {
|
|
11
|
-
static var basicTransform = "basicTransform"
|
|
12
|
-
static var isRenderStartLayer = "isRenderStartLayer"
|
|
13
|
-
static var affineTransform = "affineTransform"
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
static func swizzleLayerMethodsForLayoutFlip() {
|
|
17
|
-
Swizzle.swizzleSelector(
|
|
18
|
-
cls: self,
|
|
19
|
-
originalSelector: #selector(CALayer.setAffineTransform(_:)),
|
|
20
|
-
customSelector: #selector(CALayer.fw_setAffineTransform(_:)))
|
|
21
|
-
Swizzle.swizzleSelector(
|
|
22
|
-
cls: self,
|
|
23
|
-
originalSelector: #selector(CALayer.affineTransform),
|
|
24
|
-
customSelector: #selector(CALayer.fw_affineTransform))
|
|
25
|
-
Swizzle.swizzleSelector(
|
|
26
|
-
cls: self,
|
|
27
|
-
originalSelector: #selector(CALayer.add(_:forKey:)),
|
|
28
|
-
customSelector: #selector(CALayer.fw_add(_:forKey:)))
|
|
29
|
-
Swizzle.swizzleSelector(
|
|
30
|
-
cls: self,
|
|
31
|
-
originalSelector: #selector(CALayer.render(in:)),
|
|
32
|
-
customSelector: #selector(CALayer.fw_render(in:)))
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
var basicTransform: CGAffineTransform {
|
|
36
|
-
get {
|
|
37
|
-
let result = objc_getAssociatedObject(self, &AssociatedKeys.basicTransform) as? NSValue
|
|
38
|
-
|
|
39
|
-
return result?.cgAffineTransformValue ?? CGAffineTransformIdentity
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
set {
|
|
43
|
-
let newBasicTransformValue = NSValue(cgAffineTransform: newValue)
|
|
44
|
-
if (objc_getAssociatedObject(self, &AssociatedKeys.basicTransform) as? NSValue)
|
|
45
|
-
== newBasicTransformValue {
|
|
46
|
-
return
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
let currentAffineTransform = self.affineTransform()
|
|
50
|
-
objc_setAssociatedObject(
|
|
51
|
-
self,
|
|
52
|
-
&AssociatedKeys.basicTransform,
|
|
53
|
-
newBasicTransformValue,
|
|
54
|
-
.OBJC_ASSOCIATION_RETAIN_NONATOMIC
|
|
55
|
-
)
|
|
56
|
-
self.setAffineTransform(currentAffineTransform)
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
var isRenderStartLayer: Bool {
|
|
61
|
-
get {
|
|
62
|
-
let result = objc_getAssociatedObject(self, &AssociatedKeys.isRenderStartLayer) as? Bool
|
|
63
|
-
return result ?? false
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
set {
|
|
67
|
-
objc_setAssociatedObject(
|
|
68
|
-
self,
|
|
69
|
-
&AssociatedKeys.isRenderStartLayer,
|
|
70
|
-
newValue,
|
|
71
|
-
.OBJC_ASSOCIATION_RETAIN_NONATOMIC
|
|
72
|
-
)
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
@objc func fw_setAffineTransform(_ affineTransform: CGAffineTransform) {
|
|
77
|
-
if objc_getAssociatedObject(self, &AssociatedKeys.basicTransform) != nil {
|
|
78
|
-
objc_setAssociatedObject(
|
|
79
|
-
self,
|
|
80
|
-
&AssociatedKeys.affineTransform,
|
|
81
|
-
NSValue(cgAffineTransform: affineTransform),
|
|
82
|
-
.OBJC_ASSOCIATION_RETAIN_NONATOMIC
|
|
83
|
-
)
|
|
84
|
-
fw_setAffineTransform(CGAffineTransformConcat(basicTransform, affineTransform))
|
|
85
|
-
} else {
|
|
86
|
-
fw_setAffineTransform(affineTransform)
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
@objc func fw_affineTransform() -> CGAffineTransform {
|
|
91
|
-
if objc_getAssociatedObject(self, &AssociatedKeys.basicTransform) != nil {
|
|
92
|
-
if let value = objc_getAssociatedObject(self, &AssociatedKeys.affineTransform) as? NSValue {
|
|
93
|
-
return value.cgAffineTransformValue
|
|
94
|
-
}
|
|
95
|
-
return fw_affineTransform()
|
|
96
|
-
} else {
|
|
97
|
-
return fw_affineTransform()
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
@objc func fw_add(_ anim: CAAnimation, forKey key: String?) {
|
|
102
|
-
if objc_getAssociatedObject(self, &AssociatedKeys.basicTransform) != nil,
|
|
103
|
-
let basicAnim = anim as? CABasicAnimation,
|
|
104
|
-
let keyPath = basicAnim.keyPath,
|
|
105
|
-
keyPath.starts(with: "transform.scale"),
|
|
106
|
-
self.basicTransform.a == -1,
|
|
107
|
-
let fromValue = basicAnim.fromValue as? Double,
|
|
108
|
-
let toValue = basicAnim.toValue as? Double {
|
|
109
|
-
basicAnim.fromValue = fromValue * -1
|
|
110
|
-
basicAnim.toValue = toValue * -1
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
fw_add(anim, forKey: key)
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
@objc func fw_render(in ctx: CGContext) {
|
|
117
|
-
if objc_getAssociatedObject(self, &AssociatedKeys.basicTransform) != nil {
|
|
118
|
-
var isRenderStartLayer = true
|
|
119
|
-
var allSuperLayerTransform = basicTransform
|
|
120
|
-
var layer = self
|
|
121
|
-
while let superlayer = layer.superlayer {
|
|
122
|
-
layer = superlayer
|
|
123
|
-
if layer.isRenderStartLayer {
|
|
124
|
-
isRenderStartLayer = false
|
|
125
|
-
break
|
|
126
|
-
}
|
|
127
|
-
allSuperLayerTransform = CGAffineTransformConcat(layer.basicTransform, allSuperLayerTransform)
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if isRenderStartLayer {
|
|
131
|
-
self.isRenderStartLayer = true
|
|
132
|
-
if allSuperLayerTransform.a == -1 {
|
|
133
|
-
ctx.saveGState()
|
|
134
|
-
ctx.concatenate(CGAffineTransformMakeScale(-1, 1))
|
|
135
|
-
ctx.translateBy(x: -self.bounds.size.width, y: 0)
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
fw_render(in: ctx)
|
|
139
|
-
if isRenderStartLayer {
|
|
140
|
-
self.isRenderStartLayer = false
|
|
141
|
-
if allSuperLayerTransform.a == -1 {
|
|
142
|
-
ctx.restoreGState()
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
} else {
|
|
146
|
-
fw_render(in: ctx)
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// UILabel+LayoutFlip.swift
|
|
3
|
-
//
|
|
4
|
-
// Created by linjie jiang on 4/25/23.
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
import UIKit
|
|
8
|
-
|
|
9
|
-
private let gNoUseClasses: [String] = [
|
|
10
|
-
"VUlUZXh0RmllbGRMYWJlbA==".decodeBase64String() // UITextFieldLabel
|
|
11
|
-
]
|
|
12
|
-
private let gSuperviewNoUseClasses: [String] = [
|
|
13
|
-
"VUlEYXRlUGlja2VyQ29udGVudFZpZXc=".decodeBase64String() // UIDatePickerContentView
|
|
14
|
-
]
|
|
15
|
-
|
|
16
|
-
extension UILabel {
|
|
17
|
-
func shouldUseCalculatedTextAlignment() -> Bool {
|
|
18
|
-
for className in gNoUseClasses {
|
|
19
|
-
if let cls = NSClassFromString(className),
|
|
20
|
-
self.isKind(of: cls) {
|
|
21
|
-
return false
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
for className in gSuperviewNoUseClasses {
|
|
26
|
-
if let cls = NSClassFromString(className),
|
|
27
|
-
let superview = superview,
|
|
28
|
-
superview.isKind(of: cls) {
|
|
29
|
-
return false
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return true
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// UIView+LayoutFlip.swift
|
|
3
|
-
//
|
|
4
|
-
// Created by linjie jiang on 4/25/23.
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
import UIKit
|
|
8
|
-
import WebKit
|
|
9
|
-
|
|
10
|
-
private let gNoFlipClasses: [Any] = [
|
|
11
|
-
UILabel.self,
|
|
12
|
-
UITextView.self,
|
|
13
|
-
UITextField.self,
|
|
14
|
-
WKWebView.self,
|
|
15
|
-
UIImageView.self,
|
|
16
|
-
UISearchBar.self,
|
|
17
|
-
"PUPhotosSectionHeaderContentView",
|
|
18
|
-
"UITableViewIndex",
|
|
19
|
-
"UIWebView",
|
|
20
|
-
"X1VJUmVtb3RlVmlldw==".decodeBase64String(), // _UIRemoteView
|
|
21
|
-
"VUlBdXRvY29ycmVjdFRleHRWaWV3".decodeBase64String() // UIAutocorrectTextView
|
|
22
|
-
]
|
|
23
|
-
|
|
24
|
-
enum LayoutFlipViewType: Int {
|
|
25
|
-
case auto
|
|
26
|
-
case inherit
|
|
27
|
-
case normal
|
|
28
|
-
case flip
|
|
29
|
-
case normalWithAllDescendants
|
|
30
|
-
case flipWithAllDescendants
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
extension UIView {
|
|
34
|
-
private struct AssociatedKeys {
|
|
35
|
-
static var viewType = "viewType"
|
|
36
|
-
static var calculatedViewType = "calculatedViewType"
|
|
37
|
-
static var lastType = "lastType"
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
static func swizzleViewMethodsForLayoutFlip() {
|
|
41
|
-
Swizzle.swizzleSelector(
|
|
42
|
-
cls: self,
|
|
43
|
-
originalSelector: #selector(UIView.didMoveToSuperview),
|
|
44
|
-
customSelector: #selector(UIView.fw_didMoveToSuperview))
|
|
45
|
-
Swizzle.swizzleSelector(
|
|
46
|
-
cls: self,
|
|
47
|
-
originalSelector: #selector(UIView.didMoveToWindow),
|
|
48
|
-
customSelector: #selector(UIView.fw_didMoveToWindow))
|
|
49
|
-
Swizzle.swizzleSelector(
|
|
50
|
-
cls: self,
|
|
51
|
-
originalSelector: #selector(UIView.snapshotView(afterScreenUpdates:)),
|
|
52
|
-
customSelector: #selector(UIView.fw_snapshotView(afterScreenUpdates:)))
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
var viewType: LayoutFlipViewType {
|
|
56
|
-
get {
|
|
57
|
-
let rawValue = objc_getAssociatedObject(self, &AssociatedKeys.viewType) as? Int ?? 0
|
|
58
|
-
let type = LayoutFlipViewType(rawValue: rawValue) ?? .auto
|
|
59
|
-
|
|
60
|
-
return type
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
set {
|
|
64
|
-
if viewType == newValue {
|
|
65
|
-
return
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
objc_setAssociatedObject(
|
|
69
|
-
self,
|
|
70
|
-
&AssociatedKeys.viewType,
|
|
71
|
-
newValue.rawValue,
|
|
72
|
-
.OBJC_ASSOCIATION_RETAIN_NONATOMIC
|
|
73
|
-
)
|
|
74
|
-
renewLayerTransformForceRecursively(false)
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
private(set) var calculatedViewType: LayoutFlipViewType {
|
|
79
|
-
get {
|
|
80
|
-
let rawValue = objc_getAssociatedObject(self, &AssociatedKeys.calculatedViewType) as? Int ?? 0
|
|
81
|
-
var type = LayoutFlipViewType(rawValue: rawValue) ?? .auto
|
|
82
|
-
if type == .auto {
|
|
83
|
-
if self.window != nil {
|
|
84
|
-
updateCalculatedViewType()
|
|
85
|
-
let newRawValue = objc_getAssociatedObject(self, &AssociatedKeys.calculatedViewType) as? Int ?? 0
|
|
86
|
-
type = LayoutFlipViewType(rawValue: newRawValue) ?? .auto
|
|
87
|
-
} else {
|
|
88
|
-
type = .normal
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return type
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
set {
|
|
96
|
-
objc_setAssociatedObject(
|
|
97
|
-
self,
|
|
98
|
-
&AssociatedKeys.calculatedViewType,
|
|
99
|
-
newValue.rawValue,
|
|
100
|
-
.OBJC_ASSOCIATION_RETAIN_NONATOMIC
|
|
101
|
-
)
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
private var lastType: LayoutFlipViewType {
|
|
106
|
-
get {
|
|
107
|
-
let rawValue = objc_getAssociatedObject(self, &AssociatedKeys.lastType) as? Int ?? 0
|
|
108
|
-
let type = LayoutFlipViewType(rawValue: rawValue) ?? .auto
|
|
109
|
-
|
|
110
|
-
return type
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
set {
|
|
114
|
-
objc_setAssociatedObject(
|
|
115
|
-
self,
|
|
116
|
-
&AssociatedKeys.lastType,
|
|
117
|
-
newValue.rawValue,
|
|
118
|
-
.OBJC_ASSOCIATION_RETAIN_NONATOMIC
|
|
119
|
-
)
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
@objc func fw_didMoveToSuperview() {
|
|
124
|
-
fw_didMoveToSuperview()
|
|
125
|
-
renewLayerTransformForceRecursively(false)
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
@objc func fw_didMoveToWindow() {
|
|
129
|
-
fw_didMoveToWindow()
|
|
130
|
-
renewLayerTransformForceRecursively(false)
|
|
131
|
-
LayoutFlipManager.shared.registerUIElement(self)
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
@objc func fw_snapshotView(afterScreenUpdates afterUpdates: Bool) -> UIView? {
|
|
135
|
-
let view = fw_snapshotView(afterScreenUpdates: afterUpdates)
|
|
136
|
-
view?.viewType = calculatedViewType
|
|
137
|
-
return view
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
func renewLayerTransformForceRecursively(_ forceRecursively: Bool) {
|
|
141
|
-
if !isIOSSDKView {
|
|
142
|
-
return
|
|
143
|
-
}
|
|
144
|
-
updateCalculatedViewType()
|
|
145
|
-
let updatedViewType = calculatedViewType
|
|
146
|
-
let superViewCalculatedViewType = superview?.calculatedViewType ?? .auto
|
|
147
|
-
let shouldFlipCurrentView = updatedViewType == .flip || updatedViewType == .flipWithAllDescendants
|
|
148
|
-
let shouldFlipSuperview = superViewCalculatedViewType == .flip
|
|
149
|
-
|| superViewCalculatedViewType == .flipWithAllDescendants
|
|
150
|
-
|
|
151
|
-
let shouldSetFlipTransform = shouldFlipSuperview != shouldFlipCurrentView
|
|
152
|
-
|
|
153
|
-
if shouldSetFlipTransform && LayoutFlipManager.shared.enableHorizontalFlip {
|
|
154
|
-
layer.basicTransform = CGAffineTransformMakeScale(-1, 1)
|
|
155
|
-
} else {
|
|
156
|
-
layer.basicTransform = CGAffineTransformIdentity
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if updatedViewType != lastType || forceRecursively {
|
|
160
|
-
for subView in subviews {
|
|
161
|
-
subView.renewLayerTransformForceRecursively(forceRecursively)
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
lastType = updatedViewType
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
private func automaticViewType() -> LayoutFlipViewType {
|
|
169
|
-
if self is UIWindow {
|
|
170
|
-
return .normal
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
for element in gNoFlipClasses {
|
|
174
|
-
if let cls = element as? AnyClass,
|
|
175
|
-
self.isKind(of: cls) {
|
|
176
|
-
return .normal
|
|
177
|
-
|
|
178
|
-
} else if let className = element as? String,
|
|
179
|
-
let cls = NSClassFromString(className),
|
|
180
|
-
self.isKind(of: cls) {
|
|
181
|
-
return .normal
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
return superview != nil ? .inherit : .normal
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
private func updateCalculatedViewType() {
|
|
189
|
-
var resultCalculatedViewType = viewType
|
|
190
|
-
if resultCalculatedViewType == .auto {
|
|
191
|
-
resultCalculatedViewType = automaticViewType()
|
|
192
|
-
}
|
|
193
|
-
let superViewCalculatedViewType = superview?.calculatedViewType ?? .auto
|
|
194
|
-
if superViewCalculatedViewType == .flipWithAllDescendants
|
|
195
|
-
|| superViewCalculatedViewType == .normalWithAllDescendants
|
|
196
|
-
|| resultCalculatedViewType == .inherit {
|
|
197
|
-
calculatedViewType = superViewCalculatedViewType
|
|
198
|
-
} else {
|
|
199
|
-
calculatedViewType = resultCalculatedViewType
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// LayoutFlipManager.swift
|
|
3
|
-
//
|
|
4
|
-
// Created by linjie jiang on 4/25/23.
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
import UIKit
|
|
8
|
-
|
|
9
|
-
class LayoutFlipManager {
|
|
10
|
-
static let shared = LayoutFlipManager()
|
|
11
|
-
|
|
12
|
-
static func swizzelMethods() {
|
|
13
|
-
DispatchQueue.once {
|
|
14
|
-
UIView.swizzleViewMethodsForLayoutFlip()
|
|
15
|
-
CALayer.swizzleLayerMethodsForLayoutFlip()
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
var enableHorizontalFlip: Bool = false {
|
|
20
|
-
didSet {
|
|
21
|
-
if enableHorizontalFlip == oldValue {
|
|
22
|
-
return
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
var rootViews: Set<UIView> = Set()
|
|
26
|
-
for element in registeredUIElements.allObjects {
|
|
27
|
-
element.performReload()
|
|
28
|
-
|
|
29
|
-
if element.window != nil && element.window != element {
|
|
30
|
-
continue
|
|
31
|
-
}
|
|
32
|
-
rootViews.insert(rootViewForView(element))
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
for rootView in rootViews {
|
|
36
|
-
rootView.renewLayerTransformForceRecursively(true)
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
private var registeredUIElements: NSHashTable<UIView> = NSHashTable.weakObjects()
|
|
42
|
-
|
|
43
|
-
func registerUIElement(_ element: UIView) {
|
|
44
|
-
self.registeredUIElements.add(element)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
private func rootViewForView(_ view: UIView) -> UIView {
|
|
48
|
-
if let window = view.window {
|
|
49
|
-
return window
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
var rootView: UIView = view
|
|
53
|
-
while let superview = rootView.superview {
|
|
54
|
-
rootView = superview
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return rootView
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// DispatchQueue+Once.swift
|
|
3
|
-
//
|
|
4
|
-
// Created by Jeff Zheng on 2022/3/1.
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
import Foundation
|
|
8
|
-
|
|
9
|
-
public extension DispatchQueue {
|
|
10
|
-
private static var _onceContainer = [String]()
|
|
11
|
-
|
|
12
|
-
/// Execute a block only once.
|
|
13
|
-
class func once(
|
|
14
|
-
file: String = #file, function: String = #function, line: Int = #line, block: () -> Void
|
|
15
|
-
) {
|
|
16
|
-
let token = file + ":" + function + ":" + String(line)
|
|
17
|
-
once(token: token, block: block)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/// Execute a block only once.
|
|
21
|
-
class func once(token: String, block: () -> Void) {
|
|
22
|
-
objc_sync_enter(self)
|
|
23
|
-
defer { objc_sync_exit(self) }
|
|
24
|
-
|
|
25
|
-
guard !_onceContainer.contains(token) else {
|
|
26
|
-
return
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
_onceContainer.append(token)
|
|
30
|
-
block()
|
|
31
|
-
}
|
|
32
|
-
}
|
package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/String+Base64.swift
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// String+Base64.swift
|
|
3
|
-
//
|
|
4
|
-
// Created by linjie jiang on 4/25/23.
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
import Foundation
|
|
8
|
-
|
|
9
|
-
extension String {
|
|
10
|
-
func decodeBase64String() -> String {
|
|
11
|
-
if let decodedData = Data(base64Encoded: self),
|
|
12
|
-
let decodedString = String(data: decodedData, encoding: .utf8) {
|
|
13
|
-
return decodedString
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return ""
|
|
17
|
-
}
|
|
18
|
-
}
|
package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/UIKit/UIView+UIHierarchy.swift
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// UIView+UIHierarchy.swift
|
|
3
|
-
//
|
|
4
|
-
// Created by Jeff Zheng on 2021/12/22.
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
import UIKit
|
|
8
|
-
import FireworkVideo
|
|
9
|
-
|
|
10
|
-
public extension UIView {
|
|
11
|
-
var parentViewController: UIViewController? {
|
|
12
|
-
var parentResponder: UIResponder? = self
|
|
13
|
-
while parentResponder != nil {
|
|
14
|
-
parentResponder = parentResponder!.next
|
|
15
|
-
if let viewController = parentResponder as? UIViewController {
|
|
16
|
-
return viewController
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return nil
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
var isIOSSDKView: Bool {
|
|
24
|
-
guard self.window != nil else {
|
|
25
|
-
return false
|
|
26
|
-
}
|
|
27
|
-
guard let parentVC = self.parentViewController else {
|
|
28
|
-
return false
|
|
29
|
-
}
|
|
30
|
-
let iOSSDKBundle = Bundle(for: FireworkVideoSDK.self)
|
|
31
|
-
|
|
32
|
-
if iOSSDKBundle == Bundle(for: type(of: parentVC)) {
|
|
33
|
-
return true
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
var ancestorVC = parentVC.parent
|
|
37
|
-
while ancestorVC != nil {
|
|
38
|
-
if iOSSDKBundle == Bundle(for: type(of: ancestorVC!)) {
|
|
39
|
-
return true
|
|
40
|
-
}
|
|
41
|
-
ancestorVC = ancestorVC!.parent
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return false
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Swizzle.swift
|
|
3
|
-
//
|
|
4
|
-
// Created by linjie jiang on 2023/2/7.
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
import Foundation
|
|
8
|
-
|
|
9
|
-
public class Swizzle {
|
|
10
|
-
public static func swizzleSelector(cls: AnyClass, originalSelector: Selector, customSelector: Selector) {
|
|
11
|
-
guard let originalMethod = class_getInstanceMethod(cls, originalSelector) else { return }
|
|
12
|
-
guard let customMethod = class_getInstanceMethod(cls, customSelector) else { return }
|
|
13
|
-
|
|
14
|
-
if class_addMethod(
|
|
15
|
-
cls,
|
|
16
|
-
originalSelector,
|
|
17
|
-
method_getImplementation(customMethod),
|
|
18
|
-
method_getTypeEncoding(customMethod)
|
|
19
|
-
) {
|
|
20
|
-
class_replaceMethod(
|
|
21
|
-
cls,
|
|
22
|
-
customSelector,
|
|
23
|
-
method_getImplementation(originalMethod),
|
|
24
|
-
method_getTypeEncoding(originalMethod)
|
|
25
|
-
)
|
|
26
|
-
} else {
|
|
27
|
-
method_exchangeImplementations(originalMethod, customMethod)
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
public static func swizzleClassSelector(cls: AnyClass, originalSelector: Selector, customSelector: Selector) {
|
|
32
|
-
guard let originalMethod = class_getClassMethod(cls, originalSelector) else { return }
|
|
33
|
-
guard let customMethod = class_getClassMethod(cls, customSelector) else { return }
|
|
34
|
-
|
|
35
|
-
method_exchangeImplementations(originalMethod, customMethod)
|
|
36
|
-
}
|
|
37
|
-
}
|