Skip to content

Commit

Permalink
Can now import from the exported
Browse files Browse the repository at this point in the history
  • Loading branch information
PoomSmart committed Feb 12, 2024
1 parent 265d2c6 commit 81c9240
Show file tree
Hide file tree
Showing 16 changed files with 37 additions and 34 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
TARGET := iphone:clang:latest:11.0
INSTALL_TARGET_PROCESSES = YouTube
ARCHS = arm64
PACKAGE_VERSION = 1.6.0
PACKAGE_VERSION = 1.7.0

include $(THEOS)/makefiles/common.mk

Expand Down
13 changes: 8 additions & 5 deletions Tweak.xm
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ static NSString *getCategory(char c, NSString *method) {

// Import settings
YTSettingsSectionItem *import = [YTSettingsSectionItemClass itemWithTitle:LOC(@"IMPORT_SETTINGS")
titleDescription:LOC(@"IMPORT_SETTINGS_DESC")
titleDescription:[NSString stringWithFormat:LOC(@"IMPORT_SETTINGS_DESC"), @"YT(Cold|Hot|Global)Config.*: (0|1)"]
accessibilityIdentifier:nil
detailTextBlock:nil
selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) {
Expand All @@ -258,9 +258,12 @@ static NSString *getCategory(char c, NSString *method) {
NSTextCheckingResult *match = [regex firstMatchInString:line options:0 range:NSMakeRange(0, [line length])];
if (match) {
NSString *key = [line substringWithRange:[match rangeAtIndex:1]];
if ([cache valueForKeyPath:key] == nil) continue;
NSString *valueString = [line substringWithRange:[match rangeAtIndex:2]];
int integerValue = [valueString integerValue];
id cacheValue = [cache valueForKeyPath:key];
if (cacheValue == nil) continue;
NSString *valueString = [line substringWithRange:[match rangeAtIndex:2]];
int integerValue = [valueString integerValue];
if (integerValue == 0 && ![cacheValue boolValue]) continue;
if (integerValue == 1 && [cacheValue boolValue]) continue;
importedSettings[key] = @(integerValue);
[reportedSettings addObject:[NSString stringWithFormat:@"%@: %d", key, integerValue]];
}
Expand Down Expand Up @@ -299,7 +302,7 @@ static NSString *getCategory(char c, NSString *method) {
NSMutableArray *content = [NSMutableArray array];
for (NSString *classKey in cache) {
[cache[classKey] enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSNumber *value, BOOL* stop) {
[content addObject:[NSString stringWithFormat:@"%@: %d", key, [value boolValue]]];
[content addObject:[NSString stringWithFormat:@"%@.%@: %d", classKey, key, [value boolValue]]];
}];
}
[content sortUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"VIEW_MODIFIED_SETTINGS" = "إظهار الإعدادات المعدَّلة";
"VIEW_MODIFIED_SETTINGS_DESC" = "المس لعرض جميع التغييرات التي أجريتها يدويَّاً.";
"IMPORT_SETTINGS" = "Import settings";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard.";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.\nEach setting must be in this format: %@";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard or there will be no changes after importing it.";
"SETTINGS_TO_IMPORT" = "Settings to import";
"SETTINGS_TO_IMPORT_DESC" = "Found %ld valid settings to be imported.";
"IMPORT" = "Import";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"VIEW_MODIFIED_SETTINGS" = "Modifizierte Einstellungen anzeigen";
"VIEW_MODIFIED_SETTINGS_DESC" = "Tippe hier, um alle manuelle Änderungen zu sehen.";
"IMPORT_SETTINGS" = "Import settings";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard.";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.\nEach setting must be in this format: %@";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard or there will be no changes after importing it.";
"SETTINGS_TO_IMPORT" = "Settings to import";
"SETTINGS_TO_IMPORT_DESC" = "Found %ld valid settings to be imported.";
"IMPORT" = "Import";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"VIEW_MODIFIED_SETTINGS" = "View modified settings";
"VIEW_MODIFIED_SETTINGS_DESC" = "Tap to view all the changes you made manually.";
"IMPORT_SETTINGS" = "Import settings";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard.";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.\nEach setting must be in this format: %@";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard or there will be no changes after importing it.";
"SETTINGS_TO_IMPORT" = "Settings to import";
"SETTINGS_TO_IMPORT_DESC" = "Found %ld valid settings to be imported.";
"IMPORT" = "Import";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"VIEW_MODIFIED_SETTINGS" = "Ver ajustes modificados";
"VIEW_MODIFIED_SETTINGS_DESC" = "Pulse para ver todos los cambios realizados manualmente";
"IMPORT_SETTINGS" = "Import settings";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard.";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.\nEach setting must be in this format: %@";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard or there will be no changes after importing it.";
"SETTINGS_TO_IMPORT" = "Settings to import";
"SETTINGS_TO_IMPORT_DESC" = "Found %ld valid settings to be imported.";
"IMPORT" = "Import";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"VIEW_MODIFIED_SETTINGS" = "A módosított beállítások megtekintése";
"VIEW_MODIFIED_SETTINGS_DESC" = "Érintse meg az összes manuális módosítás megtekintéséhez.";
"IMPORT_SETTINGS" = "Import settings";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard.";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.\nEach setting must be in this format: %@";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard or there will be no changes after importing it.";
"SETTINGS_TO_IMPORT" = "Settings to import";
"SETTINGS_TO_IMPORT_DESC" = "Found %ld valid settings to be imported.";
"IMPORT" = "Import";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"VIEW_MODIFIED_SETTINGS" = "変更された設定を表示します";
"VIEW_MODIFIED_SETTINGS_DESC" = "タップすると手動で行った全ての変更を表示します";
"IMPORT_SETTINGS" = "Import settings";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard.";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.\nEach setting must be in this format: %@";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard or there will be no changes after importing it.";
"SETTINGS_TO_IMPORT" = "Settings to import";
"SETTINGS_TO_IMPORT_DESC" = "Found %ld valid settings to be imported.";
"IMPORT" = "Import";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"VIEW_MODIFIED_SETTINGS" = "수정된 설정 보기";
"VIEW_MODIFIED_SETTINGS_DESC" = "수동으로 변경한 모든 내용을 보려면 탭하세요.";
"IMPORT_SETTINGS" = "Import settings";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard.";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.\nEach setting must be in this format: %@";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard or there will be no changes after importing it.";
"SETTINGS_TO_IMPORT" = "Settings to import";
"SETTINGS_TO_IMPORT_DESC" = "Found %ld valid settings to be imported.";
"IMPORT" = "Import";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"VIEW_MODIFIED_SETTINGS" = "Ver configurações modificadas";
"VIEW_MODIFIED_SETTINGS_DESC" = "Toque para ver todas as alterações feitas manualmente.";
"IMPORT_SETTINGS" = "Import settings";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard.";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.\nEach setting must be in this format: %@";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard or there will be no changes after importing it.";
"SETTINGS_TO_IMPORT" = "Settings to import";
"SETTINGS_TO_IMPORT_DESC" = "Found %ld valid settings to be imported.";
"IMPORT" = "Import";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"VIEW_MODIFIED_SETTINGS" = "Vizualizare setări modificate";
"VIEW_MODIFIED_SETTINGS_DESC" = "Apăsați pentru a vizualiza toate modificările efectuate.";
"IMPORT_SETTINGS" = "Import settings";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard.";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.\nEach setting must be in this format: %@";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard or there will be no changes after importing it.";
"SETTINGS_TO_IMPORT" = "Settings to import";
"SETTINGS_TO_IMPORT_DESC" = "Found %ld valid settings to be imported.";
"IMPORT" = "Import";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"VIEW_MODIFIED_SETTINGS" = "Отобразить изменения";
"VIEW_MODIFIED_SETTINGS_DESC" = "Нажмите, чтобы увидеть примененные вами изменения.";
"IMPORT_SETTINGS" = "Import settings";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard.";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.\nEach setting must be in this format: %@";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard or there will be no changes after importing it.";
"SETTINGS_TO_IMPORT" = "Settings to import";
"SETTINGS_TO_IMPORT_DESC" = "Found %ld valid settings to be imported.";
"IMPORT" = "Import";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"VIEW_MODIFIED_SETTINGS" = "Değiştirilen ayarları görüntüle";
"VIEW_MODIFIED_SETTINGS_DESC" = "El ile yaptığın tüm değişiklikleri görüntülemek için dokun.";
"IMPORT_SETTINGS" = "Import settings";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard.";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.\nEach setting must be in this format: %@";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard or there will be no changes after importing it.";
"SETTINGS_TO_IMPORT" = "Settings to import";
"SETTINGS_TO_IMPORT_DESC" = "Found %ld valid settings to be imported.";
"IMPORT" = "Import";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"VIEW_MODIFIED_SETTINGS" = "Xem các thay đổi";
"VIEW_MODIFIED_SETTINGS_DESC" = "Chạm để xem tất cả các thay đổi mà bạn đã áp dụng.";
"IMPORT_SETTINGS" = "Import settings";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard.";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.\nEach setting must be in this format: %@";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard or there will be no changes after importing it.";
"SETTINGS_TO_IMPORT" = "Settings to import";
"SETTINGS_TO_IMPORT_DESC" = "Found %ld valid settings to be imported.";
"IMPORT" = "Import";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"VIEW_MODIFIED_SETTINGS" = "查看已改动的选项";
"VIEW_MODIFIED_SETTINGS_DESC" = "查看您已手动更改的选项。";
"IMPORT_SETTINGS" = "Import settings";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard.";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.\nEach setting must be in this format: %@";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard or there will be no changes after importing it.";
"SETTINGS_TO_IMPORT" = "Settings to import";
"SETTINGS_TO_IMPORT_DESC" = "Found %ld valid settings to be imported.";
"IMPORT" = "Import";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"VIEW_MODIFIED_SETTINGS" = "查看修改的設定";
"VIEW_MODIFIED_SETTINGS_DESC" = "點擊查看您修改的所有設定";
"IMPORT_SETTINGS" = "Import settings";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard.";
"IMPORT_SETTINGS_DESC" = "Import the settings from the clipboard.\nEach setting must be in this format: %@";
"NOTHING_TO_IMPORT" = "Nothing found from the clipboard or there will be no changes after importing it.";
"SETTINGS_TO_IMPORT" = "Settings to import";
"SETTINGS_TO_IMPORT_DESC" = "Found %ld valid settings to be imported.";
"IMPORT" = "Import";
Expand Down

0 comments on commit 81c9240

Please sign in to comment.