react-native-firework-sdk 2.1.0 → 2.2.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.
Files changed (184) hide show
  1. package/FireworkVideoUI.xcframework/Info.plist +40 -0
  2. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/FireworkVideoUI +0 -0
  3. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Headers/FireworkVideoUI-Swift.h +280 -0
  4. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Headers/FireworkVideoUI.h +18 -0
  5. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Info.plist +0 -0
  6. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.abi.json +1327 -0
  7. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.private.swiftinterface +41 -0
  8. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  9. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios.swiftinterface +41 -0
  10. package/FireworkVideoUI.xcframework/ios-arm64/FireworkVideoUI.framework/Modules/module.modulemap +11 -0
  11. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/FireworkVideoUI +0 -0
  12. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Headers/FireworkVideoUI-Swift.h +556 -0
  13. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Headers/FireworkVideoUI.h +18 -0
  14. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Info.plist +0 -0
  15. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.abi.json +1327 -0
  16. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +41 -0
  17. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  18. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.swiftinterface +41 -0
  19. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.abi.json +1327 -0
  20. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +41 -0
  21. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  22. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/FireworkVideoUI.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +41 -0
  23. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/Modules/module.modulemap +11 -0
  24. package/FireworkVideoUI.xcframework/ios-arm64_x86_64-simulator/FireworkVideoUI.framework/_CodeSignature/CodeResources +245 -0
  25. package/README.md +1 -1
  26. package/android/build.gradle +1 -2
  27. package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/FWVideoFeed.kt +6 -0
  28. package/android/src/main/java/com/fireworksdk/bridge/components/videofeed/StoryBlockFrameLayout.kt +6 -0
  29. package/android/src/main/java/com/fireworksdk/bridge/models/FWAdBadgeConfigModelDeserializer.kt +3 -3
  30. package/android/src/main/java/com/fireworksdk/bridge/models/FWEventName.kt +3 -0
  31. package/android/src/main/java/com/fireworksdk/bridge/models/FWFontInfoModelDeserializer.kt +1 -1
  32. package/android/src/main/java/com/fireworksdk/bridge/models/FWProductInfoViewConfigurationDeserializer.kt +10 -6
  33. package/android/src/main/java/com/fireworksdk/bridge/models/FWSDKInitOptionsModelDeserializer.kt +3 -3
  34. package/android/src/main/java/com/fireworksdk/bridge/models/FWShoppingCtaResultDeserializer.kt +2 -2
  35. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedConfigModelDeserializer.kt +14 -12
  36. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModel.kt +1 -0
  37. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedPropsModelDeserializer.kt +11 -7
  38. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoFeedSource.kt +1 -0
  39. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlaybackDetails.kt +8 -8
  40. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModel.kt +1 -0
  41. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoPlayerConfigModelDeserializer.kt +19 -12
  42. package/android/src/main/java/com/fireworksdk/bridge/models/FWVideoShoppingProductDeserializer.kt +11 -11
  43. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWStoryBlockManager.kt +5 -0
  44. package/android/src/main/java/com/fireworksdk/bridge/reactnative/manager/FWVideoFeedManager.kt +5 -0
  45. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWLiveStreamModule.kt +45 -4
  46. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FWVideoShoppingModule.kt +2 -0
  47. package/android/src/main/java/com/fireworksdk/bridge/reactnative/module/FireworkSDKModule.kt +112 -36
  48. package/android/src/main/java/com/fireworksdk/bridge/reactnative/utils/FWEventUtils.kt +7 -4
  49. package/android/src/main/java/com/fireworksdk/bridge/utils/FWConfigUtil.kt +26 -32
  50. package/android/src/main/java/com/fireworksdk/bridge/utils/FWGlobalDataUtil.kt +6 -0
  51. package/ios/Components/StoryBlock.swift +5 -6
  52. package/ios/Components/StoryBlockManager.m +1 -0
  53. package/ios/Components/StoryBlockManager.swift +4 -0
  54. package/ios/Components/VideoFeed.swift +12 -8
  55. package/ios/Components/VideoFeedManager.m +1 -0
  56. package/ios/Components/VideoFeedManager.swift +4 -0
  57. package/ios/Components/VideoPlayerConfiguration.swift +1 -0
  58. package/ios/FireworkSdk.xcodeproj/project.pbxproj +261 -471
  59. package/ios/FireworkVideoUI/FireworkVideoUI/FireworkVideoUI.docc/FireworkVideoUI.md +13 -0
  60. package/ios/FireworkVideoUI/FireworkVideoUI/FireworkVideoUI.h +18 -0
  61. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/AppLanguageManager.swift +147 -0
  62. package/ios/{Utils/AppLanguage/Bundle+FWSwizzle.swift → FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/Bundle+AppLanguage.swift} +7 -7
  63. package/ios/{Utils/AppLanguage/NumberFormatter+FWSwizzle.swift → FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/NumberFormatter+AppLanguage.swift} +5 -5
  64. package/ios/{Utils/AppLanguage/URLSession+FWSwizzle.swift → FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/Foundation/URLSession+AppLanguage.swift} +7 -7
  65. package/ios/{Utils/AppLanguage/UIImageView+FWSwizzle.swift → FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIImageView+AppLanguage.swift} +8 -8
  66. package/ios/{Utils/AppLanguage/UILabel+FWSwizzle.swift → FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UILabel+AppLanguage.swift} +17 -17
  67. package/ios/{Utils/AppLanguage/UITextField+FWSwizzle.swift → FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextField+AppLanguage.swift} +16 -16
  68. package/ios/{Utils/AppLanguage/UITextView+FWSwizzle.swift → FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UITextView+AppLanguage.swift} +16 -16
  69. package/ios/{Utils/AppLanguage/UIView+FWSwizzle.swift → FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIView+AppLanguage.swift} +7 -7
  70. package/ios/{Utils/AppLanguage/UIViewController+FWSwizzle.swift → FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIViewController+AppLanguage.swift} +19 -5
  71. package/ios/{Utils/AppLanguage/UIWindow+FWSwizzle.swift → FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/Extensions/UIKit/UIWindow+AppLanguage.swift} +5 -5
  72. package/ios/{Utils/AppLanguage/FWLanguageUtil.swift → FireworkVideoUI/FireworkVideoUI/Sources/AppLanguage/LanguageUtil.swift} +4 -4
  73. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/Foundation/NSObject+LayoutFlip.swift +42 -0
  74. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/CALayer+LayoutFlip.swift +160 -0
  75. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/UILabel+LayoutFlip.swift +35 -0
  76. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/Extensions/UIKit/UIView+LayoutFlip.swift +199 -0
  77. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/LayoutFlip/LayoutFlipManager.swift +59 -0
  78. package/ios/{Utils/Extensions/DispatchQueue+FWOnce.swift → FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/DispatchQueue+Once.swift} +4 -4
  79. package/ios/FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/Foundation/String+Base64.swift +18 -0
  80. package/ios/{Utils/Extensions/UIView+FWUIHierarchy.swift → FireworkVideoUI/FireworkVideoUI/Sources/Utils/Extensions/UIKit/UIView+UIHierarchy.swift} +4 -5
  81. package/ios/{Utils/FWSwizzleUtil.swift → FireworkVideoUI/FireworkVideoUI/Sources/Utils/Swizzle.swift} +2 -2
  82. package/ios/FireworkVideoUI/FireworkVideoUI.xcodeproj/project.pbxproj +766 -0
  83. package/ios/FireworkVideoUI/FireworkVideoUI.xcworkspace/contents.xcworkspacedata +10 -0
  84. package/ios/FireworkVideoUI/FireworkVideoUI.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  85. package/ios/FireworkVideoUI/FireworkVideoUITests/FireworkVideoUITests.swift +37 -0
  86. package/ios/FireworkVideoUI/Podfile +15 -0
  87. package/ios/FireworkVideoUI/Podfile.lock +16 -0
  88. package/ios/Models/NativeToRN/FireworkEventName.swift +4 -0
  89. package/ios/Models/NativeToRN/FireworkSDK+Json.swift +5 -1
  90. package/ios/Models/RNToNative/RCTConvert+StoryBlock.swift +2 -1
  91. package/ios/Models/RNToNative/RCTConvert+VideoFeed.swift +2 -1
  92. package/ios/Modules/FWNavigatorModule/FWNavigatorModule.swift +8 -100
  93. package/ios/Modules/FireworkSDKModule/FireworkSDKModule+EventTracking.swift +34 -16
  94. package/ios/Modules/FireworkSDKModule/FireworkSDKModule.swift +23 -7
  95. package/ios/Modules/FireworkSDKModule/SDKInitOptions.swift +0 -1
  96. package/ios/Modules/LiveStream/LiveStreamModule.swift +1 -0
  97. package/ios/Modules/Shopping/ProductInfoViewConfiguration.swift +0 -8
  98. package/ios/Modules/Shopping/ShoppingModule.swift +0 -18
  99. package/ios/Support/MultiHostStreaming/FWMultiHostStreaming.podspec +4 -6
  100. package/ios/Utils/Extensions/Swizzle/UINavigationController+FWSwizzle.swift +4 -1
  101. package/ios/scripts/react_native_firework_sdk_pods.rb +22 -26
  102. package/lib/commonjs/FireworkSDK.js +40 -17
  103. package/lib/commonjs/FireworkSDK.js.map +1 -1
  104. package/lib/commonjs/LiveStream.js +2 -2
  105. package/lib/commonjs/LiveStream.js.map +1 -1
  106. package/lib/commonjs/VideoShopping.js +1 -1
  107. package/lib/commonjs/VideoShopping.js.map +1 -1
  108. package/lib/commonjs/components/StoryBlock.js +9 -9
  109. package/lib/commonjs/components/StoryBlock.js.map +1 -1
  110. package/lib/commonjs/components/VideoFeed.js +6 -4
  111. package/lib/commonjs/components/VideoFeed.js.map +1 -1
  112. package/lib/commonjs/index.js.map +1 -1
  113. package/lib/commonjs/models/FWEventName.js +1 -0
  114. package/lib/commonjs/models/FWEventName.js.map +1 -1
  115. package/lib/commonjs/models/VideoPlaybackEventName.js +3 -0
  116. package/lib/commonjs/models/VideoPlaybackEventName.js.map +1 -1
  117. package/lib/module/FireworkSDK.js +39 -17
  118. package/lib/module/FireworkSDK.js.map +1 -1
  119. package/lib/module/LiveStream.js +2 -2
  120. package/lib/module/LiveStream.js.map +1 -1
  121. package/lib/module/VideoShopping.js +1 -1
  122. package/lib/module/VideoShopping.js.map +1 -1
  123. package/lib/module/components/StoryBlock.js +9 -7
  124. package/lib/module/components/StoryBlock.js.map +1 -1
  125. package/lib/module/components/VideoFeed.js +6 -4
  126. package/lib/module/components/VideoFeed.js.map +1 -1
  127. package/lib/module/index.js.map +1 -1
  128. package/lib/module/models/FWEventName.js +1 -0
  129. package/lib/module/models/FWEventName.js.map +1 -1
  130. package/lib/module/models/VideoPlaybackEventName.js +3 -0
  131. package/lib/module/models/VideoPlaybackEventName.js.map +1 -1
  132. package/lib/typescript/FireworkSDK.d.ts +8 -4
  133. package/lib/typescript/LiveStream.d.ts +2 -2
  134. package/lib/typescript/VideoShopping.d.ts +1 -1
  135. package/lib/typescript/components/StoryBlock.d.ts +7 -0
  136. package/lib/typescript/components/VideoFeed.d.ts +7 -0
  137. package/lib/typescript/index.d.ts +2 -2
  138. package/lib/typescript/models/FWEventName.d.ts +1 -0
  139. package/lib/typescript/models/ProductInfoViewConfiguration.d.ts +0 -31
  140. package/lib/typescript/models/SDKInitOptions.d.ts +6 -1
  141. package/lib/typescript/models/StoryBlockSource.d.ts +1 -1
  142. package/lib/typescript/models/VideoFeedSource.d.ts +1 -1
  143. package/lib/typescript/models/VideoPlaybackDetails.d.ts +16 -0
  144. package/lib/typescript/models/VideoPlaybackEventName.d.ts +13 -1
  145. package/lib/typescript/models/VideoPlayerConfiguration.d.ts +4 -0
  146. package/package.json +7 -2
  147. package/react-native-firework-sdk.podspec +10 -5
  148. package/src/FireworkSDK.ts +41 -15
  149. package/src/LiveStream.ts +2 -2
  150. package/src/VideoShopping.ts +1 -1
  151. package/src/components/StoryBlock.tsx +12 -3
  152. package/src/components/VideoFeed.tsx +12 -4
  153. package/src/index.ts +0 -2
  154. package/src/models/FWEventName.ts +1 -0
  155. package/src/models/ProductInfoViewConfiguration.ts +0 -32
  156. package/src/models/SDKInitOptions.ts +6 -1
  157. package/src/models/StoryBlockSource.ts +2 -1
  158. package/src/models/VideoFeedSource.ts +2 -1
  159. package/src/models/VideoPlaybackDetails.ts +16 -0
  160. package/src/models/VideoPlaybackEventName.ts +13 -1
  161. package/src/models/VideoPlayerConfiguration.ts +4 -0
  162. package/ios/Utils/AppLanguage/FWAppLanguageManager.swift +0 -139
  163. package/ios/Utils/FWRTL/Classes/Manager/FWRTLManager.h +0 -25
  164. package/ios/Utils/FWRTL/Classes/Manager/FWRTLManager.m +0 -75
  165. package/ios/Utils/FWRTL/Classes/UICategories/CALayer+FWRTL.h +0 -21
  166. package/ios/Utils/FWRTL/Classes/UICategories/CALayer+FWRTL.m +0 -124
  167. package/ios/Utils/FWRTL/Classes/UICategories/FWRTLRemoteViewControllerAdaptor.h +0 -11
  168. package/ios/Utils/FWRTL/Classes/UICategories/FWRTLRemoteViewControllerAdaptor.m +0 -86
  169. package/ios/Utils/FWRTL/Classes/UICategories/FWRTLWhiteListManager.h +0 -16
  170. package/ios/Utils/FWRTL/Classes/UICategories/FWRTLWhiteListManager.m +0 -55
  171. package/ios/Utils/FWRTL/Classes/UICategories/UILabel+FWRTL.h +0 -18
  172. package/ios/Utils/FWRTL/Classes/UICategories/UILabel+FWRTL.m +0 -39
  173. package/ios/Utils/FWRTL/Classes/UICategories/UIView+FWRTL.h +0 -54
  174. package/ios/Utils/FWRTL/Classes/UICategories/UIView+FWRTL.m +0 -141
  175. package/ios/Utils/FWRTL/Classes/UICategories/UIWindow+FWRTL.h +0 -16
  176. package/ios/Utils/FWRTL/Classes/UICategories/UIWindow+FWRTL.m +0 -20
  177. package/ios/Utils/FWRTL/Classes/Utils/FWRTLDefinitions.h +0 -52
  178. package/ios/Utils/FWRTL/Classes/Utils/NSObject+FWRTLReloadBlock.h +0 -19
  179. package/ios/Utils/FWRTL/Classes/Utils/NSObject+FWRTLReloadBlock.m +0 -49
  180. package/ios/Utils/FWRTL/Classes/Utils/NSString+FWRTL.h +0 -21
  181. package/ios/Utils/FWRTL/Classes/Utils/NSString+FWRTL.m +0 -38
  182. package/ios/Utils/FWRTL/Classes/Utils/UIImage+FWRTL.h +0 -18
  183. package/ios/Utils/FWRTL/Classes/Utils/UIImage+FWRTL.m +0 -43
  184. /package/ios/Support/MultiHostStreaming/{src → Sources}/MultiHostStreamingSDK.swift +0 -0
