hybrid-navigation 2.7.10 → 2.8.1

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 (26) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/com/reactnative/hybridnavigation/Garden.java +4 -0
  4. package/android/src/main/java/com/reactnative/hybridnavigation/HybridFragment.java +6 -0
  5. package/android/src/main/java/com/reactnative/hybridnavigation/NavigationModule.java +35 -28
  6. package/ios/HybridNavigation/Bridge/HBDGardenModule.m +2 -1
  7. package/ios/HybridNavigation/GlobalStyle.h +4 -0
  8. package/ios/HybridNavigation/GlobalStyle.m +13 -0
  9. package/ios/HybridNavigation/HybridNavigation.h +1 -1
  10. package/ios/HybridNavigation/Navigator/HBDStackNavigator.m +12 -1
  11. package/ios/HybridNavigation/Navigator/HBDTabNavigator.m +2 -1
  12. package/ios/HybridNavigation/View/HBDNavigationBar.h +2 -3
  13. package/ios/HybridNavigation/View/HBDNavigationBar.m +31 -35
  14. package/ios/HybridNavigation/ViewController/HBDModalViewController.m +7 -0
  15. package/ios/HybridNavigation/ViewController/HBDNavigationController.m +18 -26
  16. package/ios/HybridNavigation/ViewController/HBDViewController+Garden.h +21 -0
  17. package/ios/HybridNavigation/{HBDGarden.m → ViewController/HBDViewController+Garden.m} +19 -45
  18. package/ios/HybridNavigation/ViewController/HBDViewController.h +1 -5
  19. package/ios/HybridNavigation/ViewController/HBDViewController.m +17 -14
  20. package/ios/HybridNavigation/ViewController/UINavigationController+HBD.m +5 -8
  21. package/ios/HybridNavigation/ViewController/UIViewController+HBD.m +10 -7
  22. package/lib/typing.d.ts +1 -0
  23. package/package.json +1 -1
  24. package/docs/deeplink.html +0 -376
  25. package/docs/deeplink.pdf +0 -0
  26. package/ios/HybridNavigation/HBDGarden.h +0 -36
package/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ## 2.8.1 (2022-04-25)
2
+
3
+ ### iOS specific
4
+
5
+ - 优化 `redirectTo` 路由实现,避免在转场过程中执行新的路由动作
6
+
7
+ ## 2.8.0 (2022-04-13)
8
+
9
+ - 添加 `forceTransparentDialogWindow` 配置项,用于设置当页面是 Dialog 时,是否强制背景透明
10
+
11
+ ## 2.7.11 (2022-04-13)
12
+
13
+ ### Android specific
14
+
15
+ - 确保在 Activity 处于 start 状态时,才获取 `currentRoute` 和 `routeGraph`
16
+
17
+ ## 2.7.10 (2022-04-12)
18
+
19
+ - 使用 `CompanentType<any>` 代替 `React.ComponentType<any>`
20
+
1
21
  ## 2.7.9 (2022-03-23)
2
22
 
3
23
  ### Android specific
@@ -33,5 +33,5 @@ dependencies {
33
33
  implementation fileTree(dir: 'libs', include: ['*.jar'])
34
34
  implementation 'com.facebook.react:react-native:+'
35
35
  // api project(':navigation')
36
- api 'io.github.listenzz:AndroidNavigation:12.0.8'
36
+ api 'io.github.listenzz:AndroidNavigation:12.1.0'
37
37
  }
