- notification lifecycle fixes - replace some notifications with delegates

- fix osw profile switch issue
This commit is contained in:
TrueZhuanjia committed 2025-06-22 21:25:29 +08:00
1 parent cd6e08956c
commit 6bc142a07b
12 files changed
+89 -96

No files matched your search

@@ -34,7 +34,8 @@ NS_ASSUME_NONNULL_BEGIN
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
- (void) updateGuidelinesForOnScreenWidget:(OnScreenWidgetView* )widget;
- (void)updateGuidelinesForOnScreenWidget:(OnScreenWidgetView* )widget;
@end
NS_ASSUME_NONNULL_END
@@ -32,11 +32,6 @@
- (id) initWithView:(UIView*)view controllerSup:(ControllerSupport*)controllerSupport streamConfig:(StreamConfiguration*)streamConfig oscLevel:(int)oscLevel {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleMovingOnScreenWidgetNotification:)
name:@"OnScreenWidgetMovedByTouch"
object:nil];
_view = view;
_view.multipleTouchEnabled = false;
@@ -121,12 +116,7 @@
[self._view addSubview: verticalGuideline];
}
- (void) handleMovingOnScreenWidgetNotification: (NSNotification *)notification{
OnScreenWidgetView* widget = notification.object;
[self updateGuidelinesForOnScreenWidget:widget];
}
- (void) updateGuidelinesForOnScreenWidget: (OnScreenWidgetView* )widget{
- (void)updateGuidelinesForOnScreenWidget:(OnScreenWidgetView* )widget{
/* have guidelines follow wherever the user is touching on the screen */
horizontalGuideline.hidden = verticalGuideline.hidden = NO;
horizontalGuideline.center = verticalGuideline.center = CGPointMake(CGRectGetMidX(widget.frame), CGRectGetMidY(widget.frame));
@@ -349,5 +339,4 @@
}
@end