Skip to content
Merged
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
35 changes: 34 additions & 1 deletion packages/webview_flutter/tizen/src/webview.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,29 @@ WebView::WebView(flutter::PluginRegistrar* registrar, int viewId,
}
}

webViewInstance_->RegisterOnPageStartedHandler(
[this](LWE::WebContainer* container, const std::string& url) {
LOG_DEBUG("RegisterOnPageStartedHandler(url: %s)\n", url.c_str());
flutter::EncodableMap map;
map.insert(
std::make_pair<flutter::EncodableValue, flutter::EncodableValue>(
flutter::EncodableValue("url"), flutter::EncodableValue(url)));
std::unique_ptr<flutter::EncodableValue> args =
std::make_unique<flutter::EncodableValue>(map);
channel_->InvokeMethod("onPageStarted", std::move(args));
});
webViewInstance_->RegisterOnPageLoadedHandler(
[this](LWE::WebContainer* container, const std::string& url) {
LOG_DEBUG("RegisterOnPageLoadedHandler(url: %s)\n", url.c_str());
flutter::EncodableMap map;
map.insert(
std::make_pair<flutter::EncodableValue, flutter::EncodableValue>(
flutter::EncodableValue("url"), flutter::EncodableValue(url)));
std::unique_ptr<flutter::EncodableValue> args =
std::make_unique<flutter::EncodableValue>(map);
channel_->InvokeMethod("onPageFinished", std::move(args));
});

webViewInstance_->LoadURL(currentUrl_);
}

Expand Down Expand Up @@ -593,7 +616,17 @@ void WebView::HandleMethodCall(
}
result->Success();
} else if (methodName.compare("removeJavascriptChannels") == 0) {
result->NotImplemented();
if (std::holds_alternative<flutter::EncodableList>(arguments)) {
auto nameList = std::get<flutter::EncodableList>(arguments);
for (size_t i = 0; i < nameList.size(); i++) {
if (std::holds_alternative<std::string>(nameList[i])) {
webViewInstance_->RemoveJavascriptInterface(
std::get<std::string>(nameList[i]), "postMessage");
}
}
}
result->Success();

} else if (methodName.compare("clearCache") == 0) {
webViewInstance_->ClearCache();
result->Success();
Expand Down