@@ -62,6 +62,8 @@ public class Garden {
62
62
 
63
63
  boolean extendedLayoutIncludesTopBar;
64
64
 
65
+ boolean forceTransparentDialogWindow;
66
+
65
67
  Garden(@NonNull HybridFragment fragment, Style style) {
66
68
  // 构造 garden 实例时,Toolbar 还没有被创建
67
69
 
@@ -81,6 +83,8 @@ public class Garden {
81
83
  if (!TextUtils.isEmpty(screenColor)) {
82
84
  style.setScreenBackgroundColor(Color.parseColor(screenColor));
83
85
  }
86
+
87
+ this.forceTransparentDialogWindow = options.getBoolean("forceTransparentDialogWindow");
84
88
 
85
89
  applyOptions(options);
86
90
  }
@@ -2,6 +2,7 @@ package com.reactnative.hybridnavigation;
2
2
 
3
3
  import android.os.Bundle;
4
4
  import android.view.View;
5
+ import android.view.Window;
5
6
 
6
7
  import androidx.annotation.CallSuper;
7
8
  import androidx.annotation.NonNull;
@@ -90,6 +91,11 @@ public class HybridFragment extends AwesomeFragment {
90
91
  public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
91
92
  super.onViewCreated(view, savedInstanceState);
92
93
  garden.configureToolbar();
94
+ if (getShowsDialog() && garden.forceTransparentDialogWindow) {
95
+ Window window = getWindow();
96
+ assert window != null;
97
+ window.setDimAmount(0);
98
+ }
93
99
  }
94
100
 
95
101
  public Garden getGarden() {
@@ -198,17 +198,20 @@ public class NavigationModule extends ReactContextBaseJavaModule {
198
198
  }
199
199
 
200
200
  ReactAppCompatActivity reactAppCompatActivity = (ReactAppCompatActivity) activity;
201
- FragmentManager fragmentManager = reactAppCompatActivity.getSupportFragmentManager();
202
- Fragment fragment = fragmentManager.findFragmentById(android.R.id.content);
203
- if (fragment instanceof AwesomeFragment) {
204
- String sceneId = findSceneIdByModuleName(moduleName, (AwesomeFragment) fragment);
205
- FLog.i(TAG, "The sceneId found by " + moduleName + " : " + sceneId);
206
- promise.resolve(sceneId);
207
- } else {
208
- promise.resolve(null);
209
- }
201
+ reactAppCompatActivity.scheduleTaskAtStarted(() -> {
202
+ FragmentManager fragmentManager = reactAppCompatActivity.getSupportFragmentManager();
203
+ Fragment fragment = fragmentManager.findFragmentById(android.R.id.content);
204
+ if (fragment instanceof AwesomeFragment) {
205
+ String sceneId = findSceneIdByModuleName(moduleName, (AwesomeFragment) fragment);
206
+ FLog.i(TAG, "The sceneId found by " + moduleName + " : " + sceneId);
207
+ promise.resolve(sceneId);
208
+ } else {
209
+ promise.resolve(null);
210
+ }
211
+ });
210
212
  }
211
213
  };
214
+
212
215
  UiThreadUtil.runOnUiThread(task);
213
216
  }
214
217
 
@@ -252,18 +255,20 @@ public class NavigationModule extends ReactContextBaseJavaModule {
252
255
  }
253
256
 
254
257
  ReactAppCompatActivity reactAppCompatActivity = (ReactAppCompatActivity) activity;
255
- FragmentManager fragmentManager = reactAppCompatActivity.getSupportFragmentManager();
256
- HybridFragment current = bridgeManager.primaryFragment(fragmentManager);
257
-
258
- if (current != null) {
259
- Bundle bundle = new Bundle();
260
- bundle.putString("moduleName", current.getModuleName());
261
- bundle.putString("sceneId", current.getSceneId());
262
- bundle.putString("mode", Navigator.Util.getMode(current));
263
- promise.resolve(Arguments.fromBundle(bundle));
264
- } else {
265
- UiThreadUtil.runOnUiThread(this, 16);
266
- }
258
+ reactAppCompatActivity.scheduleTaskAtStarted(() -> {
259
+ FragmentManager fragmentManager = reactAppCompatActivity.getSupportFragmentManager();
260
+ HybridFragment current = bridgeManager.primaryFragment(fragmentManager);
261
+
262
+ if (current != null) {
263
+ Bundle bundle = new Bundle();
264
+ bundle.putString("moduleName", current.getModuleName());
265
+ bundle.putString("sceneId", current.getSceneId());
266
+ bundle.putString("mode", Navigator.Util.getMode(current));
267
+ promise.resolve(Arguments.fromBundle(bundle));
268
+ } else {
269
+ UiThreadUtil.runOnUiThread(this, 16);
270
+ }
271
+ });
267
272
  }
268
273
  };
269
274
 
@@ -287,13 +292,15 @@ public class NavigationModule extends ReactContextBaseJavaModule {
287
292
  }
288
293
 
289
294
  ReactAppCompatActivity reactAppCompatActivity = (ReactAppCompatActivity) activity;