@@ -0,0 +1,13 @@
1
+ # ``FireworkVideoUI``
2
+
3
+ <!--@START_MENU_TOKEN@-->Summary<!--@END_MENU_TOKEN@-->
4
+
5
+ ## Overview
6
+
7
+ <!--@START_MENU_TOKEN@-->Text<!--@END_MENU_TOKEN@-->
8
+
9
+ ## Topics
10
+
11
+ ### <!--@START_MENU_TOKEN@-->Group<!--@END_MENU_TOKEN@-->
12
+
13
+ - <!--@START_MENU_TOKEN@-->``Symbol``<!--@END_MENU_TOKEN@-->
@@ -0,0 +1,18 @@
1
+ //
2
+ // FireworkVideoUI.h
3
+ // FireworkVideoUI
4
+ //
5
+ // Created by linjie jiang on 4/25/23.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+
10
+ //! Project version number for FireworkVideoUI.
11
+ FOUNDATION_EXPORT double FireworkVideoUIVersionNumber;
12
+
13
+ //! Project version string for FireworkVideoUI.
14
+ FOUNDATION_EXPORT const unsigned char FireworkVideoUIVersionString[];
15
+
16
+ // In this header, you should import all the public headers of your framework using statements like #import <FireworkVideoUI/PublicHeader.h>
17
+
18
+
@@ -0,0 +1,147 @@
1
+ //
2
+ // AppLanguageManager.swift
3
+ //
4
+ // Created by linjie jiang on 2023/2/7.
5
+ //
6
+
7
+ import UIKit
8
+
9
+ private let appLanguageStorageKey = "firework_sdk_app_language_storage_key"
10
+
11
+ enum AppLanguageLayoutDirection: Int {
12
+ case ltr, rtl, unsupported
13
+ }
14
+
15
+ /// The manager of supporting app language
16
+ public class AppLanguageManager {
17
+ public struct NotificationName {
18
+ /// The notification name for language change
19
+ public static let AppLanguageChanged = Notification.Name(
20
+ rawValue: "firework.notification.name.appLanguageChanged"
21
+ )
22
+ }
23
+
24
+ public static let shared = AppLanguageManager()
25
+
26
+ var systemLanguage: String?
27
+ private var systemLanguageCode: String? {
28
+ guard let language = systemLanguage else {
29
+ return nil
30
+ }
31
+
32
+ return LanguageUtil.getLanguageCode(language)
33
+ }
34
+
35
+ /// Get current app language.
36
+ public private(set) var appLanguage: String? {
37
+ didSet {
38
+ if appLanguage != nil {
39
+ AppLanguageManager.swizzelMethods()
40
+ LayoutFlipManager.shared.enableHorizontalFlip = shouldHorizontalFlip
41
+ }
42
+
43
+ if appLanguage != oldValue {
44
+ NotificationCenter.default.post(name: NotificationName.AppLanguageChanged, object: nil)
45
+ }
46
+ }
47
+ }
48
+
49
+ var appLanguageCode: String? {
50
+ guard let language = appLanguage else {
51
+ return nil
52
+ }
53
+
54
+ return LanguageUtil.getLanguageCode(language)
55
+ }
56
+
57
+ var appLanguageLayoutDirection: AppLanguageLayoutDirection? {
58
+ guard let languageCode = appLanguageCode else {
59
+ return nil
60
+ }
61
+ let direction = Locale.characterDirection(forLanguage: languageCode)
62
+ switch direction {
63
+ case .leftToRight:
64
+ return .ltr
65
+ case .rightToLeft:
66
+ return .rtl
67
+ default:
68
+ return .unsupported
69
+ }
70
+ }
71
+
72
+ var shouldHorizontalFlip: Bool {
73
+ guard let appLanguageCode = appLanguageCode else {
74
+ return false
75
+ }
76
+
77
+ guard let systemLanguageCode = systemLanguageCode else {
78
+ return false
79
+ }
80
+
81
+ let appLanguageDirection = Locale.characterDirection(forLanguage: appLanguageCode)
82
+ let systemLanguageDirection = Locale.characterDirection(forLanguage: systemLanguageCode)
83
+
84
+ if appLanguageDirection == .leftToRight, systemLanguageDirection == .rightToLeft {
85
+ return true
86
+ }
87
+
88
+ if appLanguageDirection == .rightToLeft, systemLanguageDirection == .leftToRight {
89
+ return true
90
+ }
91
+
92
+ return false
93
+ }
94
+
95
+ private static func swizzelMethods() {
96
+ DispatchQueue.once {
97
+ UIViewController.swizzleViewControllerMethodsForAppLanguage()
98
+ Bundle.swizzleBundleMethodsForAppLanguage()
99
+ URLSession.swizzleURLSessionMethodsForAppLanguage()
100
+ NumberFormatter.swizzleNumberFormatterMethodsForAppLanguage()
101
+ UIImageView.swizzleImageViewMethodsForAppLanguage()
102
+ UILabel.swizzleLabelMethodsForAppLanguage()
103
+ UITextField.swizzleTextFieldMethodsForAppLanguage()
104
+ UITextView.swizzleTextViewMethodsForAppLanguage()
105
+ UIWindow.swizzleWindowMethodsForAppLanguage()
106
+ UIView.swizzleViewMethodsForAppLanguage()
107
+ }
108
+
109
+ LayoutFlipManager.swizzelMethods()
110
+ }
111
+
112
+ private init() {
113
+ initializeManager()
114
+ }
115
+
116
+ private func initializeManager() {
117
+ self.systemLanguage = Locale.preferredLanguages.first
118
+ let cachedAppLanguage = UserDefaults.standard.object(forKey: appLanguageStorageKey) as? String
119
+ if LanguageUtil.isValidLanguage(cachedAppLanguage) {
120
+ self.appLanguage = cachedAppLanguage
121
+ }
122
+ }
123
+
124
+ /// Change app language
125
+ ///
126
+ /// - Parameters:
127
+ /// - language: app language. We will use system langauge when language is nil.
128
+ /// - Returns: The result of changing app language.
129
+ @discardableResult
130
+ public func changeAppLanguage(_ language: String?) -> Bool {
131
+ guard let language = language, language.count > 0 else {
132
+ appLanguage = nil
133
+ UserDefaults.standard.removeObject(forKey: appLanguageStorageKey)
134
+ UserDefaults.standard.synchronize()
135
+ return true
136
+ }
137
+
138
+ if LanguageUtil.isValidLanguage(language) {
139
+ appLanguage = language
140
+ UserDefaults.standard.set(language, forKey: appLanguageStorageKey)
141
+ UserDefaults.standard.synchronize()
142
+ return true
143
+ } else {
144
+ return false
145
+ }
146
+ }
147
+ }
@@ -1,5 +1,5 @@
1
1
  //
