[File Permissions] Add warning dialog

Added a warning dialog to notify the user of the purpose of the add
folder dialog that will pop up after it. Otherwise, they may get the
idea that the dialog is a glitch and should be cancelled.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
main
Christopher Snowhill 2022-07-23 18:04:13 -07:00
parent f9aa56b18a
commit 5c3b876c04
5 changed files with 34 additions and 1 deletions

View File

@ -332,13 +332,27 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
if(!_entry) {
dispatch_sync_reentrant(dispatch_get_main_queue(), ^{
static BOOL warnedYet = NO;
if(!warnedYet) {
NSAlert *alert = [[NSAlert alloc] init];
[alert setMessageText:NSLocalizedString(@"GrantPathTitle", @"Title of file dialog for granting folder access")];
[alert setInformativeText:NSLocalizedString(@"GrantPathMessage", @"Message to new users regarding file permissions")];
[alert addButtonWithTitle:NSLocalizedString(@"GrantPathOK", @"OK button text")];
[alert addButtonWithTitle:NSLocalizedString(@"GrantPathStopWarning", @"Button to stop warnings for session")];
if([alert runModal] == NSAlertSecondButtonReturn) {
warnedYet = YES;
}
}
NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setAllowsMultipleSelection:NO];
[panel setCanChooseDirectories:YES];
[panel setCanChooseFiles:NO];
[panel setFloatingPanel:YES];
[panel setDirectoryURL:folderUrl];
[panel setTitle:@"Open to grant access to container folder"];
[panel setTitle:NSLocalizedString(@"GrantPathTitle", @"Title of file dialog for granting folder access")];
NSInteger result = [panel runModal];
if(result == NSModalResponseOK) {
NSURL *folderUrl = [panel URL];

View File

@ -78,3 +78,8 @@
"wdhms" = "%@, %@, %@, %@ and %@";
"PrivacyPolicyURL" = "https://www.iubenda.com/privacy-policy/59859310";
"GrantPathTitle" = "Open to grant access to container folder";
"GrantPathMessage" = "Click OK on the following folder open dialog to grant access to the specified folder. Navigate the dialog further up the folder hierarchy to grant broader access to your files. Press 'Stop warning me' to hide any further warnings for the rest of the session.";
"GrantPathOK" = "OK";
"GrantPathStopWarning" = "Stop warning me";

View File

@ -81,3 +81,8 @@
"wdhms" = "%@, %@, %@, %@ y %@";
"PrivacyPolicyURL" = "https://www.iubenda.com/privacy-policy/57237510";
"GrantPathTitle" = "Open to grant access to container folder";
"GrantPathMessage" = "Click OK on the following folder open dialog to grant access to the specified folder. Navigate the dialog further up the folder hierarchy to grant broader access to your files. Press 'Stop warning me' to hide any further warnings for the rest of the session.";
"GrantPathOK" = "OK";
"GrantPathStopWarning" = "Stop warning me";

View File

@ -100,3 +100,8 @@
"wdhms" = "%@, %@, %@, %@ i %@";
"PrivacyPolicyURL" = "https://www.iubenda.com/privacy-policy/59859310";
"GrantPathTitle" = "Open to grant access to container folder";
"GrantPathMessage" = "Click OK on the following folder open dialog to grant access to the specified folder. Navigate the dialog further up the folder hierarchy to grant broader access to your files. Press 'Stop warning me' to hide any further warnings for the rest of the session.";
"GrantPathOK" = "OK";
"GrantPathStopWarning" = "Stop warning me";

View File

@ -132,3 +132,7 @@
"PrivacyPolicyURL" = "https://www.iubenda.com/privacy-policy/59859310";
"GrantPathTitle" = "Open to grant access to container folder";
"GrantPathMessage" = "Click OK on the following folder open dialog to grant access to the specified folder. Navigate the dialog further up the folder hierarchy to grant broader access to your files. Press 'Stop warning me' to hide any further warnings for the rest of the session.";
"GrantPathOK" = "OK";
"GrantPathStopWarning" = "Stop warning me";