simulates ios 12

This commit is contained in:
TrueZhuanjia
2025-06-07 18:25:45 +08:00
parent 68f21fa8e5
commit a64a29ce07
13 changed files with 42 additions and 42 deletions
+10 -10
View File
@@ -187,7 +187,7 @@ static const float REFRESH_CYCLE = 2.0f;
self.hostIconView = [[UIImageView alloc] init];
self.hostIconView.translatesAutoresizingMaskIntoConstraints = NO;
self.hostIconView.contentMode = UIViewContentModeScaleAspectFit;
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
self.hostIconView.image = [UIImage systemImageNamed:@"display"];
} else {
self.hostIconView.image = [UIImage imageNamed:@"Computer"];
@@ -225,7 +225,7 @@ static const float REFRESH_CYCLE = 2.0f;
// lockIcon
lockIconView =[[UIImageView alloc] init];
lockIconView.translatesAutoresizingMaskIntoConstraints = NO;
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
lockIconView.image = [UIImage systemImageNamed:@"lock.fill"];
} else {
// lockIconView.image = [UIImage imageNamed:@"Computer"];
@@ -308,7 +308,7 @@ static const float REFRESH_CYCLE = 2.0f;
self.launchButton.tintColor = [UIColor whiteColor];
[self.launchButton addTarget:self action:@selector(launchButtonTapped) forControlEvents:UIControlEventPrimaryActionTriggered];
[self addSubview:self.launchButton];
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:self.launchButton.frame.size.height*_sizeFactor];
[self.launchButton setImage:[UIImage systemImageNamed:@"play.fill" withConfiguration:config] forState:UIControlStateNormal];
@@ -334,7 +334,7 @@ static const float REFRESH_CYCLE = 2.0f;
[self.pairButton setTitle:[LocalizationHelper localizedStringForKey:@" Pair with PIN"] forState:UIControlStateNormal];
[self.pairButton setTitleColor:defaultBlue forState:UIControlStateNormal]; // theme
self.pairButton.titleLabel.font = [UIFont boldSystemFontOfSize:16*_sizeFactor];
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:self.pairButton.frame.size.height/3.5*_sizeFactor weight:UIImageSymbolWeightBold];
UIImage *templateImage = [UIImage systemImageNamed:@"lock.open.fill" withConfiguration:config];
UIImage *coloredImage = [templateImage imageWithTintColor:defaultBlue renderingMode:UIImageRenderingModeAlwaysOriginal];
@@ -475,7 +475,7 @@ static const float REFRESH_CYCLE = 2.0f;
- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
[super traitCollectionDidChange:previousTraitCollection];
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
if ([self.traitCollection hasDifferentColorAppearanceComparedToTraitCollection:previousTraitCollection]) {
[self updateTheme:self.traitCollection.userInterfaceStyle];
}
@@ -522,7 +522,7 @@ static const float REFRESH_CYCLE = 2.0f;
_wakeupButton.hidden = YES;
[_appButton setTitleColor:defaultBlue forState:UIControlStateNormal]; // theme
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:self.launchButton.frame.size.height/4*_sizeFactor];
[self.launchButton setImage:[UIImage systemImageNamed:@"play.fill" withConfiguration:config] forState:UIControlStateNormal];
} else {
@@ -547,7 +547,7 @@ static const float REFRESH_CYCLE = 2.0f;
_statusLabel.textColor = [ThemeManager textColorGray];
_statusLabel.text = @"Offline";
_statusIcon.tintColor = [ThemeManager textColorGray];
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
_statusIcon.image = [UIImage systemImageNamed:@"exclamationmark.triangle.fill"];
} else {
// Fallback on earlier versions
@@ -559,7 +559,7 @@ static const float REFRESH_CYCLE = 2.0f;
_pairButton.hidden = YES;
_wakeupButton.hidden = NO;
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:self.wakeupButton.frame.size.height/3.2*_sizeFactor weight:UIImageSymbolWeightBold];
UIImage *templateImage = [UIImage systemImageNamed:@"power" withConfiguration:config];
UIImage *coloredImage = [templateImage imageWithTintColor:defaultBlue renderingMode:UIImageRenderingModeAlwaysOriginal];
@@ -579,7 +579,7 @@ static const float REFRESH_CYCLE = 2.0f;
_statusLabel.textColor = [ThemeManager textColorGray];
_statusLabel.text = @"Detecting...";
_statusIcon.tintColor = [ThemeManager textColorGray];
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
_statusIcon.image = [UIImage systemImageNamed:@"antenna.radiowaves.left.and.right"];
} else {
// Fallback on earlier versions
@@ -593,7 +593,7 @@ static const float REFRESH_CYCLE = 2.0f;
_wakeupButton.hidden = NO;
[_wakeupButton setTitleColor:[ThemeManager textColorGray] forState:UIControlStateNormal]; // theme
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:self.wakeupButton.frame.size.height/3.2*_sizeFactor weight:UIImageSymbolWeightBold];
UIImage *templateImage = [UIImage systemImageNamed:@"power" withConfiguration:config];
UIImage *coloredImage = [templateImage imageWithTintColor:[ThemeManager textColorGray] renderingMode:UIImageRenderingModeAlwaysOriginal];
@@ -161,7 +161,7 @@ static CGRect streamViewBounds;
if (fileData && !error) {
// 3. 成功读取
NSSet *classes = [NSSet setWithObjects: [NSMutableData class], [NSMutableArray class], nil];
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
// 在 iOS 13 及以上使用 unarchivedObjectOfClasses
profilesEncoded = [NSKeyedUnarchiver unarchivedObjectOfClasses:classes fromData:fileData error:&error];
} else {
@@ -402,7 +402,7 @@ static CGRect streamViewBounds;
- (OnScreenButtonState *)unarchiveButtonStateEncoded:(NSData *)data {
OnScreenButtonState* buttonState;
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
// 在 iOS 13 及以上使用 unarchivedObjectOfClasses
buttonState = [NSKeyedUnarchiver unarchivedObjectOfClasses:[NSSet setWithObjects:[NSString class], [OnScreenButtonState class], nil]
fromData:data
+1 -1
View File
@@ -1032,7 +1032,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
#endif
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
// Disable the 3 finger tap gestures that trigger the copy/paste/undo toolbar on iOS 13+
return gestureRecognizer.name == nil || ![gestureRecognizer.name hasPrefix:@"kbProductivity."];
}
+2 -2
View File
@@ -83,7 +83,7 @@
// 切换按钮
_toggleButton = [UIButton buttonWithType:UIButtonTypeSystem];
_toggleArea = [UIButton buttonWithType:UIButtonTypeSystem];
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:_headerViewHeight*0.31 weight:UIImageSymbolWeightMedium];
[_toggleButton setImage:[UIImage systemImageNamed:@"chevron.left" withConfiguration:config] forState:UIControlStateNormal];
} else {
@@ -192,7 +192,7 @@
#pragma mark - Public Methods
- (void)setSectionIcon:(UIImage *)icon {
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithWeight:UIImageSymbolWeightSemibold];
_iconImageView.image = [icon imageWithConfiguration:config];
+1 -1
View File
@@ -14,7 +14,7 @@ static UIUserInterfaceStyle _privateUserInterfaceStyle = UIUserInterfaceStyleUns
static UIUserInterfaceStyle _userInterfaceStyle;
+ (UIColor *)getUIStyle{
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
UITraitCollection *traitCollection = [UIScreen mainScreen].traitCollection;
if(_privateUserInterfaceStyle == UIUserInterfaceStyleUnspecified) {
_userInterfaceStyle = traitCollection.userInterfaceStyle;
+1 -1
View File
@@ -49,7 +49,7 @@ static UIImage* noImage;
// Use UIContextMenuInteraction on iOS 13.0+ and a standard UILongPressGestureRecognizer
// for tvOS devices and iOS prior to 13.0.
#if !TARGET_OS_TV
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
UIContextMenuInteraction* rightClickInteraction = [[UIContextMenuInteraction alloc] initWithDelegate:self];
[self addInteraction:rightClickInteraction];
}
+1 -1
View File
@@ -127,7 +127,7 @@ static const int LABEL_DY = 20;
// Use UIContextMenuInteraction on iOS 13.0+ and a standard UILongPressGestureRecognizer
// for tvOS devices and iOS prior to 13.0.
#if !TARGET_OS_TV
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
UIContextMenuInteraction* rightClickInteraction = [[UIContextMenuInteraction alloc] initWithDelegate:self];
[self addInteraction:rightClickInteraction];
}
@@ -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, *)) {
if (@available(iOS 13.0, *) && false) {
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, *)) {
if (@available(iOS 13.0, *) && false) {
// 在 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, *)) {
if (@available(iOS 13.0, *) && false) {
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, *)) {
if (@available(iOS 13.0, *) && false) {
navBarAppearanceScroll.titleTextAttributes = navBarAppearanceStandard.titleTextAttributes = @{
NSFontAttributeName: [UIFont systemFontOfSize:24 weight:UIFontWeightSemibold],
NSForegroundColorAttributeName: [ThemeManager textColor] // 可选,设置标题颜色
@@ -165,7 +165,7 @@ static NSMutableSet* hostList;
self.title = [LocalizationHelper localizedStringForKey: @"Hosts" ];
//self.title = nil;
}
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
[self applyNavBarAppearance];
} else {
// Fallback on earlier versions
@@ -1280,7 +1280,7 @@ static NSMutableSet* hostList;
// 设置图标(SF Symbol)
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:17 weight:UIImageSymbolWeightMedium];
UIImage *image = [UIImage systemImageNamed:@"plus.circle" withConfiguration:config];
[button setImage:image forState:UIControlStateNormal];
@@ -1320,7 +1320,7 @@ static NSMutableSet* hostList;
button.clipsToBounds = YES;
// 设置图标(SF Symbol)
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:buttonHeight*0.85 weight:UIImageSymbolWeightRegular];
UIImage *image = [UIImage systemImageNamed:@"questionmark.circle" withConfiguration:config];
[button setImage:image forState:UIControlStateNormal];
@@ -1380,7 +1380,7 @@ static NSMutableSet* hostList;
}
- (void)setupNavBar{
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
navBarAppearanceStandard = [[UINavigationBarAppearance alloc] init];
[navBarAppearanceStandard configureWithOpaqueBackground]; // 不透明
navBarAppearanceStandard.backgroundColor =[ThemeManager appBackgroundColor];; // 设置你需要的背景色
@@ -1419,7 +1419,7 @@ static NSMutableSet* hostList;
[_settingsButton setTarget:self.revealViewController];
[_settingsButton setAction:@selector(revealToggle:)];
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
[_settingsButton setTitle:nil];
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:23 weight:UIImageSymbolWeightMedium ];
UIImage *image = [[UIImage systemImageNamed:@"sidebar.left" withConfiguration:config] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
@@ -911,7 +911,7 @@ const int FrontViewPositionNone = 0xff;
_dockedNavBar.translatesAutoresizingMaskIntoConstraints = NO;
_dockedNavBar.userInteractionEnabled = YES;
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
UINavigationBarAppearance *navBarAppearanceStandard = [[UINavigationBarAppearance alloc] init];
[navBarAppearanceStandard configureWithOpaqueBackground]; // 不透明
navBarAppearanceStandard.backgroundColor =[ThemeManager appBackgroundColor];; // 设置你需要的背景色
@@ -961,7 +961,7 @@ const int FrontViewPositionNone = 0xff;
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] init];
[backButton setTarget:self];
[backButton setAction:@selector(foldRearView)];
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
[backButton setTitle:nil];
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:23 weight:UIImageSymbolWeightMedium ];
UIImage *image = [[UIImage systemImageNamed:@"sidebar.left" withConfiguration:config] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
@@ -979,7 +979,7 @@ const int FrontViewPositionNone = 0xff;
_disconnectButton = [[UIBarButtonItem alloc] init];
[_disconnectButton setTarget:self];
[_disconnectButton setAction:@selector(disconnectRemoteSession)];
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
[_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, *)) {
if (@available(iOS 13.0, *) && false) {
[_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, *)) {
if (@available(iOS 13.0, *) && false) {
// 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, *)) {
if (@available(iOS 13.0, *) && false) {
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, *)) {
if (@available(iOS 13.0, *) && false) {
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, *)) {
if (@available(iOS 13.0, *) && false) {
UIAction* action1 = [self getFavoriteMenuAction];
if (@available(iOS 14.0, *)) _moreButton.menu = [UIMenu menuWithTitle:@"" children:@[action1]];
}
@@ -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, *)) {
if (@available(iOS 13.0, *) && false) {
[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, *)) {
if (@available(iOS 13.0, *) && false) {
[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, *)) {
if (@available(iOS 13.0, *) && false) {
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:16 weight:UIImageSymbolWeightMedium];
[button setImage:[UIImage systemImageNamed:@"minus.circle" withConfiguration:config] forState:UIControlStateNormal];
} else {
@@ -796,7 +796,7 @@ BOOL isCustomResolution(CGSize res) {
- (void)attachInfoTagForStack:(UIStackView* )stack{
UIButton* button = [UIButton buttonWithType:UIButtonTypeSystem];
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:13.5 weight:UIImageSymbolWeightBold];
[button setImage:[UIImage systemImageNamed:@"info.circle" withConfiguration:config] forState:UIControlStateNormal];
} else {
@@ -1729,7 +1729,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, *)) {
if (@available(iOS 13.0, *) && false) {
label.layer.filters = nil;
label.textColor = [ThemeManager textColor];
} else {
@@ -1744,7 +1744,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, *)) {
if (@available(iOS 13.0, *) && false) {
selector.selectedSegmentTintColor = [ThemeManager appSecondaryColor];
} else {
// Fallback on earlier versions
@@ -555,7 +555,7 @@
#if TARGET_OS_TV
[_overlayView setFont:[UIFont systemFontOfSize:24]];
#else
if (@available(iOS 13.0, *)) {
if (@available(iOS 13.0, *) && false) {
[_overlayView setFont:[UIFont monospacedSystemFontOfSize:12 weight:UIFontWeightRegular]];
} else {
[_overlayView setFont:[UIFont systemFontOfSize:12]];// Fallback on earlier versions