Migrate fetch data to C##1397
Conversation
| } | ||
| } | ||
|
|
||
| public static Task HydrateFile(string path) => Task.Run(() => |
There was a problem hiding this comment.
Just extract these functions into Placeholder.cs.
| { | ||
| private static readonly ConcurrentDictionary<string, FileWatcher> _watchers = new(); | ||
|
|
||
| public static JSValue WatchPath(string rootPath, JSValue onEvent) |
There was a problem hiding this comment.
Instead of using an object for tracking active watchers we use an guid string.
|
|
||
| namespace Intx.Addon; | ||
|
|
||
| internal static class Placeholder |
There was a problem hiding this comment.
The same code as before.
| progressCallback: (progress) => void progressCallback(progress), | ||
| }); | ||
|
|
||
| LocalSync.SyncState.addItem({ action: 'UPLOADING', path, progress: 1 }); |
There was a problem hiding this comment.
After the download has been completed we put the progress to 100%, otherwise we don't receive the last progress notification from inxt-js and it leaves the file like at 96% or whatever until is created on drive-server-wip.
| var evt = JSValue.CreateObject(); | ||
| evt["action"] = "error"; | ||
| evt["path"] = message; | ||
| evt["message"] = message; |
There was a problem hiding this comment.
The variable is not really used in javascript (we just log the event when action is error), however, since in C++ we were using the same struct it was called path but it makes more sense to be called message since it contains the error message.
|



What
Implemennt the fetch data callback in C#. This is the callback that happens when a user tries to hydrate a file using double click on that file. Basically we connect the callbacks in C# using
connectSyncRoot, when a user tries to fetch a file we receive an event in C#. From C# we call the callback of javascript for download the file that he have registered inconnectSyncRoot. From the javascript code we download the file and we call a callback in C# for every piece of bytes that we receive. The C# code starts hydrating the placeholder and sending the progress to windows.