diff --git a/Makefile b/Makefile index c461503..15cbe89 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ endif DEBUG=0 FINALPACKAGE=1 ARCHS = arm64 -PACKAGE_VERSION = 2.2 +PACKAGE_VERSION = 2.2.1 TARGET := iphone:clang:latest:11.0 include $(THEOS)/makefiles/common.mk diff --git a/Settings.x b/Settings.x index 1befaa6..1130de0 100644 --- a/Settings.x +++ b/Settings.x @@ -8,8 +8,11 @@ static const NSInteger YTLiteSection = 789; static void resetYTLiteSettings() { NSString *prefsPath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:@"YTLite.plist"]; - NSFileManager *fileManager = [NSFileManager defaultManager]; - [fileManager removeItemAtPath:prefsPath error:nil]; + [[NSFileManager defaultManager] removeItemAtPath:prefsPath error:nil]; + + [[UIApplication sharedApplication] performSelector:@selector(suspend)]; + [NSThread sleepForTimeInterval:1.0]; + exit(0); } NSBundle *YTLiteBundle() { @@ -218,7 +221,8 @@ static YTSettingsSectionItem *createSwitchItem(NSString *title, NSString *titleD createSwitchItem(LOC(@"HideShortsThanks"), LOC(@"HideShortsThanksDesc"), @"hideShortsThanks", &kHideShortsThanks, selfObject), createSwitchItem(LOC(@"HideShortsChannelName"), LOC(@"HideShortsChannelNameDesc"), @"hideShortsChannelName", &kHideShortsChannelName, selfObject), createSwitchItem(LOC(@"HideShortsDescription"), LOC(@"HideShortsDescriptionDesc"), @"hideShortsDescription", &kHideShortsDescription, selfObject), - createSwitchItem(LOC(@"HideShortsAudioTrack"), LOC(@"HideShortsAudioTrackDesc"), @"hideShortsAudioTrack", &kHideShortsAudioTrack, selfObject) + createSwitchItem(LOC(@"HideShortsAudioTrack"), LOC(@"HideShortsAudioTrackDesc"), @"hideShortsAudioTrack", &kHideShortsAudioTrack, selfObject), + createSwitchItem(LOC(@"NoPromotionCards"), LOC(@"NoPromotionCardsDesc"), @"hideShortsPromoCards", &kHideShortsPromoCards, selfObject) ]; YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] initWithNavTitle:LOC(@"Shorts") pickerSectionTitle:nil rows:rows selectedItemIndex:NSNotFound parentResponder:[self parentResponder]]; [settingsViewController pushViewController:picker]; @@ -355,6 +359,22 @@ static YTSettingsSectionItem *createSwitchItem(NSString *title, NSString *titleD return [%c(YTUIUtils) openURL:[NSURL URLWithString:@"https://github.com/LillieH1000"]]; }]; + YTSettingsSectionItem *stalker = [%c(YTSettingsSectionItem) itemWithTitle:@"Stalker" titleDescription:LOC(@"ChineseSimplified") accessibilityIdentifier:nil detailTextBlock:nil selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { + return [%c(YTUIUtils) openURL:[NSURL URLWithString:@"https://github.com/xiangfeidexiaohuo"]]; + }]; + + YTSettingsSectionItem *clement = [%c(YTSettingsSectionItem) itemWithTitle:@"Clement" titleDescription:LOC(@"ChineseTraditional") accessibilityIdentifier:nil detailTextBlock:nil selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { + return [%c(YTUIUtils) openURL:[NSURL URLWithString:@"https://twitter.com/a100900900"]]; + }]; + + YTSettingsSectionItem *balackburn = [%c(YTSettingsSectionItem) itemWithTitle:@"Balackburn" titleDescription:LOC(@"French") accessibilityIdentifier:nil detailTextBlock:nil selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { + return [%c(YTUIUtils) openURL:[NSURL URLWithString:@"https://github.com/Balackburn"]]; + }]; + + YTSettingsSectionItem *decibelios = [%c(YTSettingsSectionItem) itemWithTitle:@"DeciBelioS" titleDescription:LOC(@"Spanish") accessibilityIdentifier:nil detailTextBlock:nil selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { + return [%c(YTUIUtils) openURL:[NSURL URLWithString:@"https://github.com/Deci8BelioS"]]; + }]; + YTSettingsSectionItem *dayanch96 = [%c(YTSettingsSectionItem) itemWithTitle:@"Dayanch96" titleDescription:LOC(@"Developer") accessibilityIdentifier:nil detailTextBlock:nil selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { return [%c(YTUIUtils) openURL:[NSURL URLWithString:@"https://github.com/Dayanch96/"]]; }]; @@ -362,7 +382,6 @@ static YTSettingsSectionItem *createSwitchItem(NSString *title, NSString *titleD YTSettingsSectionItem *reset = [%c(YTSettingsSectionItem) itemWithTitle:LOC(@"ResetSettings") titleDescription:nil accessibilityIdentifier:nil detailTextBlock:nil selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { YTAlertView *alertView = [%c(YTAlertView) confirmationDialogWithAction:^{ resetYTLiteSettings(); - exit(0); } actionTitle:LOC(@"Yes") cancelTitle:LOC(@"No")]; @@ -378,7 +397,7 @@ static YTSettingsSectionItem *createSwitchItem(NSString *title, NSString *titleD return @(OS_STRINGIFY(TWEAK_VERSION)); } selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) { - NSArray *rows = @[ps, miro, lillie, dayanch96, space, createSwitchItem(LOC(@"Advanced"), nil, @"advancedMode", &kAdvancedMode, selfObject), reset]; + NSArray *rows = @[ps, miro, lillie, dayanch96, stalker, clement, balackburn, decibelios, space, createSwitchItem(LOC(@"Advanced"), nil, @"advancedMode", &kAdvancedMode, selfObject), reset]; YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] initWithNavTitle:LOC(@"About") pickerSectionTitle:LOC(@"Credits") rows:rows selectedItemIndex:NSNotFound parentResponder:[self parentResponder]]; [settingsViewController pushViewController:picker]; @@ -395,4 +414,27 @@ static YTSettingsSectionItem *createSwitchItem(NSString *title, NSString *titleD return; } %orig; } -%end \ No newline at end of file +%end + +%ctor { + if (!kAdvancedModeReminder && !kAdvancedMode) { + NSString *prefsPath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:@"YTLite.plist"]; + NSMutableDictionary *prefs = [NSMutableDictionary dictionaryWithContentsOfFile:prefsPath]; + [prefs setObject:@(YES) forKey:@"advancedModeReminder"]; + [prefs writeToFile:prefsPath atomically:NO]; + CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("com.dvntm.ytlite.prefschanged"), NULL, NULL, YES); + + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + YTAlertView *alertView = [%c(YTAlertView) confirmationDialogWithAction:^{ + [prefs setObject:@(YES) forKey:@"advancedMode"]; + [prefs writeToFile:prefsPath atomically:NO]; + CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("com.dvntm.ytlite.prefschanged"), NULL, NULL, YES); + } + actionTitle:LOC(@"Yes") + cancelTitle:LOC(@"No")]; + alertView.title = @"YTLite"; + alertView.subtitle = [NSString stringWithFormat:LOC(@"AdvancedModeReminder"), @"YTLite", LOC(@"Version"), LOC(@"Advanced")]; + [alertView show]; + }); + } +} \ No newline at end of file diff --git a/YTLite.h b/YTLite.h index 1c309c7..0eb015e 100644 --- a/YTLite.h +++ b/YTLite.h @@ -77,6 +77,7 @@ BOOL kHideShortsThanks; BOOL kHideShortsChannelName; BOOL kHideShortsDescription; BOOL kHideShortsAudioTrack; +BOOL kHideShortsPromoCards; BOOL kRemoveLabels; BOOL kReExplore; BOOL kRemoveShorts; @@ -86,6 +87,7 @@ BOOL kRemoveLibrary; BOOL kRemovePlayNext; BOOL kNoContinueWatching; BOOL kAdvancedMode; +BOOL kAdvancedModeReminder; int kPivotIndex; @interface YTSettingsSectionItemManager (Custom) @@ -110,6 +112,12 @@ int kPivotIndex; @property (nonatomic, strong) YTQTMButton *searchButton; @end +@interface YTSearchView : UIView +@end + +@interface YTSearchBarView : UIView +@end + @interface YTNavigationBarTitleView : UIView @end @@ -151,6 +159,9 @@ int kPivotIndex; @interface YTReelWatchHeaderView : UIView @end +@interface YTELMView : UIView +@end + @interface MLHAMQueuePlayer : NSObject @property id playerEventCenter; -(void)setRate:(float)rate; diff --git a/YTLite.x b/YTLite.x index 3d18502..ea1f43b 100644 --- a/YTLite.x +++ b/YTLite.x @@ -33,10 +33,11 @@ if (self.hasCompatibilityOptions && self.compatibilityOptions.hasAdLoggingData && kNoAds) return nil; NSString *description = [self description]; - if (([description containsString:@"brand_promo"] + if ((([description containsString:@"brand_promo"] || [description containsString:@"product_carousel"] || [description containsString:@"product_engagement_panel"] || [description containsString:@"product_item"]) && kNoAds) + || ([description containsString:@"inline_shorts"] && kHideShorts)) return [NSData data]; return %orig; } @@ -114,6 +115,32 @@ } %end +%hook YTSearchView +- (void)layoutSubviews { + %orig; + + if (kNoVoiceSearchButton && self.subviews.count > 0) { + UIView *firstSubview = self.subviews.firstObject; + if (firstSubview.subviews.count > 1) { + UIView *subview1 = firstSubview.subviews[1]; + [subview1 setValue:@(1) forKey:@"hidden"]; + } + } +} +%end + +%hook YTSearchBarView +- (void)layoutSubviews { + %orig; + + if (kNoVoiceSearchButton && ![self.superview isKindOfClass:objc_lookUpClass("YTNavigationBarTitleView")]) { + CGRect frame = self.frame; + frame.size.width += 20; + self.frame = frame; + } +} +%end + // Hide YouTube Logo %hook YTNavigationBarTitleView - (void)layoutSubviews { %orig; if (kNoYTLogo && self.subviews.count > 1 && [self.subviews[1].accessibilityIdentifier isEqualToString:@"id.yoodle.logo"]) self.subviews[1].hidden = YES; } @@ -343,6 +370,21 @@ } %end +// Fit Shorts Button Labels For Localizations +%hook YTReelPlayerButton +- (void)layoutSubviews { + %orig; + + for (UIView *subview in self.subviews) { + if ([subview isKindOfClass:[UILabel class]]) { + UILabel *label = (UILabel *)subview; + label.adjustsFontSizeToFitWidth = YES; + break; + } + } +} +%end + // Fix Playlist Mini-bar Height For Small Screens %hook YTPlaylistMiniBarView - (void)setFrame:(CGRect)frame { @@ -453,9 +495,21 @@ - (void)layoutSubviews { %orig; if (kHideShortsDescription && [self.subviews[2].accessibilityIdentifier isEqualToString:@"id.reels_smv_player_title_label"]) self.subviews[2].hidden = YES; - if (kHideShortsThanks && [self.subviews[self.subviews.count - 3].accessibilityIdentifier isEqualToString:@"id.elements.components.suggested_action"]) self.subviews[self.subviews.count - 3].hidden = YES; + if (kHideShortsThanks && [self.subviews[self.subviews.count - 3].accessibilityIdentifier isEqualToString:@"id.elements.components.suggested_action"]) self.subviews[self.subviews.count - 3].hidden = YES; // Might be useful for older versions if (kHideShortsChannelName) self.subviews[self.subviews.count - 2].hidden = YES; if (kHideShortsAudioTrack) self.subviews.lastObject.hidden = YES; + for (UIView *subview in self.subviews) { + if (kHideShortsPromoCards && [NSStringFromClass([subview class]) isEqualToString:@"YTBadge"]) { + subview.hidden = YES; + } + } +} +%end + +%hook YTELMView +- (void)layoutSubviews { + %orig; + if (kHideShortsThanks && [self.subviews.firstObject.accessibilityIdentifier isEqualToString:@"id.elements.components.suggested_action"]) self.subviews.firstObject.hidden = YES; } %end @@ -680,6 +734,7 @@ static void reloadPrefs() { kHideShortsChannelName = [prefs[@"hideShortsChannelName"] boolValue] ?: NO; kHideShortsDescription = [prefs[@"hideShortsDescription"] boolValue] ?: NO; kHideShortsAudioTrack = [prefs[@"hideShortsAudioTrack"] boolValue] ?: NO; + kHideShortsPromoCards = [prefs[@"hideShortsPromoCards"] boolValue] ?: NO; kRemoveLabels = [prefs[@"removeLabels"] boolValue] ?: NO; kReExplore = [prefs[@"reExplore"] boolValue] ?: NO; kRemoveShorts = [prefs[@"removeShorts"] boolValue] ?: NO; @@ -690,6 +745,7 @@ static void reloadPrefs() { kNoContinueWatching = [prefs[@"noContinueWatching"] boolValue] ?: NO; kPivotIndex = (prefs[@"pivotIndex"] != nil) ? [prefs[@"pivotIndex"] intValue] : 0; kAdvancedMode = [prefs[@"advancedMode"] boolValue] ?: NO; + kAdvancedModeReminder = [prefs[@"advancedModeReminder"] boolValue] ?: NO; NSDictionary *newSettings = @{ @"noAds" : @(kNoAds), @@ -742,6 +798,7 @@ static void reloadPrefs() { @"hideShortsChannelName" : @(kHideShortsChannelName), @"hideShortsDescription" : @(kHideShortsDescription), @"hideShortsAudioTrack" : @(kHideShortsAudioTrack), + @"hideShortsPromoCards" : @(kHideShortsPromoCards), @"removeLabels" : @(kRemoveLabels), @"reExplore" : @(kReExplore), @"removeShorts" : @(kRemoveShorts), @@ -751,7 +808,8 @@ static void reloadPrefs() { @"removePlayNext" : @(kRemovePlayNext), @"noContinueWatching" : @(kNoContinueWatching), @"pivotIndex" : @(kPivotIndex), - @"advancedMode" : @(kAdvancedMode) + @"advancedMode" : @(kAdvancedMode), + @"advancedModeReminder" : @(kAdvancedModeReminder) }; if (![newSettings isEqualToDictionary:prefs]) [newSettings writeToFile:path atomically:NO]; diff --git a/layout/Library/Application Support/.DS_Store b/layout/Library/Application Support/.DS_Store deleted file mode 100644 index fbc2516..0000000 Binary files a/layout/Library/Application Support/.DS_Store and /dev/null differ diff --git a/layout/Library/Application Support/YTLite.bundle/en.lproj/Localizable.strings b/layout/Library/Application Support/YTLite.bundle/en.lproj/Localizable.strings index 7cdde4d..9c480da 100644 --- a/layout/Library/Application Support/YTLite.bundle/en.lproj/Localizable.strings +++ b/layout/Library/Application Support/YTLite.bundle/en.lproj/Localizable.strings @@ -141,7 +141,12 @@ "About" = "About"; "Credits" = "Credits"; "Developer" = "YTLite developer"; +"ChineseSimplified" = "Chinese (Simplified) localization"; +"ChineseTraditional" = "Chinese (Traditional) localization"; +"French" = "French localization"; +"Spanish" = "Spanish localization"; "Advanced" = "Advanced mode"; +"AdvancedModeReminder" = "Would you like to activate Advanced mode for YTLite?\n\nThis mode provides more than 50 additional options to customize and optimize your YouTube experience. You can enable/disable it later from Settings → %@ → %@ → %@."; "ResetSettings" = "Reset YTLite settings"; "ResetMessage" = "This option will reset YTLite settings to default and close YouTube.\n\nAre you sure you want to continue?"; "Yes" = "Yes"; diff --git a/layout/Library/Application Support/YTLite.bundle/es.lproj/Localizable.strings b/layout/Library/Application Support/YTLite.bundle/es.lproj/Localizable.strings index 1d879ab..db57713 100644 --- a/layout/Library/Application Support/YTLite.bundle/es.lproj/Localizable.strings +++ b/layout/Library/Application Support/YTLite.bundle/es.lproj/Localizable.strings @@ -141,7 +141,12 @@ "About" = "Acerca de"; "Credits" = "Créditos"; "Developer" = "Desarrollador de YTLite"; +"ChineseSimplified" = "Chinese (Simplified) localization"; +"ChineseTraditional" = "Chinese (Traditional) localization"; +"French" = "French localization"; +"Spanish" = "Spanish localization"; "Advanced" = "Modo avanzado"; +"AdvancedModeReminder" = "Would you like to activate Advanced mode for YTLite?\n\nThis mode provides more than 50 additional options to customize and optimize your YouTube experience. You can enable/disable it later from Settings → %@ → %@ → %@."; "ResetSettings" = "Restablecer configuración de YTLite"; "ResetMessage" = "Esta opción restablecerá la configuración de YTLite a los valores predeterminados y cerrará YouTube.\n\n¿Estás seguro de que deseas continuar?"; "Yes" = "Sí"; diff --git a/layout/Library/Application Support/YTLite.bundle/fr.lproj/Localizable.strings b/layout/Library/Application Support/YTLite.bundle/fr.lproj/Localizable.strings index 1277f8c..d1167d9 100644 --- a/layout/Library/Application Support/YTLite.bundle/fr.lproj/Localizable.strings +++ b/layout/Library/Application Support/YTLite.bundle/fr.lproj/Localizable.strings @@ -143,7 +143,12 @@ "About" = "À propos"; "Credits" = "Crédits"; "Developer" = "Développeur YTLite"; +"ChineseSimplified" = "Chinese (Simplified) localization"; +"ChineseTraditional" = "Chinese (Traditional) localization"; +"French" = "French localization"; +"Spanish" = "Spanish localization"; "Advanced" = "Mode avancé"; +"AdvancedModeReminder" = "Would you like to activate Advanced mode for YTLite?\n\nThis mode provides more than 50 additional options to customize and optimize your YouTube experience. You can enable/disable it later from Settings → %@ → %@ → %@."; "ResetSettings" = "Réinitialiser les paramètres YTLite"; "ResetMessage" = "Cette option réinitialisera les paramètres YTLite par défaut et fermera YouTube.\n\nÊtes-vous sûr de vouloir continuer ?"; "Yes" = "Oui"; diff --git a/layout/Library/Application Support/YTLite.bundle/ru.lproj/Localizable.strings b/layout/Library/Application Support/YTLite.bundle/ru.lproj/Localizable.strings index c28e23e..e1ec0c0 100644 --- a/layout/Library/Application Support/YTLite.bundle/ru.lproj/Localizable.strings +++ b/layout/Library/Application Support/YTLite.bundle/ru.lproj/Localizable.strings @@ -141,7 +141,12 @@ "About" = "О твике"; "Credits" = "Авторы"; "Developer" = "Разработчик твика"; +"ChineseSimplified" = "Китайская (упрощенная) локализация"; +"ChineseTraditional" = "Китайская (традиционная) локализация"; +"French" = "Французская локализация"; +"Spanish" = "Испанская локализация"; "Advanced" = "Расширенный режим"; +"AdvancedModeReminder" = "Хотите ли вы активировать расширенный режим настроек YTLite?\n\nДанный режим добавляет более 50 опций для тонкой настройки YouTube. Вы всегда сможете включить/отключить расширенный режим перейдя в Настройки → %@ → %@ → %@."; "ResetSettings" = "Сбросить настройки твика"; "ResetMessage" = "Данное действие сбросит настройки YTLite к значениям по умолчанию и закроет YouTube.\n\nУверены, что хотите продолжить?"; "Yes" = "Да"; diff --git a/layout/Library/Application Support/YTLite.bundle/zh-Hans.lproj/Localizable.strings b/layout/Library/Application Support/YTLite.bundle/zh-Hans.lproj/Localizable.strings index c165c84..5e42eee 100644 --- a/layout/Library/Application Support/YTLite.bundle/zh-Hans.lproj/Localizable.strings +++ b/layout/Library/Application Support/YTLite.bundle/zh-Hans.lproj/Localizable.strings @@ -141,8 +141,13 @@ "About" = "关于"; "Credits" = "信息"; "Developer" = "YTLite开发者"; +"ChineseSimplified" = "Chinese (Simplified) localization"; +"ChineseTraditional" = "Chinese (Traditional) localization"; +"French" = "French localization"; +"Spanish" = "Spanish localization"; "Advanced" = "高级模式"; +"AdvancedModeReminder" = "Would you like to activate Advanced mode for YTLite?\n\nThis mode provides more than 50 additional options to customize and optimize your YouTube experience. You can enable/disable it later from Settings → %@ → %@ → %@."; "ResetSettings" = "重置YTLite设置"; "ResetMessage" = "此选项会将YTLite设置重置为默认值并关闭YouTube。\n\n确定要继续吗?"; "Yes" = "是"; -"No" = "不"; +"No" = "不"; \ No newline at end of file diff --git a/layout/Library/Application Support/YTLite.bundle/zh-Hant.lproj/Localizable.strings b/layout/Library/Application Support/YTLite.bundle/zh-Hant.lproj/Localizable.strings index 157fbfa..94d7ef0 100644 --- a/layout/Library/Application Support/YTLite.bundle/zh-Hant.lproj/Localizable.strings +++ b/layout/Library/Application Support/YTLite.bundle/zh-Hant.lproj/Localizable.strings @@ -141,7 +141,12 @@ "About" = "關於"; "Credits" = "貢獻"; "Developer" = "YTLite開發者"; +"ChineseSimplified" = "Chinese (Simplified) localization"; +"ChineseTraditional" = "Chinese (Traditional) localization"; +"French" = "French localization"; +"Spanish" = "Spanish localization"; "Advanced" = "進階模式"; +"AdvancedModeReminder" = "Would you like to activate Advanced mode for YTLite?\n\nThis mode provides more than 50 additional options to customize and optimize your YouTube experience. You can enable/disable it later from Settings → %@ → %@ → %@."; "ResetSettings" = "重置YTLite設定"; "ResetMessage" = "這個選項會將YTLite重置為預設值,並關閉Youtube\n\n您確定要繼續嗎?"; "Yes" = "是"; diff --git a/packages/com.dvntm.ytlite_2.2.1_iphoneos-arm.deb b/packages/com.dvntm.ytlite_2.2.1_iphoneos-arm.deb new file mode 100644 index 0000000..957cebb Binary files /dev/null and b/packages/com.dvntm.ytlite_2.2.1_iphoneos-arm.deb differ diff --git a/packages/com.dvntm.ytlite_2.2.1_iphoneos-arm64.deb b/packages/com.dvntm.ytlite_2.2.1_iphoneos-arm64.deb new file mode 100644 index 0000000..4807340 Binary files /dev/null and b/packages/com.dvntm.ytlite_2.2.1_iphoneos-arm64.deb differ