From 7f240104cd0fd216cbb13dd22dd389ffffc00d7b Mon Sep 17 00:00:00 2001 From: arichornlover <78001398+arichornlover@users.noreply.github.com> Date: Wed, 5 Jun 2024 15:25:18 -0500 Subject: [PATCH] Update uYouPlusSettings.xm --- Sources/uYouPlusSettings.xm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Sources/uYouPlusSettings.xm b/Sources/uYouPlusSettings.xm index ca02576..3e44fd7 100644 --- a/Sources/uYouPlusSettings.xm +++ b/Sources/uYouPlusSettings.xm @@ -209,10 +209,13 @@ extern NSBundle *uYouPlusBundle(); [settingsString appendFormat:@"%@: %@\n", key, value]; } } + if (settingsString.length > 0) { UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[@"public.text"] inMode:UIDocumentPickerModeExportToService]; documentPicker.delegate = (id)self; documentPicker.allowsMultipleSelection = NO; - [settingsViewController presentViewController:documentPicker animated:YES completion:nil]; + [UIApplication.sharedApplication.keyWindow.rootViewController presentViewController:documentPicker animated:YES completion:nil]; + } + return YES; } else { // Copy Settings functionality (default behavior) NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; @@ -242,7 +245,8 @@ extern NSBundle *uYouPlusBundle(); UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithDocumentTypes:@[@"public.text"] inMode:UIDocumentPickerModeImport]; documentPicker.delegate = (id)self; documentPicker.allowsMultipleSelection = NO; - [settingsViewController presentViewController:documentPicker animated:YES completion:nil]; + [UIApplication.sharedApplication.keyWindow.rootViewController presentViewController:documentPicker animated:YES completion:nil]; + return YES; } else { // Paste Settings functionality (default behavior) UIAlertController *confirmPasteAlert = [UIAlertController alertControllerWithTitle:LOC(@"CONFIRM_PASTE_TITLE") message:LOC(@"CONFIRM_PASTE_MESSAGE") preferredStyle:UIAlertControllerStyleAlert];