fix: widgets disappears after display orientation change & saving profile in osw tool

This commit is contained in:
TrueZhuanjia committed 2025-07-25 20:18:43 +08:00
1 parent ab7ccc7732
commit 0df5135f0b
1 file changed
+11 -1
@@ -243,7 +243,10 @@
selector: @selector(handleReturnToForeground) selector: @selector(handleReturnToForeground)
name: UIApplicationDidBecomeActiveNotification name: UIApplicationDidBecomeActiveNotification
object: nil]; object: nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(deviceOrientationDidChange) // handle orientation change since i made portrait mode available
name:UIDeviceOrientationDidChangeNotification
object:nil];
OnScreenWidgetView.editMode = true; OnScreenWidgetView.editMode = true;
[self handleMissingToolBarIcon:toolbarRootView]; [self handleMissingToolBarIcon:toolbarRootView];
@@ -256,6 +259,13 @@
[OSCProfilesManager setOnScreenWidgetViewsSet:self.onScreenWidgetViews]; // pass the keyboard button dict to profiles manager [OSCProfilesManager setOnScreenWidgetViewsSet:self.onScreenWidgetViews]; // pass the keyboard button dict to profiles manager
} }
- (void)deviceOrientationDidChange{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
sleep(1);
[OSCProfilesManager setOnScreenWidgetViewsSet:self.onScreenWidgetViews]; // pass the keyboard button dict to profiles manager
});
}
/* fades the 'Undo Button' in or out depending on whether the user has any OSC layout changes to undo */ /* fades the 'Undo Button' in or out depending on whether the user has any OSC layout changes to undo */
- (void) OSCLayoutChanged { - (void) OSCLayoutChanged {
if ([self.layoutOSC.layoutChanges count] > 0) { if ([self.layoutOSC.layoutChanges count] > 0) {