Update uYouPlusSettings.xm

This commit is contained in:
arichornlover 2024-06-09 18:58:08 -05:00 committed by GitHub
parent e389ecb6d6
commit 1e1c4b4dae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -201,16 +201,16 @@ extern NSBundle *uYouPlusBundle();
selectBlock:^BOOL (YTSettingsCell *cell, NSUInteger arg1) {
if (IS_ENABLED(@"replaceCopyandPasteButtons_enabled")) {
// Export Settings functionality
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
NSMutableString *settingsString = [NSMutableString string];
NSURL *tempFileURL = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"exported_settings.txt"]];
NSMutableString *settingsString = [NSMutableNSMutableString string];
for (NSString *key in copyKeys) {
if ([userDefaults objectForKey:key]) {
NSString *value = [userDefaults objectForKey:key];
id value = [[NSUserDefaults standardUserDefaults] objectForKey:key];
if (value) {
[settingsString appendFormat:@"%@: %@\n", key, value];
}
}
if (settingsString.length > 0) {
UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[@"public.text"] inMode:UIDocumentPickerModeExportToService];
[settingsString writeToURL:tempFileURL atomically:YES encoding:NSUTF8StringEncoding error:nil];
UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithURL:tempFileURL inMode:UIDocumentPickerModeExportToService];
documentPicker.delegate = (id<UIDocumentPickerDelegate>)self;
documentPicker.allowsMultipleSelection = NO;
[UIApplication.sharedApplication.keyWindow.rootViewController presentViewController:documentPicker animated:YES completion:nil];