Skip to content

Commit bb59e83

Browse files
authored
Merge pull request #8 from willowtreeapps/develop
Develop
2 parents d963d97 + 220e6b5 commit bb59e83

69 files changed

Lines changed: 1025 additions & 219 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AttributesInspector/AttributesViewer/PreviewViews/HYPViewPreview.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ -(instancetype)initWithPreviewTargetView:(UIView *)view
5252

5353
self.accessibilityTextLabel.text = view.accessibilityLabel ? view.accessibilityLabel : @"--";
5454

55-
self.frameLabel.text = [NSString stringWithFormat:@"X: %.1f Y: %.1f Width: %.1f Height: %.1f", self.frame.origin.x, self.frame.origin.y, self.frame.size.width, self.frame.size.height];
55+
self.frameLabel.text = [NSString stringWithFormat:@"X: %.1f Y: %.1f Width: %.1f Height: %.1f", view.frame.origin.x, view.frame.origin.y, view.frame.size.width, view.frame.size.height];
5656

5757
return self;
5858
}

AttributesInspector/HYPAttributeInspectorInteractionView.m

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,26 +83,40 @@ -(void)tapGesture:(UITapGestureRecognizer *)tapGesture
8383

8484
-(void)viewSelected:(UIView *)selection
8585
{
86-
if (self.lastSelectedView == selection)
86+
if (self.currentlySelectedView == selection)
8787
{
8888
[self.extension.snapshotContainer dismissCurrentPopover];
89-
self.lastSelectedView = nil;
89+
self.currentlySelectedView = nil;
9090

9191
return;
9292
}
9393

94-
self.lastSelectedView = selection;
95-
96-
CGRect viewRect = [selection.superview convertRect:selection.frame toView:[self.extension attachedWindow]];
94+
self.currentlySelectedView = selection;
9795

98-
self.highlightView.frame = viewRect;
96+
[self updateSelection];
97+
}
9998

100-
self.currentlySelectedView = selection;
99+
-(void)interactionViewDidTransitionToSize:(CGSize)size
100+
{
101+
[super interactionViewDidTransitionToSize:size];
102+
[self updateSelection];
103+
}
101104

105+
-(void)updateSelection
106+
{
107+
if (!self.currentlySelectedView)
108+
{
109+
return;
110+
}
111+
112+
CGRect viewRect = [self.currentlySelectedView.superview convertRect:self.currentlySelectedView.frame toView:[self.extension attachedWindow]];
113+
114+
self.highlightView.frame = viewRect;
115+
102116
HYPAttributesPreviewViewController *attributesView = [[HYPAttributesPreviewViewController alloc] initWithSelectedView:self.currentlySelectedView];
103-
117+
104118
attributesView.delegate = self;
105-
119+
106120
[self.extension.snapshotContainer presentPopover:attributesView recommendedHeight:250 forView:self.currentlySelectedView];
107121
}
108122

AttributesInspector/HYPAttributesInspectorPluginModule.m

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
@interface HYPAttributesInspectorPluginModule ()
2727

28+
@property (nonatomic) HYPAttributeInspectorInteractionView *currentAttributesInteractionView;
29+
2830
@end
2931

3032
@implementation HYPAttributesInspectorPluginModule
@@ -47,7 +49,8 @@ -(void)activateSnapshotPluginViewWithContext:(UIView *)context
4749
{
4850
[super activateSnapshotPluginViewWithContext:context];
4951
[_snapshotPluginView removeFromSuperview];
50-
_snapshotPluginView = [[HYPAttributeInspectorInteractionView alloc] initWithExtension:self.extension];
52+
self.currentAttributesInteractionView = [[HYPAttributeInspectorInteractionView alloc] initWithExtension:self.extension];
53+
_snapshotPluginView = self.currentAttributesInteractionView;
5154
_snapshotPluginView.translatesAutoresizingMaskIntoConstraints = false;
5255
[context addSubview:_snapshotPluginView];
5356
[_snapshotPluginView.leadingAnchor constraintEqualToAnchor:context.leadingAnchor].active = true;
@@ -56,6 +59,18 @@ -(void)activateSnapshotPluginViewWithContext:(UIView *)context
5659
[_snapshotPluginView.bottomAnchor constraintEqualToAnchor:context.bottomAnchor].active = true;
5760
}
5861

