Skip to content

Commit

Permalink
Added “Copy Settings” & “Paste Settings” buttons (qnblackcat#1497)
Browse files Browse the repository at this point in the history
* Added Copy Settings & Paste Settings buttons

* Fix Strings for Paste Settings

* new localizations

---------

Co-authored-by: arichornlover <[email protected]>
  • Loading branch information
aricloverEXALT and arichornlover authored Jul 29, 2024
1 parent 4f28b67 commit 14a7123
Show file tree
Hide file tree
Showing 23 changed files with 192 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Localizations/uYouPlus.bundle/ar.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"REPORT_AN_ISSUE" = "Report an issue";
"ADD_TITLE" = "Add your title here...";

"COPY_SETTINGS" = "Copy Settings";
"COPY_SETTINGS_DESC" = "Copy all current settings to the clipboard";
"PASTE_SETTINGS" = "Paste Settings";
"PASTE_SETTINGS_DESC" = "Paste settings from clipboard and apply";
"PASTE_SETTINGS_ALERT" = "Are you sure you want to paste the settings?";

"QUIT_YOUTUBE" = "Quit YouTube";

"RESTART_YOUTUBE" = "Restart YouTube to apply changes";
Expand Down
6 changes: 6 additions & 0 deletions Localizations/uYouPlus.bundle/cz.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"REPORT_AN_ISSUE" = "Report an issue";
"ADD_TITLE" = "Add your title here...";

"COPY_SETTINGS" = "Copy Settings";
"COPY_SETTINGS_DESC" = "Copy all current settings to the clipboard";
"PASTE_SETTINGS" = "Paste Settings";
"PASTE_SETTINGS_DESC" = "Paste settings from clipboard and apply";
"PASTE_SETTINGS_ALERT" = "Are you sure you want to paste the settings?";

"QUIT_YOUTUBE" = "Quit YouTube";

"RESTART_YOUTUBE" = "Restart YouTube to apply changes";
Expand Down
6 changes: 6 additions & 0 deletions Localizations/uYouPlus.bundle/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"REPORT_AN_ISSUE" = "Report an issue";
"ADD_TITLE" = "Add your title here...";

"COPY_SETTINGS" = "Copy Settings";
"COPY_SETTINGS_DESC" = "Copy all current settings to the clipboard";
"PASTE_SETTINGS" = "Paste Settings";
"PASTE_SETTINGS_DESC" = "Paste settings from clipboard and apply";
"PASTE_SETTINGS_ALERT" = "Are you sure you want to paste the settings?";

"QUIT_YOUTUBE" = "Quit YouTube";

"RESTART_YOUTUBE" = "Restart YouTube to apply changes";
Expand Down
6 changes: 6 additions & 0 deletions Localizations/uYouPlus.bundle/el.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"REPORT_AN_ISSUE" = "Report an issue";
"ADD_TITLE" = "Add your title here...";

"COPY_SETTINGS" = "Copy Settings";
"COPY_SETTINGS_DESC" = "Copy all current settings to the clipboard";
"PASTE_SETTINGS" = "Paste Settings";
"PASTE_SETTINGS_DESC" = "Paste settings from clipboard and apply";
"PASTE_SETTINGS_ALERT" = "Are you sure you want to paste the settings?";

"QUIT_YOUTUBE" = "Quit YouTube";

"RESTART_YOUTUBE" = "Restart YouTube to apply changes";
Expand Down
6 changes: 6 additions & 0 deletions Localizations/uYouPlus.bundle/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"REPORT_AN_ISSUE" = "Report an issue";
"ADD_TITLE" = "Add your title here...";

"COPY_SETTINGS" = "Copy Settings";
"COPY_SETTINGS_DESC" = "Copy all current settings to the clipboard";
"PASTE_SETTINGS" = "Paste Settings";
"PASTE_SETTINGS_DESC" = "Paste settings from clipboard and apply";
"PASTE_SETTINGS_ALERT" = "Are you sure you want to paste the settings?";

"QUIT_YOUTUBE" = "Quit YouTube";

"RESTART_YOUTUBE" = "Restart YouTube to apply changes";
Expand Down
6 changes: 6 additions & 0 deletions Localizations/uYouPlus.bundle/es.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"REPORT_AN_ISSUE" = "Informar de un problema";
"ADD_TITLE" = "Añada aquí su título...";

"COPY_SETTINGS" = "Copy Settings";
"COPY_SETTINGS_DESC" = "Copy all current settings to the clipboard";
"PASTE_SETTINGS" = "Paste Settings";
"PASTE_SETTINGS_DESC" = "Paste settings from clipboard and apply";
"PASTE_SETTINGS_ALERT" = "Are you sure you want to paste the settings?";

"QUIT_YOUTUBE" = "Salir de Youtube";

"RESTART_YOUTUBE" = "Reinicia YouTube para aplicar los cambios";
Expand Down
6 changes: 6 additions & 0 deletions Localizations/uYouPlus.bundle/fr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"REPORT_AN_ISSUE" = "Report an issue";
"ADD_TITLE" = "Add your title here...";

"COPY_SETTINGS" = "Copy Settings";
"COPY_SETTINGS_DESC" = "Copy all current settings to the clipboard";
"PASTE_SETTINGS" = "Paste Settings";
"PASTE_SETTINGS_DESC" = "Paste settings from clipboard and apply";
"PASTE_SETTINGS_ALERT" = "Are you sure you want to paste the settings?";

"QUIT_YOUTUBE" = "Quit YouTube";

"RESTART_YOUTUBE" = "Restart YouTube to apply changes";
Expand Down
6 changes: 6 additions & 0 deletions Localizations/uYouPlus.bundle/he.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"REPORT_AN_ISSUE" = "Report an issue";
"ADD_TITLE" = "Add your title here...";

"COPY_SETTINGS" = "Copy Settings";
"COPY_SETTINGS_DESC" = "Copy all current settings to the clipboard";
"PASTE_SETTINGS" = "Paste Settings";
"PASTE_SETTINGS_DESC" = "Paste settings from clipboard and apply";
"PASTE_SETTINGS_ALERT" = "Are you sure you want to paste the settings?";

"QUIT_YOUTUBE" = "Quit YouTube";

"RESTART_YOUTUBE" = "Restart YouTube to apply changes";
Expand Down
6 changes: 6 additions & 0 deletions Localizations/uYouPlus.bundle/hu.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"REPORT_AN_ISSUE" = "Report an issue";
"ADD_TITLE" = "Add your title here...";

"COPY_SETTINGS" = "Copy Settings";
"COPY_SETTINGS_DESC" = "Copy all current settings to the clipboard";
"PASTE_SETTINGS" = "Paste Settings";
"PASTE_SETTINGS_DESC" = "Paste settings from clipboard and apply";
"PASTE_SETTINGS_ALERT" = "Are you sure you want to paste the settings?";

"QUIT_YOUTUBE" = "Quit YouTube";

"RESTART_YOUTUBE" = "Restart YouTube to apply changes";
Expand Down
6 changes: 6 additions & 0 deletions Localizations/uYouPlus.bundle/it.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"REPORT_AN_ISSUE" = "Report an issue";
"ADD_TITLE" = "Add your title here...";

"COPY_SETTINGS" = "Copy Settings";
"COPY_SETTINGS_DESC" = "Copy all current settings to the clipboard";
"PASTE_SETTINGS" = "Paste Settings";
"PASTE_SETTINGS_DESC" = "Paste settings from clipboard and apply";
"PASTE_SETTINGS_ALERT" = "Are you sure you want to paste the settings?";

"QUIT_YOUTUBE" = "Quit YouTube";

"RESTART_YOUTUBE" = "Restart YouTube to apply changes";
Expand Down
6 changes: 6 additions & 0 deletions Localizations/uYouPlus.bundle/ja.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"REPORT_AN_ISSUE" = "不具合を報告";
"ADD_TITLE" = "タイトルをここに追加...";

"COPY_SETTINGS" = "設定をコピー";
"COPY_SETTINGS_DESC" = "現在のすべての設定をクリップボードにコピーします";
"PASTE_SETTINGS" = "設定を貼り付け";
"PASTE_SETTINGS_DESC" = "クリップボードから設定を貼り付けて適用します";
"PASTE_SETTINGS_ALERT" = "Are you sure you want to paste the settings?";

"QUIT_YOUTUBE" = "YouTubeを終了";

"RESTART_YOUTUBE" = "変更を適用するためにYouTubeを再起動";
Expand Down
6 changes: 6 additions & 0 deletions Localizations/uYouPlus.bundle/ko.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"REPORT_AN_ISSUE" = "Report an issue";
"ADD_TITLE" = "Add your title here...";

"COPY_SETTINGS" = "Copy Settings";
"COPY_SETTINGS_DESC" = "Copy all current settings to the clipboard";
"PASTE_SETTINGS" = "Paste Settings";
"PASTE_SETTINGS_DESC" = "Paste settings from clipboard and apply";
"PASTE_SETTINGS_ALERT" = "Are you sure you want to paste the settings?";

"QUIT_YOUTUBE" = "Quit YouTube";

"RESTART_YOUTUBE" = "Restart YouTube to apply changes";
Expand Down
6 changes: 6 additions & 0 deletions Localizations/uYouPlus.bundle/nl.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"REPORT_AN_ISSUE" = "Report an issue";
"ADD_TITLE" = "Add your title here...";

"COPY_SETTINGS" = "Copy Settings";
"COPY_SETTINGS_DESC" = "Copy all current settings to the clipboard";
"PASTE_SETTINGS" = "Paste Settings";
"PASTE_SETTINGS_DESC" = "Paste settings from clipboard and apply";
"PASTE_SETTINGS_ALERT" = "Are you sure you want to paste the settings?";

"QUIT_YOUTUBE" = "Quit YouTube";

"RESTART_YOUTUBE" = "Restart YouTube to apply changes";
Expand Down
6 changes: 6 additions & 0 deletions Localizations/uYouPlus.bundle/pl.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"REPORT_AN_ISSUE" = "Zgłoś błąd";
"ADD_TITLE" = "Podaj tutaj tytuł...";

"COPY_SETTINGS" = "Kopiuj ustawienia";
"COPY_SETTINGS_DESC" = "Kopiuj ustawienia do schowka";
"PASTE_SETTINGS" = "Wklej ustawienia";
"PASTE_SETTINGS_DESC" = "Wklej ustawienia ze schowka i zastosuj je";
"PASTE_SETTINGS_ALERT" = "Are you sure you want to paste the settings?";

"QUIT_YOUTUBE" = "Zamknij aplikację";

"RESTART_YOUTUBE" = "Zrestartuj YouTube aby wprowadzić zmiany";
Expand Down
6 changes: 6 additions & 0 deletions Localizations/uYouPlus.bundle/pt.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"REPORT_AN_ISSUE" = "Informar um problema";
"ADD_TITLE" = "Adicione seu título aqui...";

"COPY_SETTINGS" = "Copy Settings";
"COPY_SETTINGS_DESC" = "Copy all current settings to the clipboard";
"PASTE_SETTINGS" = "Paste Settings";
"PASTE_SETTINGS_DESC" = "Paste settings from clipboard and apply";
"PASTE_SETTINGS_ALERT" = "Are you sure you want to paste the settings?";

"QUIT_YOUTUBE" = "Sair do YouTube";

"RESTART_YOUTUBE" = "Reinicie o YouTube para aplicar as alterações";
Expand Down
6 changes: 6 additions & 0 deletions Localizations/uYouPlus.bundle/ro.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"REPORT_AN_ISSUE" = "Report an issue";
"ADD_TITLE" = "Add your title here...";

"COPY_SETTINGS" = "Copy Settings";
"COPY_SETTINGS_DESC" = "Copy all current settings to the clipboard";
"PASTE_SETTINGS" = "Paste Settings";
"PASTE_SETTINGS_DESC" = "Paste settings from clipboard and apply";
"PASTE_SETTINGS_ALERT" = "Are you sure you want to paste the settings?";

"QUIT_YOUTUBE" = "Quit YouTube";

"RESTART_YOUTUBE" = "Restart YouTube to apply changes";
Expand Down
6 changes: 6 additions & 0 deletions Localizations/uYouPlus.bundle/ru.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"REPORT_AN_ISSUE" = "Report an issue";
"ADD_TITLE" = "Add your title here...";

"COPY_SETTINGS" = "Copy Settings";
"COPY_SETTINGS_DESC" = "Copy all current settings to the clipboard";
"PASTE_SETTINGS" = "Paste Settings";
"PASTE_SETTINGS_DESC" = "Paste settings from clipboard and apply";
"PASTE_SETTINGS_ALERT" = "Are you sure you want to paste the settings?";

"QUIT_YOUTUBE" = "Quit YouTube";

"RESTART_YOUTUBE" = "Restart YouTube to apply changes";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ https://github.com/PoomSmart/Return-YouTube-Dislikes/tree/main/layout/Library/Ap
"REPORT_AN_ISSUE" = "Report an issue";
"ADD_TITLE" = "Add your title here...";

"COPY_SETTINGS" = "Copy Settings";
"COPY_SETTINGS_DESC" = "Copy all current settings to the clipboard";
"PASTE_SETTINGS" = "Paste Settings";
"PASTE_SETTINGS_DESC" = "Paste settings from clipboard and apply";
"PASTE_SETTINGS_ALERT" = "Are you sure you want to paste the settings?";

"QUIT_YOUTUBE" = "Quit YouTube";

"RESTART_YOUTUBE" = "Restart YouTube to apply changes";
Expand Down
6 changes: 6 additions & 0 deletions Localizations/uYouPlus.bundle/tr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"REPORT_AN_ISSUE" = "Report an issue";
"ADD_TITLE" = "Add your title here...";

"COPY_SETTINGS" = "Ayarları Kopyala";
"COPY_SETTINGS_DESC" = "Tüm mevcut ayarları panoya kopyala";
"PASTE_SETTINGS" = "Ayarları Yapıştır";
"PASTE_SETTINGS_DESC" = "Panodaki ayarları yapıştır ve uygula";
"PASTE_SETTINGS_ALERT" = "Are you sure you want to paste the settings?";

"QUIT_YOUTUBE" = "Quit YouTube";

"RESTART_YOUTUBE" = "Restart YouTube to apply changes";
Expand Down
6 changes: 6 additions & 0 deletions Localizations/uYouPlus.bundle/vi.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"REPORT_AN_ISSUE" = "Báo lỗi";
"ADD_TITLE" = "Thêm tiêu đề lỗi ở đây...";

"COPY_SETTINGS" = "Copy Settings";
"COPY_SETTINGS_DESC" = "Copy all current settings to the clipboard";
"PASTE_SETTINGS" = "Paste Settings";
"PASTE_SETTINGS_DESC" = "Paste settings from clipboard and apply";
"PASTE_SETTINGS_ALERT" = "Are you sure you want to paste the settings?";

"QUIT_YOUTUBE" = "Đóng YouTube";

"RESTART_YOUTUBE" = "Khởi động lại YouTube để áp dụng các thay đổi";
Expand Down
6 changes: 6 additions & 0 deletions Localizations/uYouPlus.bundle/zh_cn.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"REPORT_AN_ISSUE" = "Report an issue";
"ADD_TITLE" = "Add your title here...";

"COPY_SETTINGS" = "Copy Settings";
"COPY_SETTINGS_DESC" = "Copy all current settings to the clipboard";
"PASTE_SETTINGS" = "Paste Settings";
"PASTE_SETTINGS_DESC" = "Paste settings from clipboard and apply";
"PASTE_SETTINGS_ALERT" = "Are you sure you want to paste the settings?";

"QUIT_YOUTUBE" = "Quit YouTube";

"RESTART_YOUTUBE" = "Restart YouTube to apply changes";
Expand Down
6 changes: 6 additions & 0 deletions Localizations/uYouPlus.bundle/zh_tw.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"REPORT_AN_ISSUE" = "Report an issue";
"ADD_TITLE" = "Add your title here...";

"COPY_SETTINGS" = "Copy Settings";
"COPY_SETTINGS_DESC" = "Copy all current settings to the clipboard";
"PASTE_SETTINGS" = "Paste Settings";
"PASTE_SETTINGS_DESC" = "Paste settings from clipboard and apply";
"PASTE_SETTINGS_ALERT" = "Are you sure you want to paste the settings?";

"QUIT_YOUTUBE" = "Quit YouTube";

"RESTART_YOUTUBE" = "Restart YouTube to apply changes";
Expand Down
60 changes: 60 additions & 0 deletions Sources/uYouPlusSettings.xm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@

#define SWITCH_ITEM2(t, d, k) [sectionItems addObject:[YTSettingsSectionItemClass switchItemWithTitle:t titleDescription:d accessibilityIdentifier:nil switchOn:IS_ENABLED(k) switchBlock:^BOOL (YTSettingsCell *cell, BOOL enabled) {[[NSUserDefaults standardUserDefaults] setBool:enabled forKey:k];SHOW_RELAUNCH_YT_SNACKBAR;return YES;} settingItemId:0]]

NSArray *copyKeys = @[
/* MAIN Player Keys */ @"slideToSeek_enabled", @"snapToChapter_enabled", @"pinchToZoom_enabled", @"ytMiniPlayer_enabled", @"hideRemixButton_enabled", @"hideClipButton_enabled", @"hideDownloadButton_enabled", @"stockVolumeHUD_enabled",
/* MAIN Button Keys */ @"hideAutoplaySwitch_enabled", @"hideCC_enabled", @"hideHUD_enabled", @"hidePaidPromotionCard_enabled", @"hideChannelWatermark_enabled", @"redProgressBar_enabled", @"hideHoverCards_enabled", @"hideRightPanel_enabled",
/* MAIN Shorts Keys */ @"hideBuySuperThanks_enabled", @"hideSubcriptions_enabled",
/* MAIN Misc Keys */ @"hideiSponsorBlockButton_enabled", @"disableHints_enabled", @"ytStartupAnimation_enabled", @"hideChipBar_enabled", @"hidePlayNextInQueue_enabled", @"iPhoneLayout_enabled", @"bigYTMiniPlayer_enabled", @"reExplore_enabled", @"flex_enabled",
/* TWEAK uYou Keys */ @"showedWelcomeVC", @"hideShortsTab", @"hideCreateTab", @"hideCastButton", @"relatedVideosAtTheEndOfYTVideos", @"removeYouTubeAds", @"backgroundPlayback", @"disableAgeRestriction", @"iPadLayout", @"noSuggestedVideoAtEnd", @"shortsProgressBar", @"hideShortsCells", @"removeShortsCell", @"startupPage",
/* TWEAK YTUHD Keys */ @"EnableVP9", @"AllVP9"
];

static const NSInteger uYouPlusSection = 500;

@interface YTSettingsSectionItemManager (uYouPlus)
Expand Down Expand Up @@ -72,6 +81,57 @@ extern NSBundle *uYouPlusBundle();
];
[sectionItems addObject:bug];

