Merge pull request #920 from arichorn/patch-3

[Feature Request] iPhone Layout
This commit is contained in:
Nguyễn Đạt 2023-02-05 13:19:01 +07:00 committed by GitHub
commit 4d5778ac13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 126 additions and 20 deletions

View file

@ -98,7 +98,7 @@ extern NSBundle *uYouPlusBundle();
return YES;
}
settingItemId:0],
];
];
YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] initWithNavTitle:LOC(@"VIDEO_PLAYER_OPTIONS") pickerSectionTitle:nil rows:rows selectedItemIndex:NSNotFound parentResponder:[self parentResponder]];
[settingsViewController pushViewController:picker];
return YES;
@ -217,8 +217,7 @@ extern NSBundle *uYouPlusBundle();
return YES;
}
settingItemId:0],
];
];
YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] initWithNavTitle:LOC(@"VIDEO_CONTROLS_OVERLAY_OPTIONS") pickerSectionTitle:nil rows:rows selectedItemIndex:NSNotFound parentResponder:[self parentResponder]];
[settingsViewController pushViewController:picker];
return YES;
@ -297,7 +296,7 @@ extern NSBundle *uYouPlusBundle();
return YES;
}
settingItemId:0],
];
];
YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] initWithNavTitle:LOC(@"SHORTS_CONTROLS_OVERLAY_OPTIONS") pickerSectionTitle:nil rows:rows selectedItemIndex:NSNotFound parentResponder:[self parentResponder]];
[settingsViewController pushViewController:picker];
return YES;
@ -424,7 +423,22 @@ extern NSBundle *uYouPlusBundle();
return YES;
}
settingItemId:0],
];
];
if (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad) {
YTSettingsSectionItem *ipadItem = [YTSettingsSectionItemClass switchItemWithTitle:LOC(@"IPHONE_LAYOUT")
titleDescription:LOC(@"IPHONE_LAYOUT_DESC")
accessibilityIdentifier:nil
switchOn:IsEnabled(@"iPhoneLayout_enabled")
switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) {
[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:@"iPhoneLayout_enabled"];
return YES;
}
settingItemId:0];
rows = [rows arrayByAddingObject:ipadItem];
}
YTSettingsPickerViewController *picker = [[%c(YTSettingsPickerViewController) alloc] initWithNavTitle:LOC(@"MISCELLANEOUS") pickerSectionTitle:nil rows:rows selectedItemIndex:NSNotFound parentResponder:[self parentResponder]];
[settingsViewController pushViewController:picker];
return YES;

View file

@ -120,3 +120,6 @@
"YT_RE_EXPLORE" = "استبدال تبويب Shorts بتبويب Explore (أداة YTReExplore)";
"YT_RE_EXPLORE_DESC" = " تتطلب إغلاق التطبيق وإعادة فتحه.";
"IPHONE_LAYOUT" = "iPhone Layout";
"IPHONE_LAYOUT_DESC" = "Toggle to use the iPhone Layout. App restart is required.";

View file

@ -119,4 +119,7 @@
"NEW_MINIPLAYER_STYLE_DESC" = "Je potřeba restart aplikace.";
"YT_RE_EXPLORE" = "Nahradit záložku Shorts tab záložkou Explore (YTReExplore)";
"YT_RE_EXPLORE_DESC" = "Je potřeba restart aplikace.";
"YT_RE_EXPLORE_DESC" = "Je potřeba restart aplikace.";
"IPHONE_LAYOUT" = "iPhone Layout";
"IPHONE_LAYOUT_DESC" = "Toggle to use the iPhone Layout. App restart is required.";

View file

@ -119,4 +119,7 @@
"NEW_MINIPLAYER_STYLE_DESC" = "App-Neustart erforderlich!";
"YT_RE_EXPLORE" = "Shorts-Tab durch Entdecken-Tab ersetzen (YTReExplore)";
"YT_RE_EXPLORE_DESC" = "App-Neustart erforderlich!";
"YT_RE_EXPLORE_DESC" = "App-Neustart erforderlich!";
"IPHONE_LAYOUT" = "iPhone Layout";
"IPHONE_LAYOUT_DESC" = "Toggle to use the iPhone Layout. App restart is required.";

