@@ -91,10 +91,6 @@ - (BOOL)openWindow
9191 /* registering to window */
9292 [self .windowScene _registerSettingsDiffActionArray: @[self ] forKey: self .process.sceneID];
9393
94- /* fixing keyboard issues */
95- [[NSNotificationCenter defaultCenter ] addObserver: self selector: @selector (keyboardWillShow: ) name: UIKeyboardWillShowNotification object: nil ];
96- [[NSNotificationCenter defaultCenter ] addObserver: self selector: @selector (keyboardWillHide: ) name: UIKeyboardWillHideNotification object: nil ];
97-
9894 /* initilize lock */
9995 lock = OS_UNFAIR_LOCK_INIT;
10096
@@ -105,9 +101,6 @@ - (BOOL)closeWindow
105101{
106102 [super closeWindow ];
107103
108- /* fixing keyboard issues */
109- [[NSNotificationCenter defaultCenter ] removeObserver: self ];
110-
111104 /* invalidate presenter */
112105 [_presenter invalidate ];
113106
@@ -307,70 +300,6 @@ - (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection
307300 os_unfair_lock_unlock (&lock);
308301}
309302
310- - (void )keyboardWillShow : (NSNotification *)notification
311- {
312- os_unfair_lock_lock (&lock);
313-
314- NSDictionary *info = notification.userInfo ;
315- CGRect keyboardFrame = [[info objectForKey: UIKeyboardFrameEndUserInfoKey] CGRectValue ];
316-
317- CGFloat bottomInset = keyboardFrame.size .height ;
318-
319- if (![self .process.processHandle isValid ] || self.process .isSuspended )
320- {
321- os_unfair_lock_unlock (&lock);
322- return ;
323- }
324-
325- [self .presenter.scene updateSettingsWithBlock: ^(UIMutableApplicationSceneSettings *settings) {
326- UIEdgeInsets currentInsets = settings.safeAreaInsetsPortrait ;
327- currentInsets.bottom = bottomInset;
328-
329-
330- settings.safeAreaInsetsPortrait = currentInsets;
331- settings.safeAreaInsetsLandscapeLeft = currentInsets;
332- settings.safeAreaInsetsLandscapeRight = currentInsets;
333- settings.safeAreaInsetsPortraitUpsideDown = currentInsets;
334- }];
335-
336- isKeyboardShown = true ;
337-
338- os_unfair_lock_unlock (&lock);
339- }
340-
341- - (void )keyboardWillHide : (NSNotification *)notification
342- {
343- os_unfair_lock_lock (&lock);
344-
345- if (![self .process.processHandle isValid ] || self.process .isSuspended )
346- {
347- os_unfair_lock_unlock (&lock);
348- return ;
349- }
350-
351- [self .presenter.scene updateSettingsWithBlock: ^(UIMutableApplicationSceneSettings *settings) {
352- UIEdgeInsets currentInsets = settings.safeAreaInsetsPortrait ;
353-
354- if (self.isFullscreen )
355- {
356- currentInsets.bottom = LDEWindowServer.shared .safeAreaInsets .bottom ;
357- }
358- else
359- {
360- currentInsets.bottom = 0 ;
361- }
362-
363- settings.safeAreaInsetsPortrait = currentInsets;
364- settings.safeAreaInsetsLandscapeLeft = currentInsets;
365- settings.safeAreaInsetsLandscapeRight = currentInsets;
366- settings.safeAreaInsetsPortraitUpsideDown = currentInsets;
367- }];
368-
369- isKeyboardShown = false ;
370-
371- os_unfair_lock_unlock (&lock);
372- }
373-
374303- (NSString *)windowName
375304{
376305 return self.process .displayName ;
0 commit comments