Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/Notifications/NotificationsViewExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Dynamo.ViewModels;
using Dynamo.Wpf.Extensions;
using Dynamo.Utilities;
using System.IO;

namespace Dynamo.Notifications
{
Expand Down Expand Up @@ -112,6 +113,28 @@ public void Loaded(ViewLoadedParams viewStartupParams)
viewStartupParams.dynamoMenu.Items.Add(notificationsMenuItem.MenuItem);

LoadNotificationCenter();

//If TrustedLocations contain paths pointing to ProgramData, log a warning notification.
string programDataPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
var unsafeLocations = new System.Collections.Generic.List<string>();
foreach (var location in viewModel.Model.PreferenceSettings.TrustedLocations)
{
var fullChildPath = Path.GetFullPath(location);
if (fullChildPath.StartsWith(programDataPath, StringComparison.OrdinalIgnoreCase))
{
unsafeLocations.Add(location);
}
}
if (unsafeLocations.Count > 0)
{
foreach (var unsafePath in unsafeLocations)
{
string detail = Properties.Resources.UnsafePathDetectedDetail + "\n" + unsafePath;
Notifications.Add(new NotificationMessage("Preference Settings", Properties.Resources.UnsafePathDetectedTitle, detail));
}

notificationsMenuItem.NotificationsChangeHandler.Invoke(this, null);
}
}

private void LoadNotificationCenter()
Expand Down
18 changes: 18 additions & 0 deletions src/Notifications/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion src/Notifications/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Expand Down Expand Up @@ -150,4 +150,10 @@
<data name="NotificationsCenterTitle" xml:space="preserve">
<value>Notifications</value>
</data>
<data name="UnsafePathDetectedDetail" xml:space="preserve">
<value>An unsafe path has been detected in Trusted Locations:</value>
</data>
<data name="UnsafePathDetectedTitle" xml:space="preserve">
<value>Unsafe path detected</value>
</data>
</root>
14 changes: 13 additions & 1 deletion src/Notifications/Properties/Resources.resx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Expand Down Expand Up @@ -135,6 +135,12 @@
<data name="ExtensionName" xml:space="preserve">
<value>Notifications</value>
</data>
<data name="NoNotificationsMsg" xml:space="preserve">
<value>You currently have no notifications. New notifications will appear above</value>
</data>
<data name="NoNotificationsTitle" xml:space="preserve">
<value>No notifications</value>
</data>
<data name="NotificationCenterDisabledMsg" xml:space="preserve">
<value>Notification Center feature is disabled. Enable it in preference panel to see latest news.</value>
</data>
Expand All @@ -144,4 +150,10 @@
<data name="NotificationsCenterTitle" xml:space="preserve">
<value>Notifications</value>
</data>
<data name="UnsafePathDetectedDetail" xml:space="preserve">
<value>An unsafe path has been detected in Trusted Locations:</value>
</data>
<data name="UnsafePathDetectedTitle" xml:space="preserve">
<value>Unsafe path detected</value>
</data>
</root>
Loading