View file

@ -119,4 +119,7 @@
"NEW_MINIPLAYER_STYLE_DESC" = "Απαιτείται επανεκκίνηση της εφαρμογής.";
"YT_RE_EXPLORE" = "Αντικατάσταση της καρτέλας Shorts με την καρτέλα Explore (YTReExplore)";
"YT_RE_EXPLORE_DESC" = "Απαιτείται επανεκκίνηση της εφαρμογής.";
"YT_RE_EXPLORE_DESC" = "Απαιτείται επανεκκίνηση της εφαρμογής.";
"IPHONE_LAYOUT" = "iPhone Layout";
"IPHONE_LAYOUT_DESC" = "Toggle to use the iPhone Layout. App restart is required.";

View file

@ -119,4 +119,7 @@
"NEW_MINIPLAYER_STYLE_DESC" = "App restart is required.";
"YT_RE_EXPLORE" = "Replace Shorts tab with Explore tab (YTReExplore)";
"YT_RE_EXPLORE_DESC" = "App restart is required.";
"YT_RE_EXPLORE_DESC" = "App restart is required.";
"IPHONE_LAYOUT" = "iPhone Layout";
"IPHONE_LAYOUT_DESC" = "Toggle to use the iPhone Layout. App restart is required.";

View file

@ -119,4 +119,7 @@
"NEW_MINIPLAYER_STYLE_DESC" = "Requiere reiniciar la app.";
"YT_RE_EXPLORE" = "Reemplazar pestaña de Cortos con pestaña de Explorar (YTReExplore)";
"YT_RE_EXPLORE_DESC" = "Requiere reiniciar la app.";
"YT_RE_EXPLORE_DESC" = "Requiere reiniciar la app.";
"IPHONE_LAYOUT" = "iPhone Layout";
"IPHONE_LAYOUT_DESC" = "Toggle to use the iPhone Layout. App restart is required.";

View file

@ -120,3 +120,6 @@
"YT_RE_EXPLORE" = "Remplacer l'onglet Shorts par l'onglet Explorer (YTReExplore)";
"YT_RE_EXPLORE_DESC" = "Un redémarrage de l'application est nécessaire";
"IPHONE_LAYOUT" = "iPhone Layout";
"IPHONE_LAYOUT_DESC" = "Toggle to use the iPhone Layout. App restart is required.";

View file

@ -119,4 +119,7 @@
"NEW_MINIPLAYER_STYLE_DESC" = "נדרש לפתוח מחדש את היישום.";
"YT_RE_EXPLORE" = "החלף את לשונית ה-Shorts בלשונית Explore (YTReExplore)";
"YT_RE_EXPLORE_DESC" = "נדרש לפתוח מחדש את היישום.";
"YT_RE_EXPLORE_DESC" = "נדרש לפתוח מחדש את היישום.";
"IPHONE_LAYOUT" = "iPhone Layout";
"IPHONE_LAYOUT_DESC" = "Toggle to use the iPhone Layout. App restart is required.";

View file

@ -119,4 +119,7 @@
"NEW_MINIPLAYER_STYLE_DESC" = "Az alkalmazás újraindítása szükséges.";
"YT_RE_EXPLORE" = "Cserélje le a Shorts fület a Felfedezés fülre (YTReExplore)";
"YT_RE_EXPLORE_DESC" = "Az alkalmazás újraindítása szükséges.";
"YT_RE_EXPLORE_DESC" = "Az alkalmazás újraindítása szükséges.";
"IPHONE_LAYOUT" = "iPhone Layout";
"IPHONE_LAYOUT_DESC" = "Toggle to use the iPhone Layout. App restart is required.";

View file

