- newUI ios12 compatibility
- settings wighet them color - minor tweaks
This commit is contained in:
+1
-1
@@ -738,7 +738,7 @@
|
||||
// Set the label's frame with the calculated x-position
|
||||
self.currentProfileLabel.frame = CGRectMake(profileLabelXPosition, self.currentProfileLabel.frame.origin.y, self.currentProfileLabel.frame.size.width, self.currentProfileLabel.frame.size.height);
|
||||
self.currentProfileLabel.hidden = NO; // Show Current Profile display
|
||||
if (@available(iOS 13.0, *) && false) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
self.currentProfileLabel.textAlignment = NSTextAlignmentNatural;
|
||||
self.currentProfileLabel.numberOfLines = 2;
|
||||
} else {
|
||||
|
||||
@@ -268,7 +268,7 @@ didPickDocumentsAtURLs:(NSArray<NSURL *> *)urls {
|
||||
NSMutableArray *profilesEncoded;
|
||||
// 解码原始的NSArray对象,得到包含编码对象的数组
|
||||
error = nil;
|
||||
if (@available(iOS 13.0, *) && false) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
// 在 iOS 13 及以上使用 unarchivedObjectOfClasses
|
||||
profilesEncoded = [NSKeyedUnarchiver unarchivedObjectOfClasses:classes fromData:fileData error:&error];
|
||||
} else {
|
||||
|
||||
@@ -136,7 +136,7 @@ static NSMutableSet* hostList;
|
||||
|
||||
- (void)updateTitle {
|
||||
|
||||
if (@available(iOS 13.0, *) && false) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
navBarAppearanceScroll.titleTextAttributes = navBarAppearanceStandard.titleTextAttributes = @{
|
||||
NSFontAttributeName: [UIFont systemFontOfSize:20 weight:UIFontWeightMedium],
|
||||
NSForegroundColorAttributeName: [ThemeManager textColor] // 可选,设置标题颜色
|
||||
@@ -151,7 +151,7 @@ static NSMutableSet* hostList;
|
||||
self.title = [LocalizationHelper localizedStringForKey: @"Searching for PCs on your network..."] ;
|
||||
}
|
||||
else {
|
||||
if (@available(iOS 13.0, *) && false) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
navBarAppearanceScroll.titleTextAttributes = navBarAppearanceStandard.titleTextAttributes = @{
|
||||
NSFontAttributeName: [UIFont systemFontOfSize:24 weight:UIFontWeightSemibold],
|
||||
NSForegroundColorAttributeName: [ThemeManager textColor] // 可选,设置标题颜色
|
||||
@@ -165,10 +165,10 @@ static NSMutableSet* hostList;
|
||||
self.title = [LocalizationHelper localizedStringForKey: @"Hosts" ];
|
||||
//self.title = nil;
|
||||
}
|
||||
if (@available(iOS 13.0, *) && false) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
[self applyNavBarAppearance];
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
self.navigationController.navigationBar.backgroundColor = [ThemeManager appBackgroundColor];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,6 +365,8 @@ static NSMutableSet* hostList;
|
||||
self.hostCollectionVC.view.hidden = YES;
|
||||
self.collectionView.hidden = NO;
|
||||
self.collectionView.backgroundColor = [ThemeManager appBackgroundColor];
|
||||
//self.view.backgroundColor = [ThemeManager appBackgroundColor];
|
||||
|
||||
[self attachWaterMark];
|
||||
self.navigationItem.rightBarButtonItems = @[_upButton];
|
||||
self.revealViewController.mainFrameIsInHostView = false;
|
||||
@@ -1280,7 +1282,7 @@ static NSMutableSet* hostList;
|
||||
|
||||
// 设置图标(SF Symbol)
|
||||
|
||||
if (@available(iOS 13.0, *) && false) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:17 weight:UIImageSymbolWeightMedium];
|
||||
UIImage *image = [UIImage systemImageNamed:@"plus.circle" withConfiguration:config];
|
||||
[button setImage:image forState:UIControlStateNormal];
|
||||
@@ -1320,7 +1322,7 @@ static NSMutableSet* hostList;
|
||||
button.clipsToBounds = YES;
|
||||
|
||||
// 设置图标(SF Symbol)
|
||||
if (@available(iOS 13.0, *) && false) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:buttonHeight*0.85 weight:UIImageSymbolWeightRegular];
|
||||
UIImage *image = [UIImage systemImageNamed:@"questionmark.circle" withConfiguration:config];
|
||||
[button setImage:image forState:UIControlStateNormal];
|
||||
@@ -1380,7 +1382,7 @@ static NSMutableSet* hostList;
|
||||
}
|
||||
|
||||
- (void)setupNavBar{
|
||||
if (@available(iOS 13.0, *) && false) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
navBarAppearanceStandard = [[UINavigationBarAppearance alloc] init];
|
||||
[navBarAppearanceStandard configureWithOpaqueBackground]; // 不透明
|
||||
navBarAppearanceStandard.backgroundColor =[ThemeManager appBackgroundColor];; // 设置你需要的背景色
|
||||
@@ -1406,6 +1408,9 @@ static NSMutableSet* hostList;
|
||||
//appearance.
|
||||
[self applyNavBarAppearance];
|
||||
}
|
||||
else {
|
||||
self.navigationController.navigationBar.backgroundColor = [ThemeManager appBackgroundColor];
|
||||
}
|
||||
|
||||
self->_addHostButton = [self createAddHostButton];
|
||||
self->_helpButton = [self createHelpButton];
|
||||
@@ -1419,7 +1424,7 @@ static NSMutableSet* hostList;
|
||||
|
||||
[_settingsButton setTarget:self.revealViewController];
|
||||
[_settingsButton setAction:@selector(revealToggle:)];
|
||||
if (@available(iOS 13.0, *) && false) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
[_settingsButton setTitle:nil];
|
||||
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:23 weight:UIImageSymbolWeightMedium ];
|
||||
UIImage *image = [[UIImage systemImageNamed:@"sidebar.left" withConfiguration:config] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
||||
@@ -1767,6 +1772,8 @@ static NSMutableSet* hostList;
|
||||
// view, so we won't get a return to active notification
|
||||
// for that which would normally fire beginForegroundRefresh.
|
||||
self.view.backgroundColor = [ThemeManager appBackgroundColor];
|
||||
self.hostCollectionVC.view.backgroundColor = [ThemeManager appBackgroundColor];
|
||||
self.collectionView.backgroundColor = [ThemeManager appBackgroundColor];
|
||||
|
||||
[self.view addSubview:self.collectionView];
|
||||
[self initHostCollection];
|
||||
|
||||
@@ -911,7 +911,7 @@ const int FrontViewPositionNone = 0xff;
|
||||
_dockedNavBar.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
_dockedNavBar.userInteractionEnabled = YES;
|
||||
|
||||
if (@available(iOS 13.0, *) && false) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
UINavigationBarAppearance *navBarAppearanceStandard = [[UINavigationBarAppearance alloc] init];
|
||||
[navBarAppearanceStandard configureWithOpaqueBackground]; // 不透明
|
||||
navBarAppearanceStandard.backgroundColor =[ThemeManager appBackgroundColor];; // 设置你需要的背景色
|
||||
@@ -924,7 +924,8 @@ const int FrontViewPositionNone = 0xff;
|
||||
_dockedNavBar.standardAppearance = navBarAppearanceStandard;
|
||||
_dockedNavBar.scrollEdgeAppearance = navBarAppearanceStandard;
|
||||
} else {
|
||||
_dockedNavBar.backgroundColor = [ThemeManager appBackgroundColor];
|
||||
_dockedNavBar.backgroundColor = [UIColor clearColor];
|
||||
_dockedNavBar.barTintColor = [[ThemeManager appBackgroundColor] colorWithAlphaComponent:0.1];
|
||||
}
|
||||
|
||||
|
||||
@@ -939,7 +940,6 @@ const int FrontViewPositionNone = 0xff;
|
||||
// navItem.rightBarButtonItem = _disconnectButton;
|
||||
|
||||
[_dockedNavBar setItems:@[_navItem]];
|
||||
_dockedNavBar.barTintColor = [UIColor darkGrayColor];
|
||||
_dockedNavBar.titleTextAttributes = @{NSForegroundColorAttributeName: [UIColor whiteColor]};
|
||||
|
||||
[_contentView.rearNavView addSubview:_dockedNavBar];
|
||||
@@ -961,14 +961,14 @@ const int FrontViewPositionNone = 0xff;
|
||||
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] init];
|
||||
[backButton setTarget:self];
|
||||
[backButton setAction:@selector(foldRearView)];
|
||||
if (@available(iOS 13.0, *) && false) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
[backButton setTitle:nil];
|
||||
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:23 weight:UIImageSymbolWeightMedium ];
|
||||
UIImage *image = [[UIImage systemImageNamed:@"sidebar.left" withConfiguration:config] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
||||
[backButton setImage:image];
|
||||
backButton.imageInsets = UIEdgeInsetsMake(20, 10, 0, 0);
|
||||
} else {
|
||||
[backButton setTitle:[LocalizationHelper localizedStringForKey:@"Back"]];
|
||||
[backButton setTitle:[LocalizationHelper localizedStringForKey:@"Collapse"]];
|
||||
}
|
||||
_navItem.leftBarButtonItem = backButton;
|
||||
}
|
||||
@@ -979,7 +979,7 @@ const int FrontViewPositionNone = 0xff;
|
||||
_disconnectButton = [[UIBarButtonItem alloc] init];
|
||||
[_disconnectButton setTarget:self];
|
||||
[_disconnectButton setAction:@selector(disconnectRemoteSession)];
|
||||
if (@available(iOS 13.0, *) && false) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
[_disconnectButton setTitle:nil];
|
||||
UIImage *image = [[UIImage imageNamed:@"disconnect.svg" ] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
|
||||
|
||||
@@ -1002,7 +1002,7 @@ const int FrontViewPositionNone = 0xff;
|
||||
if(!_moreButton) _moreButton = [[UIBarButtonItem alloc] init];
|
||||
|
||||
//[moreButton setAction:@selector(moreButtonTapped:)];
|
||||
if (@available(iOS 13.0, *) && false) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
[_moreButton setTitle:nil];
|
||||
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:23 weight:UIImageSymbolWeightMedium ];
|
||||
UIImage *image = [[UIImage systemImageNamed:@"ellipsis.circle" withConfiguration:config] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
|
||||
@@ -1039,7 +1039,7 @@ const int FrontViewPositionNone = 0xff;
|
||||
|
||||
|
||||
- (void)removeSettingItemSelected{
|
||||
if (@available(iOS 13.0, *) && false) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
// UIAction* action1 = [self getAllSettingMenuAction];
|
||||
UIAction* action1 = [self getDoneRemoveSettingAction];
|
||||
if (@available(iOS 14.0, *)) _moreButton.menu = [UIMenu menuWithTitle:@"" children:@[action1]];
|
||||
@@ -1051,7 +1051,7 @@ const int FrontViewPositionNone = 0xff;
|
||||
}
|
||||
|
||||
- (void)doneRemoveSettingItemSelected{
|
||||
if (@available(iOS 13.0, *) && false) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
UIAction* action1 = [self getAllSettingMenuAction];
|
||||
UIAction* action2 = [self getRemoveSettingItemAction];
|
||||
if (@available(iOS 14.0, *)) _moreButton.menu = [UIMenu menuWithTitle:@"" children:@[action1, action2]];
|
||||
@@ -1146,7 +1146,7 @@ const int FrontViewPositionNone = 0xff;
|
||||
}
|
||||
|
||||
- (void)favoriteSettingSelected {
|
||||
if (@available(iOS 13.0, *) && false) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
UIAction* action1 = [self getAllSettingMenuAction];
|
||||
UIAction* action2 = [self getRemoveSettingItemAction];
|
||||
if (@available(iOS 14.0, *)) _moreButton.menu = [UIMenu menuWithTitle:@"" children:@[action1, action2]];
|
||||
@@ -1157,7 +1157,7 @@ const int FrontViewPositionNone = 0xff;
|
||||
}
|
||||
|
||||
- (void)allSettingSelected {
|
||||
if (@available(iOS 13.0, *) && false) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
UIAction* action1 = [self getFavoriteMenuAction];
|
||||
if (@available(iOS 14.0, *)) _moreButton.menu = [UIMenu menuWithTitle:@"" children:@[action1]];
|
||||
}
|
||||
|
||||
@@ -387,7 +387,7 @@ BOOL isCustomResolution(CGSize res) {
|
||||
parentStack.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
[self.scrollView addSubview:parentStack];
|
||||
[NSLayoutConstraint activateConstraints:@[
|
||||
[parentStack.topAnchor constraintEqualToAnchor:self.scrollView.contentLayoutGuide.topAnchor constant: [self getStandardNavBarHeight] + 13],
|
||||
[parentStack.topAnchor constraintEqualToAnchor:self.scrollView.contentLayoutGuide.topAnchor constant: [self getStandardNavBarHeight]],
|
||||
[parentStack.bottomAnchor constraintEqualToAnchor:self.scrollView.contentLayoutGuide.bottomAnchor constant:-20],
|
||||
[parentStack.centerXAnchor constraintEqualToAnchor:self.view.centerXAnchor constant: 0], //mark: settingMenuLayout
|
||||
[parentStack.widthAnchor constraintEqualToAnchor:self.view.widthAnchor constant:-20] // section width adjusted here //mark: settingMenuLayout
|
||||
@@ -404,7 +404,7 @@ BOOL isCustomResolution(CGSize res) {
|
||||
- (void)layoutSections{
|
||||
MenuSectionView *videoSection = [[MenuSectionView alloc] init];
|
||||
videoSection.sectionTitle = [LocalizationHelper localizedStringForKey:@"Video"];
|
||||
if (@available(iOS 13.0, *) && false) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
[videoSection setSectionIcon:[UIImage systemImageNamed:@"airplayvideo"]];
|
||||
} else [videoSection setSectionIcon:nil];
|
||||
|
||||
@@ -417,7 +417,7 @@ BOOL isCustomResolution(CGSize res) {
|
||||
|
||||
MenuSectionView *gesturesSection = [[MenuSectionView alloc] init];
|
||||
gesturesSection.sectionTitle = [LocalizationHelper localizedStringForKey:@"Gestures"];
|
||||
if (@available(iOS 13.0, *) && false) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
[gesturesSection setSectionIcon:[UIImage systemImageNamed:@"hand.draw"]];
|
||||
} else [gesturesSection setSectionIcon:nil];
|
||||
|
||||
@@ -775,7 +775,7 @@ BOOL isCustomResolution(CGSize res) {
|
||||
|
||||
- (void)attachRemoveButtonForStack:(UIStackView* )stack{
|
||||
UIButton* button = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
if (@available(iOS 13.0, *) && false) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:16 weight:UIImageSymbolWeightMedium];
|
||||
[button setImage:[UIImage systemImageNamed:@"minus.circle" withConfiguration:config] forState:UIControlStateNormal];
|
||||
} else {
|
||||
@@ -795,12 +795,15 @@ BOOL isCustomResolution(CGSize res) {
|
||||
}
|
||||
|
||||
- (void)attachInfoTagForStack:(UIStackView* )stack{
|
||||
bool usingTextButton = false;
|
||||
UIButton* button = [UIButton buttonWithType:UIButtonTypeSystem];
|
||||
if (@available(iOS 13.0, *) && false) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:13.5 weight:UIImageSymbolWeightBold];
|
||||
[button setImage:[UIImage systemImageNamed:@"info.circle" withConfiguration:config] forState:UIControlStateNormal];
|
||||
} else {
|
||||
[button setTitle:@"i" forState:UIControlStateNormal];
|
||||
usingTextButton = true;
|
||||
[button setTitle:@"info" forState:UIControlStateNormal];
|
||||
button.titleLabel.font = [UIFont systemFontOfSize:13 weight:UIFontWeightBold];
|
||||
}
|
||||
button.accessibilityIdentifier = @"infoButton";
|
||||
button.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
@@ -811,7 +814,7 @@ BOOL isCustomResolution(CGSize res) {
|
||||
[stack addSubview:button];
|
||||
[NSLayoutConstraint activateConstraints:@[
|
||||
[button.trailingAnchor constraintEqualToAnchor:stack.trailingAnchor constant:-4],
|
||||
[button.topAnchor constraintEqualToAnchor:stack.topAnchor],
|
||||
[button.topAnchor constraintEqualToAnchor:stack.topAnchor constant: usingTextButton ? -2 : 0],
|
||||
]];
|
||||
}
|
||||
|
||||
@@ -1729,7 +1732,7 @@ BOOL isCustomResolution(CGSize res) {
|
||||
for (UIView *subview in view.subviews) {
|
||||
if ([subview isKindOfClass:[UILabel class]]) {
|
||||
UILabel *label = (UILabel *)subview;
|
||||
if (@available(iOS 13.0, *) && false) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
label.layer.filters = nil;
|
||||
label.textColor = [ThemeManager textColor];
|
||||
} else {
|
||||
@@ -1744,7 +1747,7 @@ BOOL isCustomResolution(CGSize res) {
|
||||
for (UIView *subview in view.subviews) {
|
||||
if ([subview isKindOfClass:[UISegmentedControl class]]) {
|
||||
UISegmentedControl *selector = (UISegmentedControl *)subview;
|
||||
if (@available(iOS 13.0, *) && false) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
selector.selectedSegmentTintColor = [ThemeManager appSecondaryColor];
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
@@ -1768,9 +1771,11 @@ BOOL isCustomResolution(CGSize res) {
|
||||
|
||||
- (void)updateTheme{
|
||||
self.view.backgroundColor = [ThemeManager appBackgroundColor];
|
||||
[self updateThemeForLabels:self.view];
|
||||
[self updateThemeForSelectors:self.view];
|
||||
[self updateThemeForSliders:self.view];
|
||||
if (@available(iOS 13.0, *)) {
|
||||
[self updateThemeForLabels:self.view];
|
||||
[self updateThemeForSelectors:self.view];
|
||||
[self updateThemeForSliders:self.view];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -555,7 +555,7 @@
|
||||
#if TARGET_OS_TV
|
||||
[_overlayView setFont:[UIFont systemFontOfSize:24]];
|
||||
#else
|
||||
if (@available(iOS 13.0, *) && false) {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
[_overlayView setFont:[UIFont monospacedSystemFontOfSize:12 weight:UIFontWeightRegular]];
|
||||
} else {
|
||||
[_overlayView setFont:[UIFont systemFontOfSize:12]];// Fallback on earlier versions
|
||||
|
||||
Reference in New Issue
Block a user