-
Notifications
You must be signed in to change notification settings - Fork 666
DYN-9958 WebView2 cache folder location #16787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
RobertGlobant20
wants to merge
8
commits into
DynamoDS:master
Choose a base branch
from
RobertGlobant20:DYN-9958-WebView2_CacheFolder-Location
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+157
−24
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cd35fca
DYN-9958 WebView2 Cache Folder Location
RobertGlobant20 567a17c
DYN-9958 WebView2 Cache Folder Location
RobertGlobant20 8f0ab3f
Update src/DynamoCoreWpf/UI/SplashScreenStartupContext.cs
RobertGlobant20 2f06b8d
Update src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs
RobertGlobant20 2a6b092
Update src/DynamoCoreWpf/UI/HostStartup.cs
RobertGlobant20 7c8ec1e
DYN-9958 WebView2 Cache Folder Location Code Review
RobertGlobant20 4a2db49
Merge branch 'master' into DYN-9958-WebView2_CacheFolder-Location
RobertGlobant20 15a042b
Merge branch 'master' into DYN-9958-WebView2_CacheFolder-Location
RobertGlobant20 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.IO; | ||
| using System.Text; | ||
| using System.Threading; | ||
| using Dynamo.Configuration; | ||
| using Dynamo.Utilities; | ||
|
|
||
| namespace Dynamo.Wpf.UI | ||
| { | ||
| /// <summary> | ||
| /// Provides static methods and properties for initializing and managing the host startup context during application | ||
| /// launch. | ||
| /// </summary> | ||
| /// <remarks><see cref="HostStartup"/> is intended for use during the application's splash screen or early | ||
| /// startup phase, before other core services are available. It allows initialization of a shared startup context | ||
| /// and provides access to user-specific directories based on the current host environment.</remarks> | ||
| public static class HostStartup | ||
| { | ||
| private static int _initialized; | ||
| public static SplashScreenStartupContext? Current { get; private set; } | ||
|
|
||
| /// <summary> | ||
| /// Initialize the HostStartup with the provided context. | ||
| /// </summary> | ||
| /// <param name="context"></param> | ||
| /// <returns></returns> | ||
| public static bool TryInitialize(SplashScreenStartupContext context) | ||
| { | ||
| if (context == null) return false; | ||
| if (Interlocked.CompareExchange(ref _initialized, 1, 0) != 0) return false; | ||
| Current = context; | ||
| return true; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Resets the static state of the class to its initial, uninitialized condition. | ||
| /// </summary> | ||
| /// <remarks>Call this method to clear any existing state and reinitialize the class as if it had | ||
| /// not been used. This is typically used for testing scenarios or to force reinitialization. This method is | ||
| /// not thread-safe; ensure that no other threads are accessing the class while calling <see | ||
| /// cref="Reset"/>.</remarks> | ||
| public static void Reset() | ||
| { | ||
| Current = null; | ||
| Interlocked.Exchange(ref _initialized, 0); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets the path to the user-specific directory for the current application version. | ||
| /// </summary> | ||
| /// <remarks>The returned directory path is versioned based on the application's major and minor | ||
| /// version numbers. If user-specific host information is available, the path is constructed using the host's | ||
| /// user data folder; otherwise, it defaults to a standard location under the user's application data | ||
| /// folder.</remarks> | ||
| /// <returns>A string containing the full path to the user directory for the current application version. The directory | ||
| /// may not exist and may need to be created by the caller.</returns> | ||
| public static string GetUserDirectory() | ||
| { | ||
| // we need to use userDataFolder and hostAnalyticsInfo just in SplashScreen because PathManager/PathResolver are not created yet when SplashScreen is launched from a host | ||
| if (Current != null && !string.IsNullOrEmpty(Current.UserDataFolder) && Current.HostInfo != null) | ||
| { | ||
| var version = Current.HostInfo.Value.HostVersion; | ||
|
|
||
| return Path.Combine(Current.UserDataFolder,$"{version.Major}.{version.Minor}"); | ||
| } | ||
| else | ||
| { | ||
| var version = AssemblyHelper.GetDynamoVersion(); | ||
|
|
||
| var folder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); | ||
| return Path.Combine(Path.Combine(folder, Configurations.DynamoAsString, "Dynamo Core"), $"{version.Major}.{version.Minor}"); | ||
| } | ||
|
|
||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| using Dynamo.Models; | ||
|
|
||
| namespace Dynamo.Wpf.UI | ||
| { | ||
| /// <summary> | ||
| /// Provides contextual information for initializing a splash screen during application startup, including host | ||
| /// analytics data and the user data folder path. | ||
| /// </summary> | ||
| /// <remarks>This context is typically used to supply startup-related information to components that | ||
| /// display or manage a splash screen. It encapsulates optional host analytics details and the location of the | ||
| /// user-specific data directory.</remarks> | ||
| public sealed class SplashScreenStartupContext | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="SplashScreenStartupContext"/> class with the specified host | ||
| /// analytics information and user data folder path. | ||
| /// </summary> | ||
| /// <remarks>Use this constructor to provide context information required during the splash screen | ||
| /// startup process, such as analytics data and the location for user-specific files.</remarks> | ||
| /// <param name="hostInfo">The analytics information for the host application, or <see langword="null"/> if not available.</param> | ||
| /// <param name="userDataFolder">The path to the user data folder. If <see langword="null"/>, an empty string is used.</param> | ||
| public SplashScreenStartupContext(HostAnalyticsInfo ?hostInfo, string userDataFolder) | ||
| { | ||
| HostInfo = hostInfo; | ||
| UserDataFolder = userDataFolder ?? string.Empty; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets information about the host environment for analytics purposes. | ||
| /// </summary> | ||
| public HostAnalyticsInfo? HostInfo { get; } | ||
|
|
||
| /// <summary> | ||
| /// Gets the path to the user data folder. | ||
| /// </summary> | ||
| public string UserDataFolder { get; } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
Currentproperty should be nullable (SplashScreenStartupContext?) to match the actual implementation in HostStartup.cs where it's declared asSplashScreenStartupContext? Current.