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,60 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// UIImageView+AppLanguage.swift
|
|
3
|
-
//
|
|
4
|
-
// Created by linjie jiang on 2023/2/22.
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
import UIKit
|
|
8
|
-
import FireworkVideo
|
|
9
|
-
|
|
10
|
-
extension UIImageView {
|
|
11
|
-
static func swizzleImageViewMethodsForAppLanguage() {
|
|
12
|
-
Swizzle.swizzleSelector(
|
|
13
|
-
cls: self,
|
|
14
|
-
originalSelector: #selector(UIImageView.didMoveToWindow),
|
|
15
|
-
customSelector: #selector(UIImageView.fw_imageViewDidMoveToWindow))
|
|
16
|
-
Swizzle.swizzleSelector(
|
|
17
|
-
cls: self,
|
|
18
|
-
originalSelector: #selector(setter: UIImageView.image),
|
|
19
|
-
customSelector: #selector(UIImageView.fw_setImage(_:))
|
|
20
|
-
)
|
|
21
|
-
Swizzle.swizzleSelector(
|
|
22
|
-
cls: self,
|
|
23
|
-
originalSelector: #selector(UIImageView.awakeFromNib),
|
|
24
|
-
customSelector: #selector(UIImageView.fw_imageViewAwakeFromNib)
|
|
25
|
-
)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
@objc func fw_imageViewDidMoveToWindow() {
|
|
29
|
-
fw_imageViewDidMoveToWindow()
|
|
30
|
-
updateViewType(self.image)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
@objc func fw_setImage(_ image: UIImage?) {
|
|
34
|
-
fw_setImage(image)
|
|
35
|
-
updateViewType(image)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
@objc func fw_imageViewAwakeFromNib() {
|
|
39
|
-
self.fw_imageViewAwakeFromNib()
|
|
40
|
-
updateViewType(self.image)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
private func updateViewType(_ image: UIImage?) {
|
|
44
|
-
self.viewType = shouldFlipImage(image) ? .flip : .auto
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
private func shouldFlipImage(_ image: UIImage?) -> Bool {
|
|
48
|
-
guard let image = image else {
|
|
49
|
-
return false
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if AppLanguageManager.shared.shouldHorizontalFlip,
|
|
53
|
-
image.flipsForRightToLeftLayoutDirection == true,
|
|
54
|
-
self.isIOSSDKView {
|
|
55
|
-
return true
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return false
|
|
59
|
-
}
|
|
60
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// UILabel+AppLanguage.swift
|
|
3
|
-
//
|
|
4
|
-
// Created by linjie jiang on 2023/2/22.
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
import UIKit
|
|
8
|
-
|
|
9
|
-
extension UILabel {
|
|
10
|
-
private struct AssociatedKeys {
|
|
11
|
-
static var hasCalculatedTextAlignment = "hasCalculatedTextAlignmentKey"
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
private var hasCalculatedTextAlignment: Bool {
|
|
15
|
-
get {
|
|
16
|
-
let result = objc_getAssociatedObject(self, &AssociatedKeys.hasCalculatedTextAlignment) as? Bool
|
|
17
|
-
return result ?? false
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
set {
|
|
21
|
-
objc_setAssociatedObject(
|
|
22
|
-
self,
|
|
23
|
-
&AssociatedKeys.hasCalculatedTextAlignment,
|
|
24
|
-
newValue,
|
|
25
|
-
.OBJC_ASSOCIATION_RETAIN_NONATOMIC
|
|
26
|
-
)
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
static func swizzleLabelMethodsForAppLanguage() {
|
|
31
|
-
Swizzle.swizzleSelector(cls: self,
|
|
32
|
-
originalSelector: #selector(setter: UILabel.textAlignment),
|
|
33
|
-
customSelector: #selector(UILabel.fw_setLabelTextAlignment(_:)))
|
|
34
|
-
Swizzle.swizzleSelector(cls: self,
|
|
35
|
-
originalSelector: #selector(UILabel.didMoveToWindow),
|
|
36
|
-
customSelector: #selector(UILabel.fw_labelDidMoveToWindow))
|
|
37
|
-
Swizzle.swizzleSelector(cls: self,
|
|
38
|
-
originalSelector: #selector(UILabel.removeFromSuperview),
|
|
39
|
-
customSelector: #selector(UILabel.fw_labelRemoveFromSuperview))
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@objc func fw_setLabelTextAlignment(_ textAlignment: NSTextAlignment) {
|
|
43
|
-
addReloadClosure(key: "alignment") { [weak self] in
|
|
44
|
-
guard let self = self else {
|
|
45
|
-
return
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
self.fw_setLabelTextAlignment(self.calculatedTextAlignment(textAlignment))
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@objc func fw_labelDidMoveToWindow() {
|
|
53
|
-
fw_labelDidMoveToWindow()
|
|
54
|
-
if shouldCalculateTextAlignment(),
|
|
55
|
-
!self.hasCalculatedTextAlignment,
|
|
56
|
-
self.isIOSSDKView {
|
|
57
|
-
self.textAlignment = self.textAlignment
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
@objc func fw_labelRemoveFromSuperview() {
|
|
62
|
-
fw_labelRemoveFromSuperview()
|
|
63
|
-
self.hasCalculatedTextAlignment = false
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
private func calculatedTextAlignment(_ textAlignment: NSTextAlignment) -> NSTextAlignment {
|
|
67
|
-
if shouldCalculateTextAlignment(),
|
|
68
|
-
let layoutDirection = AppLanguageManager.shared.appLanguageLayoutDirection {
|
|
69
|
-
self.hasCalculatedTextAlignment = true
|
|
70
|
-
if layoutDirection == .rtl {
|
|
71
|
-
if textAlignment == .center {
|
|
72
|
-
return textAlignment
|
|
73
|
-
} else if textAlignment == .right {
|
|
74
|
-
return .left
|
|
75
|
-
} else {
|
|
76
|
-
return .right
|
|
77
|
-
}
|
|
78
|
-
} else if layoutDirection == .ltr {
|
|
79
|
-
return .left
|
|
80
|
-
}
|
|
81
|
-
} else {
|
|
82
|
-
return textAlignment
|
|
83
|
-
}
|
|
84
|
-
return textAlignment
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
private func shouldCalculateTextAlignment() -> Bool {
|
|
88
|
-
if AppLanguageManager.shared.shouldHorizontalFlip,
|
|
89
|
-
self.isIOSSDKView,
|
|
90
|
-
let layoutDirection = AppLanguageManager.shared.appLanguageLayoutDirection,
|
|
91
|
-
layoutDirection != .unsupported,
|
|
92
|
-
shouldUseCalculatedTextAlignment() {
|
|
93
|
-
return true
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return false
|
|
97
|
-
}
|
|
98
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// UITextField+AppLanguage.swift
|
|
3
|
-
//
|
|
4
|
-
// Created by linjie jiang on 2023/2/23.
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
import UIKit
|
|
8
|
-
|
|
9
|
-
extension UITextField {
|
|
10
|
-
private struct AssociatedKeys {
|
|
11
|
-
static var hasCalculatedTextAlignment = "hasCalculatedTextAlignmentKey"
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
private var hasCalculatedTextAlignment: Bool {
|
|
15
|
-
get {
|
|
16
|
-
let result = objc_getAssociatedObject(self, &AssociatedKeys.hasCalculatedTextAlignment) as? Bool
|
|
17
|
-
return result ?? false
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
set {
|
|
21
|
-
objc_setAssociatedObject(
|
|
22
|
-
self,
|
|
23
|
-
&AssociatedKeys.hasCalculatedTextAlignment,
|
|
24
|
-
newValue,
|
|
25
|
-
.OBJC_ASSOCIATION_RETAIN_NONATOMIC
|
|
26
|
-
)
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
static func swizzleTextFieldMethodsForAppLanguage() {
|
|
31
|
-
Swizzle.swizzleSelector(cls: self,
|
|
32
|
-
originalSelector: #selector(setter: UITextField.textAlignment),
|
|
33
|
-
customSelector: #selector(UITextField.fw_setTextFieldTextAlignment(_:)))
|
|
34
|
-
Swizzle.swizzleSelector(cls: self,
|
|
35
|
-
originalSelector: #selector(UITextField.didMoveToWindow),
|
|
36
|
-
customSelector: #selector(UITextField.fw_textFieldDidMoveToWindow))
|
|
37
|
-
Swizzle.swizzleSelector(cls: self,
|
|
38
|
-
originalSelector: #selector(UITextField.removeFromSuperview),
|
|
39
|
-
customSelector: #selector(UITextField.fw_textFieldRemoveFromSuperview))
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@objc func fw_setTextFieldTextAlignment(_ textAlignment: NSTextAlignment) {
|
|
43
|
-
addReloadClosure(key: "alignment") { [weak self] in
|
|
44
|
-
guard let self = self else {
|
|
45
|
-
return
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
self.fw_setTextFieldTextAlignment(self.calculatedTextAlignment(textAlignment))
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@objc func fw_textFieldDidMoveToWindow() {
|
|
53
|
-
fw_textFieldDidMoveToWindow()
|
|
54
|
-
if shouldCalculateTextAlignment(),
|
|
55
|
-
!self.hasCalculatedTextAlignment,
|
|
56
|
-
self.isIOSSDKView {
|
|
57
|
-
self.textAlignment = self.textAlignment
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
@objc func fw_textFieldRemoveFromSuperview() {
|
|
62
|
-
fw_textFieldRemoveFromSuperview()
|
|
63
|
-
self.hasCalculatedTextAlignment = false
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
private func calculatedTextAlignment(_ textAlignment: NSTextAlignment) -> NSTextAlignment {
|
|
67
|
-
if shouldCalculateTextAlignment(),
|
|
68
|
-
let layoutDirection = AppLanguageManager.shared.appLanguageLayoutDirection {
|
|
69
|
-
self.hasCalculatedTextAlignment = true
|
|
70
|
-
if layoutDirection == .rtl {
|
|
71
|
-
if textAlignment == .center {
|
|
72
|
-
return textAlignment
|
|
73
|
-
} else if textAlignment == .right {
|
|
74
|
-
return .left
|
|
75
|
-
} else {
|
|
76
|
-
return .right
|
|
77
|
-
}
|
|
78
|
-
} else if layoutDirection == .ltr {
|
|
79
|
-
return .left
|
|
80
|
-
}
|
|
81
|
-
} else {
|
|
82
|
-
return textAlignment
|
|
83
|
-
}
|
|
84
|
-
return textAlignment
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
private func shouldCalculateTextAlignment() -> Bool {
|
|
88
|
-
if AppLanguageManager.shared.shouldHorizontalFlip,
|
|
89
|
-
self.isIOSSDKView,
|
|
90
|
-
let layoutDirection = AppLanguageManager.shared.appLanguageLayoutDirection,
|
|
91
|
-
layoutDirection != .unsupported {
|
|
92
|
-
return true
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return false
|
|
96
|
-
}
|
|
97
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// UITextView+AppLanguage.swift
|
|
3
|
-
//
|
|
4
|
-
// Created by linjie jiang on 2023/2/23.
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
import UIKit
|
|
8
|
-
|
|
9
|
-
extension UITextView {
|
|
10
|
-
private struct AssociatedKeys {
|
|
11
|
-
static var hasCalculatedTextAlignment = "hasCalculatedTextAlignmentKey"
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
private var hasCalculatedTextAlignment: Bool {
|
|
15
|
-
get {
|
|
16
|
-
let result = objc_getAssociatedObject(self, &AssociatedKeys.hasCalculatedTextAlignment) as? Bool
|
|
17
|
-
return result ?? false
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
set {
|
|
21
|
-
objc_setAssociatedObject(
|
|
22
|
-
self,
|
|
23
|
-
&AssociatedKeys.hasCalculatedTextAlignment,
|
|
24
|
-
newValue,
|
|
25
|
-
.OBJC_ASSOCIATION_RETAIN_NONATOMIC
|
|
26
|
-
)
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
static func swizzleTextViewMethodsForAppLanguage() {
|
|
31
|
-
Swizzle.swizzleSelector(cls: self,
|
|
32
|
-
originalSelector: #selector(setter: UITextView.textAlignment),
|
|
33
|
-
customSelector: #selector(UITextView.fw_setTextViewTextAlignment(_:)))
|
|
34
|
-
Swizzle.swizzleSelector(cls: self,
|
|
35
|
-
originalSelector: #selector(UITextView.didMoveToWindow),
|
|
36
|
-
customSelector: #selector(UITextView.fw_textViewDidMoveToWindow))
|
|
37
|
-
Swizzle.swizzleSelector(cls: self,
|
|
38
|
-
originalSelector: #selector(UITextView.removeFromSuperview),
|
|
39
|
-
customSelector: #selector(UITextView.fw_textViewRemoveFromSuperview))
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@objc func fw_setTextViewTextAlignment(_ textAlignment: NSTextAlignment) {
|
|
43
|
-
addReloadClosure(key: "alignment") { [weak self] in
|
|
44
|
-
guard let self = self else {
|
|
45
|
-
return
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
self.fw_setTextViewTextAlignment(self.calculatedTextAlignment(textAlignment))
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@objc func fw_textViewDidMoveToWindow() {
|
|
53
|
-
fw_textViewDidMoveToWindow()
|
|
54
|
-
if shouldCalculateTextAlignment(),
|
|
55
|
-
!self.hasCalculatedTextAlignment,
|
|
56
|
-
self.isIOSSDKView {
|
|
57
|
-
self.textAlignment = self.textAlignment
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
@objc func fw_textViewRemoveFromSuperview() {
|
|
62
|
-
fw_textViewRemoveFromSuperview()
|
|
63
|
-
self.hasCalculatedTextAlignment = false
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
private func calculatedTextAlignment(_ textAlignment: NSTextAlignment) -> NSTextAlignment {
|
|
67
|
-
if shouldCalculateTextAlignment(),
|
|
68
|
-
let layoutDirection = AppLanguageManager.shared.appLanguageLayoutDirection {
|
|
69
|
-
self.hasCalculatedTextAlignment = true
|
|
70
|
-
if layoutDirection == .rtl {
|
|
71
|
-
if textAlignment == .center {
|
|
72
|
-
return textAlignment
|
|
73
|
-
} else if textAlignment == .right {
|
|
74
|
-
return .left
|
|
75
|
-
} else {
|
|
76
|
-
return .right
|
|
77
|
-
}
|
|
78
|
-
} else if layoutDirection == .ltr {
|
|
79
|
-
return .left
|
|
80
|
-
}
|
|
81
|
-
} else {
|
|
82
|
-
return textAlignment
|
|
83
|
-
}
|
|
84
|
-
return textAlignment
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
private func shouldCalculateTextAlignment() -> Bool {
|
|
88
|
-
if AppLanguageManager.shared.shouldHorizontalFlip,
|
|
89
|
-
self.isIOSSDKView,
|
|
90
|
-
let layoutDirection = AppLanguageManager.shared.appLanguageLayoutDirection,
|
|
91
|
-
layoutDirection != .unsupported {
|
|
92
|
-
return true
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return false
|
|
96
|
-
}
|
|
97
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// UIView+AppLanguage.swift
|
|
3
|
-
//
|
|
4
|
-
// Created by linjie jiang on 2023/3/11.
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
import UIKit
|
|
8
|
-
import FireworkVideo
|
|
9
|
-
import AVFoundation
|
|
10
|
-
|
|
11
|
-
extension UIView {
|
|
12
|
-
static func swizzleViewMethodsForAppLanguage() {
|
|
13
|
-
Swizzle.swizzleSelector(
|
|
14
|
-
cls: self,
|
|
15
|
-
originalSelector: #selector(UIView.init(frame:)),
|
|
16
|
-
customSelector: #selector(UIView.fw_init(frame:))
|
|
17
|
-
)
|
|
18
|
-
Swizzle.swizzleSelector(
|
|
19
|
-
cls: self,
|
|
20
|
-
originalSelector: #selector(UIView.awakeFromNib),
|
|
21
|
-
customSelector: #selector(UIView.fw_viewAwakeFromNib)
|
|
22
|
-
)
|
|
23
|
-
Swizzle.swizzleSelector(
|
|
24
|
-
cls: self,
|
|
25
|
-
originalSelector: #selector(getter: UIView.semanticContentAttribute),
|
|
26
|
-
customSelector: #selector(UIView.fw_semanticContentAttribute)
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@objc func fw_init(frame: CGRect) -> UIView {
|
|
31
|
-
let view = self.fw_init(frame: frame)
|
|
32
|
-
updateViewTypeIfNeeded(view)
|
|
33
|
-
|
|
34
|
-
return view
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
@objc func fw_viewAwakeFromNib() {
|
|
38
|
-
self.fw_viewAwakeFromNib()
|
|
39
|
-
updateViewTypeIfNeeded(self)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@objc func fw_semanticContentAttribute() -> UISemanticContentAttribute {
|
|
43
|
-
if self.isIOSSDKView, AppLanguageManager.shared.shouldHorizontalFlip {
|
|
44
|
-
let systemLanguageLayoutDirection = AppLanguageManager.shared.systemLanguageLayoutDirection ?? .unsupported
|
|
45
|
-
switch systemLanguageLayoutDirection {
|
|
46
|
-
case .ltr:
|
|
47
|
-
return .forceLeftToRight
|
|
48
|
-
case .rtl:
|
|
49
|
-
return .forceRightToLeft
|
|
50
|
-
case .unsupported:
|
|
51
|
-
return fw_semanticContentAttribute()
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return fw_semanticContentAttribute()
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
private func updateViewTypeIfNeeded(_ view: UIView) {
|
|
59
|
-
if view is FireworkPlayerView, AppLanguageManager.shared.shouldHorizontalFlip {
|
|
60
|
-
view.viewType = .normal
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
DispatchQueue.main.async {
|
|
64
|
-
if view.layer.sublayers?.first(where: { layer in
|
|
65
|
-
layer is AVPlayerLayer
|
|
66
|
-
}) != nil, AppLanguageManager.shared.shouldHorizontalFlip {
|
|
67
|
-
view.viewType = .normal
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// UIViewController+AppLanguage.swift
|
|
3
|
-
//
|
|
4
|
-
// Created by linjie jiang on 2023/2/21.
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
import UIKit
|
|
8
|
-
import FireworkVideo
|
|
9
|
-
|
|
10
|
-
extension UIViewController {
|
|
11
|
-
static func swizzleViewControllerMethodsForAppLanguage() {
|
|
12
|
-
Swizzle.swizzleSelector(
|
|
13
|
-
cls: self,
|
|
14
|
-
originalSelector: #selector(UIViewController.present(_:animated:completion:)),
|
|
15
|
-
customSelector: #selector(UIViewController.fw_present(_:animated:completion:))
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
Swizzle.swizzleSelector(
|
|
19
|
-
cls: self,
|
|
20
|
-
originalSelector: #selector(UIViewController.viewDidLoad),
|
|
21
|
-
customSelector: #selector(UIViewController.fw_viewDidLoad)
|
|
22
|
-
)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@objc func fw_present(
|
|
26
|
-
_ viewControllerToPresent: UIViewController,
|
|
27
|
-
animated flag: Bool,
|
|
28
|
-
completion: (() -> Void)? = nil
|
|
29
|
-
) {
|
|
30
|
-
let iOSSDKBundle = Bundle(for: FireworkVideoSDK.self)
|
|
31
|
-
let viewControllerToPresentBundle = Bundle(for: type(of: viewControllerToPresent))
|
|
32
|
-
if AppLanguageManager.shared.shouldHorizontalFlip,
|
|
33
|
-
viewControllerToPresentBundle == iOSSDKBundle {
|
|
34
|
-
viewControllerToPresent.view.viewType = .flip
|
|
35
|
-
}
|
|
36
|
-
fw_present(viewControllerToPresent, animated: flag, completion: completion)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
@objc func fw_viewDidLoad() {
|
|
40
|
-
fw_viewDidLoad()
|
|
41
|
-
if AppLanguageManager.shared.shouldHorizontalFlip {
|
|
42
|
-
if self is StoryBlockViewController
|
|
43
|
-
|| self is VideoFeedViewController {
|
|
44
|
-
self.view.viewType = .flip
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// UIWindow+AppLanguage.swift
|
|
3
|
-
//
|
|
4
|
-
// Created by linjie jiang on 2023/2/24.
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
import UIKit
|
|
8
|
-
import FireworkVideo
|
|
9
|
-
|
|
10
|
-
extension UIWindow {
|
|
11
|
-
static func swizzleWindowMethodsForAppLanguage() {
|
|
12
|
-
Swizzle.swizzleSelector(cls: self,
|
|
13
|
-
originalSelector: #selector(setter: UIWindow.rootViewController),
|
|
14
|
-
customSelector: #selector(UIWindow.fw_setRootViewController(_:)))
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
@objc func fw_setRootViewController(_ rootViewController: UIViewController?) {
|
|
18
|
-
fw_setRootViewController(rootViewController)
|
|
19
|
-
let iOSSDKBundle = Bundle(for: FireworkVideoSDK.self)
|
|
20
|
-
if AppLanguageManager.shared.shouldHorizontalFlip,
|
|
21
|
-
let viewController = rootViewController,
|
|
22
|
-
Bundle(for: type(of: viewController)) == iOSSDKBundle {
|
|
23
|
-
viewController.view.viewType = .flip
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// LanguageUtil.swift
|
|
3
|
-
//
|
|
4
|
-
// Created by linjie jiang on 2023/2/9.
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
import Foundation
|
|
8
|
-
|
|
9
|
-
class LanguageUtil {
|
|
10
|
-
static func getLanguageCode(_ language: String) -> String? {
|
|
11
|
-
guard language.count > 0 else {
|
|
12
|
-
return nil
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
var languageCode = ""
|
|
16
|
-
#if compiler(>=5.7)
|
|
17
|
-
if #available(iOS 16, *) {
|
|
18
|
-
languageCode = Locale(identifier: language).language.languageCode?.identifier ?? ""
|
|
19
|
-
} else {
|
|
20
|
-
languageCode = Locale(identifier: language).languageCode ?? ""
|
|
21
|
-
}
|
|
22
|
-
#else
|
|
23
|
-
languageCode = Locale(identifier: language).languageCode ?? ""
|
|
24
|
-
#endif
|
|
25
|
-
return languageCode.lowercased()
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
static func isValidLanguage(_ language: String?) -> Bool {
|
|
29
|
-
guard let language = language else {
|
|
30
|
-
return false
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
guard language.count > 0 else {
|
|
34
|
-
return false
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
let languageWithUnderline = language.replacingOccurrences(of: "-", with: "_")
|
|
38
|
-
|
|
39
|
-
let availableIdentifiers = Locale.availableIdentifiers
|
|
40
|
-
|
|
41
|
-
return availableIdentifiers.contains(language) || availableIdentifiers.contains(languageWithUnderline)
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// NSObject+LayoutFlip.swift
|
|
3
|
-
//
|
|
4
|
-
// Created by linjie jiang on 4/25/23.
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
import Foundation
|
|
8
|
-
|
|
9
|
-
typealias ReloadClosure = () -> Void
|
|
10
|
-
|
|
11
|
-
extension NSObject {
|
|
12
|
-
private struct AssociatedKeys {
|
|
13
|
-
static var reloadClosures = "reloadBlocks"
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
private var reloadClosures: [String: ReloadClosure] {
|
|
17
|
-
get {
|
|
18
|
-
let result = objc_getAssociatedObject(self, &AssociatedKeys.reloadClosures) as? [String: ReloadClosure]
|
|
19
|
-
return result ?? [:]
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
set {
|
|
23
|
-
objc_setAssociatedObject(
|
|
24
|
-
self,
|
|
25
|
-
&AssociatedKeys.reloadClosures,
|
|
26
|
-
newValue,
|
|
27
|
-
.OBJC_ASSOCIATION_RETAIN_NONATOMIC
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
func performReload() {
|
|
33
|
-
for (_, closure) in reloadClosures {
|
|
34
|
-
closure()
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
func addReloadClosure(key: String, reloadClosure: @escaping ReloadClosure) {
|
|
39
|
-
reloadClosures[key] = reloadClosure
|
|
40
|
-
reloadClosure()
|
|
41
|
-
}
|
|
42
|
-
}
|