hybrid-navigation 4.1.0 → 5.1.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/HybridNavigation.podspec +9 -1
- package/README.md +12 -4
- package/android/build.gradle +4 -4
- package/android/proguard-rules.pro +0 -14
- package/android/src/main/java/com/navigation/androidx/AwesomeActivity.java +116 -27
- package/android/src/main/java/com/navigation/androidx/AwesomeFragment.java +162 -13
- package/android/src/main/java/com/navigation/androidx/DefaultTabBarProvider.java +2 -2
- package/android/src/main/java/com/navigation/androidx/DrawableUtils.java +83 -18
- package/android/src/main/java/com/navigation/androidx/DrawerFragment.java +185 -25
- package/android/src/main/java/com/navigation/androidx/FragmentHelper.java +18 -0
- package/android/src/main/java/com/navigation/androidx/HybridDrawerLayout.java +563 -143
- package/android/src/main/java/com/navigation/androidx/LifecycleDelegate.java +39 -12
- package/android/src/main/java/com/navigation/androidx/PresentableActivity.java +3 -0
- package/android/src/main/java/com/navigation/androidx/PresentationDelegate.java +10 -7
- package/android/src/main/java/com/navigation/androidx/StackDelegate.java +29 -9
- package/android/src/main/java/com/navigation/androidx/StackFragment.java +31 -3
- package/android/src/main/java/com/navigation/androidx/SystemUI.java +59 -90
- package/android/src/main/java/com/navigation/androidx/TabBar.java +21 -2
- package/android/src/main/java/com/navigation/androidx/TabBarFragment.java +74 -7
- package/android/src/main/java/com/navigation/androidx/TabBarItem.java +4 -0
- package/android/src/main/java/com/navigation/androidx/TabView.java +11 -2
- package/android/src/main/java/com/reactnative/hybridnavigation/DispatchResult.java +71 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/Garden.java +18 -10
- package/android/src/main/java/com/reactnative/hybridnavigation/GlobalStyle.java +34 -2
- package/android/src/main/java/com/reactnative/hybridnavigation/HBDRootView.java +20 -10
- package/android/src/main/java/com/reactnative/hybridnavigation/HybridFragment.java +179 -13
- package/android/src/main/java/com/reactnative/hybridnavigation/HybridNavigationPackage.java +13 -24
- package/android/src/main/java/com/reactnative/hybridnavigation/NativeEvent.java +5 -1
- package/android/src/main/java/com/reactnative/hybridnavigation/NativeNavigation.java +283 -183
- package/android/src/main/java/com/reactnative/hybridnavigation/NavigationCommandQueue.java +507 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/Navigator.java +4 -1
- package/android/src/main/java/com/reactnative/hybridnavigation/OrientationCoordinator.java +162 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactAppCompatActivity.java +103 -66
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactFragment.java +421 -92
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactManager.java +227 -78
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactStackFragment.java +6 -6
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactTabBarFragment.java +26 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactTabBarProvider.java +8 -1
- package/android/src/main/java/com/reactnative/hybridnavigation/SceneLifecycleState.java +21 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/SceneLifecycleStateMachine.java +116 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/ScreenOrientation.java +42 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/Utils.java +17 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/DrawerNavigator.java +14 -6
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/ScreenNavigator.java +188 -26
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/StackNavigator.java +67 -16
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/TabNavigator.java +42 -14
- package/dist/DeepLink.d.ts +3 -2
- package/dist/DeepLink.js +37 -14
- package/dist/NativeEvent.d.ts +17 -10
- package/dist/NativeNavigation.d.ts +24 -18
- package/dist/Navigation.d.ts +34 -19
- package/dist/Navigation.js +225 -90
- package/dist/NavigationComponentWrap.d.ts +5 -3
- package/dist/NavigationComponentWrap.js +3 -6
- package/dist/Navigator.d.ts +32 -42
- package/dist/Navigator.js +117 -91
- package/dist/Options.d.ts +15 -3
- package/dist/Route.d.ts +149 -17
- package/dist/defineRoutes.d.ts +19 -0
- package/dist/defineRoutes.js +6 -0
- package/dist/handler/DispatchCommandHandler.d.ts +25 -6
- package/dist/handler/DispatchCommandHandler.js +99 -17
- package/dist/handler/LayoutCommandHandler.d.ts +8 -7
- package/dist/handler/LayoutCommandHandler.js +24 -15
- package/dist/handler/LeaveGuardHandler.d.ts +17 -0
- package/dist/handler/LeaveGuardHandler.js +350 -0
- package/dist/handler/LifecycleEventHandler.d.ts +30 -0
- package/dist/handler/LifecycleEventHandler.js +169 -0
- package/dist/handler/PresentationCoordinator.d.ts +24 -0
- package/dist/handler/PresentationCoordinator.js +449 -0
- package/dist/handler/ResultEventHandler.d.ts +21 -9
- package/dist/handler/ResultEventHandler.js +96 -13
- package/dist/handler/TabEventHandler.d.ts +8 -0
- package/dist/handler/TabEventHandler.js +25 -0
- package/dist/hooks.d.ts +7 -2
- package/dist/hooks.js +46 -4
- package/dist/index.d.ts +24 -0
- package/dist/index.js +3 -2
- package/dist/reveal.d.ts +46 -0
- package/dist/reveal.js +431 -0
- package/dist/routeConfigRegistry.d.ts +6 -0
- package/dist/routeConfigRegistry.js +19 -0
- package/dist/routeGraph.d.ts +12 -0
- package/dist/routeGraph.js +68 -0
- package/dist/router/drawer.d.ts +2 -2
- package/dist/router/drawer.js +6 -3
- package/dist/router/index.d.ts +8 -5
- package/dist/router/index.js +106 -58
- package/dist/router/screen.d.ts +2 -2
- package/dist/router/screen.js +1 -1
- package/dist/router/stack.d.ts +2 -2
- package/dist/router/stack.js +59 -30
- package/dist/router/tabs.d.ts +3 -2
- package/dist/router/tabs.js +4 -1
- package/dist/store.d.ts +4 -2
- package/dist/store.js +4 -0
- package/dist/testing.d.ts +79 -0
- package/dist/testing.js +251 -0
- package/ios/HBDGlobalStyle.h +29 -0
- package/ios/{GlobalStyle.mm → HBDGlobalStyle.mm} +43 -29
- package/ios/HybridNavigation.h +5 -1
- package/ios/Navigator/HBDDrawerNavigator.mm +24 -8
- package/ios/Navigator/HBDNavigatorRegistry.mm +1 -0
- package/ios/Navigator/HBDScreenNavigator.mm +278 -58
- package/ios/Navigator/HBDStackNavigator.mm +152 -61
- package/ios/Navigator/HBDTabNavigator.mm +60 -14
- package/ios/React/HBDNativeNavigation.mm +162 -123
- package/ios/React/HBDNavigator.h +37 -5
- package/ios/React/HBDOrientationCoordinator.h +29 -0
- package/ios/React/HBDOrientationCoordinator.mm +309 -0
- package/ios/React/HBDReactBridgeManager.h +46 -20
- package/ios/React/HBDReactBridgeManager.mm +496 -108
- package/ios/React/HBDSceneLifecycleStateMachine.h +38 -0
- package/ios/React/HBDSceneLifecycleStateMachine.mm +180 -0
- package/ios/View/HBDRootView.h +2 -0
- package/ios/View/HBDRootView.mm +148 -0
- package/ios/View/UIImage+WithBadge.h +3 -3
- package/ios/View/UIImage+WithBadge.mm +10 -15
- package/ios/ViewController/HBDDrawerController.mm +126 -5
- package/ios/ViewController/HBDNavigationController.mm +31 -4
- package/ios/ViewController/HBDReactViewController.h +6 -0
- package/ios/ViewController/HBDReactViewController.mm +220 -106
- package/ios/ViewController/HBDTabBarController.h +15 -0
- package/ios/ViewController/HBDTabBarController.mm +227 -45
- package/ios/ViewController/HBDTabBarRenderer.h +28 -0
- package/ios/ViewController/HBDViewController.h +11 -3
- package/ios/ViewController/HBDViewController.mm +209 -159
- package/ios/ViewController/UINavigationController+HBD.h +2 -2
- package/ios/ViewController/UINavigationController+HBD.mm +3 -3
- package/ios/ViewController/UIViewController+HBD.h +18 -10
- package/ios/ViewController/UIViewController+HBD.mm +90 -65
- package/package.json +3 -1
- package/src/DeepLink.ts +41 -14
- package/src/NativeEvent.ts +18 -11
- package/src/NativeNavigation.ts +29 -31
- package/src/Navigation.ts +377 -120
- package/src/NavigationComponentWrap.tsx +18 -9
- package/src/Navigator.ts +219 -152
- package/src/Options.ts +12 -3
- package/src/Route.ts +228 -17
- package/src/defineRoutes.ts +46 -0
- package/src/handler/DispatchCommandHandler.ts +154 -21
- package/src/handler/LayoutCommandHandler.ts +40 -17
- package/src/handler/LeaveGuardHandler.ts +436 -0
- package/src/handler/LifecycleEventHandler.ts +219 -0
- package/src/handler/PresentationCoordinator.ts +560 -0
- package/src/handler/ResultEventHandler.ts +126 -19
- package/src/handler/TabEventHandler.ts +31 -0
- package/src/hooks.ts +75 -7
- package/src/index.ts +37 -2
- package/src/reveal.ts +565 -0
- package/src/routeConfigRegistry.ts +26 -0
- package/src/routeGraph.ts +87 -0
- package/src/router/drawer.ts +8 -5
- package/src/router/index.ts +139 -63
- package/src/router/screen.ts +3 -3
- package/src/router/stack.ts +80 -29
- package/src/router/tabs.ts +16 -7
- package/src/store.ts +6 -1
- package/src/testing.ts +395 -0
- package/testing.d.ts +1 -0
- package/testing.js +3 -0
- package/android/src/main/java/androidx/fragment/app/InternalFragment.java +0 -22
- package/android/src/main/java/com/navigation/androidx/SystemUI30.java +0 -87
- package/android/src/main/java/com/reactnative/hybridnavigation/NativeGarden.java +0 -176
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactTabBar.java +0 -130
- package/android/src/main/res/layout/nav_tab_bar_react.xml +0 -32
- package/android/src/main/res/layout/nav_tab_bar_react_indeterminate.xml +0 -32
- package/dist/NativeGarden.d.ts +0 -13
- package/dist/NativeGarden.js +0 -2
- package/dist/handler/VisibilityEventHandler.d.ts +0 -13
- package/dist/handler/VisibilityEventHandler.js +0 -39
- package/ios/GlobalStyle.h +0 -15
- package/ios/React/HBDNativeGarden.h +0 -10
- package/ios/React/HBDNativeGarden.mm +0 -111
- package/src/NativeGarden.ts +0 -16
- package/src/handler/VisibilityEventHandler.ts +0 -52
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
|
|
3
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
4
|
+
|
|
5
|
+
typedef NS_ENUM(NSInteger, HBDSceneLifecycleState) {
|
|
6
|
+
HBDSceneLifecycleStateCreated,
|
|
7
|
+
HBDSceneLifecycleStateVisible,
|
|
8
|
+
HBDSceneLifecycleStateInvisible,
|
|
9
|
+
HBDSceneLifecycleStateDestroyed,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
FOUNDATION_EXPORT NSString *HBDSceneLifecycleStateToString(HBDSceneLifecycleState state);
|
|
13
|
+
|
|
14
|
+
typedef void (^HBDSceneLifecycleStateChangeBlock)(HBDSceneLifecycleState prevState, HBDSceneLifecycleState newState);
|
|
15
|
+
typedef BOOL (^HBDSceneLifecycleReadyBlock)(BOOL flushLayout);
|
|
16
|
+
|
|
17
|
+
@interface HBDSceneLifecycleStateMachine : NSObject
|
|
18
|
+
|
|
19
|
+
@property(nonatomic, assign, readonly) HBDSceneLifecycleState state;
|
|
20
|
+
@property(nonatomic, assign, readonly, getter=isMounted) BOOL mounted;
|
|
21
|
+
@property(nonatomic, assign, readonly, getter=isFirstRendered) BOOL firstRendered;
|
|
22
|
+
@property(nonatomic, assign, readonly, getter=isVisible) BOOL visible;
|
|
23
|
+
@property(nonatomic, copy, nullable) HBDSceneLifecycleStateChangeBlock onStateChange;
|
|
24
|
+
@property(nonatomic, copy, nullable) HBDSceneLifecycleReadyBlock readyForVisibleCheck;
|
|
25
|
+
|
|
26
|
+
- (void)markMounted;
|
|
27
|
+
- (void)markFirstRenderComplete;
|
|
28
|
+
- (void)viewWillAppearWithInteractiveTransition:(BOOL)interactive;
|
|
29
|
+
- (void)viewDidAppear;
|
|
30
|
+
- (void)viewDidLayoutSubviews;
|
|
31
|
+
- (void)viewWillDisappearWithInteractiveTransition:(BOOL)interactive;
|
|
32
|
+
- (void)viewDidDisappear;
|
|
33
|
+
- (void)handleReload;
|
|
34
|
+
- (void)markDestroyed;
|
|
35
|
+
|
|
36
|
+
@end
|
|
37
|
+
|
|
38
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
#import "HBDSceneLifecycleStateMachine.h"
|
|
2
|
+
|
|
3
|
+
NSString *HBDSceneLifecycleStateToString(HBDSceneLifecycleState state) {
|
|
4
|
+
switch (state) {
|
|
5
|
+
case HBDSceneLifecycleStateCreated:
|
|
6
|
+
return @"created";
|
|
7
|
+
case HBDSceneLifecycleStateVisible:
|
|
8
|
+
return @"visible";
|
|
9
|
+
case HBDSceneLifecycleStateInvisible:
|
|
10
|
+
return @"invisible";
|
|
11
|
+
case HBDSceneLifecycleStateDestroyed:
|
|
12
|
+
return @"destroyed";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@interface HBDSceneLifecycleStateMachine ()
|
|
17
|
+
|
|
18
|
+
@property(nonatomic, assign, readwrite) HBDSceneLifecycleState state;
|
|
19
|
+
@property(nonatomic, assign, readwrite, getter=isMounted) BOOL mounted;
|
|
20
|
+
@property(nonatomic, assign, readwrite, getter=isFirstRendered) BOOL firstRendered;
|
|
21
|
+
@property(nonatomic, assign) BOOL viewAppeared;
|
|
22
|
+
@property(nonatomic, assign) BOOL appearanceScheduled;
|
|
23
|
+
@property(nonatomic, assign) NSUInteger generation;
|
|
24
|
+
|
|
25
|
+
@end
|
|
26
|
+
|
|
27
|
+
@implementation HBDSceneLifecycleStateMachine
|
|
28
|
+
|
|
29
|
+
- (instancetype)init {
|
|
30
|
+
if (self = [super init]) {
|
|
31
|
+
_state = HBDSceneLifecycleStateCreated;
|
|
32
|
+
}
|
|
33
|
+
return self;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
- (BOOL)isVisible {
|
|
37
|
+
return self.state == HBDSceneLifecycleStateVisible;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
- (void)markMounted {
|
|
41
|
+
if (self.state == HBDSceneLifecycleStateDestroyed) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
self.mounted = YES;
|
|
45
|
+
self.firstRendered = NO;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
- (void)markFirstRenderComplete {
|
|
49
|
+
if (self.state == HBDSceneLifecycleStateDestroyed || !self.mounted || self.firstRendered) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
self.firstRendered = YES;
|
|
53
|
+
[self scheduleVisibleIfReady];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
- (void)viewWillAppearWithInteractiveTransition:(BOOL)interactive {
|
|
57
|
+
if (self.state == HBDSceneLifecycleStateDestroyed || interactive) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
self.viewAppeared = YES;
|
|
61
|
+
[self scheduleVisibleIfReady];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
- (void)viewDidAppear {
|
|
65
|
+
if (self.state == HBDSceneLifecycleStateDestroyed) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
self.viewAppeared = YES;
|
|
69
|
+
[self scheduleVisibleIfReady];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
- (void)viewDidLayoutSubviews {
|
|
73
|
+
if (self.state == HBDSceneLifecycleStateDestroyed) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
[self scheduleVisibleIfReady];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
- (void)viewWillDisappearWithInteractiveTransition:(BOOL)interactive {
|
|
80
|
+
if (self.state == HBDSceneLifecycleStateDestroyed || interactive) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
[self finishAppearance];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
- (void)viewDidDisappear {
|
|
87
|
+
if (self.state == HBDSceneLifecycleStateDestroyed) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
[self finishAppearance];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
- (void)handleReload {
|
|
94
|
+
if (self.state == HBDSceneLifecycleStateDestroyed) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
self.generation += 1;
|
|
98
|
+
self.appearanceScheduled = NO;
|
|
99
|
+
self.firstRendered = NO;
|
|
100
|
+
if (self.state == HBDSceneLifecycleStateVisible) {
|
|
101
|
+
[self transitionTo:HBDSceneLifecycleStateInvisible];
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
- (void)markDestroyed {
|
|
106
|
+
if (self.state == HBDSceneLifecycleStateDestroyed) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
self.generation += 1;
|
|
110
|
+
self.appearanceScheduled = NO;
|
|
111
|
+
self.viewAppeared = NO;
|
|
112
|
+
if (self.state == HBDSceneLifecycleStateVisible) {
|
|
113
|
+
[self transitionTo:HBDSceneLifecycleStateInvisible];
|
|
114
|
+
}
|
|
115
|
+
self.mounted = NO;
|
|
116
|
+
self.firstRendered = NO;
|
|
117
|
+
[self transitionTo:HBDSceneLifecycleStateDestroyed];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
- (void)finishAppearance {
|
|
121
|
+
self.viewAppeared = NO;
|
|
122
|
+
self.generation += 1;
|
|
123
|
+
self.appearanceScheduled = NO;
|
|
124
|
+
if (self.state == HBDSceneLifecycleStateVisible) {
|
|
125
|
+
[self transitionTo:HBDSceneLifecycleStateInvisible];
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
- (void)scheduleVisibleIfReady {
|
|
130
|
+
if (self.state == HBDSceneLifecycleStateDestroyed ||
|
|
131
|
+
!self.mounted ||
|
|
132
|
+
!self.firstRendered ||
|
|
133
|
+
!self.viewAppeared ||
|
|
134
|
+
self.state == HBDSceneLifecycleStateVisible ||
|
|
135
|
+
self.appearanceScheduled) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (!self.readyForVisibleCheck) {
|
|
140
|
+
[self transitionTo:HBDSceneLifecycleStateVisible];
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (!self.readyForVisibleCheck(NO)) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
self.appearanceScheduled = YES;
|
|
149
|
+
NSUInteger generation = self.generation;
|
|
150
|
+
__weak HBDSceneLifecycleStateMachine *weakSelf = self;
|
|
151
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
152
|
+
HBDSceneLifecycleStateMachine *strongSelf = weakSelf;
|
|
153
|
+
if (!strongSelf || strongSelf.generation != generation) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
strongSelf.appearanceScheduled = NO;
|
|
157
|
+
if (!strongSelf.mounted || !strongSelf.firstRendered || !strongSelf.viewAppeared ||
|
|
158
|
+
strongSelf.state == HBDSceneLifecycleStateDestroyed ||
|
|
159
|
+
strongSelf.state == HBDSceneLifecycleStateVisible) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (strongSelf.readyForVisibleCheck && !strongSelf.readyForVisibleCheck(YES)) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
[strongSelf transitionTo:HBDSceneLifecycleStateVisible];
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
- (void)transitionTo:(HBDSceneLifecycleState)nextState {
|
|
170
|
+
if (self.state == nextState) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
HBDSceneLifecycleState prevState = self.state;
|
|
174
|
+
self.state = nextState;
|
|
175
|
+
if (self.onStateChange) {
|
|
176
|
+
self.onStateChange(prevState, nextState);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
@end
|
package/ios/View/HBDRootView.h
CHANGED
package/ios/View/HBDRootView.mm
CHANGED
|
@@ -7,6 +7,76 @@
|
|
|
7
7
|
#import <React/RCTSurfaceView.h>
|
|
8
8
|
#import <React/RCTUtils.h>
|
|
9
9
|
|
|
10
|
+
@protocol HBDParagraphComponentViewProtocol <NSObject>
|
|
11
|
+
|
|
12
|
+
@property (nonatomic, strong, readonly, nullable) UIView *contentView;
|
|
13
|
+
@property (nonatomic, readonly, nullable) NSAttributedString *attributedText;
|
|
14
|
+
|
|
15
|
+
@end
|
|
16
|
+
|
|
17
|
+
@interface HBDParagraphViewState : NSObject
|
|
18
|
+
|
|
19
|
+
@property (nonatomic, assign) UIViewContentMode contentMode;
|
|
20
|
+
@property (nonatomic, assign) BOOL clipsToBounds;
|
|
21
|
+
|
|
22
|
+
@end
|
|
23
|
+
|
|
24
|
+
@implementation HBDParagraphViewState
|
|
25
|
+
@end
|
|
26
|
+
|
|
27
|
+
static Class HBDParagraphComponentViewClass(void) {
|
|
28
|
+
static Class paragraphClass = Nil;
|
|
29
|
+
static dispatch_once_t onceToken;
|
|
30
|
+
dispatch_once(&onceToken, ^{
|
|
31
|
+
paragraphClass = NSClassFromString(@"RCTParagraphComponentView");
|
|
32
|
+
});
|
|
33
|
+
return paragraphClass;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static UIViewContentMode HBDContentModeForParagraphView(UIView *paragraphView) {
|
|
37
|
+
NSAttributedString *attributedText = nil;
|
|
38
|
+
if ([paragraphView respondsToSelector:@selector(attributedText)]) {
|
|
39
|
+
attributedText = ((id<HBDParagraphComponentViewProtocol>)paragraphView).attributedText;
|
|
40
|
+
}
|
|
41
|
+
NSTextAlignment alignment = NSTextAlignmentNatural;
|
|
42
|
+
if (attributedText.length > 0) {
|
|
43
|
+
NSParagraphStyle *paragraphStyle = [attributedText attribute:NSParagraphStyleAttributeName atIndex:0 effectiveRange:NULL];
|
|
44
|
+
if (paragraphStyle) {
|
|
45
|
+
alignment = paragraphStyle.alignment;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
switch (alignment) {
|
|
49
|
+
case NSTextAlignmentCenter:
|
|
50
|
+
return UIViewContentModeTop;
|
|
51
|
+
case NSTextAlignmentRight:
|
|
52
|
+
return UIViewContentModeTopRight;
|
|
53
|
+
case NSTextAlignmentLeft:
|
|
54
|
+
case NSTextAlignmentJustified:
|
|
55
|
+
return UIViewContentModeTopLeft;
|
|
56
|
+
case NSTextAlignmentNatural:
|
|
57
|
+
default:
|
|
58
|
+
return paragraphView.effectiveUserInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft
|
|
59
|
+
? UIViewContentModeTopRight
|
|
60
|
+
: UIViewContentModeTopLeft;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
static void HBDRestoreParagraphViewStates(NSMapTable<UIView *, HBDParagraphViewState *> *savedStates) {
|
|
65
|
+
if (savedStates.count == 0) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
[UIView performWithoutAnimation:^{
|
|
69
|
+
for (UIView *textView in savedStates) {
|
|
70
|
+
HBDParagraphViewState *state = [savedStates objectForKey:textView];
|
|
71
|
+
if (state) {
|
|
72
|
+
textView.contentMode = state.contentMode;
|
|
73
|
+
textView.clipsToBounds = state.clipsToBounds;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
[savedStates removeAllObjects];
|
|
77
|
+
}];
|
|
78
|
+
}
|
|
79
|
+
|
|
10
80
|
@interface HBDRootView ()
|
|
11
81
|
|
|
12
82
|
@property (nonatomic, assign) BOOL isSurfaceViewVisible;
|
|
@@ -17,6 +87,8 @@
|
|
|
17
87
|
@implementation HBDRootView {
|
|
18
88
|
UIView *_Nullable _surfaceView;
|
|
19
89
|
RCTSurfaceStage _stage;
|
|
90
|
+
NSUInteger _sizeTransitionDepth;
|
|
91
|
+
NSMapTable<UIView *, HBDParagraphViewState *> *_savedParagraphStates;
|
|
20
92
|
}
|
|
21
93
|
|
|
22
94
|
RCT_NOT_IMPLEMENTED(-(instancetype)init)
|
|
@@ -34,6 +106,7 @@ RCT_NOT_IMPLEMENTED(-(nullable instancetype)initWithCoder : (NSCoder *)coder)
|
|
|
34
106
|
_sizeMeasureMode = sizeMeasureMode;
|
|
35
107
|
_surface.delegate = self;
|
|
36
108
|
_stage = surface.stage;
|
|
109
|
+
_savedParagraphStates = [NSMapTable weakToStrongObjectsMapTable];
|
|
37
110
|
[self _updateViews];
|
|
38
111
|
}
|
|
39
112
|
|
|
@@ -41,6 +114,17 @@ RCT_NOT_IMPLEMENTED(-(nullable instancetype)initWithCoder : (NSCoder *)coder)
|
|
|
41
114
|
}
|
|
42
115
|
|
|
43
116
|
- (void)dealloc {
|
|
117
|
+
NSMapTable<UIView *, HBDParagraphViewState *> *savedStates = _savedParagraphStates;
|
|
118
|
+
_savedParagraphStates = nil;
|
|
119
|
+
if (savedStates.count > 0) {
|
|
120
|
+
if ([NSThread isMainThread]) {
|
|
121
|
+
HBDRestoreParagraphViewStates(savedStates);
|
|
122
|
+
} else {
|
|
123
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
124
|
+
HBDRestoreParagraphViewStates(savedStates);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
44
128
|
[_surface stop];
|
|
45
129
|
}
|
|
46
130
|
|
|
@@ -63,6 +147,70 @@ RCT_NOT_IMPLEMENTED(-(nullable instancetype)initWithCoder : (NSCoder *)coder)
|
|
|
63
147
|
CGRect windowFrame = [self.window convertRect:self.frame fromView:self.superview];
|
|
64
148
|
|
|
65
149
|
[_surface setMinimumSize:minimumSize maximumSize:maximumSize viewportOffset:windowFrame.origin];
|
|
150
|
+
if (_sizeTransitionDepth > 0) {
|
|
151
|
+
[self _prepareParagraphViewsForSizeTransition];
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
- (void)prepareForSizeTransitionWithCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
|
|
156
|
+
if (!coordinator || !coordinator.animated) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
_sizeTransitionDepth += 1;
|
|
161
|
+
[self _prepareParagraphViewsForSizeTransition];
|
|
162
|
+
|
|
163
|
+
__weak HBDRootView *weakSelf = self;
|
|
164
|
+
[coordinator animateAlongsideTransition:^(__unused id<UIViewControllerTransitionCoordinatorContext> context) {
|
|
165
|
+
HBDRootView *strongSelf = weakSelf;
|
|
166
|
+
if (strongSelf) {
|
|
167
|
+
[strongSelf _prepareParagraphViewsForSizeTransition];
|
|
168
|
+
}
|
|
169
|
+
} completion:^(__unused id<UIViewControllerTransitionCoordinatorContext> context) {
|
|
170
|
+
HBDRootView *strongSelf = weakSelf;
|
|
171
|
+
if (!strongSelf) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (strongSelf->_sizeTransitionDepth > 0) {
|
|
175
|
+
strongSelf->_sizeTransitionDepth -= 1;
|
|
176
|
+
}
|
|
177
|
+
if (strongSelf->_sizeTransitionDepth == 0) {
|
|
178
|
+
[strongSelf _restoreParagraphViewsAfterSizeTransition];
|
|
179
|
+
}
|
|
180
|
+
}];
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
- (void)_prepareParagraphViewsForSizeTransition {
|
|
184
|
+
Class paragraphClass = HBDParagraphComponentViewClass();
|
|
185
|
+
if (paragraphClass == Nil) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
[UIView performWithoutAnimation:^{
|
|
189
|
+
[self _configureParagraphViewsInHierarchy:self paragraphClass:paragraphClass];
|
|
190
|
+
}];
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
- (void)_configureParagraphViewsInHierarchy:(UIView *)view paragraphClass:(Class)paragraphClass {
|
|
194
|
+
if ([view isKindOfClass:paragraphClass] && [view respondsToSelector:@selector(contentView)]) {
|
|
195
|
+
UIView *textView = ((id<HBDParagraphComponentViewProtocol>)view).contentView;
|
|
196
|
+
if ([textView isKindOfClass:[UIView class]]) {
|
|
197
|
+
if ([_savedParagraphStates objectForKey:textView] == nil) {
|
|
198
|
+
HBDParagraphViewState *state = [HBDParagraphViewState new];
|
|
199
|
+
state.contentMode = textView.contentMode;
|
|
200
|
+
state.clipsToBounds = textView.clipsToBounds;
|
|
201
|
+
[_savedParagraphStates setObject:state forKey:textView];
|
|
202
|
+
}
|
|
203
|
+
textView.contentMode = HBDContentModeForParagraphView(view);
|
|
204
|
+
textView.clipsToBounds = YES;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
for (UIView *subview in view.subviews) {
|
|
208
|
+
[self _configureParagraphViewsInHierarchy:subview paragraphClass:paragraphClass];
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
- (void)_restoreParagraphViewsAfterSizeTransition {
|
|
213
|
+
HBDRestoreParagraphViewStates(_savedParagraphStates);
|
|
66
214
|
}
|
|
67
215
|
|
|
68
216
|
- (CGSize)intrinsicContentSize {
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
NS_ASSUME_NONNULL_BEGIN
|
|
4
4
|
|
|
5
|
-
@interface UIImage (
|
|
5
|
+
@interface UIImage (HBDWithBadge)
|
|
6
6
|
|
|
7
|
-
- (UIImage *)
|
|
7
|
+
- (UIImage *)hbd_withIconColor:(nullable UIColor *)iconColor;
|
|
8
8
|
|
|
9
|
-
- (UIImage *)
|
|
9
|
+
- (UIImage *)hbd_withIconColor:(nullable UIColor *)iconColor badgeColor:(nullable UIColor *)badgeColor;
|
|
10
10
|
|
|
11
11
|
@end
|
|
12
12
|
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
#import "UIImage+WithBadge.h"
|
|
2
2
|
|
|
3
|
-
@implementation UIImage (
|
|
3
|
+
@implementation UIImage (HBDWithBadge)
|
|
4
4
|
|
|
5
|
-
- (UIImage *)
|
|
5
|
+
- (UIImage *)hbd_withIconColor:(UIColor *)iconColor badgeColor:(UIColor *)badgeColor {
|
|
6
6
|
CGSize imageSize = self.size;
|
|
7
7
|
|
|
8
8
|
UIGraphicsImageRenderer *render = [[UIGraphicsImageRenderer alloc] initWithSize:imageSize];
|
|
9
9
|
|
|
10
10
|
UIImage *resultImage = [render imageWithActions:^(UIGraphicsImageRendererContext * _Nonnull rendererContext) {
|
|
11
|
-
// 创建 tint 后的图标图片
|
|
12
11
|
if (iconColor) {
|
|
13
|
-
|
|
12
|
+
UIImage *iconTintedImage = [self imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
|
|
13
|
+
[iconColor set];
|
|
14
|
+
[iconTintedImage drawAtPoint:CGPointZero];
|
|
15
|
+
} else {
|
|
16
|
+
[self drawAtPoint:CGPointZero];
|
|
17
|
+
}
|
|
14
18
|
|
|
15
|
-
// 设置图标颜色并绘制
|
|
16
|
-
[iconColor set];
|
|
17
|
-
[iconTintedImage drawAtPoint:CGPointZero];
|
|
18
|
-
} else {
|
|
19
|
-
[self drawAtPoint:CGPointZero];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// 创建徽章
|
|
23
19
|
CGSize badgeSize = CGSizeMake(8, 8);
|
|
24
20
|
CGPoint badgeOrigin = CGPointMake(imageSize.width - badgeSize.width, 0);
|
|
25
21
|
CGRect badgeRect = CGRectMake(badgeOrigin.x, badgeOrigin.y, badgeSize.width, badgeSize.height);
|
|
@@ -32,9 +28,8 @@
|
|
|
32
28
|
return [resultImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
|
33
29
|
}
|
|
34
30
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return [self withIconColor:iconColor badgeColor:[UITabBarItem appearance].badgeColor];
|
|
31
|
+
- (UIImage *)hbd_withIconColor:(UIColor *)iconColor {
|
|
32
|
+
return [self hbd_withIconColor:iconColor badgeColor:[UITabBarItem appearance].badgeColor];
|
|
38
33
|
}
|
|
39
34
|
|
|
40
35
|
@end
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#import "HBDDrawerController.h"
|
|
2
2
|
|
|
3
|
+
#import "HBDGlobalStyle.h"
|
|
3
4
|
#import "HBDUtils.h"
|
|
4
5
|
#import "UIViewController+HBD.h"
|
|
5
6
|
|
|
@@ -115,9 +116,15 @@ static const CGFloat HBDDrawerMenuOverlayMaxAlpha = 0.34;
|
|
|
115
116
|
- (void)viewWillAppear:(BOOL)animated {
|
|
116
117
|
[super viewWillAppear:animated];
|
|
117
118
|
[self.contentController beginAppearanceTransition:YES animated:animated];
|
|
118
|
-
[self.contentController endAppearanceTransition];
|
|
119
119
|
if (self.isMenuOpened) {
|
|
120
120
|
[self.menuController beginAppearanceTransition:YES animated:animated];
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
- (void)viewDidAppear:(BOOL)animated {
|
|
125
|
+
[super viewDidAppear:animated];
|
|
126
|
+
[self.contentController endAppearanceTransition];
|
|
127
|
+
if (self.isMenuOpened) {
|
|
121
128
|
[self.menuController endAppearanceTransition];
|
|
122
129
|
}
|
|
123
130
|
}
|
|
@@ -125,9 +132,15 @@ static const CGFloat HBDDrawerMenuOverlayMaxAlpha = 0.34;
|
|
|
125
132
|
- (void)viewWillDisappear:(BOOL)animated {
|
|
126
133
|
[super viewWillDisappear:animated];
|
|
127
134
|
[self.contentController beginAppearanceTransition:NO animated:animated];
|
|
128
|
-
[self.contentController endAppearanceTransition];
|
|
129
135
|
if (self.isMenuOpened) {
|
|
130
136
|
[self.menuController beginAppearanceTransition:NO animated:animated];
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
- (void)viewDidDisappear:(BOOL)animated {
|
|
141
|
+
[super viewDidDisappear:animated];
|
|
142
|
+
[self.contentController endAppearanceTransition];
|
|
143
|
+
if (self.isMenuOpened) {
|
|
131
144
|
[self.menuController endAppearanceTransition];
|
|
132
145
|
}
|
|
133
146
|
}
|
|
@@ -238,7 +251,7 @@ static const CGFloat HBDDrawerMenuOverlayMaxAlpha = 0.34;
|
|
|
238
251
|
|
|
239
252
|
UIView *menuHolderView = [[UIView alloc] initWithFrame:self.view.bounds];
|
|
240
253
|
menuHolderView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
|
241
|
-
menuHolderView.backgroundColor = [
|
|
254
|
+
menuHolderView.backgroundColor = [self hbd_globalStyle].screenBackgroundColor ?: UIColor.whiteColor;
|
|
242
255
|
self.menuHolderView = menuHolderView;
|
|
243
256
|
|
|
244
257
|
[self.view insertSubview:menuHolderView belowSubview:self.contentWrapperView];
|
|
@@ -256,6 +269,7 @@ static const CGFloat HBDDrawerMenuOverlayMaxAlpha = 0.34;
|
|
|
256
269
|
if (shouldMoveToParent) {
|
|
257
270
|
[menu didMoveToParentViewController:self];
|
|
258
271
|
}
|
|
272
|
+
menuHolderView.backgroundColor = [self resolvedMenuBackgroundColor];
|
|
259
273
|
|
|
260
274
|
UIView *menuGradientOverlayView = [[UIView alloc] initWithFrame:CGRectZero];
|
|
261
275
|
menuGradientOverlayView.userInteractionEnabled = NO;
|
|
@@ -265,9 +279,10 @@ static const CGFloat HBDDrawerMenuOverlayMaxAlpha = 0.34;
|
|
|
265
279
|
menuGradientOverlayLayer.colors = @[
|
|
266
280
|
(__bridge id)[UIColor colorWithWhite:0 alpha:HBDDrawerMenuOverlayMaxAlpha * 0.32].CGColor,
|
|
267
281
|
(__bridge id)[UIColor colorWithWhite:0 alpha:HBDDrawerMenuOverlayMaxAlpha * 0.6].CGColor,
|
|
282
|
+
(__bridge id)[UIColor colorWithWhite:0 alpha:HBDDrawerMenuOverlayMaxAlpha].CGColor,
|
|
268
283
|
(__bridge id)[UIColor colorWithWhite:0 alpha:HBDDrawerMenuOverlayMaxAlpha].CGColor
|
|
269
284
|
];
|
|
270
|
-
menuGradientOverlayLayer.locations = @[@0, @0.55, @1];
|
|
285
|
+
menuGradientOverlayLayer.locations = @[@0, @0.55, @1, @1];
|
|
271
286
|
[menuGradientOverlayView.layer addSublayer:menuGradientOverlayLayer];
|
|
272
287
|
[menuHolderView addSubview:menuGradientOverlayView];
|
|
273
288
|
self.menuGradientOverlayView = menuGradientOverlayView;
|
|
@@ -726,13 +741,20 @@ static const CGFloat HBDDrawerMenuOverlayMaxAlpha = 0.34;
|
|
|
726
741
|
CGFloat height = CGRectGetHeight(self.view.bounds);
|
|
727
742
|
|
|
728
743
|
if (self.menuHolderView) {
|
|
744
|
+
CGFloat totalWidth = CGRectGetWidth(self.view.bounds);
|
|
745
|
+
CGFloat menuRatio = totalWidth > 0 ? MIN(1.0, MAX(0.0, menuWidth / totalWidth)) : 1.0;
|
|
729
746
|
self.menuHolderView.frame = self.view.bounds;
|
|
747
|
+
self.menuHolderView.backgroundColor = [self resolvedMenuBackgroundColor];
|
|
730
748
|
self.menuController.view.frame = CGRectMake(0, 0, menuWidth, height);
|
|
731
749
|
self.menuController.view.transform = CGAffineTransformIdentity;
|
|
732
750
|
self.menuController.view.alpha = 1;
|
|
733
751
|
|
|
734
|
-
self.menuGradientOverlayView.frame =
|
|
752
|
+
self.menuGradientOverlayView.frame = self.view.bounds;
|
|
753
|
+
[CATransaction begin];
|
|
754
|
+
[CATransaction setDisableActions:YES];
|
|
735
755
|
self.menuGradientOverlayLayer.frame = self.menuGradientOverlayView.bounds;
|
|
756
|
+
self.menuGradientOverlayLayer.locations = @[@0, @(menuRatio * 0.55), @(menuRatio), @1];
|
|
757
|
+
[CATransaction commit];
|
|
736
758
|
self.menuGradientOverlayView.alpha = 1 - progress;
|
|
737
759
|
}
|
|
738
760
|
|
|
@@ -777,6 +799,105 @@ static const CGFloat HBDDrawerMenuOverlayMaxAlpha = 0.34;
|
|
|
777
799
|
self.contentWrapperView.layer.shadowOpacity = HBDDrawerContentShadowOpacity * progress;
|
|
778
800
|
}
|
|
779
801
|
|
|
802
|
+
- (UIViewController *)primaryMenuControllerForBackdrop {
|
|
803
|
+
UIViewController *controller = self.menuController;
|
|
804
|
+
for (NSInteger depth = 0; depth < 8 && controller; depth++) {
|
|
805
|
+
if ([controller isKindOfClass:[UITabBarController class]]) {
|
|
806
|
+
UIViewController *selected = ((UITabBarController *)controller).selectedViewController;
|
|
807
|
+
if (!selected) {
|
|
808
|
+
break;
|
|
809
|
+
}
|
|
810
|
+
controller = selected;
|
|
811
|
+
} else if ([controller isKindOfClass:[UINavigationController class]]) {
|
|
812
|
+
UIViewController *top = ((UINavigationController *)controller).topViewController;
|
|
813
|
+
if (!top) {
|
|
814
|
+
break;
|
|
815
|
+
}
|
|
816
|
+
controller = top;
|
|
817
|
+
} else {
|
|
818
|
+
break;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
return controller;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
- (nullable UIColor *)opaqueBackgroundColorOfView:(UIView *)view {
|
|
825
|
+
if (!view || view.hidden || view.alpha < 0.99) {
|
|
826
|
+
return nil;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
UIColor *color = view.backgroundColor;
|
|
830
|
+
if (!color && view.layer.backgroundColor) {
|
|
831
|
+
color = [UIColor colorWithCGColor:view.layer.backgroundColor];
|
|
832
|
+
}
|
|
833
|
+
if (!color) {
|
|
834
|
+
return nil;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
UIColor *resolvedColor = color;
|
|
838
|
+
if (@available(iOS 13.0, *)) {
|
|
839
|
+
resolvedColor = [color resolvedColorWithTraitCollection:self.traitCollection];
|
|
840
|
+
}
|
|
841
|
+
return CGColorGetAlpha(resolvedColor.CGColor) >= 0.99 ? color : nil;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
- (nullable UIColor *)resolvedOpaqueBackgroundColorInView:(UIView *)rootView {
|
|
845
|
+
if (!rootView || CGRectIsEmpty(rootView.bounds)) {
|
|
846
|
+
return nil;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
CGRect targetBounds = rootView.bounds;
|
|
850
|
+
UIColor *resolved = [self opaqueBackgroundColorOfView:rootView];
|
|
851
|
+
|
|
852
|
+
UIView *current = rootView;
|
|
853
|
+
for (NSInteger depth = 0; depth < 8; depth++) {
|
|
854
|
+
UIView *fullBoundsChild = nil;
|
|
855
|
+
for (UIView *subview in current.subviews.reverseObjectEnumerator) {
|
|
856
|
+
if (subview.hidden || subview.alpha < 0.99) {
|
|
857
|
+
continue;
|
|
858
|
+
}
|
|
859
|
+
CGRect frameInRoot = [subview convertRect:subview.bounds toView:rootView];
|
|
860
|
+
BOOL coversRoot = CGRectGetMinX(frameInRoot) <= CGRectGetMinX(targetBounds) + 1.0 &&
|
|
861
|
+
CGRectGetMinY(frameInRoot) <= CGRectGetMinY(targetBounds) + 1.0 &&
|
|
862
|
+
CGRectGetMaxX(frameInRoot) >= CGRectGetMaxX(targetBounds) - 1.0 &&
|
|
863
|
+
CGRectGetMaxY(frameInRoot) >= CGRectGetMaxY(targetBounds) - 1.0;
|
|
864
|
+
if (coversRoot) {
|
|
865
|
+
fullBoundsChild = subview;
|
|
866
|
+
break;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
if (!fullBoundsChild) {
|
|
870
|
+
break;
|
|
871
|
+
}
|
|
872
|
+
UIColor *childColor = [self opaqueBackgroundColorOfView:fullBoundsChild];
|
|
873
|
+
if (childColor) {
|
|
874
|
+
resolved = childColor;
|
|
875
|
+
}
|
|
876
|
+
current = fullBoundsChild;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
return resolved;
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
- (UIColor *)resolvedMenuBackgroundColor {
|
|
883
|
+
UIViewController *primaryMenu = [self primaryMenuControllerForBackdrop];
|
|
884
|
+
if (primaryMenu.isViewLoaded) {
|
|
885
|
+
UIColor *color = [self resolvedOpaqueBackgroundColorInView:primaryMenu.view];
|
|
886
|
+
if (color) {
|
|
887
|
+
return color;
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
if (self.menuController.isViewLoaded) {
|
|
892
|
+
UIColor *color = [self resolvedOpaqueBackgroundColorInView:self.menuController.view];
|
|
893
|
+
if (color) {
|
|
894
|
+
return color;
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
return [self hbd_globalStyle].screenBackgroundColor ?: UIColor.whiteColor;
|
|
899
|
+
}
|
|
900
|
+
|
|
780
901
|
- (CGFloat)contentCornerRadiusForDrawerProgress:(CGFloat)progress {
|
|
781
902
|
if (progress <= 0) {
|
|
782
903
|
return 0;
|