replace force expand & close of settings view with background resolution width & height swap

This commit is contained in:
True Zhuanjia
2024-07-08 19:06:59 +08:00
parent 072f7bdffb
commit a021784d48
3 changed files with 30 additions and 6 deletions
+2 -1
View File
@@ -44,7 +44,8 @@
- (void) updateAppsForExistingHost:(TemporaryHost *)host;
- (void) removeHost:(TemporaryHost*)host;
- (void) removeApp:(TemporaryApp*)app;
- (Settings*) retrieveSettings;
- (void) saveData;
- (TemporarySettings*) getSettings;
- (void) updateUniqueId:(NSString*)uniqueId;
@@ -28,6 +28,7 @@
#import "ConnectionHelper.h"
#import "LocalizationHelper.h"
#import "CustomEdgeSwipeGestureRecognizer.h"
#import "DataManager.h"
#if !TARGET_OS_TV
#import "SettingsViewController.h"
@@ -1075,11 +1076,27 @@ static NSMutableSet* hostList;
//if([SettingsViewController isLandscapeNow] != _streamConfig.width > _streamConfig.height)
[self simulateSettingsButtonPress]; //force expand setting view if orientation changed since last quit from app.
[self simulateSettingsButtonPress]; //force expand setting view if orientation changed since last quit from app.
//[self simulateSettingsButtonPress]; //force expand setting view if orientation changed since last quit from app.
//[self simulateSettingsButtonPress]; //force expand setting view if orientation changed since last quit from app.
[self swapResolutionWidthHeightAccordingly];
}
-(void)swapResolutionWidthHeightAccordingly{
DataManager* dataMan = [[DataManager alloc] init];
Settings *currentSettings = [dataMan retrieveSettings];
CGFloat screenWidthInPoints = CGRectGetWidth([[UIScreen mainScreen] bounds]);
CGFloat screenHeightInPoints = CGRectGetHeight([[UIScreen mainScreen] bounds]);
bool needSwap = ((currentSettings.width.floatValue - currentSettings.height.floatValue) * (screenWidthInPoints - screenHeightInPoints)) < 0;
NSLog(@"need to swap width & height: %d", needSwap);
if(needSwap){
CGFloat tmpLength = currentSettings.width.floatValue;
currentSettings.width = @(currentSettings.height.floatValue);
currentSettings.height = @(tmpLength);
[dataMan saveData];
}
}
#if TARGET_OS_TV
-(void)handleCollectionViewLongPress:(UILongPressGestureRecognizer *)gestureRecognizer
{
@@ -1199,10 +1216,14 @@ static NSMutableSet* hostList;
selector: @selector(handleEnterBackground)
name: UIApplicationWillResignActiveNotification
object: nil];
[self simulateSettingsButtonPress]; //force reload resolution table in the setting
[self simulateSettingsButtonPress];
//[self simulateSettingsButtonPress]; //force reload resolution table in the setting
//[self simulateSettingsButtonPress];
[self swapResolutionWidthHeightAccordingly];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
+2
View File
@@ -1542,6 +1542,7 @@
"$(PROJECT_DIR)/Limelight/ViewControllers/CustomOSCViewControl/Cells",
"$(PROJECT_DIR)/Limelight/Input",
"$(PROJECT_DIR)/Limelight/Localization",
"$(PROJECT_DIR)/Limelight/Database",
);
INFOPLIST_FILE = "Limelight/Limelight-Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = MoonlightZWM;
@@ -1598,6 +1599,7 @@
"$(PROJECT_DIR)/Limelight/ViewControllers/CustomOSCViewControl/Cells",
"$(PROJECT_DIR)/Limelight/Input",
"$(PROJECT_DIR)/Limelight/Localization",
"$(PROJECT_DIR)/Limelight/Database",
);
INFOPLIST_FILE = "Limelight/Limelight-Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = MoonlightZWM;