mirror of
https://github.com/SoPat712/YTLitePlus.git
synced 2025-08-22 02:58:45 -04:00
Improve localizations, fix bugs
This commit is contained in:
@@ -108,13 +108,13 @@ static const NSInteger YTLiteSection = 789;
|
||||
# pragma mark - Copy and Paste Settings
|
||||
YTSettingsSectionItem *copySettings = [%c(YTSettingsSectionItem)
|
||||
itemWithTitle:LOC(@"COPY_SETTINGS")
|
||||
titleDescription:IS_ENABLED(@"switchCopyandPasteFunctionality_enabled") ? LOC(@"COPY_SETTINGS_DESC_2") : LOC(@"COPY_SETTINGS_DESC")
|
||||
titleDescription:IS_ENABLED(@"switchCopyandPasteFunctionality_enabled") ? LOC(@"EXPORT_SETTINGS_DESC") : LOC(@"COPY_SETTINGS_DESC")
|
||||
accessibilityIdentifier:nil
|
||||
detailTextBlock:nil
|
||||
selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) {
|
||||
if (IS_ENABLED(@"switchCopyandPasteFunctionality_enabled")) {
|
||||
// Export Settings functionality
|
||||
NSURL *tempFileURL = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"exported_settings.txt"]];
|
||||
NSURL *tempFileURL = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"YTLitePlusSettings.txt"]];
|
||||
NSMutableString *settingsString = [NSMutableString string];
|
||||
for (NSString *key in NSUserDefaultsCopyKeys) {
|
||||
id value = [[NSUserDefaults standardUserDefaults] objectForKey:key];
|
||||
@@ -146,7 +146,7 @@ static const NSInteger YTLiteSection = 789;
|
||||
[[%c(GOOHUDManagerInternal) sharedInstance] showMessageMainThread:[%c(YTHUDMessage) messageWithText:@"Settings copied"]];
|
||||
}
|
||||
// Prompt to export YouTube Plus settings
|
||||
UIAlertController *exportAlert = [UIAlertController alertControllerWithTitle:@"Export Settings" message:@"Note: This cannot save iSponsorBlock and most YouTube settings.\nWould you like to also export your YouTube Plus Settings?" preferredStyle:UIAlertControllerStyleAlert];
|
||||
UIAlertController *exportAlert = [UIAlertController alertControllerWithTitle:@"Export Settings" message:@"Note: This feature cannot save iSponsorBlock and most YouTube settings.\n\nWould you like to also export your YouTube Plus Settings?" preferredStyle:UIAlertControllerStyleAlert];
|
||||
[exportAlert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]];
|
||||
[exportAlert addAction:[UIAlertAction actionWithTitle:@"Export" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
||||
// Export YouTube Plus Settings functionality
|
||||
@@ -160,7 +160,7 @@ static const NSInteger YTLiteSection = 789;
|
||||
|
||||
YTSettingsSectionItem *pasteSettings = [%c(YTSettingsSectionItem)
|
||||
itemWithTitle:LOC(@"PASTE_SETTINGS")
|
||||
titleDescription:IS_ENABLED(@"switchCopyandPasteFunctionality_enabled") ? LOC(@"PASTE_SETTINGS_DESC_2") : LOC(@"PASTE_SETTINGS_DESC")
|
||||
titleDescription:IS_ENABLED(@"switchCopyandPasteFunctionality_enabled") ? LOC(@"IMPORT_SETTINGS_DESC") : LOC(@"PASTE_SETTINGS_DESC")
|
||||
accessibilityIdentifier:nil
|
||||
detailTextBlock:nil
|
||||
selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) {
|
||||
@@ -170,7 +170,6 @@ static const NSInteger YTLiteSection = 789;
|
||||
documentPicker.delegate = (id<UIDocumentPickerDelegate>)self;
|
||||
documentPicker.allowsMultipleSelection = NO;
|
||||
[settingsViewController presentViewController:documentPicker animated:YES completion:nil];
|
||||
return YES;
|
||||
} else {
|
||||
// Paste Settings functionality (DEFAULT - Pastes from Clipboard)
|
||||
UIAlertController *confirmPasteAlert = [UIAlertController alertControllerWithTitle:LOC(@"PASTE_SETTINGS_ALERT") message:nil preferredStyle:UIAlertControllerStyleAlert];
|
||||
@@ -194,6 +193,8 @@ static const NSInteger YTLiteSection = 789;
|
||||
}]];
|
||||
[settingsViewController presentViewController:confirmPasteAlert animated:YES completion:nil];
|
||||
}
|
||||
// Show a toast message to confirm the action
|
||||
[[%c(GOOHUDManagerInternal) sharedInstance] showMessageMainThread:[%c(YTHUDMessage) messageWithText:@"Settings pasted"]];
|
||||
// Reminder to import YouTube Plus settings
|
||||
UIAlertController *reminderAlert = [UIAlertController alertControllerWithTitle:@"Reminder"
|
||||
message:@"Remember to import your YouTube Plus settings as well."
|
||||
@@ -689,15 +690,35 @@ static const NSInteger YTLiteSection = 789;
|
||||
// Implement the delegate method for document picker
|
||||
%new
|
||||
- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentsAtURLs:(NSArray<NSURL *> *)urls {
|
||||
if (urls.count > 0) {
|
||||
NSURL *pickedURL = [urls firstObject];
|
||||
NSError *error;
|
||||
NSString *fileType = [pickedURL resourceValuesForKeys:@[NSURLTypeIdentifierKey] error:&error][NSURLTypeIdentifierKey];
|
||||
|
||||
if (pickedURL) {
|
||||
// Use AVPlayerViewController to play the video
|
||||
UIViewController *settingsViewController = [self valueForKey:@"_settingsViewControllerDelegate"];
|
||||
|
||||
if (UTTypeConformsTo((__bridge CFStringRef)fileType, kUTTypePlainText)) {
|
||||
// This block handles the import of settings from a text file.
|
||||
NSString *fileContents = [NSString stringWithContentsOfURL:pickedURL encoding:NSUTF8StringEncoding error:nil];
|
||||
NSArray *lines = [fileContents 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];
|
||||
}
|
||||
}
|
||||
if ([settingsViewController respondsToSelector:@selector(reloadData)]) {
|
||||
// Call a custom reloadData method if it exists
|
||||
[settingsViewController performSelector:@selector(reloadData)];
|
||||
}
|
||||
} else if (UTTypeConformsTo((__bridge CFStringRef)fileType, kUTTypeMovie)) {
|
||||
// This block handles video playback using AVPlayer and AVPlayerViewController.
|
||||
AVPlayer *player = [AVPlayer playerWithURL:pickedURL];
|
||||
AVPlayerViewController *playerViewController = [[AVPlayerViewController alloc] init];
|
||||
playerViewController.player = player;
|
||||
|
||||
UIViewController *settingsViewController = [self valueForKey:@"_settingsViewControllerDelegate"];
|
||||
if (settingsViewController) {
|
||||
[settingsViewController presentViewController:playerViewController animated:YES completion:^{
|
||||
[player play];
|
||||
@@ -705,6 +726,8 @@ static const NSInteger YTLiteSection = 789;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
%new
|
||||
- (void)documentPickerWasCancelled:(UIDocumentPickerViewController *)controller {
|
||||
|
@@ -6,6 +6,7 @@
|
||||
"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" = "Apply settings from clipboard?";
|
||||
"EXPORT_SETTINGS" = "Export Settings";
|
||||
"EXPORT_SETTINGS_DESC" = "Exports all current settings into a .txt file";
|
||||
"IMPORT_SETTINGS" = "Import Settings";
|
||||
|
@@ -6,6 +6,7 @@
|
||||
"COPY_SETTINGS_DESC" = "Копиране на всички текущи настройки в клипборда";
|
||||
"PASTE_SETTINGS" = "Поставяне на настройки";
|
||||
"PASTE_SETTINGS_DESC" = "Поставяне на настройки от клипборда и прилагане";
|
||||
"PASTE_SETTINGS_ALERT" = "Apply settings from clipboard?";
|
||||
"EXPORT_SETTINGS" = "Експортиране на настройки";
|
||||
"EXPORT_SETTINGS_DESC" = "Експортиране на всички текущи настройки в .txt файл";
|
||||
"IMPORT_SETTINGS" = "Импортиране на настройки";
|
||||
|
@@ -6,6 +6,7 @@
|
||||
"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" = "Apply settings from clipboard?";
|
||||
"EXPORT_SETTINGS" = "Export Settings";
|
||||
"EXPORT_SETTINGS_DESC" = "Exports all current settings into a .txt file";
|
||||
"IMPORT_SETTINGS" = "Import Settings";
|
||||
|
@@ -6,6 +6,7 @@
|
||||
"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" = "Apply settings from clipboard?";
|
||||
"EXPORT_SETTINGS" = "Export Settings";
|
||||
"EXPORT_SETTINGS_DESC" = "Exports all current settings into a .txt file";
|
||||
"IMPORT_SETTINGS" = "Import Settings";
|
||||
|
@@ -6,6 +6,7 @@
|
||||
"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" = "Apply settings from clipboard?";
|
||||
"EXPORT_SETTINGS" = "Export Settings";
|
||||
"EXPORT_SETTINGS_DESC" = "Exports all current settings into a .txt file";
|
||||
"IMPORT_SETTINGS" = "Import Settings";
|
||||
|
@@ -6,6 +6,7 @@
|
||||
"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" = "Apply settings from clipboard?";
|
||||
"EXPORT_SETTINGS" = "Export Settings";
|
||||
"EXPORT_SETTINGS_DESC" = "Exports all current settings into a .txt file";
|
||||
"IMPORT_SETTINGS" = "Import Settings";
|
||||
|
@@ -6,6 +6,7 @@
|
||||
"COPY_SETTINGS_DESC" = "現在のすべての設定をクリップボードにコピーします";
|
||||
"PASTE_SETTINGS" = "設定を貼り付け";
|
||||
"PASTE_SETTINGS_DESC" = "クリップボードから設定を貼り付けて適用します";
|
||||
"PASTE_SETTINGS_ALERT" = "Apply settings from clipboard?";
|
||||
"EXPORT_SETTINGS" = "Export Settings";
|
||||
"EXPORT_SETTINGS_DESC" = "Exports all current settings into a .txt file";
|
||||
"IMPORT_SETTINGS" = "Import Settings";
|
||||
|
@@ -6,6 +6,7 @@
|
||||
"COPY_SETTINGS_DESC" = "Copia todas as configurações atuais para a área de transferência";
|
||||
"PASTE_SETTINGS" = "Colar Configurações";
|
||||
"PASTE_SETTINGS_DESC" = "Cola as configurações da área de transferência e aplica";
|
||||
"PASTE_SETTINGS_ALERT" = "Apply settings from clipboard?";
|
||||
"EXPORT_SETTINGS" = "Exportar Configurações";
|
||||
"EXPORT_SETTINGS_DESC" = "Exporta todas as configurações atuais para um arquivo .txt";
|
||||
"IMPORT_SETTINGS" = "Importar Configurações";
|
||||
|
@@ -6,6 +6,7 @@
|
||||
"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" = "Apply settings from clipboard?";
|
||||
"EXPORT_SETTINGS" = "Export Settings";
|
||||
"EXPORT_SETTINGS_DESC" = "Exports all current settings into a .txt file";
|
||||
"IMPORT_SETTINGS" = "Import Settings";
|
||||
|
@@ -6,6 +6,7 @@
|
||||
"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" = "Apply settings from clipboard?";
|
||||
"EXPORT_SETTINGS" = "Export Settings";
|
||||
"EXPORT_SETTINGS_DESC" = "Exports all current settings into a .txt file";
|
||||
"IMPORT_SETTINGS" = "Import Settings";
|
||||
|
@@ -21,6 +21,8 @@ https://github.com/PoomSmart/Return-YouTube-Dislikes/tree/main/layout/Library/Ap
|
||||
"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" = "Apply settings from clipboard?";
|
||||
|
||||
"EXPORT_SETTINGS" = "Export Settings";
|
||||
"EXPORT_SETTINGS_DESC" = "Exports all current settings into a .txt file";
|
||||
"IMPORT_SETTINGS" = "Import Settings";
|
||||
|
@@ -6,6 +6,7 @@
|
||||
"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" = "Apply settings from clipboard?";
|
||||
"EXPORT_SETTINGS" = "Ayarları Dışa Aktar";
|
||||
"EXPORT_SETTINGS_DESC" = "Tüm mevcut ayarları bir .txt dosyasına dışa aktarır";
|
||||
"IMPORT_SETTINGS" = "Ayarları İçe Aktar";
|
||||
|
@@ -6,6 +6,7 @@
|
||||
"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" = "Apply settings from clipboard?";
|
||||
"EXPORT_SETTINGS" = "Export Settings";
|
||||
"EXPORT_SETTINGS_DESC" = "Exports all current settings into a .txt file";
|
||||
"IMPORT_SETTINGS" = "Import Settings";
|
||||
|
@@ -7,6 +7,7 @@
|
||||
"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" = "Apply settings from clipboard?";
|
||||
"EXPORT_SETTINGS" = "Export Settings";
|
||||
"EXPORT_SETTINGS_DESC" = "Exports all current settings into a .txt file";
|
||||
"IMPORT_SETTINGS" = "Import Settings";
|
||||
|
Reference in New Issue
Block a user