290
- FragmentManager fragmentManager = reactAppCompatActivity.getSupportFragmentManager();
291
- ArrayList<Bundle> graph = bridgeManager.buildRouteGraph(fragmentManager);
292
- if (graph.size() > 0) {
293
- promise.resolve(Arguments.fromList(graph));
294
- } else {
295
- UiThreadUtil.runOnUiThread(this, 16);
296
- }
295
+ reactAppCompatActivity.scheduleTaskAtStarted(() -> {
296
+ FragmentManager fragmentManager = reactAppCompatActivity.getSupportFragmentManager();
297
+ ArrayList<Bundle> graph = bridgeManager.buildRouteGraph(fragmentManager);
298
+ if (graph.size() > 0) {
299
+ promise.resolve(Arguments.fromList(graph));
300
+ } else {
301
+ UiThreadUtil.runOnUiThread(this, 16);
302
+ }
303
+ });
297
304
  }
298
305
  };
299
306
 
@@ -9,6 +9,7 @@
9
9
  #import "HBDGardenModule.h"
10
10
  #import "HBDReactBridgeManager.h"
11
11
  #import "HBDTabBarController.h"
12
+ #import "GlobalStyle.h"
12
13
  #import <React/RCTLog.h>
13
14
 
14
15
  @interface HBDGardenModule ()
@@ -42,7 +43,7 @@ RCT_EXPORT_MODULE(GardenModule)
42
43
 
43
44
  RCT_EXPORT_METHOD(setStyle:
44
45
  (NSDictionary *) style) {
45
- [HBDGarden createGlobalStyleWithOptions:style];
46
+ [GlobalStyle createWithOptions:style];
46
47
  }
47
48
 
48
49
  RCT_EXPORT_METHOD(setTitleItem:
@@ -10,6 +10,10 @@
10
10
 
11
11
  @interface GlobalStyle : NSObject
12
12
 
13
+ + (void)createWithOptions:(NSDictionary *)options;
14
+
15
+ + (GlobalStyle *)globalStyle;
16
+
13
17
  @property(nonatomic, strong, readonly) UIColor *screenBackgroundColor;
14
18
 
15
19
  @property(nonatomic, assign, readonly, getter=isBackTitleHidden) BOOL backTitleHidden;
@@ -40,6 +40,19 @@
40
40
 
41
41
  @implementation GlobalStyle
42
42
 
43
+ static GlobalStyle *globalStyle;
44
+
45
+ + (void)createWithOptions:(NSDictionary *)options {
46
+ globalStyle = [[GlobalStyle alloc] initWithOptions:options];
47
+ [globalStyle inflateNavigationBar:[UINavigationBar appearance]];
48
+ [globalStyle inflateBarButtonItem:[UIBarButtonItem appearance]];
49
+ [globalStyle inflateTabBar:[UITabBar appearance]];
50
+ }
51
+
52
+ + (GlobalStyle *)globalStyle {
53
+ return globalStyle;
54
+ }
55
+
43
56
  - (instancetype)initWithOptions:(NSDictionary *)options {
44
57
  if (self = [super init]) {
45
58
  _options = options;
@@ -3,10 +3,10 @@
3
3
 
4
4
  #import "HBDBarButtonItem.h"
5
5
  #import "HBDNavigationBar.h"
6
- #import "HBDGarden.h"
7
6
  #import "HBDReactBridgeManager.h"
8
7
 
9
8
  #import "HBDViewController.h"
9
+ #import "HBDViewController+Garden.h"
10
10
  #import "HBDNavigationController.h"
11
11
  #import "HBDTabBarController.h"
12
12
  #import "HBDDrawerController.h"
@@ -67,10 +67,21 @@
67
67
  resolve(@(NO));
68
68
  return;
69
69
  }
70
+
71
+ if (nav.transitionCoordinator) {
72
+ __weak typeof(self) selfObj = self;
73
+ [nav.transitionCoordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
74
+
75
+ } completion:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
76
+ [selfObj handleNavigationWithViewController:target action:action extras:extras resolver:resolve rejecter:reject];
77
+ }];
78
+ return;
79
+ }
70
80
 