62+
-(void)snapshotContextWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
63+
{
64+
[super snapshotContextWillTransitionToSize:size withTransitionCoordinator:coordinator];
65+
[self.currentAttributesInteractionView interactionViewWillTransitionToSize:size withTransitionCoordinator:coordinator];
66+
}
67+
68+
-(void)snapshotContextDidTransitionToSize:(CGSize)size
69+
{
70+
[super snapshotContextDidTransitionToSize:size];
71+
[self.currentAttributesInteractionView interactionViewDidTransitionToSize:size];
72+
}
73+
5974
-(void)deactivateSnapshotPluginView
6075
{
6176
[super deactivateSnapshotPluginView];

Core/Public/HyperionManager.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#import <UIKit/UIKit.h>
2323
#import "HYPActivationGestureOptions.h"
2424

25+
@protocol HYPPlugin;
2526
@protocol HYPPluginModule;
2627

2728
/**
@@ -50,6 +51,13 @@
5051
*/
5152
-(void)togglePluginDrawer;
5253

54+
/**
55+
* Provides a list of plugin classes.
56+
* @return A list of plugin classes.
57+
*/
58+
-(NSArray<Class<HYPPlugin>> *)retrievePluginClasses;
59+
60+
5361
/**
5462
* Provides a cached list of plugin modules.
5563
* @return A cached list of plugin modules.

Core/Public/HyperionManager.m

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,18 +153,9 @@ -(void)setActivationGesture:(HYPActivationGestureOptions)gesture {
153153
[window.overlayVC.edgeSwipeRecognizer setEnabled:edgeSwipeEnabled];
154154
}
155155

156-
-(NSArray<id<HYPPluginModule>> *)retrievePluginModules
157-
{
158-
//TODO: Cache Plugin Modules
159-
return [self forceRefreshPluginModules];
160-
}
161-
162-
-(NSArray<id<HYPPluginModule>> *)forceRefreshPluginModules
156+
-(NSArray<Class<HYPPlugin>> *)retrievePluginClasses
163157
{
164-
HYPPluginExtension *pluginExtension = [[HYPPluginExtension alloc] initWithSnapshotContainer:[[[HyperionWindowManager sharedInstance] currentSnapshotWindow] snapshotContainer] overlayContainer:[[[HyperionWindowManager sharedInstance] currentOverlayWindow] overlayContainer] hypeWindow:[[HyperionWindowManager sharedInstance] currentSnapshotWindow] attachedWindow:self.key];
165-
166-
NSMutableArray<id<HYPPluginModule>> *mutablePluginModules = [[NSMutableArray alloc] init];
167-
NSMutableArray *pluginClasses = [[NSMutableArray alloc] init];
158+
NSMutableArray<Class<HYPPlugin>> *pluginClasses = [[NSMutableArray alloc] init];
168159

169160
int numClasses;
170161
Class * classes = NULL;
@@ -190,6 +181,22 @@ -(void)setActivationGesture:(HYPActivationGestureOptions)gesture {
190181
free(classes);
191182
}
192183

184+
return pluginClasses;
185+
}
186+
187+
-(NSArray<id<HYPPluginModule>> *)retrievePluginModules
188+
{
189+
//TODO: Cache Plugin Modules
190+
return [self forceRefreshPluginModules];
191+
}
192+
193+
-(NSArray<id<HYPPluginModule>> *)forceRefreshPluginModules
194+
{
195+
HYPPluginExtension *pluginExtension = [[HYPPluginExtension alloc] initWithSnapshotContainer:[[[HyperionWindowManager sharedInstance] currentSnapshotWindow] snapshotContainer] overlayContainer:[[[HyperionWindowManager sharedInstance] currentOverlayWindow] overlayContainer] hypeWindow:[[HyperionWindowManager sharedInstance] currentSnapshotWindow] attachedWindow:self.key];
196+
197+
NSMutableArray<id<HYPPluginModule>> *mutablePluginModules = [[NSMutableArray alloc] init];
198+
NSArray<Class<HYPPlugin>> *pluginClasses = [self retrievePluginClasses];
199+
193200
for (Class<HYPPlugin> pluginClass in pluginClasses)
194201
{
195202
if ([pluginClass conformsToProtocol:@protocol(HYPPlugin)])

Core/Public/Plugin/HYPOverlayViewProvider.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,21 @@
4141
*/
4242
-(void)deactivateSnapshotPluginView;
4343

44+
@optional
45+
46+
/**
47+
* Called when the context the plugin view is in is about to change size.
48+
* @param size The size that the context is about to change to.
49+
* @param coordinator The transition coordinator allows you to animate views in sync with the size change.
50+
*/
51+
-(void)snapshotContextWillTransitionToSize:(CGSize)size withTransitionCoordinator:(__nullable id<UIViewControllerTransitionCoordinator>)coordinator;
52+
53+
/**
54+
* Called when the context has changed size.
55+
* @param size The size that the plugin view has changed to.
56+
*/
57+
-(void)snapshotContextDidTransitionToSize:(CGSize)size;
58+
4459
@end
4560

4661
/**

Core/Public/Plugin/SnapShotPlugin/HYPSnapshotInteractionView.h

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,24 @@
3333
* Creates a new HYPSnapshotInteractionView with the provided extension.
3434
* @param extension The extension the HYPSnapshotInteractionView should be created with.
3535
*/
36-
-(instancetype)initWithExtension:(id<HYPPluginExtension>)extension;
36+
-(__nonnull instancetype)initWithExtension:(__nullable id<HYPPluginExtension>)extension;
37+
38+
/**
39+
* Called when the interaction view is about to change size.
40+
* @param size The size that the interaction view is about to change to.
41+
* @param coordinator The transition coordinator allows you to animate views in sync with the size change.
42+
*/
43+
-(void)interactionViewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(__nullable id<UIViewControllerTransitionCoordinator>)coordinator;
44+
45+
/**
46+
* Called when the interaction view has changed size.
47+
* @param size The size that the interaction view has changed to.
48+
*/
49+
-(void)interactionViewDidTransitionToSize:(CGSize)size;
3750

3851
/**
3952
* The extension that the HYPSnapshotInteractionView was intialized with.
4053
*/
41-
@property (nonatomic, readonly) id<HYPPluginExtension> extension;
54+
@property (nonatomic, readonly, nullable) id<HYPPluginExtension> extension;
4255

4356
@end

Core/Public/Plugin/SnapShotPlugin/HYPSnapshotInteractionView.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,14 @@ -(instancetype)initWithExtension:(id<HYPPluginExtension>)extension
3434
return self;
3535
}
3636

