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

This commit is contained in:
True Zhuanjia committed 2024-07-08 19:06:59 +08:00
1 parent 072f7bdffb
commit a021784d48
3 files changed
+30 -6

No files matched your search

+2 -1
View File
@@ -44,7 +44,8 @@
- (void) updateAppsForExistingHost:(TemporaryHost *)host; - (void) updateAppsForExistingHost:(TemporaryHost *)host;
- (void) removeHost:(TemporaryHost*)host; - (void) removeHost:(TemporaryHost*)host;
- (void) removeApp:(TemporaryApp*)app; - (void) removeApp:(TemporaryApp*)app;
- (Settings*) retrieveSettings;
- (void) saveData;
- (TemporarySettings*) getSettings; - (TemporarySettings*) getSettings;
- (void) updateUniqueId:(NSString*)uniqueId; - (void) updateUniqueId:(NSString*)uniqueId;
@@ -28,6 +28,7 @@
#import "ConnectionHelper.h" #import "ConnectionHelper.h"
#import "LocalizationHelper.h" #import "LocalizationHelper.h"
#import "CustomEdgeSwipeGestureRecognizer.h" #import "CustomEdgeSwipeGestureRecognizer.h"
#import "DataManager.h"
#if !TARGET_OS_TV #if !TARGET_OS_TV
#import "SettingsViewController.h" #import "SettingsViewController.h"
@@ -1075,11 +1076,27 @@ static NSMutableSet* hostList;
//if([SettingsViewController isLandscapeNow] != _streamConfig.width > _streamConfig.height) //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 #if TARGET_OS_TV
-(void)handleCollectionViewLongPress:(UILongPressGestureRecognizer *)gestureRecognizer -(void)handleCollectionViewLongPress:(UILongPressGestureRecognizer *)gestureRecognizer
{ {
@@ -1199,10 +1216,14 @@ static NSMutableSet* hostList;
selector: @selector(handleEnterBackground) selector: @selector(handleEnterBackground)
name: UIApplicationWillResignActiveNotification name: UIApplicationWillResignActiveNotification
object: nil]; object: nil];
[self simulateSettingsButtonPress]; //force reload resolution table in the setting //[self simulateSettingsButtonPress]; //force reload resolution table in the setting
[self simulateSettingsButtonPress]; //[self simulateSettingsButtonPress];
[self swapResolutionWidthHeightAccordingly];
} }
- (void)viewWillAppear:(BOOL)animated - (void)viewWillAppear:(BOOL)animated
{ {
[super viewWillAppear:animated]; [super viewWillAppear:animated];
+2
View File
@@ -1542,6 +1542,7 @@
"$(PROJECT_DIR)/Limelight/ViewControllers/CustomOSCViewControl/Cells", "$(PROJECT_DIR)/Limelight/ViewControllers/CustomOSCViewControl/Cells",
"$(PROJECT_DIR)/Limelight/Input", "$(PROJECT_DIR)/Limelight/Input",
"$(PROJECT_DIR)/Limelight/Localization", "$(PROJECT_DIR)/Limelight/Localization",
"$(PROJECT_DIR)/Limelight/Database",
); );
INFOPLIST_FILE = "Limelight/Limelight-Info.plist"; INFOPLIST_FILE = "Limelight/Limelight-Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = MoonlightZWM; INFOPLIST_KEY_CFBundleDisplayName = MoonlightZWM;
@@ -1598,6 +1599,7 @@
"$(PROJECT_DIR)/Limelight/ViewControllers/CustomOSCViewControl/Cells", "$(PROJECT_DIR)/Limelight/ViewControllers/CustomOSCViewControl/Cells",
"$(PROJECT_DIR)/Limelight/Input", "$(PROJECT_DIR)/Limelight/Input",
"$(PROJECT_DIR)/Limelight/Localization", "$(PROJECT_DIR)/Limelight/Localization",
"$(PROJECT_DIR)/Limelight/Database",
); );
INFOPLIST_FILE = "Limelight/Limelight-Info.plist"; INFOPLIST_FILE = "Limelight/Limelight-Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = MoonlightZWM; INFOPLIST_KEY_CFBundleDisplayName = MoonlightZWM;