71
81
  if (!nav.hbd_viewAppeared) {
82
+ __weak typeof(self) selfObj = self;
72
83
  dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t) (0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
73
- [self handleNavigationWithViewController:target action:action extras:extras resolver:resolve rejecter:reject];
84
+ [selfObj handleNavigationWithViewController:target action:action extras:extras resolver:resolve rejecter:reject];
74
85
  });
75
86
  return;
76
87
  }
@@ -10,6 +10,7 @@
10
10
  #import "HBDTabBarController.h"
11
11
  #import "HBDReactBridgeManager.h"
12
12
  #import "HBDUtils.h"
13
+ #import "GlobalStyle.h"
13
14
  #import <React/RCTUtils.h>
14
15
 
15
16
  @implementation HBDTabNavigator
@@ -45,7 +46,7 @@
45
46
  tabBarOptions[@"tabBarModuleName"] = tabBarModuleName;
46
47
  tabBarOptions[@"sizeIndeterminate"] = @([options[@"sizeIndeterminate"] boolValue]);
47
48
  tabBarOptions[@"selectedIndex"] = options[@"selectedIndex"] ?: @(0);
48
- GlobalStyle *style = [HBDGarden globalStyle];
49
+ GlobalStyle *style = [GlobalStyle globalStyle];
49
50
  tabBarOptions[@"tabBarItemColor"] = style.tabBarItemColorHexString;
50
51
  tabBarOptions[@"tabBarUnselectedItemColor"] = style.tabBarUnselectedItemColorHexString;
51
52
  tabBarOptions[@"badgeColor"] = style.badgeColorHexString;
@@ -10,10 +10,9 @@
10
10
 
11
11
  @interface HBDNavigationBar : UINavigationBar
12
12
 
13
- @property(nonatomic, strong, readonly) UIImageView *shadowImageView;
14
- @property(nonatomic, strong, readonly) UIVisualEffectView *fakeView;
13
+ @property(nonatomic, strong, readonly) UIImageView *fakeShadowView;
14
+ @property(nonatomic, strong, readonly) UIView *fakeBackgroundView;
15
15
  @property(nonatomic, strong, readonly) UILabel *backButtonLabel;
16
- @property(nonatomic, strong, readonly) UIView *hbd_backgroundView;
17
16
 
18
17
  @end
19
18
 
@@ -11,8 +11,8 @@
11
11
 
12
12
  @interface HBDNavigationBar ()
13
13
 
14
- @property(nonatomic, strong, readwrite) UIImageView *shadowImageView;
15
- @property(nonatomic, strong, readwrite) UIVisualEffectView *fakeView;
14
+ @property(nonatomic, strong, readwrite) UIImageView *fakeShadowView;
15
+ @property(nonatomic, strong, readwrite) UIView *fakeBackgroundView;
16
16
 
17
17
  @end
18
18
 
@@ -45,7 +45,7 @@
45
45
 
46
46
  NSArray *array = @[@"UINavigationBarContentView", @"UIButtonBarStackView", @"HBDNavigationBar"];