2
- // Bundle+FWSwizzle.swift
2
+ // Bundle+AppLanguage.swift
3
3
  //
4
4
  // Created by linjie jiang on 2023/2/7.
5
5
  //
@@ -7,9 +7,9 @@
7
7
  import Foundation
8
8
  import FireworkVideo
9
9
 
10
- public extension Bundle {
11
- static func swizzleMethodsForBundle() {
12
- FWSwizzleUtil.swizzleSelector(
10
+ extension Bundle {
11
+ static func swizzleBundleMethodsForAppLanguage() {
12
+ Swizzle.swizzleSelector(
13
13
  cls: self,
14
14
  originalSelector: #selector(Bundle.localizedString(forKey:value:table:)),
15
15
  customSelector: #selector(Bundle.fw_localizedString(forKey:value:table:)))
@@ -20,8 +20,8 @@ public extension Bundle {
20
20
  value: String?,
21
21
  table tableName: String?
22
22
  ) -> String {
23
- if let language = FWAppLanguageManager.shared.appLanguage,
24
- let languageCode = FWAppLanguageManager.shared.appLanguageCode,
23
+ if let language = AppLanguageManager.shared.appLanguage,
24
+ let languageCode = AppLanguageManager.shared.appLanguageCode,
25
25
  Bundle(for: FireworkVideoSDK.self) == self {
26
26
  let iOSSDKBundle = Bundle(for: FireworkVideoSDK.self)
27
27
 
@@ -38,7 +38,7 @@ public extension Bundle {
38
38
  return item != "Base" && item != "en"
39
39
  }
40
40
  if let targeLanguage = targeLanguageList.first(where: { item in
41
- let targeLanguageCode = FWLanguageUtil.getLanguageCode(item)
41
+ let targeLanguageCode = LanguageUtil.getLanguageCode(item)
42
42
  return languageCode == targeLanguageCode
43
43
  }) {
44
44
  languageBundlePath = iOSSDKBundle.path(forResource: targeLanguage, ofType: "lproj")
@@ -1,21 +1,21 @@
1
1
  //
2
- // NumberFormatter+FWSwizzle.swift
2
+ // NumberFormatter+AppLanguage.swift
3
3
  //
4
4
  // Created by linjie jiang on 2023/2/20.
5
5
  //
6
6
 
7
7
  import Foundation
8
8
 
9
- public extension NumberFormatter {
10
- static func swizzleMethodsForNumberFormatter() {
11
- FWSwizzleUtil.swizzleSelector(
9
+ extension NumberFormatter {
10
+ static func swizzleNumberFormatterMethodsForAppLanguage() {
11
+ Swizzle.swizzleSelector(
12
12
  cls: self,
13
13
  originalSelector: #selector(NumberFormatter.string(from:)),
14
14
  customSelector: #selector(NumberFormatter.fw_string(from:)))
15
15
  }
16
16
 
17
17
  @objc func fw_string(from number: NSNumber) -> String? {
18
- if let language = FWAppLanguageManager.shared.appLanguage,
18
+ if let language = AppLanguageManager.shared.appLanguage,
19
19
  self.numberStyle == .currency {
20
20
  self.locale = Locale(identifier: language)
21
21
  }
@@ -1,5 +1,5 @@
1
1
  //
2
- // URLSession+FWSwizzle.swift
2
+ // URLSession+AppLanguage.swift
3
3
  //
4
4
  // Created by linjie jiang on 2023/2/20.
5
5
  //
@@ -11,19 +11,19 @@ private var FWHostList: [String] = [
11
11
  "p2.fwpixel.com"
12
12
  ]
13
13
 
14
- public extension URLSession {
15
- static func swizzleMethodsForURLSession() {
14
+ extension URLSession {
15
+ static func swizzleURLSessionMethodsForAppLanguage() {
16
16
  // swiftlint:disable:next line_length
17
17
  let orginalSelector1 = #selector(URLSession.dataTask(with:completionHandler:) as (URLSession) -> (URLRequest, @escaping (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask)
18
18
  let customSelector1 = #selector(URLSession.fw_dataTask(with:completionHandler:))
19
- FWSwizzleUtil.swizzleSelector(
19
+ Swizzle.swizzleSelector(
20
20
  cls: self,
21
21
  originalSelector: orginalSelector1,
22
22
  customSelector: customSelector1)
23
23
  // swiftlint:disable:next line_length
24
24
  let orginalSelector2 = #selector(URLSession.dataTask(with:) as (URLSession) -> (URLRequest) -> URLSessionDataTask)
25
25
  let customSelector2 = #selector(URLSession.fw_dataTask(with:))
26
- FWSwizzleUtil.swizzleSelector(
26
+ Swizzle.swizzleSelector(
27
27
  cls: self,
28
28
  originalSelector: orginalSelector2,
29
29
  customSelector: customSelector2)
@@ -52,8 +52,8 @@ public extension URLSession {
52
52
  host = request.url?.host ?? ""
53
53
  #endif
54
54
 
55
- if let language = FWAppLanguageManager.shared.appLanguage,
56
- let languageCode = FWAppLanguageManager.shared.appLanguageCode,
55
+ if let language = AppLanguageManager.shared.appLanguage,
56
+ let languageCode = AppLanguageManager.shared.appLanguageCode,
57
57
  FWHostList.contains(host) {
58
58
  var mutableRequest = request
59
59
  if language != languageCode {
@@ -1,5 +1,5 @@
1
1
  //
2
- // UIImageView+FWSwizzle.swift
2
+ // UIImageView+AppLanguage.swift
3
3
  //
4
4
  // Created by linjie jiang on 2023/2/22.
5
5
  //
@@ -16,17 +16,17 @@ private let FWImageNamesWithDirections: [String] = [
16
16
  ]
17
17
 
18
18
  extension UIImageView {
19
- static func swizzleMethodsForImageView() {
20
- FWSwizzleUtil.swizzleSelector(
19
+ static func swizzleImageViewMethodsForAppLanguage() {
20
+ Swizzle.swizzleSelector(
21
21
  cls: self,
22
22
  originalSelector: #selector(UIImageView.didMoveToWindow),
23
23
  customSelector: #selector(UIImageView.fw_imageViewDidMoveToWindow))
24
- FWSwizzleUtil.swizzleSelector(
24
+ Swizzle.swizzleSelector(
25
25
  cls: self,
26
26
  originalSelector: #selector(setter: UIImageView.image),
27
27
  customSelector: #selector(UIImageView.fw_setImage(_:))
28
28
  )
29
- FWSwizzleUtil.swizzleSelector(
29
+ Swizzle.swizzleSelector(
30
30
  cls: self,
31
31
  originalSelector: #selector(UIImageView.awakeFromNib),
32
32
  customSelector: #selector(UIImageView.fw_imageViewAwakeFromNib)
@@ -49,7 +49,7 @@ extension UIImageView {
49
49
  }
50
50
 
51
51
  private func updateViewType(_ image: UIImage?) {
52
- self.fwrtl_viewType = shouldFlipImage(image) ? FWRTLViewTypeFlip : FWRTLViewTypeAuto
52
+ self.viewType = shouldFlipImage(image) ? .flip : .auto
53
53
  }
54
54
 
55
55
  private func shouldFlipImage(_ image: UIImage?) -> Bool {
@@ -57,7 +57,7 @@ extension UIImageView {
57
57
  return false
58
58
  }
59
59
 
60
- if FWAppLanguageManager.shared.shouldHorizontalFlip, self.isIOSSDKView {
60
+ if AppLanguageManager.shared.shouldHorizontalFlip, self.isIOSSDKView {
61
61
  let iOSSDKBundle = Bundle(for: FireworkVideoSDK.self)
62
62
 
63
63
  for imageName in FWImageNamesWithDirections {
@@ -80,7 +80,7 @@ extension UIImageView {
80
80
  }
81
81
  }
82
82
 
83
- if FWAppLanguageManager.shared.shouldHorizontalFlip,
83
+ if AppLanguageManager.shared.shouldHorizontalFlip,
84
84
  image.flipsForRightToLeftLayoutDirection == true,
85
85
  self.isIOSSDKView {
86
86
  return true
@@ -1,5 +1,5 @@
1
1
  //
2
- // UILabel+FWSwizzle.swift
2
+ // UILabel+AppLanguage.swift
3
3
  //
4
4
  // Created by linjie jiang on 2023/2/22.
5
5
  //
@@ -8,39 +8,39 @@ import UIKit
8
8
 
9
9
  extension UILabel {
10
10
  private struct AssociatedKeys {
11
- static var fwHasCalculatedTextAlignment = "fwHasCalculatedTextAlignmentKey"
11
+ static var hasCalculatedTextAlignment = "hasCalculatedTextAlignmentKey"
12
12
  }
13
13
 
14
- private var fwHasCalculatedTextAlignment: Bool {
14
+ private var hasCalculatedTextAlignment: Bool {
15
15
  get {
16
- let result = objc_getAssociatedObject(self, &AssociatedKeys.fwHasCalculatedTextAlignment) as? Bool
16
+ let result = objc_getAssociatedObject(self, &AssociatedKeys.hasCalculatedTextAlignment) as? Bool
17
17
  return result ?? false
18
18
  }
19
19
 
20
20
  set {
21
21
  objc_setAssociatedObject(
22
22
  self,
23
- &AssociatedKeys.fwHasCalculatedTextAlignment,
23
+ &AssociatedKeys.hasCalculatedTextAlignment,
24
24
  newValue,
25
25
  .OBJC_ASSOCIATION_RETAIN_NONATOMIC
26
26
  )
27
27
  }
28
28
  }
29
29
 
30
- static func swizzleMethodsForLabel() {
31
- FWSwizzleUtil.swizzleSelector(cls: self,
30
+ static func swizzleLabelMethodsForAppLanguage() {
31
+ Swizzle.swizzleSelector(cls: self,
32
32
  originalSelector: #selector(setter: UILabel.textAlignment),
33
33
  customSelector: #selector(UILabel.fw_setLabelTextAlignment(_:)))
34
- FWSwizzleUtil.swizzleSelector(cls: self,
34
+ Swizzle.swizzleSelector(cls: self,
35
35
  originalSelector: #selector(UILabel.didMoveToWindow),
36
36
  customSelector: #selector(UILabel.fw_labelDidMoveToWindow))
37
- FWSwizzleUtil.swizzleSelector(cls: self,
37
+ Swizzle.swizzleSelector(cls: self,
38
38
  originalSelector: #selector(UILabel.removeFromSuperview),
39
39
  customSelector: #selector(UILabel.fw_labelRemoveFromSuperview))
40
40
  }
41
41
 
42
42
  @objc func fw_setLabelTextAlignment(_ textAlignment: NSTextAlignment) {
43
- self.fwrtl_addReloadBlock(forKey: "alignment") { [weak self] in
43
+ addReloadClosure(key: "alignment") { [weak self] in
44
44
  guard let self = self else {
45
45
  return
46
46
  }
@@ -52,7 +52,7 @@ extension UILabel {
52
52
  @objc func fw_labelDidMoveToWindow() {
53
53
  fw_labelDidMoveToWindow()
54
54
  if shouldCalculateTextAlignment(),
55
- !self.fwHasCalculatedTextAlignment,
55
+ !self.hasCalculatedTextAlignment,
56
56
  self.isIOSSDKView {
57
57
  self.textAlignment = self.textAlignment
58
58
  }
@@ -60,13 +60,13 @@ extension UILabel {
60
60
 
61
61
  @objc func fw_labelRemoveFromSuperview() {
62
62
  fw_labelRemoveFromSuperview()
63
- self.fwHasCalculatedTextAlignment = false
63
+ self.hasCalculatedTextAlignment = false
64
64
  }
65
65
 
66
66
  private func calculatedTextAlignment(_ textAlignment: NSTextAlignment) -> NSTextAlignment {
67
67
  if shouldCalculateTextAlignment(),
68
- let layoutDirection = FWAppLanguageManager.shared.appLanguageLayoutDirection {
69
- self.fwHasCalculatedTextAlignment = true
68
+ let layoutDirection = AppLanguageManager.shared.appLanguageLayoutDirection {
69
+ self.hasCalculatedTextAlignment = true
70
70
  if layoutDirection == .rtl {
71
71
  if textAlignment == .center {
72
72
  return textAlignment
@@ -85,11 +85,11 @@ extension UILabel {
85
85
  }
86
86
 
87
87
  private func shouldCalculateTextAlignment() -> Bool {
88
- if FWAppLanguageManager.shared.shouldHorizontalFlip,
88
+ if AppLanguageManager.shared.shouldHorizontalFlip,
89
89
  self.isIOSSDKView,
90
- let layoutDirection = FWAppLanguageManager.shared.appLanguageLayoutDirection,
90
+ let layoutDirection = AppLanguageManager.shared.appLanguageLayoutDirection,
91
91
  layoutDirection != .unsupported,
92
- fwrtl_shouldUseCalculatedTextAlignment() {
92
+ shouldUseCalculatedTextAlignment() {
93
93
  return true
94
94
  }
95
95
 
@@ -1,5 +1,5 @@
1
1
  //
2
- // UITextField+FWSwizzle.swift
2
+ // UITextField+AppLanguage.swift
3
3
  //
4
4
  // Created by linjie jiang on 2023/2/23.
5
5
  //
@@ -8,39 +8,39 @@ import UIKit
8
8
 
9
9
  extension UITextField {
10
10
  private struct AssociatedKeys {
11
- static var fwHasCalculatedTextAlignment = "fwHasCalculatedTextAlignmentKey"
11
+ static var hasCalculatedTextAlignment = "hasCalculatedTextAlignmentKey"
12
12
  }
13
13
 
14
- private var fwHasCalculatedTextAlignment: Bool {
14
+ private var hasCalculatedTextAlignment: Bool {
15
15
  get {
16
- let result = objc_getAssociatedObject(self, &AssociatedKeys.fwHasCalculatedTextAlignment) as? Bool
16
+ let result = objc_getAssociatedObject(self, &AssociatedKeys.hasCalculatedTextAlignment) as? Bool
17
17
  return result ?? false
18
18
  }
19
19
 
20
20
  set {
21
21
  objc_setAssociatedObject(
22
22
  self,
23
- &AssociatedKeys.fwHasCalculatedTextAlignment,
23
+ &AssociatedKeys.hasCalculatedTextAlignment,
24
24
  newValue,
25
25
  .OBJC_ASSOCIATION_RETAIN_NONATOMIC
26
26
  )
27
27
  }
28
28
  }
29
29
 
30
- static func swizzleMethodsForTextField() {
31
- FWSwizzleUtil.swizzleSelector(cls: self,
30
+ static func swizzleTextFieldMethodsForAppLanguage() {
31
+ Swizzle.swizzleSelector(cls: self,
32
32
  originalSelector: #selector(setter: UITextField.textAlignment),
33
33
  customSelector: #selector(UITextField.fw_setTextFieldTextAlignment(_:)))
34
- FWSwizzleUtil.swizzleSelector(cls: self,
34
+ Swizzle.swizzleSelector(cls: self,
35
35
  originalSelector: #selector(UITextField.didMoveToWindow),
36
36
  customSelector: #selector(UITextField.fw_textFieldDidMoveToWindow))
37
- FWSwizzleUtil.swizzleSelector(cls: self,
37
+ Swizzle.swizzleSelector(cls: self,
38
38
  originalSelector: #selector(UITextField.removeFromSuperview),
39
39
  customSelector: #selector(UITextField.fw_textFieldRemoveFromSuperview))
40
40
  }
41
41
 
42
42
  @objc func fw_setTextFieldTextAlignment(_ textAlignment: NSTextAlignment) {
43
- self.fwrtl_addReloadBlock(forKey: "alignment") { [weak self] in
43
+ addReloadClosure(key: "alignment") { [weak self] in
44
44
  guard let self = self else {
45
45
  return
46
46
  }
@@ -52,7 +52,7 @@ extension UITextField {
52
52
  @objc func fw_textFieldDidMoveToWindow() {
53
53
  fw_textFieldDidMoveToWindow()
54
54
  if shouldCalculateTextAlignment(),
55
- !self.fwHasCalculatedTextAlignment,
55
+ !self.hasCalculatedTextAlignment,
56
56
  self.isIOSSDKView {
57
57
  self.textAlignment = self.textAlignment
58
58
  }
@@ -60,13 +60,13 @@ extension UITextField {
60
60
 
61
61
  @objc func fw_textFieldRemoveFromSuperview() {
62
62
  fw_textFieldRemoveFromSuperview()
63
- self.fwHasCalculatedTextAlignment = false
63
+ self.hasCalculatedTextAlignment = false
64
64
  }
65
65
 
66
66
  private func calculatedTextAlignment(_ textAlignment: NSTextAlignment) -> NSTextAlignment {
67
67
  if shouldCalculateTextAlignment(),
68
- let layoutDirection = FWAppLanguageManager.shared.appLanguageLayoutDirection {
69
- self.fwHasCalculatedTextAlignment = true
68
+ let layoutDirection = AppLanguageManager.shared.appLanguageLayoutDirection {
69
+ self.hasCalculatedTextAlignment = true
70
70
  if layoutDirection == .rtl {
71
71
  if textAlignment == .center {
72
72
  return textAlignment
@@ -85,9 +85,9 @@ extension UITextField {
85
85
  }
86
86
 
87
87
  private func shouldCalculateTextAlignment() -> Bool {
88
- if FWAppLanguageManager.shared.shouldHorizontalFlip,
88
+ if AppLanguageManager.shared.shouldHorizontalFlip,
89
89
  self.isIOSSDKView,
90
- let layoutDirection = FWAppLanguageManager.shared.appLanguageLayoutDirection,
90
+ let layoutDirection = AppLanguageManager.shared.appLanguageLayoutDirection,
91
91
  layoutDirection != .unsupported {
92
92
  return true
93
93
  }
@@ -1,5 +1,5 @@
1
1
  //
2
- // UITextView+FWSwizzle.swift
2
+ // UITextView+AppLanguage.swift
3
3
  //
4
4
  // Created by linjie jiang on 2023/2/23.
5
5
  //
@@ -8,39 +8,39 @@ import UIKit
8
8
 
9
9
  extension UITextView {
10
10
  private struct AssociatedKeys {
11
- static var fwHasCalculatedTextAlignment = "fwHasCalculatedTextAlignmentKey"
11
+ static var hasCalculatedTextAlignment = "hasCalculatedTextAlignmentKey"
12
12
  }
13
13
 
14
- private var fwHasCalculatedTextAlignment: Bool {
14
+ private var hasCalculatedTextAlignment: Bool {
15
15
  get {
16
- let result = objc_getAssociatedObject(self, &AssociatedKeys.fwHasCalculatedTextAlignment) as? Bool
16
+ let result = objc_getAssociatedObject(self, &AssociatedKeys.hasCalculatedTextAlignment) as? Bool
17
17
  return result ?? false
18
18
  }
19
19
 
20
20
  set {
21
21
  objc_setAssociatedObject(
22
22
  self,
23
- &AssociatedKeys.fwHasCalculatedTextAlignment,
23
+ &AssociatedKeys.hasCalculatedTextAlignment,
24
24
  newValue,
25
25
  .OBJC_ASSOCIATION_RETAIN_NONATOMIC
26
26
  )
27
27
  }
28
28
  }
29
29
 
30
- static func swizzleMethodsForTextView() {
31
- FWSwizzleUtil.swizzleSelector(cls: self,
30
+ static func swizzleTextViewMethodsForAppLanguage() {
31
+ Swizzle.swizzleSelector(cls: self,
32
32
  originalSelector: #selector(setter: UITextView.textAlignment),
33
33
  customSelector: #selector(UITextView.fw_setTextViewTextAlignment(_:)))
34
- FWSwizzleUtil.swizzleSelector(cls: self,
34
+ Swizzle.swizzleSelector(cls: self,
35
35
  originalSelector: #selector(UITextView.didMoveToWindow),
36
36
  customSelector: #selector(UITextView.fw_textViewDidMoveToWindow))
37
- FWSwizzleUtil.swizzleSelector(cls: self,
37
+ Swizzle.swizzleSelector(cls: self,
38
38
  originalSelector: #selector(UITextView.removeFromSuperview),
39
39
  customSelector: #selector(UITextView.fw_textViewRemoveFromSuperview))
40
40
  }
41
41
 
42
42
  @objc func fw_setTextViewTextAlignment(_ textAlignment: NSTextAlignment) {
43
- self.fwrtl_addReloadBlock(forKey: "alignment") { [weak self] in
43
+ addReloadClosure(key: "alignment") { [weak self] in
44
44
  guard let self = self else {
45
45
  return
46
46
  }
@@ -52,7 +52,7 @@ extension UITextView {
52
52
  @objc func fw_textViewDidMoveToWindow() {
53
53
  fw_textViewDidMoveToWindow()
54
54
  if shouldCalculateTextAlignment(),
55
- !self.fwHasCalculatedTextAlignment,
55
+ !self.hasCalculatedTextAlignment,
56
56
  self.isIOSSDKView {
57
57
  self.textAlignment = self.textAlignment
58
58
  }
@@ -60,13 +60,13 @@ extension UITextView {
60
60
 
61
61
  @objc func fw_textViewRemoveFromSuperview() {
62
62
  fw_textViewRemoveFromSuperview()
63
- self.fwHasCalculatedTextAlignment = false
63
+ self.hasCalculatedTextAlignment = false
64
64
  }
65
65
 
66
66
  private func calculatedTextAlignment(_ textAlignment: NSTextAlignment) -> NSTextAlignment {
67
67
  if shouldCalculateTextAlignment(),
68
- let layoutDirection = FWAppLanguageManager.shared.appLanguageLayoutDirection {
69
- self.fwHasCalculatedTextAlignment = true
68
+ let layoutDirection = AppLanguageManager.shared.appLanguageLayoutDirection {
69
+ self.hasCalculatedTextAlignment = true
70
70
  if layoutDirection == .rtl {
71
71
  if textAlignment == .center {
72
72
  return textAlignment
@@ -85,9 +85,9 @@ extension UITextView {
85
85
  }
86
86
 
87
87
  private func shouldCalculateTextAlignment() -> Bool {
88
- if FWAppLanguageManager.shared.shouldHorizontalFlip,
88
+ if AppLanguageManager.shared.shouldHorizontalFlip,
89
89
  self.isIOSSDKView,
90
- let layoutDirection = FWAppLanguageManager.shared.appLanguageLayoutDirection,
90
+ let layoutDirection = AppLanguageManager.shared.appLanguageLayoutDirection,
91
91
  layoutDirection != .unsupported {
92
92
  return true
93
93
  }
@@ -1,5 +1,5 @@
1
1
  //
2
- // UIView+FWSwizzle.swift
2
+ // UIView+AppLanguage.swift
3
3
  //
4
4
  // Created by linjie jiang on 2023/3/11.
5
5
  //
@@ -8,13 +8,13 @@ import UIKit
8
8
  import FireworkVideo
9
9
 
10
10
  extension UIView {
11
- static func swizzleMethodsForView() {
12
- FWSwizzleUtil.swizzleSelector(
11
+ static func swizzleViewMethodsForAppLanguage() {
12
+ Swizzle.swizzleSelector(
13
13
  cls: self,
14
14
  originalSelector: #selector(UIView.init(frame:)),
15
15
  customSelector: #selector(UIView.fw_init(frame:))
16
16
  )
17
- FWSwizzleUtil.swizzleSelector(
17
+ Swizzle.swizzleSelector(
18
18
  cls: self,
19
19
  originalSelector: #selector(UIView.awakeFromNib),
20
20
  customSelector: #selector(UIView.fw_viewAwakeFromNib)
@@ -24,15 +24,15 @@ extension UIView {
24
24
  @objc func fw_init(frame: CGRect) -> UIView {
25
25
  let view = self.fw_init(frame: frame)
26
26
  if view is FireworkPlayerView {
27
- view.fwrtl_viewType = FWRTLViewTypeNormal
27
+ view.viewType = .normal
28
28
  }
29
29
  return view
30
30
  }
31
31
 
32
32
  @objc func fw_viewAwakeFromNib() {
33
33
  self.fw_viewAwakeFromNib()
34
- if self is FireworkPlayerView, FWAppLanguageManager.shared.shouldHorizontalFlip {
35
- self.fwrtl_viewType = FWRTLViewTypeNormal
34
+ if self is FireworkPlayerView, AppLanguageManager.shared.shouldHorizontalFlip {
35
+ self.viewType = .normal
36
36
  }
37
37
  }
38
38
  }