Refresh immediately after connect
This commit is contained in:
@@ -18,12 +18,18 @@ class FunctionHandler :
|
||||
public CefV8Handler
|
||||
{
|
||||
public:
|
||||
FunctionHandler(const CSiaApi& siaApi, bool& appStarted, std::unique_ptr<CSiaDriveConfig>& siaDriveConfig, std::unique_ptr<Api::Dokan::CSiaDokanDrive>& siaDrive, std::function<void()> shutdownCallback) :
|
||||
FunctionHandler(const CSiaApi& siaApi,
|
||||
bool& appStarted,
|
||||
std::unique_ptr<CSiaDriveConfig>& siaDriveConfig,
|
||||
std::unique_ptr<Api::Dokan::CSiaDokanDrive>& siaDrive,
|
||||
std::function<void()> shutdownCallback,
|
||||
std::function<void(CefRefPtr<CefV8Context> context)> refreshCallback) :
|
||||
_siaApi(siaApi),
|
||||
_siaDriveConfig(siaDriveConfig),
|
||||
_siaDrive(siaDrive),
|
||||
_appStarted(appStarted),
|
||||
_shutdownCallback(shutdownCallback)
|
||||
_shutdownCallback(shutdownCallback),
|
||||
_refreshCallback(refreshCallback)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -33,6 +39,7 @@ private:
|
||||
std::unique_ptr<Api::Dokan::CSiaDokanDrive>& _siaDrive;
|
||||
bool& _appStarted;
|
||||
std::function<void()> _shutdownCallback;
|
||||
std::function<void(CefRefPtr<CefV8Context> context)> _refreshCallback;
|
||||
|
||||
private:
|
||||
void MountCallback(CefRefPtr<CefV8Context> context, CefRefPtr<CefV8Value> cb) const
|
||||
@@ -134,6 +141,7 @@ public:
|
||||
else if (name == "startApp")
|
||||
{
|
||||
_appStarted = true;
|
||||
_refreshCallback(context);
|
||||
return true;
|
||||
}
|
||||
else if (name == "stopApp")
|
||||
@@ -268,7 +276,7 @@ void CSiaDriveApp::OnContextCreated(
|
||||
obj->SetValue("clientVersion", CefV8Value::CreateString(SIDRIVE_VERSION_STRING), V8_PROPERTY_ATTRIBUTE_NONE);
|
||||
global->SetValue("uiState", obj, V8_PROPERTY_ATTRIBUTE_NONE);
|
||||
|
||||
CefRefPtr<FunctionHandler> handler(new FunctionHandler(*_siaApi, _appStarted, _siaDriveConfig, _siaDrive, [this]() {this->ShutdownServices(); }));
|
||||
CefRefPtr<FunctionHandler> handler(new FunctionHandler(*_siaApi, _appStarted, _siaDriveConfig, _siaDrive, [this]() {this->ShutdownServices(); }, [this](CefRefPtr<CefV8Context> context) {this->SiaApiRefreshCallback(context, *_siaCurl, _siaDriveConfig.get()); }));
|
||||
obj = CefV8Value::CreateObject(nullptr, nullptr);
|
||||
obj->SetValue("unlockWallet", CefV8Value::CreateFunction("unlockWallet", handler), V8_PROPERTY_ATTRIBUTE_NONE);
|
||||
obj->SetValue("createWallet", CefV8Value::CreateFunction("createWallet", handler), V8_PROPERTY_ATTRIBUTE_NONE);
|
||||
|
Reference in New Issue
Block a user