From 822dfc433b029f637a3998e2dc7285ce14755236 Mon Sep 17 00:00:00 2001 From: TrueZhuanjia Date: Fri, 6 Jun 2025 22:06:47 +0800 Subject: [PATCH] moreButton + disconnectButton in Streaming, and related codings --- Limelight/MenuSectionView.h | 1 + .../ViewControllers/SWRevealViewController.h | 1 + .../ViewControllers/SWRevealViewController.m | 26 ++++++++++++++++--- .../ViewControllers/SettingsViewController.m | 20 ++++++-------- .../StreamFrameViewController.m | 1 + 5 files changed, 34 insertions(+), 15 deletions(-) diff --git a/Limelight/MenuSectionView.h b/Limelight/MenuSectionView.h index 27da76f6..33f7692f 100644 --- a/Limelight/MenuSectionView.h +++ b/Limelight/MenuSectionView.h @@ -29,5 +29,6 @@ - (void)addToParentStack:(UIStackView *)parentStack; - (void)removeSubStackView:(UIStackView *)stackView; - (void)updateLayout; +- (void)updateViewForFoldState; @end diff --git a/Limelight/ViewControllers/SWRevealViewController.h b/Limelight/ViewControllers/SWRevealViewController.h index 8262226d..b681fd68 100755 --- a/Limelight/ViewControllers/SWRevealViewController.h +++ b/Limelight/ViewControllers/SWRevealViewController.h @@ -354,6 +354,7 @@ typedef enum - (SettingsMenuMode)getSettingsMenuMode; - (void)enterRemoveSettingItemMode; - (void)doneRemoveSettingItem; +- (void)layoutSettingsView; @end diff --git a/Limelight/ViewControllers/SWRevealViewController.m b/Limelight/ViewControllers/SWRevealViewController.m index 50d7ffde..9261100b 100755 --- a/Limelight/ViewControllers/SWRevealViewController.m +++ b/Limelight/ViewControllers/SWRevealViewController.m @@ -861,8 +861,21 @@ const int FrontViewPositionNone = 0xff; #pragma mark - Public methods and property accessors - (void)willMoveToPosition{ + + SettingsMenuMode currentMenuMode = [self getSettingsMenuMode]; + _separatorLine.hidden = _frontViewPosition == FrontViewPositionLeft; - if(_frontViewPosition != FrontViewPositionLeft) [self setupMoreButtonMenu]; + + if(_frontViewPosition == FrontViewPositionLeft && currentMenuMode == RemoveSettingItem){ + [self doneRemoveSettingItemSelected]; + } + + if(_frontViewPosition != FrontViewPositionLeft){ + [self setupMoreButtonMenu]; + [self layoutSettingsView]; + //if(currentMenuMode == AllSettings) [self allSettingSelected]; + //if(currentMenuMode == FavoriteSettings) [self favoriteSettingSelected]; + } } @@ -1046,9 +1059,14 @@ const int FrontViewPositionNone = 0xff; if ([self.navBarMenuDelegate respondsToSelector:@selector(doneRemoveSettingItem)]) { [self.navBarMenuDelegate doneRemoveSettingItem]; - } else NSLog(@"Delegate not set or does not respond to switchToAllSettings:"); + } else NSLog(@"Delegate not set or does not respond to doneRemoveSettingItem:"); } +- (void)layoutSettingsView{ + if ([self.navBarMenuDelegate respondsToSelector:@selector(layoutSettingsView)]) { + [self.navBarMenuDelegate layoutSettingsView]; + } else NSLog(@"Delegate not set or does not respond to layoutSettingsView:"); +} - (void)setupMoreButtonMenu{ @@ -1140,7 +1158,7 @@ const int FrontViewPositionNone = 0xff; } - (void)buttonsInStreaming{ - _navItem.rightBarButtonItems = @[_disconnectButton]; + _navItem.rightBarButtonItems = @[_disconnectButton, _moreButton]; } - (void)buttonsNotInStreaming{ @@ -1152,6 +1170,8 @@ const int FrontViewPositionNone = 0xff; } - (void)disconnectRemoteSession{ + if([self getSettingsMenuMode] == RemoveSettingItem) [self doneRemoveSettingItemSelected]; + [[NSNotificationCenter defaultCenter] postNotificationName:@"SessionDisconnectedBySettingsMenuNotification" object:self]; [self foldRearView]; } diff --git a/Limelight/ViewControllers/SettingsViewController.m b/Limelight/ViewControllers/SettingsViewController.m index 1fb41d2e..12fd42d2 100644 --- a/Limelight/ViewControllers/SettingsViewController.m +++ b/Limelight/ViewControllers/SettingsViewController.m @@ -339,18 +339,6 @@ BOOL isCustomResolution(CGSize res) { [[NSNotificationCenter defaultCenter] postNotificationName:@"SettingsViewClosedNotification" object:self]; // notify other view that settings view just closed } -//deprecated -- (IBAction)exitButtonTapped:(id)sender { - [self->_mainFrameViewController simulateSettingsButtonPress]; - [[NSNotificationCenter defaultCenter] postNotificationName:@"SessionDisconnectedBySettingsMenuNotification" object:self]; -} - -//deprecated -- (IBAction)backToStreamingButtonTapped:(id)sender { - [self simulateSettingsButtonPress]; -} - - /* - (void)addExitButtonOnTop{ UIButton *exitButton = [UIButton buttonWithType:UIButtonTypeSystem]; @@ -817,6 +805,13 @@ BOOL isCustomResolution(CGSize res) { [self saveFavoriteSettingStackIdentifiers]; } +- (void)layoutSettingsView{ + [self.view layoutSubviews]; + if(currentSettingsMenuMode == AllSettings){ + for(MenuSectionView* section in parentStack.arrangedSubviews) [section updateViewForFoldState]; + } +} + - (void)switchToFavoriteSettings{ [self updateTheme]; currentSettingsMenuMode = FavoriteSettings; @@ -829,6 +824,7 @@ BOOL isCustomResolution(CGSize res) { [view removeFromSuperview]; } parentStack.spacing = 15; + [self loadFavoriteSettingStackIdentifiers]; for(NSString* settingIdentifier in _favoriteSettingStackIdentifiers){ [parentStack addArrangedSubview:_settingStackDict[settingIdentifier]]; } diff --git a/Limelight/ViewControllers/StreamFrameViewController.m b/Limelight/ViewControllers/StreamFrameViewController.m index 8d0684d8..d8ed1473 100644 --- a/Limelight/ViewControllers/StreamFrameViewController.m +++ b/Limelight/ViewControllers/StreamFrameViewController.m @@ -279,6 +279,7 @@ #endif - (void)popFirstLaunchTip { + return; // temp disable // 初始化倒计时秒数 __block NSInteger remainingSeconds = 16;