@ -119,4 +119,7 @@
"NEW_MINIPLAYER_STYLE_DESC" = "È richiesto un riavvio dell'app.";
"YT_RE_EXPLORE" = "Sostituisci il tab Shorts con il tab Esplora (YTReExplore)";
"YT_RE_EXPLORE_DESC" = "È richiesto un riavvio dell'app.";
"YT_RE_EXPLORE_DESC" = "È richiesto un riavvio dell'app.";
"IPHONE_LAYOUT" = "iPhone Layout";
"IPHONE_LAYOUT_DESC" = "Toggle to use the iPhone Layout. App restart is required.";

View file

@ -120,3 +120,6 @@
"YT_RE_EXPLORE" = "ショートタブを探索タブに置き換える (YTReExplore)";
"YT_RE_EXPLORE_DESC" = "アプリの再起動が必要です。";
"IPHONE_LAYOUT" = "iPhone Layout";
"IPHONE_LAYOUT_DESC" = "Toggle to use the iPhone Layout. App restart is required.";

View file

@ -120,3 +120,6 @@
"YT_RE_EXPLORE" = "Shorts 탭 대신 탐색 탭 보이기 (YTReExplore)";
"YT_RE_EXPLORE_DESC" = "앱을 다시 시작해야 합니다.";
"IPHONE_LAYOUT" = "iPhone Layout";
"IPHONE_LAYOUT_DESC" = "Toggle to use the iPhone Layout. App restart is required.";

View file

@ -119,4 +119,7 @@
"NEW_MINIPLAYER_STYLE_DESC" = "Je moet de app opnieuw opstarten om dit te activeren.";
"YT_RE_EXPLORE" = "Vervang Shorts met Ontdekken (YTReExplore)";
"YT_RE_EXPLORE_DESC" = "Je moet de app opnieuw opstarten om dit te activeren.";
"YT_RE_EXPLORE_DESC" = "Je moet de app opnieuw opstarten om dit te activeren.";
"IPHONE_LAYOUT" = "iPhone Layout";
"IPHONE_LAYOUT_DESC" = "Toggle to use the iPhone Layout. App restart is required.";

View file

@ -119,4 +119,7 @@
"NEW_MINIPLAYER_STYLE_DESC" = "Restart aplikacji jest wymagany.";
"YT_RE_EXPLORE" = "Zamień kartę Shorts na kartę Odkrywaj (YTReExplore)";
"YT_RE_EXPLORE_DESC" = "Restart aplikacji jest wymagany.";
"YT_RE_EXPLORE_DESC" = "Restart aplikacji jest wymagany.";
"IPHONE_LAYOUT" = "iPhone Layout";
"IPHONE_LAYOUT_DESC" = "Toggle to use the iPhone Layout. App restart is required.";

View file

@ -119,4 +119,7 @@
"NEW_MINIPLAYER_STYLE_DESC" = "A reinicialização do app é necessária.";
"YT_RE_EXPLORE" = "Substituir a guia Shorts pela guia Explorar (YTReExplore)";
"YT_RE_EXPLORE_DESC" = "A reinicialização do app é necessária.";
"YT_RE_EXPLORE_DESC" = "A reinicialização do app é necessária.";
"IPHONE_LAYOUT" = "iPhone Layout";
"IPHONE_LAYOUT_DESC" = "Toggle to use the iPhone Layout. App restart is required.";

View file

@ -120,3 +120,6 @@
"YT_RE_EXPLORE" = "Înlocuire fila Shorts cu fila Explore (YTReExplore)";
"YT_RE_EXPLORE_DESC" = "Este necesară repornirea aplicației.";
"IPHONE_LAYOUT" = "iPhone Layout";
"IPHONE_LAYOUT_DESC" = "Toggle to use the iPhone Layout. App restart is required.";

View file

@ -119,4 +119,7 @@
"NEW_MINIPLAYER_STYLE_DESC" = "Потребуется перезагрузка.";
"YT_RE_EXPLORE" = "Вкладка «Навигация» вместо «Shorts»";
"YT_RE_EXPLORE_DESC" = "Потребуется перезагрузка.";
"YT_RE_EXPLORE_DESC" = "Потребуется перезагрузка.";
"IPHONE_LAYOUT" = "iPhone Layout";
"IPHONE_LAYOUT_DESC" = "Toggle to use the iPhone Layout. App restart is required.";