37+
-(void)interactionViewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(__nullable id<UIViewControllerTransitionCoordinator>)coordinator
38+
{
39+
//No op;
40+
}
41+
42+
-(void)interactionViewDidTransitionToSize:(CGSize)size
43+
{
44+
//No op;
45+
}
46+
3747
@end

Core/Public/Plugin/SnapShotPlugin/HYPSnapshotPluginModule.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,14 @@ -(void)deactivateSnapshotPluginView
9797
[_pluginMenuItem setSelected:NO animated:YES];
9898
}
9999

100+
-(void)snapshotContextWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
101+
{
102+
//No op;
103+
}
104+
105+
-(void)snapshotContextDidTransitionToSize:(CGSize)size
106+
{
107+
//No op;
108+
}
109+
100110
@end

Core/SnapShotDebuggingWindow/HYPSnapshotViewController.m

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ @implementation HYPSnapshotViewController
6464

6565
const CGFloat PluginListWidth = 280;
6666

67-
6867
-(instancetype)initWithDebuggingWindow:(HYPSnapshotDebuggingWindow *)snapshotDebuggingWindow attachedWindow:(UIWindow *)attachedWindow
6968
{
7069
self = [super init];
@@ -462,6 +461,27 @@ -(void)updatePopOverFrame:(HYPPopoverViewController *)popOverViewController
462461
[popOverViewController setArrowPosition:position offset:arrowOffset];
463462
}
464463

464+
-(void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
465+
{
466+
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
467+
[self dismissCurrentPopover];
468+
469+
[self.snapshotContainer.overlayModule snapshotContextWillTransitionToSize:size withTransitionCoordinator:coordinator];
470+
471+
self.scrollView.zoomScale = 1;
472+
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
473+
[self takeSnapshot];
474+
self.scrollViewContainer.frame = CGRectMake(0, 0, size.width, size.height);
475+
self.scrollView.zoomScale = 1;
476+
self.scrollView.contentOffset = CGPointZero;
477+
} completion:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
478+
[self takeSnapshot];
479+
self.scrollView.zoomScale = 1;
480+
self.scrollView.contentOffset = CGPointZero;
481+
[self.snapshotContainer.overlayModule snapshotContextDidTransitionToSize:size];
482+
}];
483+
}
484+
465485
-(void)presentViewController:(UIViewController *)controller animated:(bool)animated
466486
{
467487
[self presentViewController:controller animated:YES completion:nil];

0 commit comments

Comments
 (0)