47
47
  if ([array containsObject:viewName]) {
48
- if (self.fakeView.alpha < 0.01) {
48
+ if (self.fakeBackgroundView.alpha < 0.01) {
49
49
  return nil;
50
50
  }
51
51
  }
@@ -59,29 +59,25 @@
59
59
 
60
60
  - (void)layoutSubviews {
61
61
  [super layoutSubviews];
62
- self.fakeView.frame = self.fakeView.superview.bounds;
63
- self.shadowImageView.frame = CGRectMake(0, CGRectGetHeight(self.shadowImageView.superview.bounds), CGRectGetWidth(self.shadowImageView.superview.bounds), 0.5);
64
- }
65
-
66
- - (UIView *)hbd_backgroundView {
67
- return [self valueForKey:@"_backgroundView"];
62
+ self.fakeBackgroundView.frame = self.fakeBackgroundView.superview.bounds;
63
+ self.fakeShadowView.frame = CGRectMake(0, CGRectGetHeight(self.fakeShadowView.superview.bounds), CGRectGetWidth(self.fakeShadowView.superview.bounds), 0.5);
68
64
  }
69
65
 
70
66
  - (void)setBarTintColor:(UIColor *)barTintColor {
71
67
  [super setBarTintColor:barTintColor];
72
- self.fakeView.subviews.lastObject.backgroundColor = barTintColor;
73
- [self makeSureFakeView];
68
+ self.fakeBackgroundView.backgroundColor = barTintColor;
69
+ [self makesureFakeBackgroundView];
74
70
  }
75
71
 
76
- - (UIVisualEffectView *)fakeView {
77
- if (!_fakeView) {
72
+ - (UIView *)fakeBackgroundView {
73
+ if (!_fakeBackgroundView) {
78
74
  [super setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
79
- _fakeView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
80
- _fakeView.userInteractionEnabled = NO;
81
- _fakeView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
82
- [[self.subviews firstObject] insertSubview:_fakeView atIndex:0];
75
+ _fakeBackgroundView = [[UIView alloc] init];
76
+ _fakeBackgroundView.userInteractionEnabled = NO;
77
+ _fakeBackgroundView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
78
+ [[self.subviews firstObject] insertSubview:_fakeBackgroundView atIndex:0];
83
79
  }
84
- return _fakeView;
80
+ return _fakeBackgroundView;
85
81
  }
86
82
 
87
83
  - (void)setTranslucent:(BOOL)translucent {
@@ -94,35 +90,35 @@
94
90
  }
95
91
 
96
92
  - (void)setShadowImage:(UIImage *)shadowImage {
97
- self.shadowImageView.image = shadowImage;
93
+ self.fakeShadowView.image = shadowImage;
98
94
  if (shadowImage) {
99
- self.shadowImageView.backgroundColor = nil;
95
+ self.fakeShadowView.backgroundColor = nil;
100
96
  } else {
101
- self.shadowImageView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:77.0 / 255];
97
+ self.fakeShadowView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:77.0 / 255];
102
98
  }
103
99
  }
104
100
 
105
- - (UIImageView *)shadowImageView {
106
- if (!_shadowImageView) {
101
+ - (UIImageView *)fakeShadowView {
102
+ if (!_fakeShadowView) {
107
103
  [super setShadowImage:[UIImage new]];
108
- _shadowImageView = [[UIImageView alloc] init];
109
- _shadowImageView.userInteractionEnabled = NO;
110
- _shadowImageView.contentScaleFactor = 1;
111
- [[self.subviews firstObject] insertSubview:_shadowImageView aboveSubview:self.fakeView];
104
+ _fakeShadowView = [[UIImageView alloc] init];
105
+ _fakeShadowView.userInteractionEnabled = NO;
106
+ _fakeShadowView.contentScaleFactor = 1;
107
+ [[self.subviews firstObject] insertSubview:_fakeShadowView aboveSubview:self.fakeBackgroundView];
112
108
  }
113
- return _shadowImageView;
109
+ return _fakeShadowView;
114
110
  }
115
111
 
116
- - (void)makeSureFakeView {
112
+ - (void)makesureFakeBackgroundView {
117
113
  [UIView setAnimationsEnabled:NO];
118
- if (!self.fakeView.superview) {
119
- [[self.subviews firstObject] insertSubview:_fakeView atIndex:0];
120
- self.fakeView.frame = self.fakeView.superview.bounds;
114
+ if (!self.fakeBackgroundView.superview) {
115
+ [[self.subviews firstObject] insertSubview:_fakeBackgroundView atIndex:0];
116
+ self.fakeBackgroundView.frame = self.fakeBackgroundView.superview.bounds;
121
117
  }
122
118
 
123
- if (!self.shadowImageView.superview) {
124
- [[self.subviews firstObject] insertSubview:_shadowImageView aboveSubview:self.fakeView];
125
- self.shadowImageView.frame = CGRectMake(0, CGRectGetHeight(self.shadowImageView.superview.bounds), CGRectGetWidth(self.shadowImageView.superview.bounds), 0.5);
119
+ if (!self.fakeShadowView.superview) {
120
+ [[self.subviews firstObject] insertSubview:_fakeShadowView aboveSubview:self.fakeBackgroundView];
121
+ self.fakeShadowView.frame = CGRectMake(0, CGRectGetHeight(self.fakeShadowView.superview.bounds), CGRectGetWidth(self.fakeShadowView.superview.bounds), 0.5);
126
122
  }
127
123
  [UIView setAnimationsEnabled:YES];
128
124
  }
@@ -11,6 +11,7 @@
11
11
  #import "HBDModalViewController.h"
12
12
  #import "HBDRootView.h"
13
13
  #import "HBDUtils.h"
14
+ #import "HBDViewController+Garden.h"
14
15
 
15
16
  @interface UIViewController ()
16
17
 
@@ -448,6 +449,12 @@
448
449
 
449
450
  HBDModalViewController *modalViewController = [[HBDModalViewController alloc] init];
450
451
  modalViewController.contentViewController = vc;
452
+ if ([vc isKindOfClass:[HBDViewController class]]) {
453
+ HBDViewController *hbdvc = (HBDViewController *)vc;
454
+ if (hbdvc.forceTransparentDialogWindow) {
455
+ modalViewController.dimmingView.backgroundColor = UIColor.clearColor;
456
+ }
457
+ }
451
458
  [modalViewController showWithAnimated:animated completion:completion];
452
459
  }
453
460
 
@@ -10,6 +10,7 @@
10
10
  #import "HBDViewController.h"
11
11
  #import "HBDNavigationBar.h"
12
12
  #import "HBDUtils.h"
13
+ #import "GlobalStyle.h"
13
14
  #import "HBDPushAnimation.h"
14
15
  #import "HBDPopAnimation.h"
15
16
  #import <React/RCTLog.h>
@@ -79,8 +80,8 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
79
80
  @interface HBDNavigationController ()
80
81
 
81
82
  @property(nonatomic, readonly) HBDNavigationBar *navigationBar;
82
- @property(nonatomic, strong) UIVisualEffectView *fromFakeBar;
83
- @property(nonatomic, strong) UIVisualEffectView *toFakeBar;
83
+ @property(nonatomic, strong) UIView *fromFakeBar;
84
+ @property(nonatomic, strong) UIView *toFakeBar;
84
85
  @property(nonatomic, strong) UIImageView *fromFakeShadow;
85
86
  @property(nonatomic, strong) UIImageView *toFakeShadow;
86
87
  @property(nonatomic, weak) UIViewController *poppingViewController;
@@ -402,7 +403,7 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
402
403
  }
403
404
 
404
405
  - (BOOL)shouldShowFakeBarFrom:(UIViewController *)from to:(UIViewController *)to viewController:(UIViewController *_Nonnull)viewController {
405
- if ([HBDGarden globalStyle].alwaysSplitNavigationBarTransition && to == viewController) {
406
+ if ([GlobalStyle globalStyle].alwaysSplitNavigationBarTransition && to == viewController) {
406
407
  return YES;
407
408
  }
408
409
 
@@ -635,14 +636,8 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
635
636
  }
636
637
 
637
638
  - (void)updateNavigationBarAlphaForViewController:(UIViewController *)vc {
638
- self.navigationBar.fakeView.alpha = vc.hbd_barAlpha;
639
- self.navigationBar.shadowImageView.alpha = vc.hbd_barShadowAlpha;
640
-
641
- if (vc.hbd_barAlpha == 0) {
642
- self.navigationBar.hbd_backgroundView.layer.mask = [CALayer new];
643
- } else {
644
- self.navigationBar.hbd_backgroundView.layer.mask = nil;
645
- }
639
+ self.navigationBar.fakeBackgroundView.alpha = vc.hbd_barAlpha;
640
+ self.navigationBar.fakeShadowView.alpha = vc.hbd_barShadowAlpha;
646
641
  }
647
642
 
648
643
  - (void)updateNavigationBarBackgroundForViewController:(UIViewController *)vc {
@@ -651,19 +646,16 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
651
646
 
652
647
  - (void)showFakeBarFrom:(UIViewController *)from to:(UIViewController *_Nonnull)to {
653
648
  [UIView setAnimationsEnabled:NO];
654
- self.navigationBar.fakeView.alpha = 0;
655
- self.navigationBar.shadowImageView.alpha = 0;
649
+ self.navigationBar.fakeBackgroundView.alpha = 0;
650
+ self.navigationBar.fakeShadowView.alpha = 0;
656
651
  [self showFakeBarFrom:from];
657
652
  [self showFakeBarTo:to];
658
653
  [UIView setAnimationsEnabled:YES];
659
654
  }
660
655
 
661
656
  - (void)showFakeBarFrom:(UIViewController *)from {
662
- self.fromFakeBar.subviews.lastObject.backgroundColor = from.hbd_barTintColor;
657
+ self.fromFakeBar.backgroundColor = from.hbd_barTintColor;
663
658
  self.fromFakeBar.alpha = from.hbd_barAlpha;
664
- if (from.hbd_barAlpha == 0) {
665
- self.fromFakeBar.subviews.lastObject.layer.mask = [CALayer new];
666
- }
667
659
  self.fromFakeBar.frame = [self fakeBarFrameForViewController:from];
668
660
  [from.view addSubview:self.fromFakeBar];
669
661
  self.fromFakeShadow.alpha = from.hbd_barShadowAlpha;
@@ -672,7 +664,7 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
672
664
  }
673
665
 
674
666
  - (void)showFakeBarTo:(UIViewController *_Nonnull)to {
675
- self.toFakeBar.subviews.lastObject.backgroundColor = to.hbd_barTintColor;
667
+ self.toFakeBar.backgroundColor = to.hbd_barTintColor;
676
668
  self.toFakeBar.alpha = to.hbd_barAlpha;
677
669
  self.toFakeBar.frame = [self fakeBarFrameForViewController:to];
678
670
  [to.view addSubview:self.toFakeBar];
@@ -681,32 +673,32 @@ void printViewHierarchy(UIView *view, NSString *prefix) {
681
673
  [to.view addSubview:self.toFakeShadow];
682
674
  }
683
675
 
684
- - (UIVisualEffectView *)fromFakeBar {
676
+ - (UIView *)fromFakeBar {
685
677
  if (!_fromFakeBar) {
686
- _fromFakeBar = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
678
+ _fromFakeBar = [[UIView alloc] init];
687
679
  }
688
680
  return _fromFakeBar;
689
681
  }
690
682
 
691
- - (UIVisualEffectView *)toFakeBar {
683
+ - (UIView *)toFakeBar {
692
684
  if (!_toFakeBar) {
693
- _toFakeBar = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
685
+ _toFakeBar = [[UIView alloc] init];
694
686
  }
695
687
  return _toFakeBar;
696
688
  }
697
689
 
698
690
  - (UIImageView *)fromFakeShadow {
699
691
  if (!_fromFakeShadow) {
700
- _fromFakeShadow = [[UIImageView alloc] initWithImage:self.navigationBar.shadowImageView.image];
701
- _fromFakeShadow.backgroundColor = self.navigationBar.shadowImageView.backgroundColor;
692
+ _fromFakeShadow = [[UIImageView alloc] initWithImage:self.navigationBar.fakeShadowView.image];
693
+ _fromFakeShadow.backgroundColor = self.navigationBar.fakeShadowView.backgroundColor;
702
694
  }
703
695
  return _fromFakeShadow;
704
696
  }
705
697
 
706
698
  - (UIImageView *)toFakeShadow {
707
699
  if (!_toFakeShadow) {
708
- _toFakeShadow = [[UIImageView alloc] initWithImage:self.navigationBar.shadowImageView.image];
709
- _toFakeShadow.backgroundColor = self.navigationBar.shadowImageView.backgroundColor;
700
+ _toFakeShadow = [[UIImageView alloc] initWithImage:self.navigationBar.fakeShadowView.image];
701
+ _toFakeShadow.backgroundColor = self.navigationBar.fakeShadowView.backgroundColor;
710
702
  }
711
703
  return _toFakeShadow;
712
704
  }
@@ -0,0 +1,21 @@
1
+ #import "HBDViewController.h"
2
+
3
+ NS_ASSUME_NONNULL_BEGIN
4
+
5
+ @interface HBDViewController (Garden)
6
+
7
+ @property(nonatomic, assign) BOOL forceTransparentDialogWindow;
8
+
9
+ - (void)setLeftBarButtonItem:(NSDictionary *)item;
10
+
11
+ - (void)setRightBarButtonItem:(NSDictionary *)item;
12
+
13
+ - (void)setLeftBarButtonItems:(NSArray *)items;
14
+
15
+ - (void)setRightBarButtonItems:(NSArray *)items;
16
+
17
+ - (void)setPassThroughTouches:(BOOL)passThrough;
18
+
19
+ @end
20
+
21
+ NS_ASSUME_NONNULL_END