YTSettingsSectionItem *copySettings = [%c(YTSettingsSectionItem)
itemWithTitle:LOC(@"COPY_SETTINGS")
titleDescription:LOC(@"COPY_SETTINGS_DESC")
accessibilityIdentifier:nil
detailTextBlock:nil
selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) {
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
NSMutableString *settingsString = [NSMutableString string];
for (NSString *key in copyKeys) {
if ([userDefaults objectForKey:key]) {
NSString *value = [userDefaults objectForKey:key];
[settingsString appendFormat:@"%@: %@\n", key, value];
}
}
[[UIPasteboard generalPasteboard] setString:settingsString];
// Show a confirmation message or perform some other action here
return YES;
}
];
[sectionItems addObject:copySettings];

YTSettingsSectionItem *pasteSettings = [%c(YTSettingsSectionItem)
itemWithTitle:LOC(@"PASTE_SETTINGS")
titleDescription:LOC(@"PASTE_SETTINGS_DESC")
accessibilityIdentifier:nil
detailTextBlock:nil
selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) {
UIAlertController *confirmPasteAlert = [UIAlertController alertControllerWithTitle:LOC(@"PASTE_SETTINGS_ALERT") message:nil preferredStyle:UIAlertControllerStyleAlert];
[confirmPasteAlert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]];
[confirmPasteAlert addAction:[UIAlertAction actionWithTitle:@"Confirm" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
NSString *settingsString = [[UIPasteboard generalPasteboard] string];
if (settingsString.length > 0) {
NSArray *lines = [settingsString componentsSeparatedByString:@"\n"];
for (NSString *line in lines) {
NSArray *components = [line componentsSeparatedByString:@": "];
if (components.count == 2) {
NSString *key = components[0];
NSString *value = components[1];
[[NSUserDefaults standardUserDefaults] setObject:value forKey:key];
}
}
[settingsViewController reloadData];
SHOW_RELAUNCH_YT_SNACKBAR;
}
}]];
[settingsViewController presentViewController:confirmPasteAlert animated:YES completion:nil];
return YES;
}
];
[sectionItems addObject:pasteSettings];

YTSettingsSectionItem *exitYT = [%c(YTSettingsSectionItem)
itemWithTitle:LOC(@"QUIT_YOUTUBE")
titleDescription:nil
Expand Down

0 comments on commit 14a7123

Please sign in to comment.