- notification lifecycle fixes - replace some notifications with delegates

- fix osw profile switch issue
This commit is contained in:
TrueZhuanjia
2025-06-22 21:25:29 +08:00
parent cd6e08956c
commit 6bc142a07b
12 changed files with 89 additions and 96 deletions
@@ -107,7 +107,7 @@
[self.view addGestureRecognizer:_oscLayoutTapRecoginizer]; //
/* sets a reference to the correct 'LayoutOnScreenControlsViewController' depending on whether the user is on an iPhone or iPad */
_layoutOnScreenControlsVC = [[LayoutOnScreenControlsViewController alloc] init];
// _layoutOnScreenControlsVC = [[LayoutOnScreenControlsViewController alloc] init];
BOOL isIPhone = ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone);
if (isIPhone) {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"iPhone" bundle:nil];
@@ -267,6 +267,17 @@
selector:@selector(expandSettingsView) // //force expand settings view to update resolution table, and all setting includes current fullscreen resolution will be updated.
name:@"SettingsOverlayButtonPressedNotification"
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide)
name:UIKeyboardWillHideNotification
object:nil];
#endif
}
@@ -433,12 +444,12 @@
name:UIApplicationWillResignActiveNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver: self
[[NSNotificationCenter defaultCenter] addObserver:self
selector: @selector(applicationDidBecomeActive:)
name: UIApplicationDidBecomeActiveNotification
object: nil];
[[NSNotificationCenter defaultCenter] addObserver: self
[[NSNotificationCenter defaultCenter] addObserver:self
selector: @selector(applicationDidEnterBackground:)
name: UIApplicationDidEnterBackgroundNotification
object: nil];
@@ -468,6 +479,15 @@
[self.view addSubview:_tipLabel];
}
- (void)keyboardWillShow:(NSNotification *)notification{
[_streamView keyboardWillShow:notification];
}
- (void)keyboardWillHide{
[_streamView keyboardWillHide];
}
- (void)openWidgetLayoutTool{
[self->_streamView disableOnScreenControls];
[self->_streamView clearOnScreenKeyboardButtons]; // clear all onScreenKeyboardButtons before entering edit mode