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
@@ -1,86 +0,0 @@
1
- //
2
- // UIWebView+FWRTL.m
3
- // FWRTL
4
- //
5
- // Created by ByteDance on 2018/10/9.
6
- //
7
-
8
- #import "FWRTLRemoteViewControllerAdaptor.h"
9
- #import "UIView+FWRTL.h"
10
- #import "FWRTLDefinitions.h"
11
- #import "FWRTLManager.h"
12
-
13
- @implementation SFSafariViewController (FWRTL)
14
-
15
- + (void)load
16
- {
17
- FWSwizzle(self, viewDidLoad, alpweb_viewDidLoad);
18
- }
19
-
20
- - (void)alpweb_viewDidLoad
21
- {
22
- [self alpweb_viewDidLoad];
23
- self.view.fwrtl_viewType = FWRTLViewTypeNormalWithAllDescendants;
24
- }
25
-
26
- @end
27
-
28
- @implementation SKCloudServiceSetupViewController (FWRTL)
29
-
30
- + (void)load
31
- {
32
- FWSwizzle(self, viewDidLoad, alpsk_viewDidLoad);
33
- }
34
-
35
- - (void)alpsk_viewDidLoad
36
- {
37
- [self alpsk_viewDidLoad];
38
- self.view.fwrtl_viewType = FWRTLViewTypeNormalWithAllDescendants;
39
- }
40
-
41
- @end
42
-
43
- @implementation UIActivityViewController (FWRTL)
44
-
45
- + (void)load
46
- {
47
- FWSwizzle(self, viewDidLoad, fwrtl_act_viewDidLoad);
48
- }
49
-
50
- - (void)fwrtl_act_viewDidLoad
51
- {
52
- [self fwrtl_act_viewDidLoad];
53
- self.view.fwrtl_viewType = FWRTLViewTypeNormalWithAllDescendants;
54
- }
55
-
56
- @end
57
-
58
- @implementation UIImagePickerController (FWRTL)
59
-
60
- + (void)load
61
- {
62
- FWSwizzle(self, loadView, fwrtl_act_loadView);
63
- }
64
-
65
- - (void)fwrtl_act_loadView
66
- {
67
- [self fwrtl_act_loadView];
68
- self.view.fwrtl_viewType = FWRTLViewTypeNormalWithAllDescendants;
69
- }
70
-
71
- @end
72
-
73
- @implementation SKStoreProductViewController (FWRTL)
74
-
75
- + (void)load
76
- {
77
- FWSwizzle(self, loadView, fwrtl_act_loadView);
78
- }
79
-
80
- - (void)fwrtl_act_loadView
81
- {
82
- [self fwrtl_act_loadView];
83
- self.view.fwrtl_viewType = FWRTLViewTypeNormalWithAllDescendants;
84
- }
85
-
86
- @end
@@ -1,16 +0,0 @@
1
- //
2
- // FWRTLWhiteListManager.h
3
- // FWRTL
4
- //
5
- // Created by ByteDance on 2018/12/6.
6
- //
7
-
8
- #import <Foundation/Foundation.h>
9
-
10
- NS_ASSUME_NONNULL_BEGIN
11
-
12
- @interface FWRTLWhiteListManager : NSObject
13
-
14
- @end
15
-
16
- NS_ASSUME_NONNULL_END
@@ -1,55 +0,0 @@
1
- //
2
- // FWRTLWhiteListManager.m
3
- // FWRTL
4
- //
5
- // Created by ByteDanceon 2018/12/6.
6
- //
7
-
8
- #import "FWRTLWhiteListManager.h"
9
- #import "UIView+FWRTL.h"
10
- #import <objc/runtime.h>
11
- #import "FWRTLManager.h"
12
- #import "UIView+FWRTL.h"
13
- #import "NSObject+FWRTLReloadBlock.h"
14
- #import "FWRTLDefinitions.h"
15
-
16
- @implementation FWRTLWhiteListManager
17
-
18
- + (void)load
19
- {
20
- NSArray<NSString *> *noFlipWhiteListClasses = @[@"UILabel", @"UITextView", @"UITextField", @"UIWebView", @"WKWebView", @"UIImageView", @"UISearchBar", @"PUPhotosSectionHeaderContentView", @"UITableViewIndex", FWBase64Decode(@"X1VJUmVtb3RlVmlldw==") /* _UIRemoteView */ , FWBase64Decode(@"VUlBdXRvY29ycmVjdFRleHRWaWV3") /* UIAutocorrectTextView */ ];
21
- [noFlipWhiteListClasses enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
22
- BOOL shouldFlip = NO;
23
- BOOL shouldInherit = NO;
24
- if ([obj hasPrefix:@"!"]) {
25
- shouldFlip = YES;
26
- obj = [obj substringFromIndex:1];
27
- }
28
- if ([obj hasSuffix:@"!"]) {
29
- shouldInherit = YES;
30
- obj = [obj substringToIndex:obj.length - 1];
31
- }
32
- Class class = NSClassFromString(obj);
33
- SEL sel = NSSelectorFromString(@"fwrtl_automaticViewType");
34
- if (!class) {
35
- return;
36
- }
37
- IMP implementation = imp_implementationWithBlock(^(NSObject *self) {
38
- if (shouldInherit) {
39
- return shouldFlip ? FWRTLViewTypeFlipWithAllDescendants : FWRTLViewTypeNormalWithAllDescendants;
40
- } else {
41
- return shouldFlip ? FWRTLViewTypeFlip : FWRTLViewTypeNormal;
42
- }
43
- });
44
- if (!class_addMethod(class, sel, implementation, method_getTypeEncoding(class_getInstanceMethod([UIView class], @selector(fwrtl_automaticViewType))))) {
45
- Method method = class_getInstanceMethod(class, sel);
46
- if (!method) {
47
- return;
48
- }
49
-
50
- method_setImplementation(method, implementation);
51
- }
52
- }];
53
- }
54
-
55
- @end
@@ -1,18 +0,0 @@
1
- //
2
- // UILabel+FWRTL.h
3
- // FWRTL
4
- //
5
- // Created by ByteDance on 2018/12/6.
6
- //
7
-
8
- #import <UIKit/UIKit.h>
9
-
10
- NS_ASSUME_NONNULL_BEGIN
11
-
12
- @interface UILabel (FWRTL)
13
-
14
- - (BOOL)fwrtl_shouldUseCalculatedTextAlignment;
15
-
16
- @end
17
-
18
- NS_ASSUME_NONNULL_END
@@ -1,39 +0,0 @@
1
- //
2
- // UILabel+FWRTL.m
3
- // FWRTL
4
- //
5
- // Created by ByteDance on 2018/12/6.
6
- //
7
-
8
- #import "UILabel+FWRTL.h"
9
- #import "NSObject+FWRTLReloadBlock.h"
10
- #import "FWRTLDefinitions.h"
11
- #import "FWRTLManager.h"
12
-
13
- @implementation UILabel (FWRTL)
14
-
15
- - (BOOL)fwrtl_shouldUseCalculatedTextAlignment
16
- {
17
- static dispatch_once_t onceToken;
18
- static NSArray<NSString *> *whiteListClasses;
19
- static NSArray<NSString *> *superviewWhiteListClasses;
20
- dispatch_once(&onceToken, ^{
21
- // UITextFieldLabel
22
- whiteListClasses = @[FWBase64Decode(@"VUlUZXh0RmllbGRMYWJlbA==")];
23
- // UIDatePickerContentView
24
- superviewWhiteListClasses = @[FWBase64Decode(@"VUlEYXRlUGlja2VyQ29udGVudFZpZXc=")];
25
- });
26
- for (NSString *className in whiteListClasses) {
27
- if ([self isKindOfClass:NSClassFromString(className)]) {
28
- return NO;
29
- }
30
- }
31
- for (NSString *className in superviewWhiteListClasses) {
32
- if ([self.superview isKindOfClass:NSClassFromString(className)]) {
33
- return NO;
34
- }
35
- }
36
- return YES;
37
- }
38
-
39
- @end
@@ -1,54 +0,0 @@
1
- //
2
- // UIView+FWRTL.h
3
- // FWRTL
4
- //
5
- // Created by ByteDance on 2018/9/10.
6
- //
7
-
8
- #import <UIKit/UIKit.h>
9
-
10
- /**
11
- * The view's behavior in RTL environment
12
- * - FWRTLViewTypeAuto: The view's behavior will be automatically judged according to its class.
13
- * - FWRTLViewTypeInherit: The view's behavior will depend on its superview.
14
- * - FWRTLViewTypeNormal: The view itself will always be normal in any conditions.
15
- * - FWRTLViewTypeFlip: The view itself will always be flipped in any conditions.
16
- * - FWRTLViewTypeNormalWithAllDescendants: The view and all its descendants will always be normal in any conditions.
17
- * - FWRTLViewTypeFlipWithAllDescendants: The view and all its descendants will always be flipped in any conditions.
18
- */
19
- typedef enum : NSUInteger {
20
- FWRTLViewTypeAuto,
21
- FWRTLViewTypeInherit,
22
- FWRTLViewTypeNormal,
23
- FWRTLViewTypeFlip,
24
- FWRTLViewTypeNormalWithAllDescendants,
25
- FWRTLViewTypeFlipWithAllDescendants,
26
- } FWRTLViewType;
27
-
28
- NS_ASSUME_NONNULL_BEGIN
29
-
30
- @interface UIView (FWRTL)
31
-
32
- /**
33
- * Set the view's behavior via this property
34
- */
35
- @property (nonatomic, assign) FWRTLViewType fwrtl_viewType;
36
-
37
- /**
38
- * The view's calculated behavior considering its view type and its view hierarchy
39
- */
40
- @property (nonatomic, assign, readonly) FWRTLViewType fwrtl_calculatedViewType;
41
-
42
- /**
43
- * Force renewing the view's RTL behavior w/wo its descendants
44
- */
45
- - (void)fwrtl_renewLayerTransformForceRecursively:(BOOL)forceRecursively;
46
-
47
- /**
48
- * [For Overriding] The view's actual behavior when it's set to FWRTLViewTypeAuto
49
- */
50
- - (FWRTLViewType)fwrtl_automaticViewType;
51
-
52
- @end
53
-
54
- NS_ASSUME_NONNULL_END
@@ -1,141 +0,0 @@
1
- //
2
- // UIView+FWRTL.m
3
- // FWRTL
4
- //
5
- // Created by ByteDance on 2018/9/10.
6
- //
7
-
8
- #import "UIView+FWRTL.h"
9
- #import "CALayer+FWRTL.h"
10
- #import <objc/runtime.h>
11
- #import "FWRTLDefinitions.h"
12
- #import "FWRTLManager.h"
13
-
14
- @interface UIView ()
15
-
16
- @property (nonatomic, assign) FWRTLViewType fwrtl_lastType;
17
- @property (nonatomic, assign) FWRTLViewType fwrtl_calculatedViewType;
18
-
19
- @end
20
-
21
- @implementation UIView (FWRTL)
22
-
23
- #pragma mark - Swizzle
24
- + (void)load
25
- {
26
- FWSwizzle(self, didMoveToSuperview, fwrtl_didMoveToSuperview);
27
- FWSwizzle(self, didMoveToWindow, fwrtl_didMoveToWindow);
28
- FWSwizzle(self, snapshotViewAfterScreenUpdates:, fwrtl_snapshotViewAfterScreenUpdates:);
29
- }
30
-
31
- - (void)fwrtl_didMoveToSuperview
32
- {
33
- [self fwrtl_didMoveToSuperview];
34
- [self fwrtl_renewLayerTransformForceRecursively:NO];
35
- }
36
-
37
- - (void)fwrtl_didMoveToWindow
38
- {
39
- [self fwrtl_didMoveToWindow];
40
- [self fwrtl_renewLayerTransformForceRecursively:NO];
41
- [[FWRTLManager sharedInstance] registerUIElement:self];
42
- }
43
-
44
- - (UIView *)fwrtl_snapshotViewAfterScreenUpdates:(BOOL)afterUpdates
45
- {
46
- UIView *res = [self fwrtl_snapshotViewAfterScreenUpdates:afterUpdates];
47
- res.fwrtl_viewType = self.fwrtl_calculatedViewType;
48
- return res;
49
- }
50
-
51
-
52
- #pragma mark - Additional Properties
53
- - (void)setFwrtl_viewType:(FWRTLViewType)fwrtl_viewType
54
- {
55
- if (self.fwrtl_viewType == fwrtl_viewType) {
56
- return;
57
- }
58
- objc_setAssociatedObject(self, @selector(fwrtl_viewType), @(fwrtl_viewType), OBJC_ASSOCIATION_RETAIN);
59
- [self fwrtl_renewLayerTransformForceRecursively:NO];
60
- }
61
-
62
- - (FWRTLViewType)fwrtl_viewType
63
- {
64
- return [objc_getAssociatedObject(self, _cmd) integerValue];
65
- }
66
-
67
- - (void)setFwrtl_lastType:(FWRTLViewType)fwrtl_lastType
68
- {
69
- objc_setAssociatedObject(self, @selector(fwrtl_lastType), @(fwrtl_lastType), OBJC_ASSOCIATION_RETAIN);
70
- }
71
-
72
- - (FWRTLViewType)fwrtl_lastType
73
- {
74
- return [objc_getAssociatedObject(self, _cmd) integerValue];
75
- }
76
-
77
- - (void)setFwrtl_calculatedViewType:(FWRTLViewType)fwrtl_calculatedViewType
78
- {
79
- objc_setAssociatedObject(self, @selector(fwrtl_calculatedViewType), @(fwrtl_calculatedViewType), OBJC_ASSOCIATION_RETAIN);
80
- }
81
-
82
- - (FWRTLViewType)fwrtl_calculatedViewType
83
- {
84
- FWRTLViewType type = [objc_getAssociatedObject(self, _cmd) integerValue];
85
- if (type == FWRTLViewTypeAuto) {
86
- if (self.window) {
87
- [self fwrtl_updateCalculatedViewType];
88
- type = [objc_getAssociatedObject(self, _cmd) integerValue];
89
- } else {
90
- type = FWRTLViewTypeNormal;
91
- }
92
- }
93
- return type;
94
- }
95
-
96
- #pragma mark - RTL
97
- - (void)fwrtl_renewLayerTransformForceRecursively:(BOOL)forceRecursively
98
- {
99
- [self fwrtl_updateCalculatedViewType];
100
- FWRTLViewType updatedViewType = [self fwrtl_calculatedViewType];
101
- FWRTLViewType superViewCalculatedViewType = [self.superview fwrtl_calculatedViewType];
102
- BOOL shouldFlipCurrentView = updatedViewType == FWRTLViewTypeFlip || updatedViewType == FWRTLViewTypeFlipWithAllDescendants;
103
- BOOL shouldFlipSuperview = superViewCalculatedViewType == FWRTLViewTypeFlip || superViewCalculatedViewType == FWRTLViewTypeFlipWithAllDescendants;
104
- BOOL shouldSetFlipTransform = shouldFlipSuperview ^ shouldFlipCurrentView;
105
- if (shouldSetFlipTransform && [FWRTLManager sharedInstance].enableHorizontalFlip) {
106
- self.layer.fwrtl_basicTransform = CGAffineTransformMakeScale(-1, 1);
107
- } else {
108
- self.layer.fwrtl_basicTransform = CGAffineTransformIdentity;
109
- }
110
-
111
- if (updatedViewType != self.fwrtl_lastType || forceRecursively) {
112
- [self.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
113
- [obj fwrtl_renewLayerTransformForceRecursively:forceRecursively];
114
- }];
115
- }
116
-
117
- self.fwrtl_lastType = updatedViewType;
118
- }
119
-
120
- - (void)fwrtl_updateCalculatedViewType
121
- {
122
- FWRTLViewType rtlType = [self fwrtl_viewType];
123
- if (rtlType == FWRTLViewTypeAuto) {
124
- rtlType = [self fwrtl_automaticViewType];
125
- }
126
-
127
- FWRTLViewType superViewCalculatedType = self.superview.fwrtl_calculatedViewType;
128
- if (superViewCalculatedType == FWRTLViewTypeFlipWithAllDescendants || superViewCalculatedType == FWRTLViewTypeNormalWithAllDescendants || rtlType == FWRTLViewTypeInherit) {
129
- self.fwrtl_calculatedViewType = self.superview.fwrtl_calculatedViewType;
130
- } else {
131
- self.fwrtl_calculatedViewType = rtlType;
132
- }
133
- }
134
-
135
- #pragma mark - For Inherit
136
- - (FWRTLViewType)fwrtl_automaticViewType
137
- {
138
- return self.superview ? FWRTLViewTypeInherit : FWRTLViewTypeNormal;
139
- }
140
-
141
- @end
@@ -1,16 +0,0 @@
1
- //
2
- // UIWindow+FWRTL.h
3
- // FWRTL
4
- //
5
- // Created by ByteDance on 2018/9/10.
6
- //
7
-
8
- #import <UIKit/UIKit.h>
9
-
10
- NS_ASSUME_NONNULL_BEGIN
11
-
12
- @interface UIWindow (FWRTL)
13
-
14
- @end
15
-
16
- NS_ASSUME_NONNULL_END
@@ -1,20 +0,0 @@
1
- //
2
- // UIWindow+FWRTL.m
3
- // FWRTL
4
- //
5
- // Created by ByteDance on 2018/9/10.
6
- //
7
-
8
- #import "UIWindow+FWRTL.h"
9
- #import "UIView+FWRTL.h"
10
- #import "FWRTLDefinitions.h"
11
- #import "FWRTLManager.h"
12
-
13
- @implementation UIWindow (FWRTL)
14
-
15
- - (FWRTLViewType)fwrtl_automaticViewType
16
- {
17
- return FWRTLViewTypeNormal;
18
- }
19
-
20
- @end
@@ -1,52 +0,0 @@
1
- //
2
- // FWRTLDefinitions.h
3
- // Pods
4
- //
5
- // Created by 熊典 on 2018/10/9.
6
- //
7
-
8
- #ifndef FWRTLDefinitions_h
9
- #define FWRTLDefinitions_h
10
-
11
- #import <objc/runtime.h>
12
-
13
- #ifndef btd_keywordify
14
- #if DEBUG
15
- #define btd_keywordify autoreleasepool {}
16
- #else
17
- #define btd_keywordify try {} @catch (...) {}
18
- #endif
19
- #endif
20
-
21
- #ifndef weakify
22
- #if __has_feature(objc_arc)
23
- #define weakify(object) btd_keywordify __weak __typeof__(object) weak##_##object = object;
24
- #else
25
- #define weakify(object) btd_keywordify __block __typeof__(object) block##_##object = object;
26
- #endif
27
- #endif
28
-
29
- #ifndef strongify
30
- #if __has_feature(objc_arc)
31
- #define strongify(object) btd_keywordify __typeof__(object) object = weak##_##object;
32
- #else
33
- #define strongify(object) btd_keywordify __typeof__(object) object = block##_##object;
34
- #endif
35
- #endif
36
-
37
- #define FWSwizzle(class, oriMethod, newMethod) {Method originalMethod = class_getInstanceMethod(class, @selector(oriMethod));\
38
- Method swizzledMethod = class_getInstanceMethod(class, @selector(newMethod));\
39
- if (class_addMethod(class, @selector(oriMethod), method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod))) {\
40
- class_replaceMethod(class, @selector(newMethod), method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod));\
41
- } else {\
42
- method_exchangeImplementations(originalMethod, swizzledMethod);\
43
- }}
44
-
45
- #define FWSwizzleClass(class, oriMethod, newMethod) {Method originalMethod = class_getClassMethod(class, @selector(oriMethod));\
46
- Method swizzledMethod = class_getClassMethod(class, @selector(newMethod));\
47
- method_exchangeImplementations(originalMethod, swizzledMethod);\
48
- }
49
-
50
- #define FWBase64Decode(str) [[NSString alloc] initWithData:[[NSData alloc] initWithBase64EncodedString:str options:0] encoding:NSUTF8StringEncoding]
51
-
52
- #endif /* FWRTLDefinitions_h */
@@ -1,19 +0,0 @@
1
- //
2
- // NSObject+FWRTLReloadBlock.h
3
- // FWRTL
4
- //
5
- // Created by 熊典 on 2018/12/6.
6
- //
7
-
8
- #import <Foundation/Foundation.h>
9
-
10
- NS_ASSUME_NONNULL_BEGIN
11
-
12
- @interface NSObject (FWRTLReloadBlock)
13
-
14
- - (void)fwrtl_performReload;
15
- - (void)fwrtl_addReloadBlockForKey:(NSString *)key andExecuteIt:(void (^)(void))reloadBlock;
16
-
17
- @end
18
-
19
- NS_ASSUME_NONNULL_END
@@ -1,49 +0,0 @@
1
- //
2
- // NSObject+FWRTLReloadBlock.m
3
- // FWRTL
4
- //
5
- // Created by 熊典 on 2018/12/6.
6
- //
7
-
8
- #import "NSObject+FWRTLReloadBlock.h"
9
- #import <objc/runtime.h>
10
-
11
- @interface NSObject ()
12
-
13
- @property (nonatomic, strong) NSMutableDictionary<NSString *, void (^)(void)> *fwrtl_reloadBlocks;
14
-
15
- @end
16
-
17
- @implementation NSObject (FWRTLReloadBlock)
18
-
19
- - (void)setFwrtl_reloadBlocks:(NSMutableDictionary<NSString *,void (^)(void)> *)fwrtl_reloadBlocks
20
- {
21
- objc_setAssociatedObject(self, @selector(fwrtl_reloadBlocks), fwrtl_reloadBlocks, OBJC_ASSOCIATION_RETAIN);
22
- }
23
-
24
- - (NSMutableDictionary<NSString *,void (^)(void)> *)fwrtl_reloadBlocks
25
- {
26
- return objc_getAssociatedObject(self, _cmd);
27
- }
28
-
29
- - (void)fwrtl_addReloadBlockForKey:(NSString *)key andExecuteIt:(void (^)(void))reloadBlock
30
- {
31
- if (!self.fwrtl_reloadBlocks) {
32
- self.fwrtl_reloadBlocks = [NSMutableDictionary dictionary];
33
- }
34
- if (reloadBlock) {
35
- [self.fwrtl_reloadBlocks setObject:reloadBlock forKey:key];
36
- reloadBlock();
37
- }
38
- }
39
-
40
- - (void)fwrtl_performReload
41
- {
42
- if (self.fwrtl_reloadBlocks) {
43
- [self.fwrtl_reloadBlocks enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, void (^ _Nonnull obj)(void), BOOL * _Nonnull stop) {
44
- obj();
45
- }];
46
- }
47
- }
48
-
49
- @end
@@ -1,21 +0,0 @@
1
- //
2
- // NSString+FWRTL.h
3
- // Pods
4
- //
5
- // Created by 唐健 on 2019/5/23.
6
- //
7
-
8
-
9
-
10
- NS_ASSUME_NONNULL_BEGIN
11
-
12
- @interface NSString (FWRTL)
13
-
14
- - (BOOL)isRTLString;
15
- - (BOOL)isLTRString;
16
- - (NSString *)RTLString;
17
- - (NSString *)LTRString;
18
-
19
- @end
20
-
21
- NS_ASSUME_NONNULL_END
@@ -1,38 +0,0 @@
1
- //
2
- // NSString+FWRTL.m
3
- // Pods
4
- //
5
- // Created by 唐健 on 2019/5/23.
6
- //
7
-
8
- #import "NSString+FWRTL.h"
9
-
10
- @implementation NSString (FWRTL)
11
-
12
- - (BOOL)isRTLString
13
- {
14
- return [self hasPrefix:@"\u202B"];
15
- }
16
-
17
- - (BOOL)isLTRString
18
- {
19
- return [self hasPrefix:@"\u202A"];
20
- }
21
-
22
- - (NSString *)RTLString
23
- {
24
- if ([self isRTLString] || [self isLTRString]) {
25
- return self;
26
- }
27
- return [NSString stringWithFormat:@"\u202B%@\u202C", self];
28
- }
29
-
30
- - (NSString *)LTRString
31
- {
32
- if ([self isRTLString] || [self isLTRString]) {
33
- return self;
34
- }
35
- return [NSString stringWithFormat:@"\u202A%@\u202C", self];
36
- }
37
-
38
- @end
@@ -1,18 +0,0 @@
1
- //
2
- // UIImage+FWRTL.h
3
- // FWRTL
4
- //
5
- // Created by 熊典 on 2018/12/6.
6
- //
7
-
8
- #import <UIKit/UIKit.h>
9
-
10
- NS_ASSUME_NONNULL_BEGIN
11
-
12
- @interface UIImage (FWRTL)
13
-
14
- @property (nonatomic, strong) NSString *fwrtl_imageName;
15
-
16
- @end
17
-
18
- NS_ASSUME_NONNULL_END
@@ -1,43 +0,0 @@
1
- //
2
- // UIImage+FWRTL.m
3
- // FWRTL
4
- //
5
- // Created by 熊典 on 2018/12/6.
6
- //
7
-
8
- #import "UIImage+FWRTL.h"
9
- #import "FWRTLDefinitions.h"
10
-
11
- @implementation UIImage (FWRTL)
12
-
13
- + (void)load
14
- {
15
- FWSwizzleClass(self, imageNamed:, fwrtl_imageNamed:);
16
- FWSwizzleClass(self, imageNamed:inBundle:compatibleWithTraitCollection:, fwrtl_imageNamed:inBundle:compatibleWithTraitCollection:);
17
- }
18
-
19
- + (UIImage *)fwrtl_imageNamed:(NSString *)name
20
- {
21
- UIImage *image = [self fwrtl_imageNamed:name];
22
- image.fwrtl_imageName = name;
23
- return image;
24
- }
25
-
26
- + (UIImage *)fwrtl_imageNamed:(NSString *)name inBundle:(NSBundle *)bundle compatibleWithTraitCollection:(UITraitCollection *)traitCollection
27
- {
28
- UIImage *image = [self fwrtl_imageNamed:name inBundle:bundle compatibleWithTraitCollection:traitCollection];
29
- image.fwrtl_imageName = name;
30
- return image;
31
- }
32
-
33
- - (NSString *)fwrtl_imageName
34
- {
35
- return objc_getAssociatedObject(self, _cmd);
36
- }
37
-
38
- - (void)setFwrtl_imageName:(NSString *)fwrtl_imageName
39
- {
40
- objc_setAssociatedObject(self, @selector(fwrtl_imageName), fwrtl_imageName, OBJC_ASSOCIATION_RETAIN);
41
- }
42
-
43
- @end