mirror of
https://github.com/SoPat712/YTLitePlus.git
synced 2025-08-21 18:28:47 -04:00
Add default value ignore
This commit is contained in:
@@ -132,13 +132,18 @@ static const NSInteger YTLiteSection = 789;
|
||||
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
|
||||
NSMutableString *settingsString = [NSMutableString string];
|
||||
for (NSString *key in NSUserDefaultsCopyKeys) {
|
||||
if ([userDefaults objectForKey:key]) {
|
||||
NSString *value = [userDefaults objectForKey:key];
|
||||
id value = [userDefaults objectForKey:key];
|
||||
id defaultValue = NSUserDefaultsCopyKeysDefaults[key];
|
||||
|
||||
// Only include the setting if it is different from the default value
|
||||
// If no default value is found, include it by default
|
||||
if (value && (!defaultValue || ![value isEqual:defaultValue])) {
|
||||
[settingsString appendFormat:@"%@: %@\n", key, value];
|
||||
}
|
||||
}
|
||||
[[UIPasteboard generalPasteboard] setString:settingsString];
|
||||
// Show a confirmation message or perform some other action here
|
||||
[[%c(GOOHUDManagerInternal) sharedInstance] showMessageMainThread:[%c(YTHUDMessage) messageWithText:@"Settings copied"]];
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
@@ -176,6 +181,7 @@ static const NSInteger YTLiteSection = 789;
|
||||
}
|
||||
[settingsViewController reloadData];
|
||||
// Show a confirmation message or perform some other action here
|
||||
[[%c(GOOHUDManagerInternal) sharedInstance] showMessageMainThread:[%c(YTHUDMessage) messageWithText:@"Settings applied"]];
|
||||
}
|
||||
}]];
|
||||
[settingsViewController presentViewController:confirmPasteAlert animated:YES completion:nil];
|
||||
|
@@ -40,3 +40,15 @@ NSArray *NSUserDefaultsCopyKeys = @[
|
||||
// Useful YouTube Keys
|
||||
@"inline_muted_playback_enabled",
|
||||
];
|
||||
|
||||
|
||||
// Some default values to ignore when exporting settings
|
||||
NSDictionary *NSUserDefaultsCopyKeysDefaults = @{
|
||||
@"fixCasting_enabled": @1,
|
||||
@"inline_muted_playback_enabled": @5,
|
||||
@"newSettingsUI_enabled": @1,
|
||||
@"DEMC_safeAreaConstant": @21.5,
|
||||
@"RYD-ENABLED": @1,
|
||||
@"RYD-VOTE-SUBMISSION": @1,
|
||||
// Duplicate keys are not allowed in NSDictionary. If present, only the last one will be kept.
|
||||
};
|
Reference in New Issue
Block a user