View file

@ -134,4 +134,7 @@ https://github.com/PoomSmart/Return-YouTube-Dislikes/tree/main/layout/Library/Ap
"NEW_MINIPLAYER_STYLE_DESC" = "App restart is required.";
"YT_RE_EXPLORE" = "Replace Shorts tab with Explore tab (YTReExplore)";
"YT_RE_EXPLORE_DESC" = "App restart is required.";
"YT_RE_EXPLORE_DESC" = "App restart is required.";
"IPHONE_LAYOUT" = "iPhone Layout";
"IPHONE_LAYOUT_DESC" = "Toggle to use the iPhone Layout. App restart is required.";

View file

@ -119,4 +119,7 @@
"NEW_MINIPLAYER_STYLE_DESC" = "Uygulamanın yeniden başlatılması gerekir.";
"YT_RE_EXPLORE" = "Shorts sekmesini Keşfet sekmesiyle değiştirin (YTReExplore)";
"YT_RE_EXPLORE_DESC" = "Uygulamanın yeniden başlatılması gerekir.";
"YT_RE_EXPLORE_DESC" = "Uygulamanın yeniden başlatılması gerekir.";
"IPHONE_LAYOUT" = "iPhone Layout";
"IPHONE_LAYOUT_DESC" = "Toggle to use the iPhone Layout. App restart is required.";

View file

@ -120,3 +120,6 @@
"YT_RE_EXPLORE" = "Thay thế tab Shorts bằng tab Khám phá (YTReExplore)";
"YT_RE_EXPLORE_DESC" = "Cần khởi động lại ứng dụng.";
"IPHONE_LAYOUT" = "iPhone Layout";
"IPHONE_LAYOUT_DESC" = "Toggle to use the iPhone Layout. App restart is required.";

View file

@ -120,3 +120,6 @@
"YT_RE_EXPLORE" = "将 Shorts 选项卡替换成探索选项卡 YTReExplore";
"YT_RE_EXPLORE_DESC" = "更改本设置后需要重启 App。";
"IPHONE_LAYOUT" = "iPhone Layout";
"IPHONE_LAYOUT_DESC" = "Toggle to use the iPhone Layout. App restart is required.";

View file

@ -119,4 +119,7 @@
"NEW_MINIPLAYER_STYLE_DESC" = "需要重新啟動應用程式。";
"YT_RE_EXPLORE" = "用探索選項卡代替 Shorts 選項卡 (YTReExplore)";
"YT_RE_EXPLORE_DESC" = "需要重新啟動應用程式。";
"YT_RE_EXPLORE_DESC" = "需要重新啟動應用程式。";
"IPHONE_LAYOUT" = "iPhone Layout";
"IPHONE_LAYOUT_DESC" = "Toggle to use the iPhone Layout. App restart is required.";

View file

@ -1300,6 +1300,29 @@ UIColor* raisedColor = [UIColor colorWithRed:0.035 green:0.035 blue:0.035 alpha:
// %end
%end
%group giPhoneLayout
%hook UIDevice
- (long long)userInterfaceIdiom {
return NO;
}
%end
%hook UIStatusBarStyleAttributes
- (long long)idiom {
return YES;
}
%end
%hook UIKBTree
- (long long)nativeIdiom {
return YES;
}
%end
%hook UIKBRenderer
- (long long)assetIdiom {
return YES;
}
%end
%end
# pragma mark - ctor
%ctor {
// Load uYou first so its functions are available for hooks.
@ -1342,6 +1365,9 @@ UIColor* raisedColor = [UIColor colorWithRed:0.035 green:0.035 blue:0.035 alpha:
if (IsEnabled(@"hideChipBar_enabled")) {
%init(gHideChipBar);
}
if (IsEnabled(@"iPhoneLayout_enabled") && (UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad)) {
%init(giPhoneLayout);
}
// Disable updates
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"automaticallyCheckForUpdates"];